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 |
|---|---|---|---|---|
src/tests.adb | docandrew/YOTROC | 4 | 5160 | package body tests is
testVal : Unsigned_64 := 0;
procedure runTests is
use ASCII;
parseResult : Boolean;
codeGenResult : Boolean;
errmsg : Unbounded_String;
insts : InstructionVector.Vector;
-- a bit hacky... short-hand for To_Unbounded_String
function "-" (Source : String) return Unbounded_String
renames Ada.Strings.Unbounded.To_Unbounded_String;
type TestPrograms is array (positive range <>) of Unbounded_String;
parserTests1 : TestPrograms := (
-- test comments
-";this is a comment" & LF &
";another comment", --1 OK, just comments
-- test directives
-";this is a comment" & LF &
"% abcd 5678" & LF & --2 no directive after %
";comment 2",
-";this is a comment" & LF &
"%declare abcd 5678" & LF & --3 "declare" not understood
";comment 2",
-- test identifiers
-"%define 6asdf 0d1234", --4 identifier must start with letter
-"%define as!df 0d1234", --5 ident. only letters, nums and _
-"%define asdf! 0d1234", --6 ident. only letters, nums and _
-"%define a_sdf 1234", --7 OK
-- test numeric literals
-"%define asdf 1234", --8 OK.
-"%define asdf 2#0101#", --9 OK, use Ada format for literals
-"%define asdf 16#FFFF#", --10 OK
-"%define asdf 123.45", --11 floats OK
-"%define asdf 123.4.5", --12 err, extra decimal.
-"%define asdf 347" & LF & --13 OK, for testing identifier map.
"%define foo 43" & LF &
"%define bar 99",
-- test labels
-"; Comment" & LF &
"@label ;at address 0", --14 OK, address at 0
-"@2badlabel", --15 Bad, label must be a valid identifier
-- test instructions
-"sysret", --16 OK, no operands
-"cb R1 R3", --17 OK, count bits, two operands
-"l8 R1 R2", --18 OK, two operands
-"add R1 R2 R3", --19 OK, three operands
-"l32 R1 *R2", --20 OK, reg indirect
-"s32 R1 *(R2 + 1)", --21 OK, reg displacement
-"s32 R1 *(r2 + 16#00FF#)", --22 OK, reg displacement with hex
-"mov R1 R2", --23 err, unrecognized instruction
-"s32 R1 booger", --24 OK, identifier
-"@mylabel" & LF &
"jmpa mylabel", --25 OK, jumping to label
-"jmpa mylabel" & LF &
"@mylabel", --26 OK, jumping to forward label
-"s32 R1 R2;a comment", --27 OK, comment right after
-"s32 R1 R2 ;a comment", --28 OK, whitespace and comment after operand
-"sysret; a comment", --29 OK, comment right after instruction no operand
-"s32 R1 *(R2 + 44", --30 err, no closing paren.
-"l32 R1 16#4040#", --31 OK, immediate operand
-"sysret ;a comment"); --32 OK, whitespace and comment after no operand
begin
for pg in parserTests1'Range loop
insts.Clear;
machinecode.Clear;
Ada.Text_IO.Put_Line("" & LF & LF & "Parsing test program " & pg'Image);
parseResult := assembler.parse(To_String(parserTests1(pg)), insts, errmsg);
if parseResult then
Ada.Text_IO.Put_Line("Parse OK" & pg'Image);
Ada.Text_IO.Put_Line("Identifiers Found: ");
dumpIdentifiers;
-- test code gen if parsing was successful
codeGenResult := assembler.codeGen(insts, machinecode, errmsg);
if codeGenResult then
Ada.Text_IO.Put_Line("OK codegen" & pg'Image);
else
Ada.Text_IO.Put_Line("");
Ada.Text_IO.Put("CODEGEN ERR" & pg'Image & " ");
Ada.Text_IO.Unbounded_IO.Put_Line(errmsg);
end if;
else
Ada.Text_IO.Put_Line("");
Ada.Text_IO.Put("PARSE ERR" & pg'Image & " ");
Ada.Text_IO.Unbounded_IO.Put_Line(errmsg);
end if;
end loop;
end runTests;
end tests;
|
test/asset/agda-stdlib-1.0/Codata/M.agda | omega12345/agda-mode | 5 | 15568 | <gh_stars>1-10
------------------------------------------------------------------------
-- The Agda standard library
--
-- M-types (the dual of W-types)
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe --sized-types #-}
module Codata.M where
open import Size
open import Level
open import Codata.Thunk using (Thunk; force)
open import Data.Product hiding (map)
open import Data.Container.Core as C hiding (map)
data M {s p} (C : Container s p) (i : Size) : Set (s ⊔ p) where
inf : ⟦ C ⟧ (Thunk (M C) i) → M C i
module _ {s p} {C : Container s p} where
head : ∀ {i} → M C i → Shape C
head (inf (x , f)) = x
tail : (x : M C ∞) → Position C (head x) → M C ∞
tail (inf (x , f)) = λ p → f p .force
-- map
module _ {s₁ s₂ p₁ p₂} {C₁ : Container s₁ p₁} {C₂ : Container s₂ p₂}
(m : C₁ ⇒ C₂) where
map : ∀ {i} → M C₁ i → M C₂ i
map (inf t) = inf (⟪ m ⟫ (C.map (λ t → λ where .force → map (t .force)) t))
-- unfold
module _ {s p ℓ} {C : Container s p} (open Container C)
{S : Set ℓ} (alg : S → ⟦ C ⟧ S) where
unfold : S → ∀ {i} → M C i
unfold seed = let (x , next) = alg seed in
inf (x , λ p → λ where .force → unfold (next p))
|
programs/oeis/060/A060266.asm | neoneye/loda | 22 | 29929 | ; A060266: Difference between 2n and the following prime.
; 1,1,1,3,1,1,3,1,1,3,1,5,3,1,1,5,3,1,3,1,1,3,1,5,3,1,5,3,1,1,5,3,1,3,1,1,5,3,1,3,1,5,3,1,7,5,3,1,3,1,1,3,1,1,3,1,13,11,9,7,5,3,1,3,1,5,3,1,1,9,7,5,3,1,1,5,3,1,5,3,1,3,1,5,3,1,5,3,1,1,9,7,5,3,1,1,3,1,1,11
add $0,1
mul $0,2
mov $2,$0
seq $0,151800 ; Least prime > n (version 2 of the "next prime" function).
sub $0,$2
|
data/maps/headers/Route16Gate2F.asm | opiter09/ASM-Machina | 1 | 88583 |
map_header Route16Gate2F, ROUTE_16_GATE_2F, GATE, 0
end_map_header
|
ADL/Assemble/Insert/2/B~H~R_insert_middle.asm | MaxMorning/LinkedListVisualization | 3 | 84584 | <filename>ADL/Assemble/Insert/2/B~H~R_insert_middle.asm
aLine 0
gNew currentPtr
gMove currentPtr, Root
aLine 1
sInit i, 0
sBge i, {1:D}, 10
aLine 2
gBne currentPtr, null, 3
aLine 3
Exception NOT_FOUND
aLine 5
gMoveNext currentPtr, currentPtr
aLine 1
sInc i, 1
Jmp -9
aLine 7
gBne currentPtr, null, 3
aLine 8
Exception NOT_FOUND
aLine 10
nNew newNodePtr, {0:D}
gNewVPtr temp
gMoveNext temp, currentPtr
aLine 11
nMoveRel newNodePtr, currentPtr, 95, -164.545
pSetNext newNodePtr, temp
aLine 12
gBeq temp, null, 3
aLine 13
pSetPrev temp, newNodePtr
aLine 15
pSetNext currentPtr, newNodePtr
aLine 16
pSetPrev newNodePtr, currentPtr
aLine 17
gDelete currentPtr
gDelete temp
gDelete newNodePtr
aStd
Halt |
src/draw_fun.asm | fabiankuffer/RISC-V-QR-Code-Generator | 0 | 97489 | #a1: x, a2:y, a3: color
draw_pixel:
#werte auf stack speichern
addi sp, sp, -20
sw s0, 0(sp) #für relative position & später finale position
sw s1, 4(sp) #zum zwischenspeichern der display_adresse
sw a1, 8(sp)
sw a2, 12(sp)
sw a3, 16(sp)
#richtige zeile ermitteln
li s0, DISPLAY_WIDTH
mul s0, a2, s0
#stelle in der zeile ermitteln
add s0, a1, s0
#mal 4 rechnen da ein wert immer aus rgb- besteht
slli s0, s0, 2
#benötigte adresse ermitteln
li s1, DISPLAY_ADDRESS
add s0, s0, s1
#farbe an die gewünschte stelle setzen
sw a3, 0(s0)
#stack gespeicherte werte wieder laden
lw s0, 0(sp)
lw s1, 4(sp)
lw a1, 8(sp)
lw a2, 12(sp)
lw a3, 16(sp)
addi sp, sp, 20
ret
#a1: x link oben, a2: y rechts oben, a3: width in pixel, a4: color
draw_square:
#werte auf stack speichern
addi sp, sp, -28
sw a1, 0(sp)
sw a2, 4(sp)
sw a3, 8(sp)
sw a4, 12(sp)
sw s0, 16(sp) #zähler y achse
sw s1, 20(sp) #zähler x achse
sw ra, 24(sp) #ra ist caller saved
addi s1, zero, 0 #zähler y setzen
draw_square_loopy:
addi s0, zero, 0 #zähler x setzen
draw_square_loopx:
#parameter für draw pixel setzen
add a1, a1, s0
add a2, a2, s1
add a3, zero, a4
jal ra, draw_pixel
#werte wieder vom stack laden da sie sich verändern haben könnten
lw a1, 0(sp)
lw a2, 4(sp)
lw a3, 8(sp)
lw a4, 12(sp)
#laufvariable für x um eins hochzählen
addi s0, s0, 1
#loopx bedingung
blt s0, a3, draw_square_loopx
#x wieder an anfang des quadrads setzen setzen
add s0, zero, a3
#laufvariable für y um eins hochzählen
addi s1, s1, 1
#loopy bedingung
blt s1, a3, draw_square_loopy
#werte aus stack laden
lw a1, 0(sp)
lw a2, 4(sp)
lw a3, 8(sp)
lw a4, 12(sp)
lw s0, 16(sp)
lw s1, 20(sp)
lw ra, 24(sp)
addi sp, sp, 28
ret
#a1: x links oben, a2: y links oben, a3: x rechts unten, a4: y rechts unten, a5: color
draw_rectangle:
#werte auf stack speichern
addi sp, sp, -32
sw a1, 0(sp)
sw a2, 4(sp)
sw a3, 8(sp)
sw a4, 12(sp)
sw a5, 16(sp)
sw s0, 20(sp)
sw s1, 24(sp)
sw ra, 28(sp)
add s1, zero, a2 #zähler y setzen
draw_rectangle_loopy:
add s0, zero, a1 #zähler x setzen
draw_rectangle_loopx:
#draw pixel aufrufen
add a1, zero, s0
add a2, zero, s1
add a3, zero, a5
jal ra, draw_pixel
#daten wieder vom stack laden die sich verändert haben könnten
lw a1, 0(sp)
lw a2, 4(sp)
lw a3, 8(sp)
lw a4, 12(sp)
lw a5, 16(sp)
#for loopx bedingung
addi s0, s0, 1
bne s0, a3, draw_rectangle_loopx
#for loopy bedingung
addi s1, s1, 1
bne s1, a4, draw_rectangle_loopy
lw a1, 0(sp)
lw a2, 4(sp)
lw a3, 8(sp)
lw a4, 12(sp)
lw a5, 16(sp)
lw s0, 20(sp)
lw s1, 24(sp)
lw ra, 28(sp)
addi sp, sp, 32
ret
#a1: color
clear_screen:
#werte auf stack speichern
addi sp, sp, -24
sw a1, 0(sp)
sw s0, 4(sp) #y zähler
sw s1, 8(sp) #x zähler
sw s2, 12(sp) #display_width
sw s3, 16(sp) #display_height
sw ra, 20(sp)
li s2, DISPLAY_WIDTH
li s3, DISPLAY_HEIGHT
addi s0, zero, 0 # y zähler setzen
clear_screen_loopy:
addi s1, zero, 0 #x zähler setzen
clear_screen_loopx:
#parameter für functionsaufruf setzen
add a3, zero, a1
add a1, zero, s1
add a2, zero, s0
jal ra, draw_pixel
#register wiederherstellen
lw a1, 0(sp)
#zähler x um eins erhöhen
addi s1, s1, 1
#loopx bedingung
blt s1, s2, clear_screen_loopx
#zähler y um eins erhöhen
addi s0, s0, 1
blt s0, s3, clear_screen_loopy
#werte aus stack laden
lw a1, 0(sp)
lw s0, 4(sp)
lw s1, 8(sp)
lw s2, 12(sp)
lw s3, 16(sp)
lw ra, 20(sp)
addi sp, sp, 24
ret
|
libsrc/_DEVELOPMENT/temp/sp1/zx/c/sdcc_iy/sp1_UpdateNow.asm | jpoikela/z88dk | 640 | 27870 |
; sp1_UpdateNow
SECTION code_clib
SECTION code_temp_sp1
PUBLIC _sp1_UpdateNow
EXTERN asm_sp1_UpdateNow
defc _sp1_UpdateNow = asm_sp1_UpdateNow
|
sbsext/ext/read.asm | olifink/smsqe | 0 | 3679 | ; READ / EOF V2.00 1990 <NAME> QJUMP
;
; READ
; EOF (#n)
;
section exten
xdef read
xdef eof
xdef eofw
xref ut_chan0 ; get channel default #0
xref ut_rtfd1
xref ut_trap3
include 'dev8_keys_qdos_io'
include 'dev8_keys_err'
include 'dev8_keys_sbasic'
read
moveq #err.nimp,d0
read_rts
rts
dc.l 'READ'
eofw
moveq #-1,d7
eof
cmp.l a3,a5 ; is it channel?
bne.s eof_chan ; ... no
move.l sb_ndata(a6),d1 ; ... yes, ndata=-1 at end
bra.s eof_set
eof_chan
jsr ut_chan0
bne.s read_rts
moveq #iob.test,d0
move.l d7,d3
trap #3
moveq #err.eof,d1
sub.l d1,d0
seq d1
eof_set
moveq #1,d0
and.l d0,d1
jmp ut_rtfd1
end
|
unittests/32Bit_ASM/Primary/Primary_00_2.asm | cobalt2727/FEX | 628 | 103488 | <reponame>cobalt2727/FEX<gh_stars>100-1000
%ifdef CONFIG
{
"RegData": {
"RAX": "0xB5",
"RBX": "0x53D5",
"RCX": "0x616263F5"
},
"Mode": "32BIT"
}
%endif
mov esp, 0xe0000000
mov eax, 0x41424344
mov [esp + 4 * 0], eax
mov eax , 0x51525354
mov [esp + 4 * 1], eax
mov eax, 0x61626364
mov [esp + 4 * 2], eax
mov eax, 0x71
mov ebx, 0x81
mov ecx, 0x91
add al, byte [esp + 4 * 0]
add bx, word [esp + 4 * 1]
add ecx, dword [esp + 4 * 2]
hlt
|
example_2.2/src/graphic_data.adb | rogermc2/GA_Ada | 3 | 30164 | <reponame>rogermc2/GA_Ada<gh_stars>1-10
with Ada.Containers.Doubly_Linked_Lists;
with Ada.Text_IO; use Ada.Text_IO;
with GL.Attributes;
with GL.Culling;
with GL.Objects.Buffers;
with GL.Objects.Programs;
with GL.Objects.Vertex_Arrays;
with GL.Rasterization;
with GL.Toggles;
with GL.Types.Colors;
with GL.Uniforms;
with GL_Enums_Feedback;
with GL_Util;
with Maths;
with GA_Draw;
with GLUT_API;
with Multivectors;
package body Graphic_Data is
use GL.Types;
type Feedback is record
Token : GL_Enums_Feedback.Feed_Back_Token;
Vertex_1X : Float;
Vertex_1Y : Float;
Vertex_1Z : Float;
Vertex_2X : Float;
Vertex_2Y : Float;
Vertex_2Z : Float;
Vertex_3X : Float;
Vertex_3Y : Float;
Vertex_3Z : Float;
end record;
-- Buffer for OpenGL feedback
package Buffer_Package is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Feedback);
type Buffer_List is new Buffer_Package.List with null record;
package Indices_Package is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Integer);
type Indices_List is new Indices_Package.List with null record;
package Vertices_Package is new Ada.Containers.Doubly_Linked_Lists
(Element_Type => Multivectors.Vector);
type Vertices_List is new Vertices_Package.List with null record;
procedure Get_GLUT_Model_2D (Render_Program : GL.Objects.Programs.Program;
Model_Name : Ada.Strings.Unbounded.Unbounded_String;
Model_Rotor : Multivectors.Rotor) is
use GL_Enums_Feedback;
use GL.Types.Singles;
Screen_Width : constant Float := 1600.0;
MV_Matrix_ID : GL.Uniforms.Uniform;
Projection_Matrix_ID : GL.Uniforms.Uniform;
Colour_Location : GL.Uniforms.Uniform;
Model_View_Matrix : GL.Types.Singles.Matrix4 :=
GL.Types.Singles.Identity4;
Translation_Matrix : Singles.Matrix4;
Projection_Matrix : Singles.Matrix4;
Feedback_Buffer : GL.Objects.Buffers.Buffer;
Feedback_Array_Object : GL.Objects.Vertex_Arrays.Vertex_Array_Object;
Indices : Indices_List;
Colour : constant GL.Types.Colors.Color := (0.0, 0.0, 0.0, 0.0);
Num_Vertices : Integer;
G_Vertices_2D : Vertices_List;
Index : Integer := 0;
begin
-- DONT cull faces (we will do this ourselves!)
GL.Toggles.Disable (GL.Toggles.Cull_Face);
-- fill all polygons (otherwise they get turned into LINES
GL.Rasterization.Set_Polygon_Mode (GL.Rasterization.Fill);
-- setup projection & transform for the model:
-- glFrustum (-(float)g_viewportWidth / screenWidth, (float)g_viewportWidth / screenWidth,
-- -(float)g_viewportHeight / screenWidth, (float)g_viewportHeight / screenWidth,
-- 1.0, 100.0);
GA_Draw.Init_Projection_Matrix (Projection_Matrix, 1.0, 100.0);
Translation_Matrix := Maths.Translation_Matrix ((0.0, 0.0, -10.0));
GL_Util.Rotor_GL_Multiply (Model_Rotor, Model_View_Matrix);
Model_View_Matrix := Translation_Matrix * Model_View_Matrix;
GA_Draw.Graphic_Shader_Locations (Render_Program, MV_Matrix_ID,
Projection_Matrix_ID, Colour_Location);
GL.Uniforms.Set_Single (MV_Matrix_ID, Model_View_Matrix);
GL.Uniforms.Set_Single (Projection_Matrix_ID, Projection_Matrix);
-- buffer for OpenGL feedback, format will be:
-- GL_POLYGON_TOKEN
-- n (= 3)
-- vertex 0 x, vertex 0 y
-- vertex 1 x, vertex 1 y
-- vertex 2 x, vertex 2 y
-- GL_POLYGON_TOKEN etc etc
-- std::vector<GLfloat> buffer(300000); // more than enough for the GLUT primitives
-- switch into feedback mode:
-- glFeedbackBuffer((GLsizei)buffer.size(), GL_2D, &(buffer[0]));
-- glRenderMode(GL_FEEDBACK);
Feedback_Buffer.Initialize_Id;
Feedback_Array_Object.Bind;
GL.Objects.Buffers.Transform_Feedback_Buffer.Bind (Feedback_Buffer);
-- GL.Attributes.Enable_Vertex_Attrib_Array (0);
GL.Objects.Programs.Begin_Transform_Feedback (Triangles);
-- Render model
if Model_Name = "teapot" then
Solid_Teapot (1.0);
elsif Model_Name = "cube" then
Solid_Cube (1.0);
elsif Model_Name = "sphere" then
Solid_Sphere (1.0, 16, 8);
elsif Model_Name = "cone" then
Solid_Cone (1.0, 2.0, 16, 8);
elsif Model_Name = "torus" then
Solid_Torus (0.5, 1.0, 8, 16);
elsif Model_Name = "dodecahedron" then
Solid_Dodecahedron;
elsif Model_Name = "octahedron" then
Solid_Octahedron;
elsif Model_Name = "tetrahedron" then
Solid_Tetrahedron;
elsif Model_Name = "icosahedron" then
Solid_Icosahedron;
end if;
GL.Objects.Programs.End_Transform_Feedback;
-- GL.Attributes.Disable_Vertex_Attrib_Array (0);
-- int nbFeedback = glRenderMode(GL_RENDER);
--
-- // parse the feedback buffer:
-- g_polygons2D.clear();
-- g_vertices2D.clear();
while idx < nbFeedback loop
-- check for polygon:
if buffer (idx) /= Polygon_Token then
raise GLUT_Read_Exception with
"Graphic_Data.Get_GLUT_Model_2D Error parsing the feedback buffer!";
else
idx := idx + 1;
-- number of vertices (3)
Num_Vertices := (int)buffer[idx];
idx := idx + 1;
-- std::vector<int> vtxIdx(n);
-- Get vertices:
-- Maybe todo later: don't duplicate identical vertices . . .
for index in 1 .. Num_Vertices loop
-- vtxIdx[i] = (int)g_vertices2D.size();
Indices.Append (g_vertices2D.size)
g_vertices2D.push_back(_vector(buffer[idx] * e1 + buffer[idx+1] * e2));
idx := idx + 2;
end loop;
g_polygons2D.push_back(vtxIdx);
end if;
end loop;
-- if (g_prevStatisticsModelName != modelName)
-- {
-- printf("Model: %s, #polygons: %d, #vertices: %d\n", modelName.c_str(), g_polygons2D.size(), g_vertices2D.size());
-- g_prevStatisticsModelName = modelName;
-- }
exception
when anError : others =>
Put_Line ("An exception occurred in Graphic_Data.Get_GLUT_Model_2D.");
raise;
end Get_GLUT_Model_2D;
-- -------------------------------------------------------------------------
procedure Solid_Cube (Size : Float) is
begin
GLUT_API.GLUT_Solid_Cube (Double (Size));
end Solid_Cube;
-- -------------------------------------------------------------------------
procedure Solid_Cone (Base, Height : Float; Slices, Stacks : Integer) is
begin
GLUT_API.GLUT_Solid_Cone (Double (Base), Double (Height),
Int (Slices), Int (Stacks));
end Solid_Cone;
-- -------------------------------------------------------------------------
procedure Solid_Dodecahedron is
begin
GLUT_API.GLUT_Solid_Dodecahedron;
end Solid_Dodecahedron;
-- -------------------------------------------------------------------------
procedure Solid_Icosahedron is
begin
GLUT_API.GLUT_Solid_Icosahedron;
end Solid_Icosahedron;
-- -------------------------------------------------------------------------
procedure Solid_Octahedron is
begin
GLUT_API.GLUT_Solid_Octahedron;
end Solid_Octahedron;
-- -------------------------------------------------------------------------
procedure Solid_Sphere (Radius : Float; Slices, Stacks : Integer) is
begin
GLUT_API.GLUT_Solid_Sphere (Double (Radius), Int (Slices), Int (Stacks));
end Solid_Sphere;
-- -------------------------------------------------------------------------
procedure Solid_Teapot (Size : Float) is
begin
GLUT_API.GLUT_Solid_Teapot (Double (Size));
end Solid_Teapot;
-- -------------------------------------------------------------------------
procedure Solid_Tetrahedron is
begin
GLUT_API.GLUT_Solid_Tetrahedron;
end Solid_Tetrahedron;
-- -------------------------------------------------------------------------
procedure Solid_Torus (Inner_Radius, Outer_Radius : Float;
Sides, Rings : Integer) is
begin
GLUT_API.GLUT_Solid_Torus (Double (Inner_Radius), Double (Outer_Radius),
Int (Sides), Int (Rings));
end Solid_Torus;
-- -------------------------------------------------------------------------
end Graphic_Data;
|
Projects/Shark/I386/I386.asm | gcakir/Shark | 2 | 92819 | <gh_stars>1-10
;
;
; Copyright (c) 2019 by blindtiger. All rights reserved.
;
; The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
;
; Software distributed under the License is distributed on an "AS IS" basis,
; WITHOUT WARRANTY OF ANY KIND, either express or implied. SEe the License
; for the specific language governing rights and limitations under the
; License.
;
; The Initial Developer of the Original e is blindtiger.
;
;
.686p
.xlist
include ks386.inc
include callconv.inc
.list
_TEXT$00 SEGMENT PAGE 'CODE'
cPublicProc __FlushSingleTb, 1
mov eax, [esp + 4]
invlpg [eax]
stdRET __FlushSingleTb
stdENDP __FlushSingleTb
cPublicProc __GetPdeAddress, 2
mov eax, [esp + 4]
shr eax, 15h
shl eax, 3
add eax, [esp + 8]
stdRET __GetPdeAddress
stdENDP __GetPdeAddress
cPublicProc __GetPdeAddressPae, 2
mov eax, [esp + 4]
shr eax, 16h
shl eax, 2
add eax, [esp + 8]
stdRET __GetPdeAddressPae
stdENDP __GetPdeAddressPae
cPublicProc __GetPteAddress, 2
mov eax, [esp + 4]
shr eax, 0ch
shl eax, 2
add eax, [esp + 8]
stdRET __GetPteAddress
stdENDP __GetPteAddress
cPublicProc __GetPteAddressPae, 2
mov eax, [esp + 4]
shr eax, 0ch
shl eax, 3
add eax, [esp + 8]
stdRET __GetPteAddressPae
stdENDP __GetPteAddressPae
cPublicProc __GetVirtualAddressMappedByPte, 1
mov eax, [esp + 4]
shl eax, 0ah
stdRET __GetVirtualAddressMappedByPte
stdENDP __GetVirtualAddressMappedByPte
cPublicProc __GetVirtualAddressMappedByPtePae, 1
mov eax, [esp + 4]
shl eax, 9
stdRET __GetVirtualAddressMappedByPtePae
stdENDP __GetVirtualAddressMappedByPtePae
cPublicProc __GetVirtualAddressMappedByPde, 1
mov eax, [esp + 4]
shl eax, 14h
stdRET __GetVirtualAddressMappedByPde
stdENDP __GetVirtualAddressMappedByPde
cPublicProc __GetVirtualAddressMappedByPdePae, 1
mov eax, [esp + 4]
shl eax, 12h
stdRET __GetVirtualAddressMappedByPdePae
stdENDP __GetVirtualAddressMappedByPdePae
cPublicProc __MultipleDispatcher, 4
mov edi, edi
push ebp
mov ebp, esp
mov eax, [ebp + 8]
test eax, eax
jz @f
push [ebp + 14h]
push [ebp + 10h]
push [ebp + 0ch]
call eax
mov esp, ebp
pop ebp
stdRET __MultipleDispatcher
@@ :
mov eax, [ebp + 0ch]
test eax, eax
jz @f
push [ebp + 14h]
push [ebp + 10h]
call eax
mov esp, ebp
pop ebp
stdRET __MultipleDispatcher
@@ :
mov eax, [ebp + 10h]
test eax, eax
jz @f
push [ebp + 14h]
call eax
mov esp, ebp
pop ebp
stdRET __MultipleDispatcher
@@ :
mov eax, [ebp + 14h]
test eax, eax
jz error
call eax
mov esp, ebp
pop ebp
stdRET __MultipleDispatcher
error :
xor eax, eax
mov esp, ebp
pop ebp
stdRET __MultipleDispatcher
stdENDP __MultipleDispatcher
_TEXT$00 ends
end
|
8085_programming/gnu_8085_rev/blink_disp2_0T9_LXI.asm | SayanGhoshBDA/code-backup | 16 | 3322 | <filename>8085_programming/gnu_8085_rev/blink_disp2_0T9_LXI.asm
L3: MVI D,00
MOV A,D
OUT 20
L2: INR D
MOV A,D
CPI 09
JZ L3
L1: LXI B,0001
DCX B
MOV A,C
ADD B
JNZ L1
JMP L2
HLT
|
bb-runtimes/runtimes/ravenscar-full-stm32g474/gnat/a-cgaaso.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 6084 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.GENERIC_ANONYMOUS_ARRAY_SORT --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2021, 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. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
-- Allows an anonymous array (or array-like container) to be sorted. Generic
-- formal Less returns the result of comparing the elements designated by the
-- indexes, and generic formal Swap exchanges the designated elements.
generic
type Index_Type is (<>);
with function Less (Left, Right : Index_Type) return Boolean is <>;
with procedure Swap (Left, Right : Index_Type) is <>;
procedure Ada.Containers.Generic_Anonymous_Array_Sort
(First, Last : Index_Type'Base);
pragma Pure (Ada.Containers.Generic_Anonymous_Array_Sort);
-- Reorders the elements of Container such that the elements are sorted
-- smallest first as determined by the generic formal "<" operator provided.
-- Any exception raised during evaluation of "<" is propagated.
--
-- The actual function for the generic formal function "<" is expected to
-- return the same value each time it is called with a particular pair of
-- element values. It should not modify Container and it should define a
-- strict weak ordering relationship: irreflexive, asymmetric, transitive, and
-- in addition, if x < y for any values x and y, then for all other values z,
-- (x < z) or (z < y). If the actual for "<" behaves in some other manner,
-- the behavior of the instance of Generic_Anonymous_Array_Sort is
-- unspecified. The number of times Generic_Anonymous_Array_Sort calls "<" is
-- unspecified.
|
oeis/028/A028204.asm | neoneye/loda-programs | 11 | 89590 | ; A028204: Expansion of 1/((1-6*x)*(1-7*x)*(1-9*x)*(1-10*x)).
; Submitted by <NAME>
; 1,32,645,10480,150101,1979712,24649045,294242960,3402478101,38387226592,424748805845,4627041422640,49770222820501,529800364460672,5591164247433045,58580499720429520,610040416273729301,6320049788003441952,65188098042875122645,669845518002175103600,6860672627096008836501,70070461493973149290432,713904810963966068546645,7258036716707814111044880,73652577269023155975854101,746184880506346161723286112,7548845464280487491726457045,76271878421352438062852413360,769772781280554975329648574101
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,20970 ; Expansion of 1/((1-7*x)*(1-9*x)*(1-10*x)).
sub $0,$1
mul $1,7
add $1,$0
lpe
mov $0,$1
|
openrndr-shadestyle-parser/src/main/antlr/ShadeStyle.g4 | chosamuel/openrndr | 601 | 4385 | // heavily based on https://github.com/labud/antlr4_convert/blob/master/src/GLSL/GLSL.g4
grammar ShadeStyle;
prog:
statement_list;
//宏定义
preprocessor
: SHARP version_pre
;
version_pre
: 'version' integer VERSOIN_PROFILE?
;
VERSOIN_PROFILE
: 'core'
| 'compatibility'
| 'es'
;
//类型修饰语
type_qualifier
: (storage_qualifier
| layout_qualifier
| precision_qualifier
| interpolation_qualifier
| invariant_qualifier
| precise_qualifier)+
;
layout_qualifier: 'layout' LEFT_PAREN layout_qualifier_id (COMMA layout_qualifier_id)* RIGHT_PAREN;
layout_qualifier_id: IDENTIFIER | IDENTIFIER ASSIGNMENT_OP constant_expression | 'shared';
storage_qualifier
: 'const'
| 'in'
| 'out'
| 'uniform'
| 'buffer'
| 'shared'
;
precision_qualifier
: 'high_precision'
| 'medium_precision'
| 'low_precision'
;
interpolation_qualifier
: 'smooth'
| 'flat'
| 'noperspective'
;
invariant_qualifier: 'invariant';
precise_qualifier: 'precise';
//元数据
integer: DECIMAL # integerDecimal
| OCTAL # integerOctal
| HEX # integerHex
;
float_num: FLOAT_NUM;
bool_num : 'true' | 'false';
//元数据类型
type_specifier: type_specifier_nonarray array_specifier*;
type_specifier_nonarray
: basic_type # basicType
| IDENTIFIER # identifier
;
array_specifier : LEFT_BRACKET expression? RIGHT_BRACKET;
struct_specifier: DOT expression;
basic_type
: void_type # voidType
| scala_type # scalaType
| vector_type # vectorType
| matrix_type # matrixType
| opaque_type # opaqueType
;
void_type : 'void';
scala_type: SCALA;
vector_type: VECTOR;
matrix_type: MATRIX;
opaque_type
: float_opaque_type
| int_opaque_type
| u_int_opaque_type
;
float_opaque_type: FLOAT_OPAQUE;
int_opaque_type: INT_OPAQUE;
u_int_opaque_type: U_INT_OPAQUE;
//表达式
expression
: primary_expression # primaryExpression
| expression INCREAMENT_OP # incrementOpExpression2
| INCREAMENT_OP expression # incrementOpExpression
| ADDDIV_OP expression # unaryAddDivOpExpression
| UNARY_OP expression # unaryOpExpression
| expression MULDIV_OP expression # mulDivExpression
| expression ADDDIV_OP expression # addDivExpression
| expression SHIFT_OP expression # shiftOpExpression
| expression COMPARE_OP expression # compareOpExpression
| expression EQUAL_OP expression # equalOpExpression
| expression BITWISE_OP expression # bitwiseOpExpression
| expression LOGIC_OP expression # logicOpExpression
| expression QUESTION expression COLON expression # ternaryExpression
;
primary_expression
: constant_expression # constantExpression
| basic_type LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN # vectorExpression
| LEFT_PAREN type_specifier RIGHT_PAREN expression # castExpression
| left_value array_struct_selection? # primaryExpressionLeftValue
;
constant_expression
: integer # integerConstantExpression
| float_num # floatNumExpression
| bool_num # boolNumExpression
;
left_value: function_call # leftValueFunctionCall
| LEFT_PAREN expression RIGHT_PAREN # leftValueExpression
| IDENTIFIER # leftValueIdentifier
;
array_struct_selection: (array_specifier | struct_specifier)+;
assignment_expression: ASSIGNMENT_OP expression;
arithmetic_assignment_expression: ARITHMETIC_ASSIGNMENT_OP expression;
//函数
function_definition
: return_Type function_name
LEFT_PAREN (func_decl_member (COMMA func_decl_member)* )? RIGHT_PAREN LEFT_BRACE
statement_list
RIGHT_BRACE
;
function_declaration: return_Type function_name LEFT_PAREN (func_decl_member (COMMA func_decl_member)* )?RIGHT_PAREN;
function_call: function_name LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN;
return_Type: type_specifier;
function_name: IDENTIFIER;
func_decl_member: type_specifier IDENTIFIER;
//语句(块)
statement_list: statement*;
statement
: simple_statement # simpleStatement
| compoud_statement # compoundStatement
;
simple_statement
: function_definition_statement # functionDefinitionStatement
| basic_statement SEMICOLON # basicStatement
| selection_statement # selectionStatement
| switch_statement # switchStatement
| case_label # caseLabel
| iteration_statement # iterationStatement
| jump_statement # jumpStatement
;
compoud_statement: LEFT_BRACE statement_list RIGHT_BRACE;
basic_statement
: declaration_statement # declarationStatement
| assignment_statement # assignmentStatement
| expression_statement # expressionStatement
;
//声明语句(含初始化)
declaration_statement
: struct_declaration # structDeclaration
| simple_declaration # simpleDeclaration
| function_declaration # functionDeclaration
;
simple_declaration: type_qualifier? type_specifier simple_declarator (COMMA simple_declarator)*;
simple_declarator: left_value array_specifier* (assignment_expression)?;
struct_declaration: type_qualifier? STRUCT IDENTIFIER LEFT_BRACE (simple_declaration SEMICOLON)+ RIGHT_BRACE;
//函数定义语句
function_definition_statement: function_definition;
//赋值语句
assignment_statement: left_value array_struct_selection? assignment_expression # assignmentStatementAssignExpression
| left_value array_struct_selection? arithmetic_assignment_expression # assignmentStateArithmeticAssignExpression
;
//表达式语句
expression_statement: expression;
//条件选择语句
selection_statement: IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement;
selection_rest_statement: statement (ELSE statement)? ;
//switch语句
switch_statement: SWITCH LEFT_PAREN expression RIGHT_PAREN LEFT_BRACE statement_list RIGHT_BRACE;
case_label
: CASE expression COLON
| DEFUALT COLON
;
//循环语句
iteration_statement
: WHILE LEFT_PAREN expression RIGHT_PAREN statement # iterationWhileStatement
| DO statement WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON # iterationDoStatement
| FOR LEFT_PAREN for_init_statement for_cond_statement for_rest_statement RIGHT_PAREN LEFT_BRACE statement_list RIGHT_BRACE # iterationForStatement
;
for_init_statement
: (basic_statement (',' basic_statement)*)? SEMICOLON
;
for_cond_statement: expression SEMICOLON;
for_rest_statement: (basic_statement (',' basic_statement)*)? ;
//跳转语句
jump_statement
: CONTINUE SEMICOLON # continueStatement
| BREAK SEMICOLON # breakStatement
// | RETURN SEMICOLON # returnStatement
| RETURN expression? SEMICOLON # returnStatement
;
/**
*词法
*/
STRUCT: 'struct';
IF: 'if';
ELSE: 'else';
QUESTION: '?';
FOR: 'for';
DO: 'do';
WHILE: 'while';
CONTINUE: 'continue';
BREAK: 'break';
RETURN: 'return';
SWITCH: 'switch';
CASE: 'case';
DEFUALT: 'defualt';
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
LEFT_BRACE: '{';
RIGHT_BRACE: '}';
LEFT_BRACKET: '[';
RIGHT_BRACKET: ']';
DOT: '.';
COLON: ':';
SEMICOLON: ';';
COMMA: ',';
SHARP: '#';
//元数据
DECIMAL: [1-9] DIGIT* INTEGER_SUFFIX?;
OCTAL: '0' OCTAL_DIGIT* INTEGER_SUFFIX?;
HEX: ('0x' | '0X') HEX_DIGIT+ INTEGER_SUFFIX?;
FLOAT_NUM
: DIGIT+ DOT DIGIT* EXPONENT? FLOAT_SUFFIX?
| DOT DIGIT+ EXPONENT? FLOAT_SUFFIX?
| DIGIT+ EXPONENT FLOAT_SUFFIX?
;
//元数据类型
SCALA
: 'bool'
| 'int'
| 'uint'
| 'float'
| 'double'
;
VECTOR: ('d'|'i'|'b'|'u')? 'vec' [2-4];
MATRIX: 'd'? 'mat'[2-4] ('x'[2-4])?;
FLOAT_OPAQUE: BASIC_OPAQUE_TYPE |
( 'sampler1DShadow' | 'sampler2DShadow' | 'sampler2DRectShadow'
| 'sampler1DArrayShadow' | 'sampler2DArrayShadow' |
'samplerCubeShadow' | 'samplerCubeArrayShadow');
INT_OPAQUE: 'i'BASIC_OPAQUE_TYPE;
U_INT_OPAQUE: 'u'BASIC_OPAQUE_TYPE | 'atomic_uint';
BASIC_OPAQUE_TYPE: ('sampler' | 'image')
('1D'|'2D'|'3D'|'Cube'|'2DRect'|'1DArray'|'2DArray'|'Buffer'|'2DMS'|'2DMSArray'|'CubeArray');
//表达式
INCREAMENT_OP : '++' | '--';
UNARY_OP : '~' | '!';
MULDIV_OP : '*' | '/' | '%';
ADDDIV_OP : '+' | '-';
SHIFT_OP : '<<' | '>>' ;
COMPARE_OP : '<' | '>' | '<=' | '>=';
EQUAL_OP: '==' | '!=';
BITWISE_OP: '&' | '^' | '|';
LOGIC_OP: '&&'| '^^' | '||';
ASSIGNMENT_OP: '=';
ARITHMETIC_ASSIGNMENT_OP
: MULDIV_OP ASSIGNMENT_OP
| ADDDIV_OP ASSIGNMENT_OP
| SHIFT_OP ASSIGNMENT_OP
| BITWISE_OP ASSIGNMENT_OP
;
/**
*辅助词法
*/
fragment
DIGIT: [0-9];
fragment
HEX_DIGIT : [0-9]| [a-f] | [A-F] ;
fragment
OCTAL_DIGIT : [0-7];
fragment
INTEGER_SUFFIX: 'u' | 'U';
fragment
EXPONENT : ('e'|'E') ADDDIV_OP? ('0'..'9')+ ;
fragment
FLOAT_SUFFIX: 'f' | 'F' | 'lf' | 'LF';
fragment
LETTER
: [a-z]
| [A-Z]
| '_'
;
IDENTIFIER
: LETTER (LETTER|DIGIT)*
;
//注释
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN) // match anything between /* and */
;
WS : [ \r\t\u000C\n]+ -> channel(HIDDEN)
;
LINE_COMMENT
: '//' ~[\r\n]* '\r'? '\n' -> channel(HIDDEN)
; |
programs/oeis/176/A176849.asm | neoneye/loda | 22 | 15802 | <reponame>neoneye/loda
; A176849: Triangle read by rows which contains the (6n)-th row of the Pascal triangle in row n.
; 1,1,6,15,20,15,6,1,1,12,66,220,495,792,924,792,495,220,66,12,1,1,18,153,816,3060,8568,18564,31824,43758,48620,43758,31824,18564,8568,3060,816,153,18,1,1,24,276,2024,10626,42504,134596,346104,735471,1307504
lpb $0
sub $0,1
add $1,6
mov $2,$0
trn $0,$1
lpe
bin $1,$2
mov $0,$1
|
Numeral/Rational/AlterAdd.agda | Lolirofle/stuff-in-agda | 6 | 5905 | -- Alternating addition (Also called the Calkin-Wilf tree representation of the rationals).
-- One bijective representation of ℚ. That is, every rational number is appearing exactly once in this representation (TODO: Some proof would be nice).
module Numeral.Rational.AlterAdd where
import Lvl
open import Data
open import Data.Boolean
open import Logic.Propositional
open import Numeral.Natural as ℕ
import Numeral.Natural.Oper as ℕ
import Numeral.Natural.Oper.Comparisons as ℕ
open import Numeral.PositiveInteger as ℕ₊
open import Numeral.PositiveInteger.Oper as ℕ₊
open import Numeral.Integer using (ℤ)
open import Syntax.Number
open import Type
module Test1 where
data Tree : ℕ₊ → ℕ₊ → Type{Lvl.𝟎} where
intro : Tree(1)(1)
left : ∀{x y} → Tree(x)(y) → Tree(x) (y ℕ₊.+ x)
right : ∀{x y} → Tree(x)(y) → Tree(x ℕ₊.+ y) (y)
-- Tree-cancellationₗ : ∀{x₁ x₂ y} → (Tree x₁ y ≡ Tree x₂ y) → (x₁ ≡ x₂)
{- TODO: Is there an algorithm that determines the path to every rational in this tree? Maybe the division algorithm:
R6 (14928,2395)
L4 (558,2395) 14928−2395⋅6 = 558
R3 (558,163) 2395−558⋅4 = 163
L2 (69,163) 558−163⋅3 = 69
R2 (69,25) 163−69⋅2 = 25
L1 (19,25) 69−25⋅2 = 19
R3 (19,6) 25-19 = 6
L5 (1,6) 19-6⋅3 = 1
In (1,1) 6−1⋅5 = 1
f(R$R$R$R$R$R $ L$L$L$L $ R$R$R $ L$L $ R$R $ L $ R$R$R $ L$L$L$L$L $ Init)
If this is the case, then just represent the tree by: (Tree = List(Bool)) or (Tree = List(Either ℕ ℕ)) or (Tree = List(ℕ)) ?-}
{-
open import Data.Option
Tree-construct : (x : ℕ₊) → (y : ℕ₊) → Tree(x)(y)
Tree-construct ℕ₊.𝟏 ℕ₊.𝟏 = intro
Tree-construct ℕ₊.𝟏 (𝐒 y) = left(Tree-construct ℕ₊.𝟏 y)
Tree-construct (𝐒 x) ℕ₊.𝟏 = right(Tree-construct x ℕ₊.𝟏)
Tree-construct(x@(ℕ₊.𝐒 _)) (y@(ℕ₊.𝐒 _)) with (x −₀ y)
... | Some z = {!right(Tree-construct(z)(y))!}
... | None = {!left (Tree-construct(x)(y ℕ.−₀ x))!}
-}
-- _+_ : Tree(a₁)(b₁) → Tree(a₂)(b₂) →
-- _⋅_ : Tree(a₁)(b₁) → Tree(a₂)(b₂) →
data ℚ : Type{Lvl.𝟎} where
𝟎 : ℚ
_/₋_ : (x : ℕ₊) → (y : ℕ₊) → ⦃ _ : Tree(x)(y) ⦄ → ℚ
_/₊_ : (x : ℕ₊) → (y : ℕ₊) → ⦃ _ : Tree(x)(y) ⦄ → ℚ
{-
_/_ : (x : ℤ) → (y : ℤ) → ℚ
_/_ 𝟎 _ = 𝟎
_/_ _ 𝟎 = 𝟎
_/_ (𝐒(x)) (𝐒(y)) with sign(x) ⋅ sign(y)
... | [−] = (x /₋ y) ⦃ Tree-construction-algorithm(x)(y) ⦄
... | [+] = (x /₊ y) ⦃ Tree-construction-algorithm(x)(y) ⦄
-}
{-
a₁/(a₁+b₁)
(a₂+b₂)/b₂
-}
{-
from-ℕ : ℕ → ℚ
from-ℕ(𝟎) = 𝟎
from-ℕ(𝐒(n)) = (𝐒(n) /₊ 1) where
instance
f : (n : ℕ) → Tree(𝐒(n))(1)
f(𝟎) = Tree-intro
f(𝐒(n)) = Tree-right(f(n))
-}
{-
floor : ℚ → ℕ
floor(x / y) = x ℕ.⌊/⌋ y
ceil : ℚ → ℕ
ceil(x / y) = x ℕ.⌈/⌉ y
-}
{-
module Test2 where
open import Data.Tuple as Tuple using (_⨯_ ; _,_)
open import Functional
data Tree : Type{Lvl.𝟎} where
intro : Tree
left : Tree → Tree
right : Tree → Tree
Tree-quotient : Tree → (ℕ ⨯ ℕ)
Tree-quotient intro = (1 , 1 )
Tree-quotient (left t) with (x , y) ← Tree-quotient t = (x , x ℕ.+ y)
Tree-quotient (right t) with (x , y) ← Tree-quotient t = (x ℕ.+ y , y )
Tree-denominator : Tree → ℕ
Tree-denominator = Tuple.right ∘ Tree-quotient
Tree-numerator : Tree → ℕ
Tree-numerator = Tuple.left ∘ Tree-quotient
-}
|
oeis/105/A105334.asm | neoneye/loda-programs | 11 | 21197 | <reponame>neoneye/loda-programs
; A105334: a(n) = n*(n+1)/2 mod 32.
; Submitted by <NAME>
; 0,1,3,6,10,15,21,28,4,13,23,2,14,27,9,24,8,25,11,30,18,7,29,20,12,5,31,26,22,19,17,16,16,17,19,22,26,31,5,12,20,29,7,18,30,11,25,8,24,9,27,14,2,23,13,4,28,21,15,10,6,3,1,0,0,1,3,6,10,15,21,28,4,13,23,2,14,27,9,24
add $0,1
bin $0,2
mod $0,32
|
sources/isal/igzip/igzip_multibinary.asm | intel/qpl | 11 | 173929 | <filename>sources/isal/igzip/igzip_multibinary.asm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (C) 2022 Intel Corporation
;
; SPDX-License-Identifier: MIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
default rel
[bits 64]
%include "reg_sizes.asm"
extern isal_deflate_body_base
extern isal_deflate_body_01
extern isal_deflate_body_02
extern isal_deflate_body_04
extern isal_deflate_finish_base
extern isal_deflate_finish_01
extern isal_deflate_icf_body_hash_hist_base
extern isal_deflate_icf_body_hash_hist_01
extern isal_deflate_icf_body_hash_hist_02
extern isal_deflate_icf_body_hash_hist_04
extern isal_deflate_icf_finish_hash_hist_base
extern isal_deflate_icf_finish_hash_hist_01
extern isal_deflate_icf_finish_hash_map_base
extern isal_update_histogram_base
extern isal_update_histogram_01
extern isal_update_histogram_04
extern gen_icf_map_h1_base
extern gen_icf_map_lh1_04
extern encode_deflate_icf_base
extern encode_deflate_icf_04
extern set_long_icf_fg_base
extern set_long_icf_fg_04
%ifdef HAVE_AS_KNOWS_AVX512
extern encode_deflate_icf_06
extern set_long_icf_fg_06
extern gen_icf_map_lh1_06
%endif
extern adler32_base
extern adler32_avx2_4
extern adler32_sse
extern isal_deflate_hash_base
extern isal_deflate_hash_crc_01
extern isal_deflate_hash_mad_base
extern icf_body_hash1_fillgreedy_lazy
extern icf_body_lazyhash1_fillgreedy_greedy
section .text
%include "multibinary.asm"
mbin_interface isal_deflate_body
mbin_dispatch_init5 isal_deflate_body, isal_deflate_body_base, isal_deflate_body_01, isal_deflate_body_02, isal_deflate_body_04
mbin_interface isal_deflate_finish
mbin_dispatch_init5 isal_deflate_finish, isal_deflate_finish_base, isal_deflate_finish_01, isal_deflate_finish_01, isal_deflate_finish_01
mbin_interface isal_deflate_icf_body_lvl1
mbin_dispatch_init5 isal_deflate_icf_body_lvl1, isal_deflate_icf_body_hash_hist_base, isal_deflate_icf_body_hash_hist_01, isal_deflate_icf_body_hash_hist_02, isal_deflate_icf_body_hash_hist_04
mbin_interface isal_deflate_icf_body_lvl2
mbin_dispatch_init5 isal_deflate_icf_body_lvl2, isal_deflate_icf_body_hash_hist_base, isal_deflate_icf_body_hash_hist_01, isal_deflate_icf_body_hash_hist_02, isal_deflate_icf_body_hash_hist_04
mbin_interface isal_deflate_icf_body_lvl3
mbin_dispatch_init5 isal_deflate_icf_body_lvl3, icf_body_hash1_fillgreedy_lazy, icf_body_hash1_fillgreedy_lazy, icf_body_hash1_fillgreedy_lazy, icf_body_lazyhash1_fillgreedy_greedy
mbin_interface isal_deflate_icf_finish_lvl1
mbin_dispatch_init5 isal_deflate_icf_finish_lvl1, isal_deflate_icf_finish_hash_hist_base, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01
mbin_interface isal_deflate_icf_finish_lvl2
mbin_dispatch_init5 isal_deflate_icf_finish_lvl2, isal_deflate_icf_finish_hash_hist_base, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01, isal_deflate_icf_finish_hash_hist_01
mbin_interface isal_deflate_icf_finish_lvl3
mbin_dispatch_init5 isal_deflate_icf_finish_lvl3, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base, isal_deflate_icf_finish_hash_map_base
mbin_interface isal_update_histogram
mbin_dispatch_init5 isal_update_histogram, isal_update_histogram_base, isal_update_histogram_01, isal_update_histogram_01, isal_update_histogram_04
mbin_interface encode_deflate_icf
mbin_dispatch_init6 encode_deflate_icf, encode_deflate_icf_base, encode_deflate_icf_base, encode_deflate_icf_base, encode_deflate_icf_04, encode_deflate_icf_06
mbin_interface set_long_icf_fg
mbin_dispatch_init6 set_long_icf_fg, set_long_icf_fg_base, set_long_icf_fg_base, set_long_icf_fg_base, set_long_icf_fg_04, set_long_icf_fg_06
mbin_interface gen_icf_map_lh1
mbin_dispatch_init6 gen_icf_map_lh1, gen_icf_map_h1_base, gen_icf_map_h1_base, gen_icf_map_h1_base, gen_icf_map_lh1_04, gen_icf_map_lh1_06
mbin_interface isal_adler32
mbin_dispatch_init5 isal_adler32, adler32_base, adler32_sse, adler32_sse, adler32_avx2_4
mbin_interface isal_deflate_hash_lvl0
mbin_dispatch_init5 isal_deflate_hash_lvl0, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl1
mbin_dispatch_init5 isal_deflate_hash_lvl1, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl2
mbin_dispatch_init5 isal_deflate_hash_lvl2, isal_deflate_hash_base, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01, isal_deflate_hash_crc_01
mbin_interface isal_deflate_hash_lvl3
mbin_dispatch_init5 isal_deflate_hash_lvl3, isal_deflate_hash_base, isal_deflate_hash_base, isal_deflate_hash_base, isal_deflate_hash_mad_base
|
apps/si7060_mote/main.adb | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 14526 | <reponame>ekoeppen/STM32_Generic_Ada_Drivers
with Interfaces; use Interfaces;
with STM32_SVD; use STM32_SVD;
with STM32GD.Board; use STM32GD.Board;
with STM32GD.Power;
with Drivers.Si7060;
with CBOR_Codec;
with Utils;
procedure Main is
Sensor_Reading_Tag : constant Natural := 6;
Voltage_Tag : constant Natural := 7;
Temperature_Tag : constant Natural := 8;
Humidity_Tag : constant Natural := 9;
Pressure_Tag : constant Natural := 10;
Lux_Tag : constant Natural := 11;
UV_Index_Tag : constant Natural := 12;
Motion_Tag : constant Natural := 13;
Sound_Level_Tag : constant Natural := 14;
CO2_Tag : constant Natural := 15;
Test_Packet_Tag : constant Natural := 64;
Heartbeat_Tag : constant Natural := 65;
Log_Message_Tag : constant Natural := 66;
Ping_Tag : constant Natural := 67;
Register_Value_Tag : constant Natural := 68;
Error_Message_Tag : constant Natural := 69;
Modem_Message_Tag : constant Natural := 70;
Modem_ID_Tag : constant Natural := 71;
RF_Packet_Tag : constant Natural := 72;
Status_Cmd_Tag : constant Natural := 256;
Ping_Cmd_Tag : constant Natural := 257;
Reset_Cmd_Tag : constant Natural := 258;
Packet : Radio.Packet_Type (1 .. 26);
Packet_Index : Byte;
Node_Name : Utils.Hex_String_Word;
procedure Write_Packet (C : Unsigned_8);
function Read_Packet return Unsigned_8;
package CBOR is new CBOR_Codec (Write => Write_Packet, Read => Read_Packet);
package Temp_Sensor is new Drivers.Si7060 (Address => 16#32#, I2C => STM32GD.Board.I2C);
procedure Generate_Node_Name is
HW_ID : Unsigned_32;
UID : STM32GD.UID_Type := STM32GD.UID;
begin
HW_ID := UID (1) xor UID (2) xor UID (3);
Node_Name := Utils.To_Hex_String (HW_ID);
end Generate_Node_Name;
procedure Write_Packet (C : Unsigned_8) is
begin
Packet (Packet_Index) := Byte (C);
Packet_Index := Packet_Index + 1;
end Write_Packet;
function Read_Packet return Unsigned_8 is
begin
return 0;
end Read_Packet;
function Read_Sensor_Data return Boolean is
Temperature : Integer;
Voltage : STM32GD.Power.Millivolts;
begin
if not Temp_Sensor.Temperature_x100 (Temperature) then
return False;
end if;
Voltage := STM32GD.Power.Supply_Voltage;
Text_IO.Put_Integer (Voltage); Text_IO.New_Line;
Text_IO.Put_Integer (Temperature); Text_IO.New_Line;
Packet_Index := 1;
CBOR.Encode_Tag (Sensor_Reading_Tag);
CBOR.Encode_Array (3);
CBOR.Encode_Byte_String (Node_Name);
CBOR.Encode_Tag (Temperature_Tag);
CBOR.Encode_Decimal_Fraction (Temperature, -2);
CBOR.Encode_Tag (Voltage_Tag);
CBOR.Encode_Decimal_Fraction (Voltage, -3);
return True;
end Read_Sensor_Data;
procedure Run (Interval_Seconds : Natural) is
Now : RTC.Date_Time_Type;
begin
loop
Text_IO.Put_Line ("Measuring");
if Read_Sensor_Data then
Text_IO.Put_Line ("Sending");
Radio.TX_Mode;
Radio.TX (Packet);
Radio.Power_Down;
Text_IO.Put_Line ("Sent");
end if;
RTC.Read (Now);
RTC.Add_Seconds (Now, Interval_Seconds mod 60);
if Interval_Seconds >= 60 then
RTC.Add_Minutes (Now, Interval_Seconds / 60);
end if;
RTC.Set_Alarm (Now);
Disable_Peripherals;
RTC.Wait_For_Alarm;
Enable_Peripherals;
end loop;
end Run;
begin
Init;
Radio.Init;
Radio.Power_Down;
LED.Set;
Generate_Node_Name;
if not Temp_Sensor.Init then
Text_IO.Put_Line ("Sensor not found");
loop STM32GD.Wait_For_Interrupt; end loop;
end if;
Text_IO.Put_Line ("Starting");
Text_IO.Put_Line (Node_Name);
STM32GD.Power.Enable_Stop;
Run (900);
end Main;
|
tools/scitools/conf/understand/ada/ada12/a-cforma.ads | brucegua/moocos | 1 | 30737 | ------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- A D A . C O N T A I N E R S . F O R M A L _ O R D E R E D _ M A P S --
-- --
-- S p e c --
-- --
-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
-- apply solely to the contents of the part following the private keyword. --
-- --
-- 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. --
-- --
-- --
-- --
-- --
-- --
-- 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/>. --
------------------------------------------------------------------------------
-- This spec is derived from package Ada.Containers.Bounded_Ordered_Maps in
-- the Ada 2012 RM. The modifications are to facilitate formal proofs by
-- making it easier to express properties.
-- The modifications are:
-- A parameter for the container is added to every function reading the
-- content of a container: Key, Element, Next, Query_Element, Previous,
-- Has_Element, Iterate, Reverse_Iterate. This change is motivated by the
-- need to have cursors which are valid on different containers (typically a
-- container C and its previous version C'Old) for expressing properties,
-- which is not possible if cursors encapsulate an access to the underlying
-- container. The operators "<" and ">" that could not be modified that way
-- have been removed.
-- There are four new functions:
-- function Strict_Equal (Left, Right : Map) return Boolean;
-- function Overlap (Left, Right : Map) return Boolean;
-- function Left (Container : Map; Position : Cursor) return Map;
-- function Right (Container : Map; Position : Cursor) return Map;
-- See detailed specifications for these subprograms
private with Ada.Containers.Red_Black_Trees;
private with Ada.Streams;
generic
type Key_Type is private;
type Element_Type is private;
with function "<" (Left, Right : Key_Type) return Boolean is <>;
with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Formal_Ordered_Maps is
pragma Pure;
function Equivalent_Keys (Left, Right : Key_Type) return Boolean;
type Map (Capacity : Count_Type) is tagged private;
pragma Preelaborable_Initialization (Map);
type Cursor is private;
pragma Preelaborable_Initialization (Cursor);
Empty_Map : constant Map;
No_Element : constant Cursor;
function "=" (Left, Right : Map) return Boolean;
function Length (Container : Map) return Count_Type;
function Is_Empty (Container : Map) return Boolean;
procedure Clear (Container : in out Map);
procedure Assign (Target : in out Map; Source : Map);
function Copy (Source : Map; Capacity : Count_Type := 0) return Map;
function Key (Container : Map; Position : Cursor) return Key_Type;
function Element (Container : Map; Position : Cursor) return Element_Type;
procedure Replace_Element
(Container : in out Map;
Position : Cursor;
New_Item : Element_Type);
procedure Query_Element
(Container : in out Map;
Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : Element_Type));
procedure Update_Element
(Container : in out Map;
Position : Cursor;
Process : not null access
procedure (Key : Key_Type; Element : in out Element_Type));
procedure Move (Target : in out Map; Source : in out Map);
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert
(Container : in out Map;
Key : Key_Type;
Position : out Cursor;
Inserted : out Boolean);
procedure Insert
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Include
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Replace
(Container : in out Map;
Key : Key_Type;
New_Item : Element_Type);
procedure Exclude (Container : in out Map; Key : Key_Type);
procedure Delete (Container : in out Map; Key : Key_Type);
procedure Delete (Container : in out Map; Position : in out Cursor);
procedure Delete_First (Container : in out Map);
procedure Delete_Last (Container : in out Map);
function First (Container : Map) return Cursor;
function First_Element (Container : Map) return Element_Type;
function First_Key (Container : Map) return Key_Type;
function Last (Container : Map) return Cursor;
function Last_Element (Container : Map) return Element_Type;
function Last_Key (Container : Map) return Key_Type;
function Next (Container : Map; Position : Cursor) return Cursor;
procedure Next (Container : Map; Position : in out Cursor);
function Previous (Container : Map; Position : Cursor) return Cursor;
procedure Previous (Container : Map; Position : in out Cursor);
function Find (Container : Map; Key : Key_Type) return Cursor;
function Element (Container : Map; Key : Key_Type) return Element_Type;
function Floor (Container : Map; Key : Key_Type) return Cursor;
function Ceiling (Container : Map; Key : Key_Type) return Cursor;
function Contains (Container : Map; Key : Key_Type) return Boolean;
function Has_Element (Container : Map; Position : Cursor) return Boolean;
procedure Iterate
(Container : Map;
Process :
not null access procedure (Container : Map; Position : Cursor));
procedure Reverse_Iterate
(Container : Map;
Process : not null access
procedure (Container : Map; Position : Cursor));
function Strict_Equal (Left, Right : Map) return Boolean;
-- Strict_Equal returns True if the containers are physically equal, i.e.
-- they are structurally equal (function "=" returns True) and that they
-- have the same set of cursors.
function Left (Container : Map; Position : Cursor) return Map;
function Right (Container : Map; Position : Cursor) return Map;
-- Left returns a container containing all elements preceding Position
-- (excluded) in Container. Right returns a container containing all
-- elements following Position (included) in Container. These two new
-- functions can be used to express invariant properties in loops which
-- iterate over containers. Left returns the part of the container already
-- scanned and Right the part not scanned yet.
function Overlap (Left, Right : Map) return Boolean;
-- Overlap returns True if the containers have common keys
private
pragma Inline (Next);
pragma Inline (Previous);
subtype Node_Access is Count_Type;
use Red_Black_Trees;
type Node_Type is record
Has_Element : Boolean := False;
Parent : Node_Access := 0;
Left : Node_Access := 0;
Right : Node_Access := 0;
Color : Red_Black_Trees.Color_Type := Red;
Key : Key_Type;
Element : Element_Type;
end record;
package Tree_Types is
new Ada.Containers.Red_Black_Trees.Generic_Bounded_Tree_Types (Node_Type);
type Map (Capacity : Count_Type) is
new Tree_Types.Tree_Type (Capacity) with null record;
use Ada.Streams;
type Cursor is record
Node : Node_Access;
end record;
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Item : Cursor);
for Cursor'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Item : out Cursor);
for Cursor'Read use Read;
No_Element : constant Cursor := (Node => 0);
procedure Write
(Stream : not null access Root_Stream_Type'Class;
Container : Map);
for Map'Write use Write;
procedure Read
(Stream : not null access Root_Stream_Type'Class;
Container : out Map);
for Map'Read use Read;
Empty_Map : constant Map := (Capacity => 0, others => <>);
end Ada.Containers.Formal_Ordered_Maps;
|
src/windows/sp-platform.adb | jquorning/septum | 236 | 3635 | with Ada.Directories;
with Ada.Environment_Variables;
package body SP.Platform is
function Home_Dir return String is
package Env renames Ada.Environment_Variables;
User_Profile : constant String := "HOME";
begin
if Env.Exists (User_Profile) then
return Ada.Directories.Full_Name (Env.Value (User_Profile));
else
-- TODO: Add a better fallback case here.
return "";
end if;
end Home_Dir;
function Path_Separator return Character is ('\');
function Path_Opposite_Separator return Character is ('/');
end SP.Platform;
|
C/BiosLib/getticks.asm | p-k-p/SysToolsLib | 232 | 9873 | page ,132
;*****************************************************************************;
; ;
; FILE NAME: getticks.asm ;
; ;
; DESCRIPTION: BIOS get tick count int 1AH function 00H ;
; ;
; NOTES: ;
; ;
; HISTORY: ;
; 2016-04-24 JFL Created this file. ;
; ;
; (c) Copyright 2016-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
INCLUDE ADEFINE.INC
.CODE
;-----------------------------------------------------------------------------;
; ;
; Function: _bios_getticks ;
; ;
; Description: BIOS get tick count int 1AH function 00H ;
; ;
; Parameters: None ;
; ;
; Returns: DX:AX = Number of tick counts since last midnight. ;
; ;
; Notes: The tick frequency is ~= 65536 ticks / hour. ;
; https://blogs.msdn.microsoft.com/oldnewthing/20041202-00/?p=37153 ;
; ;
; Regs altered: AX, CX, DX. ;
; ;
; History: ;
; 2016-04-24 JFL Created this routine ;
; ;
;-----------------------------------------------------------------------------;
CFASTPROC _bios_getticks
mov ah, 00H
int 1AH
mov ax, dx
mov dx, cx
ret
ENDCFASTPROC _bios_getticks
END
|
40-Printing-Etiqutte-2.size.asm | blueset/7bh-solutions | 0 | 247747 | <reponame>blueset/7bh-solutions<gh_stars>0
-- 7 Billion Humans --
-- 40: Printing Etiqutte 2 --
-- Size: 11/12 --
-- Speed: 71/65 --
mem1 = nearest printer
mem2 = set 0
a:
if mem2 < 5:
mem2 = calc mem2 + 1
takefrom mem1
b:
if c == something:
step nw,w,sw,n,s,ne,e,se
jump b
endif
write mem2
drop
jump a
endif
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_nxos/CiscoNxos_vrf.g4 | yrll/batfish-repair | 0 | 2637 | parser grammar CiscoNxos_vrf;
import CiscoNxos_common;
options {
tokenVocab = CiscoNxosLexer;
}
s_vrf_context
:
VRF CONTEXT name = vrf_name NEWLINE
(
vc_address_family
| vc_ip
| vc_no
| vc_null
| vc_rd
| vc_shutdown
| vc_vni
)*
;
vc_address_family
:
ADDRESS_FAMILY
(
(
IPV4 UNICAST NEWLINE
(
vcaf4u_null
| vcaf4u_route_target
)*
)
|
(
IPV6 UNICAST NEWLINE
(
vcaf6u_null
| vcaf6u_route_target
)*
)
)
;
vcaf4u_null
:
NO?
(
MAXIMUM
) null_rest_of_line
;
vcaf4u_route_target
:
ROUTE_TARGET both_export_import rt = route_target_or_auto EVPN? NEWLINE
;
vcaf6u_null
:
NO?
(
MAXIMUM
) null_rest_of_line
;
vcaf6u_route_target
:
ROUTE_TARGET both_export_import rt = route_target_or_auto EVPN? NEWLINE
;
vc_ip
:
IP
(
ip_route
| ip_name_server
| vc_ip_null
)
;
vc_ip_null
:
(
DOMAIN_LIST
| DOMAIN_NAME
| PIM
)
null_rest_of_line
;
vc_no
:
NO vc_no_shutdown
;
vc_no_shutdown
:
SHUTDOWN NEWLINE
;
vc_null
:
(
DESCRIPTION
| MDT
| PIM
) null_rest_of_line
;
vc_rd
:
RD rd = route_distinguisher_or_auto NEWLINE
;
vc_shutdown
:
SHUTDOWN NEWLINE
;
vc_vni
:
VNI vni_number NEWLINE
;
|
tests/inputs/test_multiple_FUs/test_multiple_FPM/multiple_FPM.asm | danielstumpp/tomasulo-simulator | 0 | 91211 | <reponame>danielstumpp/tomasulo-simulator
mult.d, F1, F1, F1
mult.d, F2, F2, F1
mult.d, F3, F3, F1
mult.d, F4, F4, F5 |
specs/ada/server/ike/tkmrpc-operation_handlers-ike-dh_create.adb | DrenfongWong/tkm-rpc | 0 | 1808 | with
Tkmrpc.Servers.Ike;
with Tkmrpc.Results;
with Tkmrpc.Request.Ike.Dh_Create.Convert;
with Tkmrpc.Response.Ike.Dh_Create.Convert;
package body Tkmrpc.Operation_Handlers.Ike.Dh_Create is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
Specific_Req : Request.Ike.Dh_Create.Request_Type;
Specific_Res : Response.Ike.Dh_Create.Response_Type;
begin
Specific_Res := Response.Ike.Dh_Create.Null_Response;
Specific_Req := Request.Ike.Dh_Create.Convert.From_Request (S => Req);
if Specific_Req.Data.Dh_Id'Valid and
Specific_Req.Data.Dha_Id'Valid
then
Servers.Ike.Dh_Create
(Result => Specific_Res.Header.Result,
Dh_Id => Specific_Req.Data.Dh_Id,
Dha_Id => Specific_Req.Data.Dha_Id,
Pubvalue => Specific_Res.Data.Pubvalue);
Res :=
Response.Ike.Dh_Create.Convert.To_Response (S => Specific_Res);
else
Res.Header.Result := Results.Invalid_Parameter;
end if;
end Handle;
end Tkmrpc.Operation_Handlers.Ike.Dh_Create;
|
TransformationAlgebra/AlgebraParsers/TransformationAlgebra.g4 | simonscheider/QuAnGIS | 1 | 606 | <filename>TransformationAlgebra/AlgebraParsers/TransformationAlgebra.g4<gh_stars>1-10
grammar TransformationAlgebra;
/*
* This grammar can be used to parse strings of the Algebra of core concept transformation. Each string is an abstract representation of a GIS workflow.
*
* Example string:
* ratio fcont interpol pointmeasures temperature deify merge pi2 sigmae objectregions muni object Utrecht size pi1 interpol pointmeasures temperature deify merge pi2 sigmae objectregions muni object Utrecht
* sigmae objectregions x object y
*/
/*
* Parser Rules
*/
//Start rules:
start : (r | rr | v );
r : (l | s | q | o);
rr : (lq | sq | qs | oq | os);
v : (ov | lv | sv| qv) ;
//Value rules
countv : COUNT o | GET count | COUNTV ;
ratiov : FCONT lint | SIZE l
| RATIO ratiov WHITESPACE ratiov
| OCONT oratio | GET ratio| countv | RATIOV ;
intv : AVG lint | AVG oint | ratiov |GET intt | INTV ;
ordv : MAX lord | MIN lord | MAX oord | MIN oord | GET ordinal | intv | ORDV;
nomv : ordv | GET nom | TOPOV | NOMV;
qv : GET q | nomv | ordv | intv | ratiov | countv;
sv : REIFY l | GET s | MERGE s | SV;
lv : GET l ;
ov : GET o | DATAOBJV ;
// R rules
l : DEIFY sv | PI1 lint | PI1 lord | PI1 lnom | PI1 lq | PI1 lratio | PI1 linto | PI1 lnomo ; //First apply the most specific function
s : PI1 sint | PI1 sord | PI1 snom | PI1 lq | PI2 os ; //First apply the most specific function
o : PI1 os | PI1 oratio | PI1 oint | PI1 oord | PI1 onom| PI1 oq | PI1 onomo | PI2 onomo | PI3 lnomo | PI3 onomo;
count : PI2 ocount ;
ratio : PI2 oratio | PI2 lratio | count;
intt : PI1 ints | PI2 oint | PI2 lint |ratio ;
ordinal : PI1 ords | intt ;
nom : PI1 noms | ordinal ;
q : PI1 qs | nom ;
// RR rules
lratio : DATAFIELD ;
lint : INTERPOL sint WHITESPACE l | SIGMASE lint WHITESPACE intv| BOWTIE lint WHITESPACE l | GROUPBYAVG lintl | lratio ;
lord : REVERT ords | SIGMASE lord WHITESPACE ordv | BOWTIE lord WHITESPACE l | groupbyaggord lordl | lint ;
lnom : REVERT snom | SIGMAE lnom WHITESPACE nomv | lord;
lq : SIGMAE lq WHITESPACE qv | BOWTIE lq WHITESPACE l |lnom;
ords : INVERT lord | SIGMASE ords WHITESPACE ordv | DATACONTOUR ;
ints : DATACONTOURLINE ;
noms : SIGMAE noms WHITESPACE nomv | ords ;
qs : noms ;
sint : DATAPM ;
sord : sint ;
snom : DATAAMOUNT | INVERT lnom | SIGMAE snom WHITESPACE nomv | sord ;
sq : snom ;
os : SIGMAE os WHITESPACE ov | BOWTIE os WHITESPACE o | DATAOBJS ;
ocount : SIGMAE ocount WHITESPACE ov | BOWTIE ocount WHITESPACE o | GROUPBYCOUNT onomo | GROUPBYAVG ocounto | GROUPBYSUM ocounto | DATAOBJCOUNT ;
oratio :BOWTIE oratio WHITESPACE o | BOWTIERATIO oratio WHITESPACE oratio | GROUPBYAVG oratioo | GROUPBYSUM oratioo | GROUPBYAVG lratioo | GROUPBYSIZE lnomo | DATAOBJQ | ocount ;
oint : SIGMASE oint WHITESPACE intv| BOWTIE oint WHITESPACE o | GROUPBYAVG ointo | GROUPBYAVG linto | oratio ;
oord : SIGMASE oord WHITESPACE ordv | BOWTIE oord WHITESPACE o | groupbyaggord oordo | oint ;
onom : SIGMAE onom WHITESPACE nomv | oord ;
oq : SIGMAE oq WHITESPACE qv | BOWTIE oq WHITESPACE o | onom;
//RRR rules
ocounto : BOWTIESTAR onomo WHITESPACE ocount ;
oratioo : ODIST os WHITESPACE os |NDIST o WHITESPACE o WHITESPACE oratioo | BOWTIESTAR onomo WHITESPACE oratio ;
ointo : BOWTIESTAR onomo WHITESPACE oint | oratioo ;
oordo : SIGMASE oordo WHITESPACE ordv | ointo ;
onomo : OTOPO os WHITESPACE os | SIGMAE onomo WHITESPACE nomv | oordo ;
lratioo : LODIST l WHITESPACE o | BOWTIESTAR lnomo WHITESPACE lratio ;
linto : BOWTIESTAR lnomo WHITESPACE lint | lratioo ;
lnomo : LOTOPO l WHITESPACE os | SIGMAE lnomo WHITESPACE nomv ;
lratiol : LDIST l WHITESPACE l | BOWTIESTAR lnoml WHITESPACE lratio;
lintl : BOWTIESTAR lnoml WHITESPACE lint | lratiol ;
lordl : SIGMASE lordl WHITESPACE ordv | lintl ;
lnoml : SIGMAE lnoml WHITESPACE nomv |lbooll |lordl;
lbooll : LVIS l WHITESPACE l WHITESPACE oint | SIGMAE lbooll WHITESPACE BOOLV ;
//Group by superfunction
groupbyaggord : GROUPBYMIN | GROUPBYMAX;
/*
* Lexer Rules
*/
//Functions:
//Value Derivations
RATIO : 'ratio ' ;
// Statistical operations
AVG : 'avg ' ;
MIN : 'min ' ;
MAX : 'max ' ;
// Aggregations of collections
COUNT : 'count ';
SIZE : 'size ';
MERGE : 'merge ';
//Conversions
REIFY : 'reify ' ;
DEIFY : 'deify ';
GET : 'get ' ;
INVERT: 'invert ';
REVERT: 'revert ';
//Amount operations
FCONT : 'fcont ' ;
OCONT : 'ocont ' ;
//Relational operations
PI1 : 'pi1 ' ; //project 1
PI2 : 'pi2 ' ; //project 2
PI3 : 'pi3 ' ; //project 3
SIGMAE : 'sigmae ' ; //Select =
SIGMASE : 'sigmale ' ; //Select <=
BOWTIE : 'bowtie ' ; //Subset relation
BOWTIESTAR : 'bowtie* '; //Join quality with quantifed relation
BOWTIERATIO : 'bowtie_ratio '; //Join two qualities
GROUPBYAVG : 'groupby_avg ' ; //Group by
GROUPBYSUM : 'groupby_sum ' ;
GROUPBYMIN : 'groupby_min ' ;
GROUPBYMAX : 'groupby_max ' ;
GROUPBYSIZE : 'groupby_size ' ;
GROUPBYCOUNT : 'groupby_count ' ;
//Geometric transformations
INTERPOL : 'interpol ' ;
ODIST : 'odist ' ;
LDIST : 'ldist ';
LODIST : 'lodist ' ;
OTOPO : 'otopo ' ;
LOTOPO : 'lotopo ' ;
NDIST : 'ndist ' ;
LVIS : 'lvis ' ;
//Data inputs:
DATAPM : 'pointmeasures ' KEYWORD ;
DATAAMOUNT : 'amountpatches ' KEYWORD ;
DATACONTOUR : 'contour ' KEYWORD ;
DATAOBJQ : 'objects ' KEYWORD ;
DATAOBJS : 'objectregions ' KEYWORD;
DATAOBJV : 'object ' KEYWORD ;
DATACONTOURLINE : 'contourline ' KEYWORD ;
DATAOBJCOUNT : 'objectcounts ' KEYWORD ;
DATAFIELD : 'field ' KEYWORD ;
TOPOV : 'in' ;
SV : 'region ' DATAV ;
COUNTV : 'count ' DATAV ;
RATIOV : 'ratio ' DATAV ;
INTV : 'interval ' DATAV ;
ORDV : 'ordinal ' DATAV | 'ordinal ' KEYWORD ;
BOOLV : 'true' | 'false';
NOMV : 'nominal ' KEYWORD ;
//Basic lexer rules
DATAV : [0-9]+ ;
WHITESPACE : ' ';
KEYWORD : ('a'..'z' | 'A'..'Z' | '-' | '_' | ':' | [0-9] )+ ; // used for naming data
WS : [ \t\r\n]+ -> skip ; |
programs/oeis/130/A130759.asm | karttu/loda | 0 | 26628 | ; A130759: Partial sums of A130707.
; 1,3,5,7,11,21,43,87,173,343,683,1365,2731,5463,10925,21847,43691,87381,174763,349527,699053,1398103,2796203,5592405,11184811,22369623,44739245,89478487,178956971,357913941,715827883,1431655767,2863311533
mov $2,1
mov $3,2
lpb $0,1
sub $0,1
add $1,$3
mul $2,2
add $3,$2
sub $3,$1
lpe
add $1,1
|
oeis/268/A268866.asm | neoneye/loda-programs | 11 | 86288 | <reponame>neoneye/loda-programs
; A268866: Records in A268865.
; Submitted by <NAME>
; 2,3,22,38,342,598,5462,9558,87382,152918,1398102,2446678,22369622,39146838
mov $2,$0
mod $2,2
sub $0,$2
lpb $0
sub $0,1
mul $2,4
add $2,4
lpe
mov $0,$2
add $0,2
|
source/league/matreshka-internals-strings-handlers.adb | svn2github/matreshka | 24 | 2685 | <filename>source/league/matreshka-internals-strings-handlers.adb
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Localization, Internationalization, Globalization for Ada --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2010-2015, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
package body Matreshka.Internals.Strings.Handlers is
use Matreshka.Internals.Utf16;
use Matreshka.Internals.Unicode;
-----------
-- Count --
-----------
not overriding function Count
(Self : Abstract_String_Handler;
Item : Matreshka.Internals.Strings.Shared_String_Access;
Code : Matreshka.Internals.Unicode.Code_Point)
return Natural
is
pragma Unreferenced (Self);
Position : Utf16_String_Index := 0;
Count : Natural := 0;
C : Code_Point;
begin
while Position < Item.Unused loop
Unchecked_Next (Item.Value, Position, C);
if C = Code then
Count := Count + 1;
end if;
end loop;
return Count;
end Count;
-----------
-- Index --
-----------
not overriding function Index
(Self : Abstract_String_Handler;
Item : Matreshka.Internals.Strings.Shared_String_Access;
From_Index : Positive;
From_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
To_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
Code : Matreshka.Internals.Unicode.Code_Point) return Natural
is
pragma Unreferenced (Self);
Position : Utf16_String_Index := From_Position;
Index : Natural := From_Index;
C : Code_Point;
begin
while Position < To_Position loop
Unchecked_Next (Item.Value, Position, C);
if C = Code then
return Index;
end if;
Index := Index + 1;
end loop;
return 0;
end Index;
-----------
-- Index --
-----------
not overriding function Index
(Self : Abstract_String_Handler;
Item : Matreshka.Internals.Strings.Shared_String_Access;
From_Index : Positive;
From_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
To_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
Pattern : Matreshka.Internals.Strings.Shared_String_Access)
return Natural
is
Position : Utf16_String_Index;
Index : Positive;
Last : Utf16_String_Index;
C : Code_Point;
begin
if Pattern.Length = 0 then
return 0;
elsif Pattern.Length = 1 then
Position := 0;
Unchecked_Next (Pattern.Value, Position, C);
return
Abstract_String_Handler'Class
(Self).Index (Item, From_Index, From_Position, To_Position, C);
elsif To_Position - From_Position < Pattern.Unused then
-- Slice to lookup in is less than pattern. No much possible.
return 0;
else
Position := From_Position;
Index := From_Index;
Last := To_Position - Pattern.Unused;
while Position <= Last loop
if Item.Value (Position .. Position + Pattern.Unused - 1)
= Pattern.Value (0 .. Pattern.Unused - 1)
then
return Index;
end if;
Unchecked_Next (Item.Value, Position);
Index := Index + 1;
end loop;
return 0;
end if;
end Index;
----------------
-- Last_Index --
----------------
not overriding function Last_Index
(Self : Abstract_String_Handler;
Item : Matreshka.Internals.Strings.Shared_String_Access;
From_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
To_Index : Positive;
To_Position : Matreshka.Internals.Utf16.Utf16_String_Index;
Code : Matreshka.Internals.Unicode.Code_Point) return Natural
is
pragma Unreferenced (Self);
Position : Utf16_String_Index := To_Position;
Index : Natural := To_Index;
C : Code_Point;
begin
while Position > From_Position loop
Unchecked_Previous (Item.Value, Position, C);
if C = Code then
return Index;
end if;
Index := Index - 1;
end loop;
return 0;
end Last_Index;
-----------------
-- Starts_With --
-----------------
not overriding function Starts_With
(Self : Abstract_String_Handler;
Item : not null Shared_String_Access;
Pattern : not null Shared_String_Access) return Boolean
is
pragma Unreferenced (Self);
I_Position : Utf16_String_Index := 0;
P_Position : Utf16_String_Index := 0;
IC : Code_Point;
PC : Code_Point;
begin
if Item = Pattern then
-- Item and Pattern are same strings.
return True;
end if;
if Item.Unused < Pattern.Unused then
-- Item is shorter than Pattern, no match possible.
return False;
end if;
while P_Position < Pattern.Unused loop
Unchecked_Next (Item.Value, I_Position, IC);
Unchecked_Next (Pattern.Value, P_Position, PC);
if IC /= PC then
return False;
end if;
end loop;
return True;
end Starts_With;
end Matreshka.Internals.Strings.Handlers;
|
002-assembly/common-gen-register-1.asm | dingjingmaster/learn-kernel | 0 | 80191 | <gh_stars>0
.data
sum: .quad 0
val: .quad 25
.macro pushaq
push %rax
push %rcx
push %rdx
push %rbx
push %rbp
push %rsi
push %rdi
.endm # pushaq
.macro popaq
pop %rdi
pop %rsi
pop %rbp
pop %rbx
pop %rdx
pop %rcx
pop %rax
.endm # popaq
.extern print_long
.text
.global _start
_start:
mov $0, %rax # 0
inc %rax # AX = 1
add $200, %rax # AX = 201
pushaq
# print sum
movq %rax, %rdi
call print_long # AX = 201
popaq
sub val(%rip), %rax # val = 25 - 201 = -176 X --> 正确 201 - 25 = 176 值保存在 %rax
pushaq
# print sum
movq %rax, %rdi
call print_long # AX = 176
popaq
mov %rax, sum(%rip) # sum = 176
decq sum(%rip) # sum = 175
negq sum(%rip) # sum = -175
pushaq
# print sum
movq sum(%rip), %rdi
call print_long # sum = -175
# print val
movq val(%rip), %rdi
call print_long # val = 25 --> 值 未变过
popaq
movq $60, %rax
xorq %rdi, %rdi
syscall
.end
|
tools-src/gnu/gcc/gcc/ada/prj-nmsc.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 26108 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . N M S C --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2000-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. --
-- --
------------------------------------------------------------------------------
--
-- Check the Naming Scheme of a project file, find the directories
-- and the source files.
private package Prj.Nmsc is
procedure Ada_Check
(Project : Project_Id;
Report_Error : Put_Line_Access);
-- Call Language_Independent_Check.
-- Check the naming scheme for Ada.
-- Find the Ada source files if any.
-- If Report_Error is null , use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
procedure Language_Independent_Check
(Project : Project_Id;
Report_Error : Put_Line_Access);
-- Check the object directory and the source directories.
-- Check the library attributes, including the library directory if any.
-- Get the set of specification and implementation suffixs, if any.
-- If Report_Error is null , use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
end Prj.Nmsc;
|
libsrc/math/daimath32/c/asm/___dai32_xidiv.asm | ahjelm/z88dk | 640 | 21208 | SECTION code_fp_dai32
PUBLIC ___dai32_xidiv
EXTERN xidiv
defc ___dai32_xidiv = xidiv
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_45_735.asm | ljhsiun2/medusa | 9 | 242588 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r15
push %r9
push %rax
push %rbp
push %rdi
push %rdx
lea addresses_WT_ht+0x1021d, %r11
nop
sub %rdx, %rdx
movb (%r11), %r9b
nop
and %rdi, %rdi
lea addresses_D_ht+0x60fd, %r11
nop
nop
nop
nop
nop
sub $47187, %rax
mov (%r11), %r15w
nop
nop
xor %r15, %r15
lea addresses_UC_ht+0x17c1d, %r9
nop
nop
add %rdx, %rdx
mov (%r9), %rdi
nop
nop
nop
and %r11, %r11
lea addresses_UC_ht+0x1caab, %rdx
nop
nop
cmp %rbp, %rbp
movw $0x6162, (%rdx)
nop
nop
and $10488, %rdi
pop %rdx
pop %rdi
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rbx
push %rcx
push %rsi
// Store
mov $0x321, %r10
nop
nop
xor $28523, %rbx
mov $0x5152535455565758, %rcx
movq %rcx, %xmm5
movups %xmm5, (%r10)
nop
nop
add %rcx, %rcx
// Store
lea addresses_RW+0x101dd, %r9
nop
nop
xor $36648, %r8
mov $0x5152535455565758, %r12
movq %r12, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
nop
add %r9, %r9
// Load
mov $0x214ec2000000001d, %r10
nop
nop
nop
nop
nop
and %rbx, %rbx
movups (%r10), %xmm0
vpextrq $1, %xmm0, %rsi
nop
add %rbx, %rbx
// Load
lea addresses_PSE+0x8c1d, %r8
nop
nop
nop
dec %r9
mov (%r8), %r12w
sub $40503, %r8
// Faulty Load
lea addresses_PSE+0x3e1d, %rcx
nop
nop
nop
nop
nop
add %rbx, %rbx
movb (%rcx), %r9b
lea oracles, %r8
and $0xff, %r9
shlq $12, %r9
mov (%r8,%r9,1), %r9
pop %rsi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 9, 'same': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'33': 45}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Project/main.asm | mpetitjean/avrdude | 0 | 244474 | ;
; PROJECT
; EnigmAssembly
;
; Authors : <NAME> & <NAME>
.include "m328pdef.inc"
;--------
; ALIASES
;--------
; KEYBOARD NUMEROTATION
.equ KEYB_PIN = PIND
.equ KEYB_DDR = DDRD
.equ KEYB_PORT = PORTD
.equ ROW1 = 7
.equ ROW2 = 6
.equ ROW3 = 5
.equ ROW4 = 4
.equ COL1 = 3
.equ COL2 = 2
.equ COL3 = 1
.equ COL4 = 0
; LEDs
.equ LEDUP_P = 2
.equ LEDDOWN_P = 3
.equ LED_DDR = DDRC
.equ LED_PORT = PORTC
.equ LED_PIN = PINC
;JOYSTICK
.equ JOYSTICK_DDR = DDRB
.equ JOYSTICK_PORT = PORTB
.equ JOYSTICK_PIN = PINB
.equ JOYSTICK_P = 2
; SCREEN
.equ SCREEN_DDR = DDRB
.equ SCREEN_PORT = PORTB
.equ SCREEN_PIN = PINB
.equ SCREEN_SDI = 3
.equ SCREEN_CLK = 5
.equ SCREEN_LE = 4
;TCNT 1 RESET VALUE
.EQU TCNT2_RESET_480 = 245
.EQU TCNT0_RESET_1M = 55
;Define some Register name
.DEF zero = r0 ; Just a 0
.DEF switch = r1 ; To alternate low and high part of byte (for keyboard)
.DEF cleareg = r2 ; Value offset to space ASCII character
.DEF eof = r3 ; Value offset to EOF ASCII character
.DEF pushapop = r4 ; Push and Pop register (avoid to access RAM)
.DEF lborderlow = r5 ; Verify we do not "underflow"
.DEF lborderhigh= r6 ; Verify we do not "underflow"
.DEF rborderlow = r7 ; Verify we do not "overflow"
.DEF rborderhigh= r8 ; Verify we do not "overflow"
.DEF tmp = r16 ; Register for tmp value
.DEF asciiof = r17 ; To store the offset for ASCII table
.DEF stepreg = r18 ; Write or XOR (0 = Write)
.DEF state = r19 ; Encryption or Decryption (0 = Encryption)
.DEF statejoy = r20 ; Joystick pressed or not (0 = Pressed)
.DEF rowpos = r21 ; Know the row to switch on
.DEF rownumber = r22 ; Select the column corresponding to the right row
;Memory
.DSEG
DisplayMem: .BYTE 17; ASCII offset/cell
.CSEG
;--------
; MACROS
;--------
; Fill in the shift register for screen
.MACRO push2Shift
SBI SCREEN_PORT, SCREEN_SDI
SBRS @0, @1 ; Set to 0 if needed
CBI SCREEN_PORT, SCREEN_SDI
SBI SCREEN_PIN,SCREEN_CLK ; Push value
SBI SCREEN_PIN,SCREEN_CLK
.ENDMACRO
; Store part of ASCII offset in low or high part of asciiof register
; if switch(0) = 1 → low part, else high
.MACRO HexToASCII
SBR asciiof, @0
SBRS switch, 0
LDI asciiof, @0<<4
.ENDMACRO
; Wait
.MACRO loop
CLR tmp
begin@0:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DEC tmp
BRNE begin@0
.ENDMACRO
;Clear offset memory (spaces)
.MACRO clearMem
LDI YH, high(DisplayMem)
LDI YL, low(DisplayMem)
; Clear Screen (put spaces everywhere)
LDI tmp, 32
ST Y, tmp
STD Y+1, tmp
STD Y+2, tmp
STD Y+3, tmp
STD Y+4, tmp
STD Y+5, tmp
STD Y+6, tmp
STD Y+7, tmp
STD Y+8, tmp
STD Y+9, tmp
STD Y+10, tmp
STD Y+11, tmp
STD Y+12, tmp
STD Y+13, tmp
STD Y+14, tmp
STD Y+15, tmp
.ENDMACRO
; Detect key pressed from keyboard (step 2 of two-steps method)
.MACRO invertKeyboard
; Switch in/out for rows and columns
LDI tmp,(1<<ROW1)|(1<<ROW2)|(1<<ROW3)|(1<<ROW4)
OUT KEYB_PORT,tmp
LDI tmp,(1<<COL1)|(1<<COL2)|(1<<COL3)|(1<<COL4)
OUT KEYB_DDR,tmp
loop key2
; Check which row is LOW
SBIS KEYB_PIN,ROW1
RJMP @0
SBIS KEYB_PIN,ROW2
RJMP @1
SBIS KEYB_PIN,ROW3
RJMP @2
SBIS KEYB_PIN,ROW4
RJMP @3
RJMP reset
.ENDMACRO
; Write one column configuration of one cell
.MACRO displayRow
LDI ZL, low(DisplayMem)
LDI ZH, high(DisplayMem)
ADIW ZL, @0 ; Point to the correct cell
LD tmp, Z ; Store in tmp ASCII offset
LDI ZH, high(ASCII<<1) ; ASCII table adress
LDI ZL, low(ASCII<<1)
LSL tmp
ADD ZL, tmp ; Point to the correct ASCII character
ADC ZH, zero
LPM tmp, Z+ ; Store the high part of the adress of the character configuration (columns)
LPM ZH, Z ; Same with the low part
MOV ZL, tmp
ADD ZL, rownumber ; Point to the correct column regarding to the row
ADC ZH, zero
LPM tmp, Z ; Store in tmp the column configuration
push2Shift tmp, 0 ; Write in shift register (display) the column configuration for that cell
push2Shift tmp, 1
push2Shift tmp, 2
push2Shift tmp, 3
push2Shift tmp, 4
.ENDMACRO
;-------
; CODE
;-------
.ORG 0x0000
rjmp init
.ORG 0x0012
rjmp timer2_ovf
init:
; Screen configuration
; Set SDI, CLK, LE as output - set them at LOW
LDI tmp, (1<<SCREEN_SDI)|(1<<SCREEN_CLK)|(1<<SCREEN_LE)
OUT SCREEN_PORT, tmp
OUT SCREEN_DDR, tmp
; Configure LEDs as outputs - set to HIGH to be off
SBI LED_DDR,LEDUP_P
SBI LED_DDR,LEDDOWN_P
SBI LED_PORT,LEDUP_P
SBI LED_PORT,LEDDOWN_P
; Configure joystick stick
CBI JOYSTICK_DDR,JOYSTICK_P
SBI JOYSTICK_PORT,JOYSTICK_P
; Clear useful registers
CLR zero
CLR switch
CLR stepreg
CLR state
; Reg initial values
LDI rownumber, 6 ; Number of rows
LDI rowpos, 1<<6 ; Selection of the first row
LDI tmp, 8
MOV cleareg, tmp ; Offset to blank space
LDI tmp, 3
MOV eof, tmp ; Offset to EOF
LDI statejoy, 1 ; Joystick not pressed
; Adress DisplayMem - 1 (outside of the screen)
LDI tmp, low(DisplayMem-1)
MOV lborderlow, tmp
LDI tmp, high(DisplayMem-1)
MOV lborderhigh, tmp
; Adress DisplayMem + 17 (outside + 1 of the screen to avoid breaking backspace)
LDI tmp, low(DisplayMem+17)
MOV rborderlow, tmp
LDI tmp, high(DisplayMem+17)
MOV tmp, rborderhigh
; Store DisplayMem table adress in Y, point to the next cell we need to configure and clear the memory to show spaces.
clearMem
; TIMER 2 - each line needs to be refreshed at 60Hz
; configure timer 2 in normal mode (count clk signals)
; WGM20 = 0 WGM21 = 0
LDS tmp,TCCR2A
CBR tmp,(1<<WGM20)|(1<<WGM21)
STS TCCR2A,tmp
; configure prescaler to 1024
; CS12=0 CS11=0 CS10=1
LDS tmp,TCCR2B
CBR tmp,(1<<WGM22)
SBR tmp,(1<<CS22)|(1<<CS21)|(1<<CS20)
STS TCCR2B,tmp
; activate overflow interrupt timer 2
; set TOIE12
LDS tmp,TIMSK2
SBR tmp,(1<<TOIE2)
STS TIMSK2,tmp
; Activate global interrupt
SEI
; clear T register
CLT
RJMP main
main:
CPSE YL, lborderlow
RJMP overflow
CPSE YH, lborderhigh
RJMP overflow
LDI YL, low(DisplayMem)
LDI YH, high(DisplayMem)
RJMP JoystickCheck
overflow:
CPSE YL, rborderlow
RJMP JoystickCheck
CPSE YH, rborderhigh
RJMP JoystickCheck
LDI YL, low(DisplayMem+16)
LDI YH, high(DisplayMem+16)
; Check state of the joystick
JoystickCheck:
IN tmp, JOYSTICK_PIN
; If pressed, bit is cleared → skip
SBRS tmp, JOYSTICK_P
RJMP pressed
; Skip if coming from pressed state
CPSE statejoy, zero
RJMP keyboard
LDI statejoy, 1
; Skip if coming from encryption
CPSE state, zero
RJMP bigclear
; Point to the first cell
LDI YL, low(DisplayMem)
LDI YH, high(DisplayMem)
; Set to XOR and decryption state
LDI stepreg, 1
LDI state,1
; Turn on the LED (PC3)
CBI LED_PORT,LEDDOWN_P
; Go to keyboard detection
RJMP keyboard
; Clear the screen and go back to first cell
bigclear:
clearMem
LDI stepreg, 0
LDI state, 0
RJMP keyboard
; Joystick was pressed
pressed:
LDI statejoy, 0 ; Change state of the Joystick
SBI LED_PORT,LEDDOWN_P
RJMP keyboard ; Go to keyboard detection
; STEP 1 of Keyboard check
; Check if all COL are HIGH
; First set all rows to LOW as output and cols as inputs
keyboard:
LDI tmp,(1<<COL1)|(1<<COL2)|(1<<COL3)|(1<<COL4)
OUT KEYB_PORT,tmp
LDI tmp,(1<<ROW1)|(1<<ROW2)|(1<<ROW3)|(1<<ROW4)
OUT KEYB_DDR,tmp
loop key1
; COLx is LOW => check for the rows (step2)
SBIS KEYB_PIN,COL1
RJMP C1Pressed
SBIS KEYB_PIN,COL2
RJMP C2Pressed
SBIS KEYB_PIN,COL3
RJMP C3Pressed
SBIS KEYB_PIN,COL4
RJMP C4Pressed
RJMP reset
; No COL is detected to be pressed, rows are not checked
reset:
BRTC jumptomain ; If T = 0 → no key pressed → jump to main
INC switch ; If T = 1 → key pressed → increment the switch(select if low or high part of a byte)
SBI LED_PIN,LEDUP_P
CLT ; Clear T
SBRC switch, 0 ; Skip if byte is full (second key pressed)
jumptomain: RJMP main
CPSE eof, asciiof
RJMP pwdencode ; Go to pwdencode if NOT eof as last character
INC stepreg ; Switch step state
LDI YL, low(DisplayMem) ; Go back to first cell
LDI YH, high(DisplayMem)
RJMP main
pwdencode:
SBRS stepreg, 0 ; Skip if in XOR
RJMP clear
LD tmp, Y ; Load current offset
EOR asciiof, tmp
ST Y+, asciiof
RJMP main
clear:
CPSE cleareg, asciiof ; Skip if typed a clear (backspace)
RJMP messagein
ST -Y, asciiof
RJMP main
messagein: SBRS switch, 0 ; Skip if switch(0) = 1 (meaning that we only have written the high part of the ASCII offset)
ST Y+, asciiof ; If ASCCI offset written → store it in the correct part of the cell table
RJMP main
C1Pressed:
invertKeyboard C1R1Pressed,C1R2Pressed,C1R3Pressed,C1R4Pressed
C2Pressed:
invertKeyboard C2R1Pressed,C2R2Pressed,C2R3Pressed,C2R4Pressed
C3Pressed:
invertKeyboard C3R1Pressed,C3R2Pressed,C3R3Pressed,C3R4Pressed
C4Pressed:
invertKeyboard C4R1Pressed,C4R2Pressed,C4R3Pressed,C4R4Pressed
C1R1Pressed:
; 7 pressed ->
HexToASCII $7
SET
RJMP main
C1R2Pressed:
; 4 pressed ->
HexToASCII $4
SET
RJMP main
C1R3Pressed:
; 1 pressed ->
HexToASCII $1
SET
RJMP main
C1R4Pressed:
; A pressed ->
HexToASCII $A
SET
RJMP main
C2R1Pressed:
; 8 pressed ->
HexToASCII $8
SET
RJMP main
C2R2Pressed:
; 5 pressed ->
HexToASCII $5
SET
RJMP main
C2R3Pressed:
; 2 pressed ->
HexToASCII $2
SET
RJMP main
C2R4Pressed:
; 0 pressed ->
HexToASCII $0
SET
RJMP main
C3R1Pressed:
; 9 pressed ->
HexToASCII $9
SET
RJMP main
C3R2Pressed:
; 6 pressed ->
HexToASCII $6
SET
RJMP main
C3R3Pressed:
; 3 pressed ->
HexToASCII $3
SET
RJMP main
C3R4Pressed:
; B pressed ->
HexToASCII $B
SET
RJMP main
C4R1Pressed:
; F pressed ->
HexToASCII $F
SET
RJMP main
C4R2Pressed:
; E pressed ->
HexToASCII $E
SET
RJMP main
C4R3Pressed:
; D pressed ->
HexToASCII $D
SET
RJMP main
C4R4Pressed:
; C pressed ->
HexToASCII $C
SET
RJMP main
timer2_ovf:
; Interruption routine at around 60Hz/line
MOV pushapop, tmp ; Save current value of tmp, faster than stack
; Reset timer counter
LDI tmp,TCNT2_RESET_480
STS TCNT2,tmp
; Write column configurations of each cell
displayRow 15
displayRow 14
displayRow 13
displayRow 12
displayRow 11
displayRow 10
displayRow 9
displayRow 8
displayRow 7
displayRow 6
displayRow 5
displayRow 4
displayRow 3
displayRow 2
displayRow 1
displayRow 0
; Useless row of the shift register
CBI SCREEN_PORT,SCREEN_SDI
SBI SCREEN_PIN,SCREEN_CLK
SBI SCREEN_PIN,SCREEN_CLK
; Write row configuration (switch on a row)
push2Shift rowpos, 6
push2Shift rowpos, 5
push2Shift rowpos, 4
push2Shift rowpos, 3
push2Shift rowpos, 2
push2Shift rowpos, 1
push2Shift rowpos, 0
; Prepare for the next iteration (upper row)
DEC rownumber
LSR rowpos
BRNE end ; If we did all the rows → jump to the bottom (row)
LDI rowpos, 1<<6
LDI rownumber, 6
; Set SCREEN_LE HIGH, wait a suficient amount of time
end:
SBI SCREEN_PIN,SCREEN_LE
loop screenLoop
SBI SCREEN_PIN,SCREEN_LE
; Retrieve the tmp value
MOV tmp, pushapop
; Return
RETI
;-------
; TABLES
;-------
ASCII:
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterSpace<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
.dw CharacterSpace<<1
.dw CharacterExclam<<1
.dw CharacterQuote<<1
.dw CharacterHash<<1
.dw CharacterDollar<<1
.dw CharacterPercent<<1
.dw CharacterAnd<<1
.dw CharacterPrime<<1
.dw CharacterParLeft<<1
.dw CharacterParRight<<1
.dw CharacterStar<<1
.dw CharacterPlus<<1
.dw CharacterComma<<1
.dw CharacterLine<<1
.dw CharacterDot<<1
.dw CharacterSlash<<1
.dw Character0<<1
.dw Character1<<1
.dw Character2<<1
.dw Character3<<1
.dw Character4<<1
.dw Character5<<1
.dw Character6<<1
.dw Character7<<1
.dw Character8<<1
.dw Character9<<1
.dw CharacterDoubleDot<<1
.dw CharacterSemiCol<<1
.dw CharacterLower<<1
.dw CharacterEqual<<1
.dw CharacterGreater<<1
.dw CharacterInterrogation<<1
.dw CharacterAt<<1
.dw CharacterA<<1
.dw CharacterB<<1
.dw CharacterC<<1
.dw CharacterD<<1
.dw CharacterE<<1
.dw CharacterF<<1
.dw CharacterG<<1
.dw CharacterH<<1
.dw CharacterI<<1
.dw CharacterJ<<1
.dw CharacterK<<1
.dw CharacterL<<1
.dw CharacterM<<1
.dw CharacterN<<1
.dw CharacterO<<1
.dw CharacterP<<1
.dw CharacterQ<<1
.dw CharacterR<<1
.dw CharacterS<<1
.dw CharacterT<<1
.dw CharacterU<<1
.dw CharacterV<<1
.dw CharacterW<<1
.dw CharacterX<<1
.dw CharacterY<<1
.dw CharacterZ<<1
.dw CharacterBracketLeft<<1
.dw CharacterBackslash<<1
.dw CharacterBracketRight<<1
.dw CharacterHat<<1
.dw CharacterUnderscore<<1
.dw CharacterGAccent<<1
.dw Characteral<<1
.dw Characterbl<<1
.dw Charactercl<<1
.dw Characterdl<<1
.dw Characterel<<1
.dw Characterfl<<1
.dw Charactergl<<1
.dw Characterhl<<1
.dw Characteril<<1
.dw Characterjl<<1
.dw Characterkl<<1
.dw Characterll<<1
.dw Characterml<<1
.dw Characternl<<1
.dw Characterol<<1
.dw Characterpl<<1
.dw Characterql<<1
.dw Characterrl<<1
.dw Charactersl<<1
.dw Charactertl<<1
.dw Characterul<<1
.dw Charactervl<<1
.dw Characterwl<<1
.dw Characterxl<<1
.dw Characteryl<<1
.dw Characterzl<<1
.dw CharacterLeftBrace<<1
.dw CharacterSep<<1
.dw CharacterRightBrace<<1
.dw CharacterTilde<<1
.dw CharacterEmpty<<1
.dw CharacterEmpty<<1
CharacterEmpty:
.db 0, 0, 0, 0b100, 0, 0, 0, 0
CharacterSpace:
.db 0, 0, 0, 0, 0, 0, 0, 0
CharacterExclam:
.db 0b100, 0b100, 0b100, 0b100, 0b100, 0, 0b100, 0
CharacterQuote:
.db 0, 0b01010, 0b01010, 0, 0, 0, 0, 0
CharacterHash:
.db 0, 0b01010, 0b11111, 0b01010, 0b11111, 0b01010, 0, 0
CharacterDollar:
.db 0b0111, 0b1100, 0b1100, 0b0110, 0b0101, 0b0101, 0b1110, 0
CharacterPercent:
.db 0b11000, 0b11001, 0b00010, 0b00100, 0b01000, 0b10011, 0b11, 0
CharacterAnd:
.db 0b110, 0b1001, 0b1010, 0b100, 0b1010, 0b1001, 0b0100, 0
CharacterPrime:
.db 0, 0b00100, 0b00100, 0, 0, 0, 0, 0
CharacterParLeft:
.db 0b00100, 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b100, 0
CharacterParRight:
.db 0b00100, 0b10, 0b10, 0b10, 0b10, 0b10, 0b100, 0
CharacterStar:
.db 0b100, 0b100, 0b11111, 0b100, 0b1010, 0b10001, 0, 0
CharacterPlus:
.db 0, 0b100, 0b100, 0b11111, 0b100, 0b100, 0, 0
CharacterComma:
.db 0, 0, 0, 0, 0b100, 0b100, 0b1000, 0
CharacterLine:
.db 0, 0, 0, 0b1110, 0, 0, 0, 0
CharacterDot:
.db 0, 0, 0, 0, 0, 0, 0b100, 0
CharacterSlash:
.db 0, 1, 2, 4, 8, 16, 0, 0
CharacterA:
.db 0b00110, 0b01001, 0b01001, 0b01001, 0b01111, 0b01001, 0b01001, 0
CharacterB:
.db 0b01110, 0b01001, 0b01001, 0b01110, 0b01001, 0b01001, 0b01110, 0
CharacterC:
.db 0b00111, 0b01000, 0b01000, 0b01000, 0b01000, 0b01000, 0b00111, 0
CharacterD:
.db 0b01110, 0b01001, 0b01001, 0b01001, 0b01001, 0b01001, 0b01110, 0
CharacterE:
.db 0b01111, 0b01000, 0b01000, 0b01110, 0b01000, 0b01000, 0b01111, 0
CharacterF:
.db 0b1111, 0b1000, 0b1000, 0b1110, 0b1000, 0b1000, 0b1000, 0
CharacterG:
.db 0b1111, 0b1000, 0b1000, 0b1000, 0b1011, 0b1001, 0b1111, 0
CharacterH:
.db 0b1001, 0b1001, 0b1001, 0b1111, 0b1001, 0b1001, 0b1001, 0
CharacterI:
.db 0b01110, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0b01110, 0
CharacterJ:
.db 0b1111, 0b0001, 0b0001, 0b0001, 0b0001, 0b1001, 0b0110, 0
CharacterK:
.db 0b1001, 0b1010, 0b1100, 0b1000, 0b1100, 0b1010, 0b1001, 0
CharacterL:
.db 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b1000, 0b1111, 0
CharacterM:
.db 0b1001, 0b1111, 0b1111, 0b1001, 0b1001, 0b1001, 0b1001, 0
CharacterN:
.db 0b1001, 0b1101, 0b1011, 0b1001, 0b1001, 0b1001, 0b1001, 0
CharacterO:
.db 0b1111, 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0
CharacterP:
.db 0b1111, 0b1001, 0b1001, 0b1111, 0b1000, 0b1000, 0b1000, 0
CharacterQ:
.db 0b0110, 0b1001, 0b1001, 0b1001, 0b0111, 0b0010, 0b0001, 0
CharacterR:
.db 0b1111, 0b1001, 0b1001, 0b1111, 0b1100, 0b1010, 0b1001, 0
CharacterS:
.db 0b0111, 0b1000, 0b1000, 0b0110, 0b0001, 0b0001, 0b1110, 0
CharacterT:
.db 0b11111, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0b0100, 0
CharacterU:
.db 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0
CharacterV:
.db 0b1010, 0b1010, 0b1010, 0b1010, 0b1010, 0b1010, 0b0100, 0
CharacterW:
.db 0b1001, 0b1001, 0b1001, 0b1001, 0b1111, 0b1111, 0b1001, 0
CharacterX:
.db 0b1001, 0b1001, 0b1001, 0b0110, 0b1001, 0b1001, 0b1001, 0
CharacterY:
.db 0b1001, 0b1001, 0b1001, 0b0111, 0b0010, 0b0100, 0b1000, 0
CharacterZ:
.db 0b1111, 0b0001, 0b0001, 0b0110, 0b1000, 0b1000, 0b1111, 0
Character0:
.db 0b01111, 0b01001, 0b01001, 0b01001, 0b01001, 0b01001, 0b01111, 0
Character1:
.db 0b00010, 0b00110, 0b01010, 0b00010, 0b00010, 0b00010, 0b00010, 0
Character2:
.db 0b01111, 0b00001, 0b00001, 0b01111, 0b01000, 0b01000, 0b01111, 0
Character3:
.db 0b01111, 0b00001, 0b00001, 0b00111, 0b00001, 0b00001, 0b01111, 0
Character4:
.db 0b01001, 0b01001, 0b01001, 0b01111, 0b00001, 0b00001, 0b00001, 0
Character5:
.db 0b01111, 0b01000, 0b01000, 0b01111, 0b00001, 0b00001, 0b01111, 0
Character6:
.db 0b01111, 0b01000, 0b01000, 0b01111, 0b01001, 0b01001, 0b01111, 0
Character7:
.db 0b01111, 0b00001, 0b00001, 0b00010, 0b00100, 0b00100, 0b00100, 0
Character8:
.db 0b01111, 0b01001, 0b01001, 0b01111, 0b01001, 0b01001, 0b01111, 0
Character9:
.db 0b01111, 0b01001, 0b01001, 0b01111, 0b00001, 0b00001, 0b01111, 0
CharacterDoubleDot:
.db 0, 0, 0b00100, 0, 0b00100, 0, 0, 0
CharacterSemiCol:
.db 0, 0, 0b00100, 0, 0b00100, 0b00100, 0b01000, 0
CharacterLower:
.db 0, 0b00010, 0b00100, 0b01000, 0b00100, 0b00010, 0, 0
CharacterEqual:
.db 0, 0, 0b01110, 0, 0b01110, 0, 0, 0
CharacterGreater:
.db 0, 0b01000, 0b00100, 0b00010, 0b00100, 0b01000, 0, 0
CharacterInterrogation:
.db 0b01110, 0b01010, 0b00010, 0b00110, 0b00100, 0, 0b00100, 0
CharacterAt:
.db 0, 0b11111, 0b00001, 0b01101, 0b01101, 0b01001, 0b01111, 0
CharacterBracketLeft:
.db 0b1100, 0b1000, 0b01000, 0b01000, 0b01000, 0b01000, 0b1100, 0
CharacterBackslash:
.db 0, 16, 8, 4, 2, 1, 0, 0
CharacterBracketRight:
.db 0b110, 2, 2, 2, 2, 2, 0b110, 0
CharacterHat:
.db 0, 4, 0b01010, 0, 0, 0, 0, 0
CharacterUnderscore:
.db 0, 0, 0, 0, 0, 0b01110, 0, 0
CharacterGAccent:
.db 0, 4, 2, 0, 0, 0, 0, 0
Characteral:
.db 0, 0, 0b00110, 1, 0b111, 0b1001, 0b111, 0
Characterbl:
.db 8, 8, 8, 0b1110, 0b1001, 0b1001, 0b1110, 0
Charactercl:
.db 0, 0, 0b110, 8, 8, 8, 0b110, 0,
Characterdl:
.db 1, 1, 1, 0b111, 0b1001, 0b1001, 0b111, 0
Characterel:
.db 0, 0b110, 0b1001, 0b1111, 8, 8, 0b111, 0
Characterfl:
.db 0, 3, 4, 0b1110, 4, 4, 4, 0
Charactergl:
.db 0, 0b101, 0b1011, 0b1011, 0b101, 1, 0b111, 0
Characterhl:
.db 0, 8, 8, 8, 0b1110, 0b1010, 0b1010, 0
Characteril:
.db 0, 4, 0, 4, 4, 4, 4, 0
Characterjl:
.db 0, 4, 0, 4, 4, 4, 0b11000, 0
Characterkl:
.db 0, 8, 8, 0b1010, 0b1100, 0b1010, 0b1010, 0
Characterll:
.db 0, 4, 4, 4, 4, 4, 4, 0
Characterml:
.db 0, 0, 0b01010, 0b10101, 0b10101, 0b10101, 0b10101, 0
Characternl:
.db 0, 0, 0b0100, 0b1010, 0b1010, 0b1010, 0b1010, 0
Characterol:
.db 0, 0, 0b1110, 0b1010, 0b1010, 0b1010, 0b1110, 0
Characterpl:
.db 0, 0, 0b1110, 0b1010, 0b1110, 8, 8, 0
Characterql:
.db 0, 0, 0b1110, 0b1010, 0b1110, 2, 2, 0
Characterrl:
.db 0, 0, 6, 8, 8, 8, 8, 0
Charactersl:
.db 0, 0, 0b1110, 16, 12, 2, 0b11100, 0
Charactertl:
.db 0, 8, 0b1110, 8, 8, 8, 0b110, 0
Characterul:
.db 0, 0, 0, 10, 10, 10, 14, 0
Charactervl:
.db 0, 0, 0, 10, 10, 10, 4, 0
Characterwl:
.db 0, 0, 0, 0b10101, 0b10101, 0b10101, 10, 0
Characterxl:
.db 0, 0, 17, 10, 4, 10, 17, 0
Characteryl:
.db 0, 0, 10, 10, 4, 4, 4, 0
Characterzl:
.db 0, 0, 0, 15, 2, 4, 15, 0
CharacterLeftBrace:
.db 3, 4, 4, 8, 4, 4, 3, 0
CharacterSep:
.db 4, 4, 4, 4, 4, 4, 4, 0
CharacterRightBrace:
.db 12, 2, 2, 1, 2, 2, 12, 0
CharacterTilde:
.db 0, 0, 5, 10, 0, 0, 0, 0
|
src/fot/LTC-PCF/Program/Division/Totality.agda | asr/fotc | 11 | 17429 | ------------------------------------------------------------------------------
-- Totality properties of the division
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Program.Division.Totality where
open import LTC-PCF.Base
open import LTC-PCF.Data.Nat
open import LTC-PCF.Data.Nat.Inequalities
open import LTC-PCF.Program.Division.ConversionRules
open import LTC-PCF.Program.Division.Division
open import LTC-PCF.Program.Division.Specification
------------------------------------------------------------------------------
-- The division is total when the dividend is less than the divisor.
div-x<y-N : ∀ {i j} → i < j → N (div i j)
div-x<y-N i<j = subst N (sym (div-x<y i<j)) nzero
-- The division is total when the dividend is greater or equal than
-- the divisor.
-- N (div (i ∸ j) j) i ≮ j → div i j ≡ succ (div (i ∸ j) j)
------------------------------------------------------------------
-- N (div i j)
div-x≮y-N : ∀ {i j} →
(divSpec (i ∸ j) j (div (i ∸ j) j)) →
i ≮ j →
N (div i j)
div-x≮y-N ih i≮j = subst N (sym (div-x≮y i≮j)) (nsucc (∧-proj₁ ih))
|
programs/oeis/061/A061038.asm | karttu/loda | 1 | 83562 | <filename>programs/oeis/061/A061038.asm
; A061038: Denominator of 1/4 - 1/n^2.
; 1,36,16,100,9,196,64,324,25,484,144,676,49,900,256,1156,81,1444,400,1764,121,2116,576,2500,169,2916,784,3364,225,3844,1024,4356,289,4900,1296,5476,361,6084,1600,6724,441,7396,1936,8100,529,8836,2304,9604,625,10404,2704,11236,729,12100,3136,12996,841,13924,3600,14884,961,15876,4096,16900,1089,17956,4624,19044,1225,20164,5184,21316,1369,22500,5776,23716,1521,24964,6400,26244,1681,27556,7056,28900,1849,30276,7744,31684,2025,33124,8464,34596,2209,36100,9216,37636,2401,39204,10000,40804,2601,42436,10816,44100,2809,45796,11664,47524,3025,49284,12544,51076,3249,52900,13456,54756,3481,56644,14400,58564,3721,60516,15376,62500,3969,64516,16384,66564,4225,68644,17424,70756,4489,72900,18496,75076,4761,77284,19600,79524,5041,81796,20736,84100,5329,86436,21904,88804,5625,91204,23104,93636,5929,96100,24336,98596,6241,101124,25600,103684,6561,106276,26896,108900,6889,111556,28224,114244,7225,116964,29584,119716,7569,122500,30976,125316,7921,128164,32400,131044,8281,133956,33856,136900,8649,139876,35344,142884,9025,145924,36864,148996,9409,152100,38416,155236,9801,158404,40000,161604,10201,164836,41616,168100,10609,171396,43264,174724,11025,178084,44944,181476,11449,184900,46656,188356,11881,191844,48400,195364,12321,198916,50176,202500,12769,206116,51984,209764,13225,213444,53824,217156,13689,220900,55696,224676,14161,228484,57600,232324,14641,236196,59536,240100,15129,244036,61504,248004,15625,252004
mov $1,$0
add $0,3
add $1,$0
add $0,1
gcd $0,4
add $1,1
div $1,$0
pow $1,2
|
programs/oeis/061/A061085.asm | karttu/loda | 0 | 25058 | <filename>programs/oeis/061/A061085.asm
; A061085: a(n) = A019550(n) / 3.
; 4,8,12,16,170,204,238,272,306,340,374,408,442,476,510,544,578,612,646,680,714,748,782,816,850,884,918,952,986,1020,1054,1088,1122,1156,1190,1224,1258,1292,1326,1360,1394,1428,1462,1496,1530,1564,1598,1632,1666
mov $1,2
add $1,$0
add $1,$0
mov $2,$0
mov $3,$0
lpb $2,1
lpb $0,1
sub $0,1
mov $2,4
lpe
mul $1,2
sub $2,1
lpe
lpb $3,1
add $1,2
sub $3,1
lpe
add $1,2
|
test11.asm | abhimanyudwivedi/mp-testing | 0 | 27697 | <gh_stars>0
.model small
.stack
.data
PA EQU 01190H
PB EQU 01191H
PC EQU 01192H
CR EQU 01193H
table db 80h,96h,0abh,0c0h,0d2h,0e2h,0eeh,0f8h,0feh,0ffh,
0feh,0f8h,0eeh,0e2h,0d2h,0c0h,0abh,96h,80h
count equ 19d
.code
mov ax,@data
mov ds,ax
mov dx,CR
mov al,80h
out dx,al
lp1: lea si,table
mov cx,count
lp2: mov dx,PA
mov al,[si]
out dx,al
inc si
call delay
loop lp2
mov ah,01h
int 16h
jz lp1
mov ah,4ch
int 21h
delay proc
mov ah,0ffffh
lp3: dec ax
jnz lp3
ret
delay endp
end |
libsrc/_DEVELOPMENT/arch/sms/SMSlib/z80/__SMSlib_variables_0.asm | jpoikela/z88dk | 640 | 95787 | <gh_stars>100-1000
; **************************************************
; SMSlib - C programming library for the SMS/GG
; ( part of devkitSMS - github.com/sverx/devkitSMS )
; **************************************************
INCLUDE "SMSlib_private.inc"
SECTION data_clib
SECTION data_SMSlib
PUBLIC __SMSlib_VDPReg
PUBLIC __SMSlib_spritesHeight
PUBLIC __SMSlib_spritesWidth
PUBLIC __SMSlib_spritesTileOffset
PUBLIC __SMSlib_theLineInterruptHandler
EXTERN l_ret, _GLOBAL_SMS_VDP_R0R1
defc __SMSlib_VDPReg = _GLOBAL_SMS_VDP_R0R1 ; /* the VDP registers #0 and #1 'shadow' (initialized RAM) */
__SMSlib_spritesHeight:
defb 8
__SMSlib_spritesTileOffset: ; /* MUST FOLLOW spritesHeight */
defb 1
__SMSlib_spritesWidth:
defb 8
__SMSlib_theLineInterruptHandler:
defw l_ret ; /* 'empty' line interrupt handler */
SECTION bss_clib
SECTION bss_SMSlib
PUBLIC __SMSlib_VDPBlank
PUBLIC __SMSlib_VDPFlags
PUBLIC __SMSlib_PauseRequested
PUBLIC __SMSlib_VDPType
PUBLIC __SMSlib_KeysStatus
PUBLIC __SMSlib_PreviousKeysStatus
PUBLIC __SMSlib_SpriteTableY
PUBLIC __SMSlib_SpriteTableXN
PUBLIC __SMSlib_SpriteNextFree
__SMSlib_VDPBlank:
defb 0 ; /* used by INTerrupt */
__SMSlib_VDPFlags:
defb 0 ; /* holds the sprite overflow and sprite collision flags */
__SMSlib_PauseRequested:
defb 0 ; /* used by NMI (SMS only) */
__SMSlib_VDPType:
defb 0 ; /* used by NTSC/PAL and VDP type detection (SMS only) */
__SMSlib_KeysStatus:
defw 0
__SMSlib_PreviousKeysStatus:
defw 0
__SMSlib_SpriteTableY:
IF MAXSPRITES = 64
defs MAXSPRITES
ELSE
defs MAXSPRITES + 1
ENDIF
__SMSlib_SpriteTableXN:
defs MAXSPRITES * 2
__SMSlib_SpriteNextFree:
defb 0
|
programs/oeis/154/A154576.asm | neoneye/loda | 22 | 165782 | ; A154576: a(n) = 2*n^2 + 14*n + 5.
; 21,41,65,93,125,161,201,245,293,345,401,461,525,593,665,741,821,905,993,1085,1181,1281,1385,1493,1605,1721,1841,1965,2093,2225,2361,2501,2645,2793,2945,3101,3261,3425,3593,3765,3941,4121,4305,4493,4685,4881,5081,5285,5493,5705,5921,6141,6365,6593,6825,7061,7301,7545,7793,8045,8301,8561,8825,9093,9365,9641,9921,10205,10493,10785,11081,11381,11685,11993,12305,12621,12941,13265,13593,13925,14261,14601,14945,15293,15645,16001,16361,16725,17093,17465,17841,18221,18605,18993,19385,19781,20181,20585,20993,21405
mov $1,$0
mul $0,2
add $1,9
mul $0,$1
add $0,21
|
part1/lists/split.agda | akiomik/plfa-solutions | 1 | 17237 | <filename>part1/lists/split.agda
module split where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; sym; trans; cong)
open Eq.≡-Reasoning
open import Data.Nat using (ℕ; zero; suc; _+_; _*_; _∸_; _≤_; s≤s; z≤n; _≤?_)
open import Relation.Nullary using (¬_; Dec; yes; no)
open import Data.Product using (_×_; ∃; ∃-syntax) renaming (_,_ to ⟨_,_⟩)
open import Function using (_∘_)
open import lists using (List; []; _∷_; [_]; [_,_]; [_,_,_]; [_,_,_,_]; All; Decidable)
-- リストのマージ
-- xs と ys を使って zs を組み立てる
data merge {A : Set} : (xs ys zs : List A) → Set where
[] :
--------------
merge [] [] []
left-∷ : ∀ {x xs ys zs}
→ merge xs ys zs
--------------------------
→ merge (x ∷ xs) ys (x ∷ zs)
right-∷ : ∀ {y xs ys zs}
→ merge xs ys zs
--------------------------
→ merge xs (y ∷ ys) (y ∷ zs)
_ : merge [ 1 , 4 ] [ 2 , 3 ] [ 1 , 2 , 3 , 4 ]
_ = left-∷ (right-∷ (right-∷ (left-∷ [])))
-- リストの分割
-- 述語Pが成り立つ場合はxs、そうでない場合はysとして分割する (scalaでいうpartition)
split : ∀ {A : Set} {P : A → Set} (P? : Decidable P) (zs : List A)
→ ∃[ xs ] ∃[ ys ] (merge xs ys zs × All P xs × All (¬_ ∘ P) ys)
split P? [] = ⟨ [] , ⟨ [] , ⟨ [] , ⟨ [] , [] ⟩ ⟩ ⟩ ⟩
split P? (z ∷ zs) with P? z | split P? zs
... | yes Pz | ⟨ xs , ⟨ ys , ⟨ m , ⟨ Pxs , ¬Pys ⟩ ⟩ ⟩ ⟩ = ⟨ z ∷ xs , ⟨ ys , ⟨ left-∷ m , ⟨ Pz ∷ Pxs , ¬Pys ⟩ ⟩ ⟩ ⟩
... | no ¬Pz | ⟨ xs , ⟨ ys , ⟨ m , ⟨ Pxs , ¬Pys ⟩ ⟩ ⟩ ⟩ = ⟨ xs , ⟨ z ∷ ys , ⟨ right-∷ m , ⟨ Pxs , ¬Pz ∷ ¬Pys ⟩ ⟩ ⟩ ⟩
-- 0と等しい1以上の自然数は存在しない
¬z≡n : ∀ {n : ℕ} → ¬ (zero ≡ suc n)
¬z≡n ()
-- m = n が成り立たなければ (m + 1) = (n + 1) も成り立たない
¬s≡s : ∀ {m n : ℕ} → ¬ (m ≡ n) → ¬ (suc m ≡ suc n)
¬s≡s ¬m≡n refl = ¬m≡n refl
-- decidableを使った、2つの自然数が等しいかどうか判定する関数
_≡ℕ?_ : ∀ (m n : ℕ) → Dec (m ≡ n)
zero ≡ℕ? zero = yes refl
zero ≡ℕ? suc n = no ¬z≡n
suc m ≡ℕ? zero = no (λ ())
suc m ≡ℕ? suc n with m ≡ℕ? n
... | yes refl = yes refl
... | no ¬m≡n = no (¬s≡s ¬m≡n)
-- テスト
-- リストの要素を3とそれ以外とに分ける
_ : split (_≡ℕ? 3) [ 3 , 0 , 3 , 1 ]
≡ ⟨ [ 3 , 3 ] , ⟨ [ 0 , 1 ] , ⟨ (left-∷ (right-∷ (left-∷ (right-∷ [])))) , ⟨ refl ∷ refl ∷ [] , ¬z≡n ∷ (¬s≡s ¬z≡n) ∷ [] ⟩ ⟩ ⟩ ⟩
_ = refl
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2623.asm | ljhsiun2/medusa | 9 | 12336 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xf929, %rsi
lea addresses_A_ht+0x1daa9, %rdi
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $104, %rcx
rep movsw
nop
and %r15, %r15
lea addresses_normal_ht+0xaab5, %rsi
lea addresses_normal_ht+0x10ad1, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $25, %rcx
rep movsq
and $22418, %rcx
lea addresses_A_ht+0x116b9, %rax
cmp %r12, %r12
mov (%rax), %rdi
nop
and %r12, %r12
lea addresses_A_ht+0x230d, %rsi
lea addresses_A_ht+0x10e39, %rdi
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $81, %rcx
rep movsq
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x4a29, %rdi
nop
nop
sub $46600, %rax
movb $0x61, (%rdi)
nop
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0x1d74a, %rsi
lea addresses_WT_ht+0x15ca9, %rdi
nop
nop
nop
nop
cmp $30498, %rbp
mov $118, %rcx
rep movsq
nop
nop
nop
nop
nop
add $432, %rbp
lea addresses_WC_ht+0xf910, %rsi
lea addresses_WT_ht+0x1929, %rdi
nop
cmp $20014, %r12
mov $67, %rcx
rep movsq
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x39e9, %rcx
sub %rdi, %rdi
mov (%rcx), %esi
nop
nop
nop
nop
sub %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdx
// Load
lea addresses_UC+0x62a9, %r14
and $45656, %rcx
movb (%r14), %r8b
nop
nop
nop
nop
cmp %rcx, %rcx
// Load
lea addresses_D+0x14e21, %r13
add $9777, %r14
mov (%r13), %r9d
nop
nop
add %r14, %r14
// Faulty Load
lea addresses_UC+0x62a9, %r14
nop
nop
nop
nop
and %rbp, %rbp
mov (%r14), %ecx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/ys_w56.asm | prismotizm/gigaleak | 0 | 82935 | Name: ys_w56.asm
Type: file
Size: 11155
Last-Modified: '2016-05-13T04:50:34Z'
SHA-1: 21B6B55474E2507917FE3B312A755829B5F92A4A
Description: null
|
libsrc/_DEVELOPMENT/math/float/math48/lm/z80/asm_dequate.asm | jpoikela/z88dk | 640 | 246765 |
SECTION code_clib
SECTION code_fp_math48
PUBLIC asm_dequate
EXTERN am48_dequate
defc asm_dequate = am48_dequate
|
src/module/ModuleCharacter.asm | Dunkansdk/AoW | 2 | 240338 | ;//////////////////////////////////////////////////////////////////////
;/// This file is subject to the terms and conditions defined in ///
;/// file 'LICENSE.txt', which is part of this source code package. ///
;//////////////////////////////////////////////////////////////////////
[SEGMENT .text]
;////////////////////////////////////////////////////
;///!< Flag to determinate if the character was initialized
;////////////////////////////////////////////////////
__bCharacterInitialized DB 0x00
;////////////////////////////////////////////////////
;///!< Character min/max Health/Mana
;////////////////////////////////////////////////////
__dwCharacterHealth DD 0x00000000
__dwCharacterMaxHealth DD 0x00000000
__dwCharacterMana DD 0x00000000
__dwCharacterMaxMana DD 0x00000000
;////////////////////////////////////////////////////
;/// \brief Gets the initial mana and health point
;///
;/// \param message The message packet
;////////////////////////////////////////////////////
GetInitialCharacterPoint:
PUSH EBP
MOV EBP, ESP
;////////////////////////////////////////////////
;/// Check if the character was already initialized
;////////////////////////////////////////////////
MOV AL, BYTE [__bCharacterInitialized]
TEST AL, AL
JNZ .GetInitialCharacterPoint_Finish
;////////////////////////////////////////////////
;/// Call foundation Parse packet for that message
;////////////////////////////////////////////////
PUSH DWORD [EBP + 0x08]
CALL FoundationParseInitialCharacter
.GetInitialCharacterPoint_Finish:
MOV ESP, EBP
POP EBP
RET 0x04 |
externals/mpir-3.0.0/mpn/mips32/umul.asm | JaminChan/eos_win | 12 | 22847 | <reponame>JaminChan/eos_win
dnl MIPS32 umul_ppmm -- longlong.h support.
dnl Copyright 1999, 2002 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 2.1 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library; see the file COPYING.LIB. If not, write
dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, USA.
include(`../config.m4')
C INPUT PARAMETERS
C plp $4
C u $5
C v $6
ASM_START()
PROLOGUE(mpn_umul_ppmm)
multu $5,$6
mflo $3
mfhi $2
j $31
sw $3,0($4)
EPILOGUE(mpn_umul_ppmm)
|
courses/spark_for_ada_programmers/labs/answers/120_depends_contract_and_information_flow_analysis/array_swapping.adb | AdaCore/training_material | 15 | 14263 | <filename>courses/spark_for_ada_programmers/labs/answers/120_depends_contract_and_information_flow_analysis/array_swapping.adb
package body Array_Swapping
is
procedure Swap (A: in out ArrayType; I, J: in IndexType)
with Depends => (A => (A, I, J)),
Pre => I /= J,
Post => A = A'Old'Update (I => A'Old(J),
J => A'Old(I))
is
T: ElementType;
begin
T := A(I);
A(I) := A(J);
A(J) := T;
end Swap;
procedure Rotate3(A: in out ArrayType; X, Y, Z: in IndexType)
is
begin
Swap(A, X, Y);
Swap(A, Y, Z);
end Rotate3;
end Array_Swapping;
|
software/hal/boards/adaracer_v1/hil/hil-devices-timers.ads | TUM-EI-RCS/StratoX | 12 | 28301 | <filename>software/hal/boards/adaracer_v1/hil/hil-devices-timers.ads
-- Institution: Technische Universitaet Muenchen
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
-- Module: Software Configuration
--
-- Authors: <NAME> (<EMAIL>)
with STM32.Timers;
with STm32.Device;
-- @summary
-- Target-specific types for the hardware timers in Adaracer V1.
package HIL.Devices.Timers with SPARK_Mode is
subtype HIL_Timer is STM32.Timers.Timer;
subtype HIL_Timer_Channel is STM32.Timers.Timer_Channel;
-- the buzzer is routed to Timer 2 channel 1 (STM32.Device.PA15)
Timer_Buzzer_Port : STM32.Timers.Timer renames STM32.Device.Timer_2; -- Buuzer port
Timerchannel_Buzzer_Port : STM32.Timers.Timer_Channel renames STM32.Timers.Channel_1;
-- alternatively, we can use FMU AUX5 at the Servo pins (Timer 4 channel 2):
Timer_Buzzer_Aux : STM32.Timers.Timer renames STM32.Device.Timer_4;
Timerchannel_Buzzer_Aux : STM32.Timers.Timer_Channel renames STM32.Timers.Channel_2;
end HIL.Devices.Timers;
|
lib/vg5k_crt0.asm | meesokim/z88dk | 0 | 7618 | <reponame>meesokim/z88dk<filename>lib/vg5k_crt0.asm
; CRT0 for the VG5000
;
; <NAME>. 2014
; <NAME>. 2014
;
; $Id: vg5k_crt0.asm,v 1.4 2015/01/21 07:05:01 stefano Exp $
;
MODULE vg5k_crt0
;--------
; Include zcc_opt.def to find out some info
;--------
INCLUDE "zcc_opt.def"
;--------
; Some scope definitions
;--------
EXTERN _main ;main() is always external to crt0 code
PUBLIC cleanup ;jp'd to by exit()
PUBLIC l_dcal ;jp(hl)
PUBLIC _std_seed ;Integer rand() seed
PUBLIC _vfprintf ;jp to the printf() core
PUBLIC exitsp ;atexit() variables
PUBLIC exitcount
PUBLIC heaplast ;Near malloc heap variables
PUBLIC heapblocks
PUBLIC __sgoioblk ;stdio info block
PUBLIC base_graphics ;Graphical variables
PUBLIC coords ;Current xy position
PUBLIC snd_tick ;Sound variable
PUBLIC bit_irqstatus ; current irq status when DI is necessary
; Now, getting to the real stuff now!
IF !myzorg
defc myzorg = 20480
ENDIF
org myzorg
org myzorg
start:
xor a
ld (18434), a ;default character will be normal and black
ex de,hl ; preserve HL
ld (start1+1),sp ;Save entry stack
ld hl,-64
add hl,sp
ld sp,hl
ld (exitsp),sp
push de ; save HL
;push ix
; Optional definition for auto MALLOC init
; it assumes we have free space between the end of
; the compiled program and the stack pointer
IF DEFINED_USING_amalloc
INCLUDE "amalloc.def"
ENDIF
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
; Set up the std* stuff so we can be called again
ld hl,__sgoioblk+2
ld (hl),19 ;stdin
ld hl,__sgoioblk+6
ld (hl),21 ;stdout
ld hl,__sgoioblk+10
ld (hl),21 ;stderr
ENDIF
ENDIF
di
call _main
ei
cleanup:
;
; Deallocate memory which has been allocated here!
;
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
EXTERN closeall
call closeall
ENDIF
ENDIF
;pop ix ; We preserved HL and IX
pop hl ; ..let's restore them !
ld ix,$47FA
start1:
ld sp,0
ret
l_dcal: jp (hl) ;Used for function pointer calls
;-----------
; Define the stdin/out/err area. For the z88 we have two models - the
; classic (kludgey) one and "ANSI" model
;-----------
__sgoioblk:
IF DEFINED_ANSIstdio
INCLUDE "stdio_fp.asm"
ELSE
defw -11,-12,-10
ENDIF
;---------------------------------
; Select which printf core we want
;---------------------------------
_vfprintf:
IF DEFINED_floatstdio
EXTERN vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
EXTERN vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
EXTERN vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
;-----------
; Now some variables
;-----------
coords: defw 0 ; Current graphics xy coordinates
base_graphics: defw $4000 ; Address of the Graphics map
_std_seed: defw 0 ; Seed for integer rand() routines
exitsp: defw 0 ; Address of where the atexit() stack is
exitcount: defb 0 ; How many routines on the atexit() stack
heaplast: defw 0 ; Address of last block on heap
heapblocks: defw 0 ; Number of blocks
IF DEFINED_USING_amalloc
EXTERN ASMTAIL
PUBLIC _heap
; The heap pointer will be wiped at startup,
; but first its value (based on ASMTAIL)
; will be kept for sbrk() to setup the malloc area
_heap:
defw ASMTAIL ; Location of the last program byte
defw 0
ENDIF
IF DEFINED_NEED1bitsound
snd_tick: defb 0 ; Sound variable
bit_irqstatus: defw 0
ENDIF
; defm "Small C+ VG5000"
; defb 0
;-----------------------
; Floating point support
;-----------------------
IF NEED_floatpack
INCLUDE "float.asm"
fp_seed: defb $80,$80,0,0,0,0 ;FP seed (unused ATM)
extra: defs 6 ;FP register
fa: defs 6 ;FP Accumulator
fasign: defb 0 ;FP register
ENDIF
|
inst/scripts/save-as.applescript | gaborcsardi/keynote | 27 | 1204 | <filename>inst/scripts/save-as.applescript
on run argv
tell application "Keynote"
save document id (item 1 of argv) in posix file (item 2 of argv as text )
end tell
end run
|
ec413_Computer_Org/lab3_ASM/lab3.asm | pequode/class-projects | 0 | 161558 | <filename>ec413_Computer_Org/lab3_ASM/lab3.asm
############################################################################
# Lab 3
# EC413
#
# Assembly Language Lab -- Programming with Loops.
#
############################################################################
# DATA
############################################################################
.data # Data segment
OutCount: .word 42
Hello: .asciiz " \n Hello World! \n " # declare a zero terminated string
Hello_len: .word 16
testout: .asciiz "d"
AnInt: .word 12 # a word initialized to 12
space: .asciiz " " # declare a zero terminate string
WordAvg: .word 0 #use this variable for part 4
ValidInt: .word 0 #
ValidInt2: .word 0 #
lf: .byte 10, 0 # string with carriage return and line feed
InLenW: .word 4 # initialize to number of words in input1 and input2
InLenB: .word 16 # initialize to number of bytes in input1 and input2
.align 4
Input1: .word 0x01020304, 0x05060708
.word 0x090A0B0C, 0x0D0E0F10
.align 4
Input2: .word 0x01221117, 0x090b1d1f # input
.word 0x0e1c2a08, 0x06040210
.align 4
Copy: .space 0x80 # space to copy input word by word
.align 4
Enter: .asciiz "\n\n"
Comma: .asciiz ","
############################################################################
# CODE
############################################################################
.text # code segment
#
# print out greeting
#
main:
la $a0,Hello # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
#Code for Item 2
#Count number of occurences of letter "l" in Hello string
la $t0,Hello # loads hell0
li $t1,0 #set ofset amount
li $t6,0 #counter of l
lw $t5,Hello_len #just in case loop turns infinate
lb $t3,5($t0)# used to get the l char
CheckDone:
lb $t2,0($t0)# current char
# if statement
bne $t3,$t2,EndOfIf
addi $t6,$t6,1 # add 1 to counter
EndOfIf:
add $t0,$t0,1 # increase offset
add $t1,$t1,1 # increase offset
blt $t1,$t5,CheckDone
sw $t6,OutCount
move $a0,$t6 # address of string to print
li $v0,1 # system call code for print_str
syscall
################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall
################################################################################
#
# Code for Item 3 --
# Print the integer value of numbers from 0 and less than AnInt
#
li $v0,1 # system call code for print_str
li $t0,0 #value to print
lw $t1,AnInt #value to go to
CountToTwv:
move $a0,$t0 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall
add $t0,$t0,1
blt $t0,$t1,CountToTwv
###################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
###################################################################################
#
# Code for Item 4 --
# Print the integer values of each byte in the array Input1 (with spaces)
#
la $t0,Input1# starting addy of array
li $t1,0 # set up the loop could probably use t0 but idk if it changes
lw $t2,InLenB # set stopping point at inlenw
NEXTELL:
lb $t4,0($t0) # get val to display
move $a0,$t4 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,space # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
add $t0,$t0,1
add $t1,$t1,1
blt $t1,$t2,NEXTELL
###################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
###################################################################################
#
# Code for Item 5 --
# Write code to copy the contents of Input2 to Copy
#
la $t0,Input1# starting addy of array
la $t3,Input2# starting addy of array
li $t1,0 # set up the loop could probably use t0 but idk if it changes
lw $t2,InLenW
NEXTInd:
lw $t4,0($t0) # copy the value of input1[i] into a reg
sw $t4,0($t3)# save that reg into input2[i]
move $a0,$t4 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,Comma # address of string to print
li $v0,4 # system call code for print_str
syscall
move $a0,$t4 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,space # address of string to print
li $v0,4 # system call code for print_str
syscall
# print the string
add $t0,$t0,4 # index the array of input 1
add $t3,$t3,4 # do same for input 2
add $t1,$t1,1 # index loop counter 1
blt $t1,$t2,NEXTInd
#################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
###################################################################################
#
# Code for Item 6 --
# Print the minimum, maximum, and integer average of the contents of array Input1
#
la $t0,Input1 # start of input
lw $t1, 0($t0) # min
lw $t5, 0($t0) # max initial
li $t3,0 # loop counter
li $t6,0 # running quotent sum
li $t7,0 # temp quotent
MinMaxLoop:
lw $t4,0($t0) # current word
blt $t4,$t1,DoneMin
move $t1,$t4 # assign min as new number
DoneMin:
bgt $t4,$t5,DoneMax
move $t1,$t4 # assign max as new number
DoneMax:
div $t4,$t2 # take the division of current num by InLenW
mflo $t7 # take quotent put it in t7
add $t6,$t6,$t7 # add this quotent to the running average/ not as accurate as a sum and then div but keeps sum small
add $t0,$t0,4 # increare element
add $t3,$t3,1 # increase counter
blt $t3,$t2,MinMaxLoop
# min
move $a0,$t1 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,Comma # address of string to print
li $v0,4 # system call code for print_str
syscall
# max
move $a0,$t5 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,Comma # address of string to print
li $v0,4 # system call code for print_str
syscall
# average
move $a0,$t6 # address of string to print
li $v0,1 # system call code for print_str
syscall
#################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
##################################################################################
#
# Code for Item 7 --
# Display the first 30 integers that are divisible by either 7 and 13 (with comma)
#
li $t0,0 # number to print
li $t1,7 # multiple of seven
li $t2,13 # multiple of 13
li $t3,0 # counter
li $t4,30 # max number of indexs
PrintFirst30:
move $a0,$t0 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,Comma # address of string to print
li $v0,4 # system call code for print_str
syscall
blt $t1,$t2,SevenWasLess
j ThirteenwasLess
SevenWasLess:
move $t0,$t1 #assign print num to the smaller of the two numbers
add $t1,$t1,7 #add 1 of itself and then go to end of loop
j Doneifs
ThirteenwasLess:
move $t0,$t2 #assign print num to the smaller of the two numbers
add $t2,$t2,13 #add 1 of itself and then go to end of loop
j Doneifs
Doneifs:
add $t3,$t3,1 # increment counter
blt $t3,$t4, PrintFirst30
#################################################################################
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall # print the string
##################################################################################
#
# Code for Item 8 --
# Repeat step 7 but display the integers in 6 lines with 5 integers with spaces per line
# This must be implemented using a nested loop.
#
li $t0,0 # number to print
li $t1,7 # multiple of seven
li $t2,13 # multiple of 13
li $t3,0 # row counter
li $t4,6 # max number of rows
li $t5,0 # collom counter
li $t6,5 # max number of collom
PrintRows:
printCols:
move $a0,$t0 # address of string to print
li $v0,1 # system call code for print_str
syscall
la $a0,space # address of string to print
li $v0,4 # system call code for print_str
syscall
blt $t1,$t2,SevenWasLez
j ThirteenwasLez
SevenWasLez:
move $t0,$t1 #assign print num to the smaller of the two numbers
add $t1,$t1,7 #add 1 of itself and then go to end of loop
j Doneif
ThirteenwasLez:
move $t0,$t2 #assign print num to the smaller of the two numbers
add $t2,$t2,13 #add 1 of itself and then go to end of loop
j Doneif
Doneif:
add $t5,$t5,1 # increment counter
blt $t5,$t6, printCols
li $t5,0
la $a0,Enter # address of string to print
li $v0,4 # system call code for print_str
syscall
add $t3,$t3,1 # increment counter
blt $t3,$t4, PrintRows
Exit:
jr $ra |
programs/oeis/032/A032613.asm | neoneye/loda | 22 | 168955 | <filename>programs/oeis/032/A032613.asm
; A032613: Concatenation of n and n + 8 or {n,n+8}.
; 19,210,311,412,513,614,715,816,917,1018,1119,1220,1321,1422,1523,1624,1725,1826,1927,2028,2129,2230,2331,2432,2533,2634,2735,2836,2937,3038,3139,3240,3341,3442,3543,3644,3745,3846,3947,4048,4149
pow $1,$0
gcd $1,2
mul $1,90
sub $1,71
mov $2,$0
mul $2,101
add $1,$2
mov $0,$1
|
BTTfolder/tryexample.scpt | pection-zz/Allproject | 2 | 4338 | try
--@yuuiko: Get User Preference
tell application "BetterTouchTool"
try
set UsrPref_CS_Highlighting to get_string_variable "customVariable3"
end try
if UsrPref_CS_Highlighting is "ON" then
set_string_variable "customVariable3" to "OFF"
else
set_string_variable "customVariable3" to "ON"
end if
return UsrPref_CS_Highlighting
end tell
end try |
Transynther/x86/_processed/NONE/_st_/i9-9900K_12_0xca.log_580_748.asm | ljhsiun2/medusa | 9 | 1677 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x7127, %r9
nop
and %rbp, %rbp
movb (%r9), %r14b
cmp $46628, %r15
lea addresses_WT_ht+0x13b49, %rsi
inc %r12
movw $0x6162, (%rsi)
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_UC_ht+0x19899, %rsi
lea addresses_WC_ht+0x13389, %rdi
nop
nop
nop
nop
and $49653, %rbp
mov $111, %rcx
rep movsl
nop
nop
nop
and $37290, %r15
lea addresses_normal_ht+0x14b49, %rsi
lea addresses_UC_ht+0x168a9, %rdi
and %r15, %r15
mov $71, %rcx
rep movsb
nop
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0x5ec9, %r8
nop
nop
sub $56565, %rcx
movb (%r8), %r12b
nop
nop
nop
nop
add %rbp, %rbp
lea addresses_WC_ht+0x1dfc9, %rsi
lea addresses_WT_ht+0x1c749, %rdi
nop
cmp %r12, %r12
mov $123, %rcx
rep movsl
nop
nop
nop
nop
xor $13160, %rbp
lea addresses_A_ht+0xf799, %r14
clflush (%r14)
nop
nop
xor %rbp, %rbp
mov (%r14), %r12
nop
nop
dec %rcx
lea addresses_WT_ht+0x5ecb, %r15
clflush (%r15)
nop
mfence
mov (%r15), %r9d
nop
nop
nop
nop
add $61885, %rdi
lea addresses_A_ht+0x11449, %rsi
lea addresses_WC_ht+0xc695, %rdi
nop
nop
nop
inc %r8
mov $75, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp %r15, %r15
lea addresses_WC_ht+0x16f99, %r9
nop
add $2286, %rdi
mov (%r9), %rbp
nop
nop
cmp %r12, %r12
lea addresses_UC_ht+0x1a919, %rbp
nop
nop
nop
nop
nop
sub $5600, %r12
vmovups (%rbp), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rdi
nop
nop
nop
nop
nop
and %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %rbp
push %rbx
push %rdi
push %rdx
// Load
lea addresses_RW+0x8349, %r14
nop
xor $57980, %r11
mov (%r14), %edx
nop
nop
nop
nop
nop
and $223, %r14
// Store
mov $0x4d0cd10000000933, %rbx
nop
nop
nop
nop
sub $64838, %r8
movl $0x51525354, (%rbx)
nop
nop
xor $53393, %rdi
// Store
lea addresses_D+0x25f9, %r8
nop
nop
nop
nop
cmp %rbp, %rbp
movw $0x5152, (%r8)
nop
xor $2940, %r11
// Store
lea addresses_WC+0x1b49, %rdx
sub $27868, %r8
movl $0x51525354, (%rdx)
nop
nop
nop
nop
nop
add %rbp, %rbp
// Store
lea addresses_WC+0x1b389, %r8
nop
nop
and %r11, %r11
mov $0x5152535455565758, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%r8)
nop
nop
nop
nop
inc %rbx
// Store
mov $0x883, %rdx
nop
nop
nop
nop
xor %rbp, %rbp
movb $0x51, (%rdx)
nop
dec %rbp
// Store
lea addresses_normal+0x1849, %r11
nop
nop
cmp %r14, %r14
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
movaps %xmm2, (%r11)
nop
nop
nop
nop
dec %rbx
// Faulty Load
lea addresses_WT+0x7b49, %r11
nop
nop
nop
xor $33751, %r14
mov (%r11), %r8d
lea oracles, %rdi
and $0xff, %r8
shlq $12, %r8
mov (%rdi,%r8,1), %r8
pop %rdx
pop %rdi
pop %rbx
pop %rbp
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal', 'same': False, 'AVXalign': True, 'congruent': 8}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 11}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 7}, 'dst': {'same': True, 'type': 'addresses_WT_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 8}, 'dst': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'54': 580}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
programs/oeis/017/A017393.asm | neoneye/loda | 22 | 89281 | ; A017393: a(n) = (11*n)^5.
; 0,161051,5153632,39135393,164916224,503284375,1252332576,2706784157,5277319168,9509900499,16105100000,25937424601,40074642432,59797108943,86617093024,122298103125,168874213376,228669389707,304316815968,398778220049,515363200000,657748550151,829997587232,1036579476493,1282388557824,1572763671875,1913507486176,2310905821257,2771746976768,3303341057599,3913539300000,4610753397701,5403974828032,6302794178043,7317420470624,8458700490625,9738138110976,11167913618807,12760903041568,14530697473149,16491622400000,18658757027251,21047953604832,23675856753593,26559922791424,29718439059375,33170543247776,36936242722357,41036433850368,45492921326699,50328437500000,55566661698801,61232239557632,67350802343143,73948986280224,81054451878125,88695903256576,96903107471907,105706913843168,115139273278249,125233257600000,136023078872351,147544108726432,159832897686693,172927194497024,186865965446875,201689413697376,217438998607457,234157455059968,251888812787799,270678415700000,290572941207901,311620419551232,333870253124243,357373235801824,382181572265625,408348897330176,435930295269007,464982319140768,495563010115349,527731916800000,561550114565451,597080224872032,634386434595793,673534515354624,714591842834375,757627416114976,802711876996557,849917529325568,899318358320899,950990049900000,1005010010005001,1061457383928832,1120413075641343,1181959767115424,1246181937653125,1313165883211776,1382999735730107,1455773482454368,1531578985264449
pow $0,5
mul $0,161051
|
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_iy/cm48_sdcciy_fmin.asm | meesokim/z88dk | 0 | 95362 |
; float fmin(float x, float y)
SECTION code_fp_math48
PUBLIC cm48_sdcciy_fmin
EXTERN cm48_sdcciyp_dread2, l0_cm48_sdcciy_fmin_callee
cm48_sdcciy_fmin:
call cm48_sdcciyp_dread2
; AC'= y
; AC = x
jp l0_cm48_sdcciy_fmin_callee
|
oeis/052/A052716.asm | neoneye/loda-programs | 11 | 97995 | <filename>oeis/052/A052716.asm<gh_stars>10-100
; A052716: E.g.f. (x+1-sqrt(1-6*x+x^2))/2.
; Submitted by <NAME>
; 0,2,4,36,528,10800,283680,9102240,345058560,15090727680,747888422400,41422381862400,2535569103513600,169983582318950400,12386182292118835200,974723523832041984000,82385641026424479744000
mov $2,$0
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
mov $3,$0
max $3,0
seq $3,32037 ; Doubles (index 2+) under "AIJ" (ordered, indistinct, labeled) transform.
lpe
min $2,1
mul $2,$3
mov $0,$2
mul $0,2
|
programs/oeis/048/A048038.asm | karttu/loda | 1 | 14199 | <reponame>karttu/loda
; A048038: Number of nonempty subsets of {1,2,...,n} in which exactly 1/2 of the elements are <= (n+1)/3.
; 0,1,2,3,9,14,20,55,83,119,329,494,714,2001,3002,4367,12375,18563,27131,77519,116279,170543,490313,735470,1081574,3124549,4686824,6906899,20030009,30045014,44352164,129024479,193536719,286097759
mov $1,$0
mov $2,$0
add $2,2
mov $0,$2
div $0,3
add $1,1
bin $1,$0
sub $1,1
|
Abhijeet_Chopra_Assign_2.asm | abhijeetchopra/assembly | 0 | 512 | TITLE Assignment Two (Assign2.asm)
; Name: <NAME>
; CWID: 50180612
; Date: 4 Nov,16
; Due : 11:59pm, Tuesday, 15 Nov
; Program Description:
; define arrayW of 20 words (integers)
; using loop find MIN
; at end of loop store MIN in AX
INCLUDE Irvine32.inc
INCLUDE Macros.inc
.DATA
; declaring and initializing array of type WORD (2 bytes / item)
arrayW WORD 3, 2, 5, 7, 2, 9, 11, 32, 19, 18, 17, 15, 5, 2, 3, 1, 21, 27, 29, 20
LEN WORD 0 ; stores array length
IND WORD 1 ; stores array index
MIN WORD 0 ; stores the largest number
.CODE
main PROC
mWriteLn "---------------------"
mWriteLn "Name: <NAME>"
mWriteLn "CWID: 50180612"
mWriteLn "Desc: Assignment #2"
mWriteLn "Date: 4 Nov,16"
mWriteLn "---------------------"
mWriteLn " "
mov EAX, 0 ; EAX = 0 (clearing EAX)
mov LEN,LENGTHOF arrayW ; LEN = length of arrayW
mov ESI,OFFSET arrayW ; ESI = address of first item of arrayW
mov AX,[ESI] ; AX = first item of arrayW
mov MIN,AX ; MIN = AX
mov AX,0 ; AX = 0 (clearing AX)
mWriteLn "Displaying Array: "
mWriteLn " "
mWrite " "
; print arrayW, find MIN
;------------------------
L1: ; loop L1 prints arrayW and finds MIN
cmp IND,LENGTHOF arrayW ; compare if IND > no. of items in arrayW
jg L3 ; exit loop if IND > length of arrayW
mov AX,[ESI] ; dereference ESI
call WriteInt ; print value of AX
mWrite "," ; print a comma to separate items
cmp AX,MIN ; compare if AX < MIN
jl L2 ; jump to L2 to update MIN
inc ESI ; increment ESI twice because...
inc ESI ; WORD array so = 2 bytes / item
inc IND ; increment the loop counter
jmp L1 ; loop the loop
; update MIN
;------------------------
L2: ; loop to update new MIN
mov MIN,AX ; MIN = AX
jmp L1 ; return to loop L1
; exit
;------------------------
L3: ; exit from loop L1
mWriteLn " " ; next line
mWriteLn " " ; next line
mWriteLn "Displaying AX register: "
mWriteLn " "
mWrite " MIN = "
mov EAX,0 ; EAX = 0
mov AX,MIN ; AX = MIN
call WriteInt ; print AX
mWriteLn " "
mWriteLn " "
mWriteLn "Displaying all registers: (Note: all values below in hexadecimal)"
call DumpRegs
exit
main ENDP
END main |
libsrc/target/smc777/graphics/w_xorpixl_MODE4.asm | Frodevan/z88dk | 640 | 2184 | <filename>libsrc/target/smc777/graphics/w_xorpixl_MODE4.asm
;
; XorPlot pixel at (x,y) coordinate.
SECTION code_clib
PUBLIC w_xorpixel_MODE4
defc NEEDxor = 1
.w_xorpixel_MODE4
INCLUDE "pixel_MODE4.inc"
|
oeis/319/A319842.asm | neoneye/loda-programs | 11 | 246003 | ; A319842: a(n) = 8 * A104720(n) + ceiling(n/2).
; Submitted by <NAME>
; 8,89,897,8978,89786,897867,8978675,89786756,897867564,8978675645,89786756453,897867564534,8978675645342,89786756453423,897867564534231,8978675645342312,89786756453423120,897867564534231201,8978675645342312009,89786756453423120090,897867564534231200898,8978675645342312008979,89786756453423120089787,897867564534231200897868,8978675645342312008978676,89786756453423120089786757,897867564534231200897867565,8978675645342312008978675646,89786756453423120089786756454,897867564534231200897867564535
add $0,1
mov $2,1
lpb $0
mov $3,$0
mul $0,4
sub $0,1
div $0,4
mod $3,2
mul $3,3
sub $3,1
mul $3,$2
add $1,$3
mul $2,10
add $2,1
lpe
sub $2,$1
mov $0,$2
sub $0,1
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_gstmessage_h.ads | persan/A-gst | 1 | 20471 | <reponame>persan/A-gst
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with glib;
with glib.Values;
with System;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h;
-- limited -- with GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h;
with glib;
-- with GStreamer.GST_Low_Level.glib_2_0_glib_gquark_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_gerror_h;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h;
with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h is
GST_MESSAGE_TRACE_NAME : aliased constant String := "GstMessage" & ASCII.NUL; -- gst/gstmessage.h:142
-- unsupported macro: GST_TYPE_MESSAGE (gst_message_get_type())
-- arg-macro: function GST_IS_MESSAGE (obj)
-- return G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MESSAGE);
-- arg-macro: function GST_IS_MESSAGE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MESSAGE);
-- arg-macro: function GST_MESSAGE_GET_CLASS (obj)
-- return G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MESSAGE, GstMessageClass);
-- arg-macro: function GST_MESSAGE (obj)
-- return G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MESSAGE, GstMessage);
-- arg-macro: function GST_MESSAGE_CLASS (klass)
-- return G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MESSAGE, GstMessageClass);
-- arg-macro: function GST_MESSAGE_CAST (obj)
-- return (GstMessage*)(obj);
-- arg-macro: function GST_MESSAGE_GET_LOCK (message)
-- return GST_MESSAGE_CAST(message).lock;
-- arg-macro: procedure GST_MESSAGE_LOCK (message)
-- g_mutex_lock(GST_MESSAGE_GET_LOCK(message))
-- arg-macro: procedure GST_MESSAGE_UNLOCK (message)
-- g_mutex_unlock(GST_MESSAGE_GET_LOCK(message))
-- arg-macro: function GST_MESSAGE_COND (message)
-- return GST_MESSAGE_CAST(message).cond;
-- arg-macro: procedure GST_MESSAGE_WAIT (message)
-- g_cond_wait(GST_MESSAGE_COND(message),GST_MESSAGE_GET_LOCK(message))
-- arg-macro: procedure GST_MESSAGE_SIGNAL (message)
-- g_cond_signal(GST_MESSAGE_COND(message))
-- arg-macro: function GST_MESSAGE_TYPE (message)
-- return GST_MESSAGE_CAST(message).type;
-- arg-macro: procedure GST_MESSAGE_TYPE_NAME (message)
-- gst_message_type_get_name(GST_MESSAGE_TYPE(message))
-- arg-macro: function GST_MESSAGE_TIMESTAMP (message)
-- return GST_MESSAGE_CAST(message).timestamp;
-- arg-macro: function GST_MESSAGE_SRC (message)
-- return GST_MESSAGE_CAST(message).src;
-- arg-macro: function GST_MESSAGE_SRC_NAME (message)
-- return GST_MESSAGE_SRC(message) ? GST_OBJECT_NAME (GST_MESSAGE_SRC(message)) : "(NULL)";
-- arg-macro: procedure gst_message_make_writable (msg)
-- GST_MESSAGE_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (msg)))
-- GStreamer
-- * Copyright (C) 2004 <NAME> <<EMAIL>>
-- *
-- * gstmessage.h: Header for GstMessage subsystem
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library 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
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library 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.
--
type GstMessage;
type anon_208;
type anon_209 is record
seqnum : aliased GLIB.guint32; -- gst/gstmessage.h:295
end record;
pragma Convention (C_Pass_By_Copy, anon_209);
type u_GstMessage_u_gst_reserved_array is array (0 .. 3) of System.Address;
type anon_208 (discr : unsigned := 0) is record
case discr is
when 0 =>
ABI : aliased anon_209; -- gst/gstmessage.h:296
when others =>
u_gst_reserved : u_GstMessage_u_gst_reserved_array; -- gst/gstmessage.h:298
end case;
end record;
pragma Convention (C_Pass_By_Copy, anon_208);
pragma Unchecked_Union (anon_208);--subtype GstMessage is u_GstMessage; -- gst/gstmessage.h:27
type GstMessageClass;
type u_GstMessageClass_u_gst_reserved_array is array (0 .. 3) of System.Address;
--subtype GstMessageClass is u_GstMessageClass; -- gst/gstmessage.h:28
--*
-- * GstMessageType:
-- * @GST_MESSAGE_UNKNOWN: an undefined message
-- * @GST_MESSAGE_EOS: end-of-stream reached in a pipeline. The application will
-- * only receive this message in the PLAYING state and every time it sets a
-- * pipeline to PLAYING that is in the EOS state. The application can perform a
-- * flushing seek in the pipeline, which will undo the EOS state again.
-- * @GST_MESSAGE_ERROR: an error occured. When the application receives an error
-- * message it should stop playback of the pipeline and not assume that more
-- * data will be played.
-- * @GST_MESSAGE_WARNING: a warning occured.
-- * @GST_MESSAGE_INFO: an info message occured
-- * @GST_MESSAGE_TAG: a tag was found.
-- * @GST_MESSAGE_BUFFERING: the pipeline is buffering. When the application
-- * receives a buffering message in the PLAYING state for a non-live pipeline it
-- * must PAUSE the pipeline until the buffering completes, when the percentage
-- * field in the message is 100%. For live pipelines, no action must be
-- * performed and the buffering percentage can be used to inform the user about
-- * the progress.
-- * @GST_MESSAGE_STATE_CHANGED: a state change happened
-- * @GST_MESSAGE_STATE_DIRTY: an element changed state in a streaming thread.
-- * This message is deprecated.
-- * @GST_MESSAGE_STEP_DONE: a stepping operation finished.
-- * @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
-- * a clock. This message is used internally and
-- * never forwarded to the application.
-- * @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
-- * unusable. The pipeline will select a new clock on
-- * the next PLAYING state change. The application
-- * should set the pipeline to PAUSED and back to
-- * PLAYING when this message is received.
-- * @GST_MESSAGE_NEW_CLOCK: a new clock was selected in the pipeline.
-- * @GST_MESSAGE_STRUCTURE_CHANGE: the structure of the pipeline changed. This
-- * message is used internally and never forwarded to the application.
-- * @GST_MESSAGE_STREAM_STATUS: status about a stream, emitted when it starts,
-- * stops, errors, etc..
-- * @GST_MESSAGE_APPLICATION: message posted by the application, possibly
-- * via an application-specific element.
-- * @GST_MESSAGE_ELEMENT: element-specific message, see the specific element's
-- * documentation
-- * @GST_MESSAGE_SEGMENT_START: pipeline started playback of a segment. This
-- * message is used internally and never forwarded to the application.
-- * @GST_MESSAGE_SEGMENT_DONE: pipeline completed playback of a segment. This
-- * message is forwarded to the application after all elements that posted
-- * @GST_MESSAGE_SEGMENT_START posted a GST_MESSAGE_SEGMENT_DONE message.
-- * @GST_MESSAGE_DURATION: The duration of a pipeline changed. The application
-- * can get the new duration with a duration query.
-- * @GST_MESSAGE_ASYNC_START: Posted by elements when they start an ASYNC
-- * #GstStateChange. This message is not forwarded to the application but is used
-- * internally. Since: 0.10.13.
-- * @GST_MESSAGE_ASYNC_DONE: Posted by elements when they complete an ASYNC
-- * #GstStateChange. The application will only receive this message from the toplevel
-- * pipeline. Since: 0.10.13
-- * @GST_MESSAGE_LATENCY: Posted by elements when their latency changes. The
-- * application should recalculate and distribute a new latency. Since: 0.10.12
-- * @GST_MESSAGE_REQUEST_STATE: Posted by elements when they want the pipeline to
-- * change state. This message is a suggestion to the application which can
-- * decide to perform the state change on (part of) the pipeline. Since: 0.10.23.
-- * @GST_MESSAGE_STEP_START: A stepping operation was started. Since: 0.10.24
-- * @GST_MESSAGE_QOS: A buffer was dropped or an element changed its processing
-- * strategy for Quality of Service reasons. Since: 0.10.29
-- * @GST_MESSAGE_PROGRESS: A progress message. Since: 0.10.33
-- * @GST_MESSAGE_ANY: mask for all of the above messages.
-- *
-- * The different message types that are available.
--
-- NOTE: keep in sync with quark registration in gstmessage.c
-- * NOTE: keep GST_MESSAGE_ANY a valid gint to avoid compiler warnings.
--
subtype GstMessageType is int;
GST_MESSAGE_UNKNOWN : constant GstMessageType := 0;
GST_MESSAGE_EOS : constant GstMessageType := 1;
GST_MESSAGE_ERROR : constant GstMessageType := 2;
GST_MESSAGE_WARNING : constant GstMessageType := 4;
GST_MESSAGE_INFO : constant GstMessageType := 8;
GST_MESSAGE_TAG : constant GstMessageType := 16;
GST_MESSAGE_BUFFERING : constant GstMessageType := 32;
GST_MESSAGE_STATE_CHANGED : constant GstMessageType := 64;
GST_MESSAGE_STATE_DIRTY : constant GstMessageType := 128;
GST_MESSAGE_STEP_DONE : constant GstMessageType := 256;
GST_MESSAGE_CLOCK_PROVIDE : constant GstMessageType := 512;
GST_MESSAGE_CLOCK_LOST : constant GstMessageType := 1024;
GST_MESSAGE_NEW_CLOCK : constant GstMessageType := 2048;
GST_MESSAGE_STRUCTURE_CHANGE : constant GstMessageType := 4096;
GST_MESSAGE_STREAM_STATUS : constant GstMessageType := 8192;
GST_MESSAGE_APPLICATION : constant GstMessageType := 16384;
GST_MESSAGE_ELEMENT : constant GstMessageType := 32768;
GST_MESSAGE_SEGMENT_START : constant GstMessageType := 65536;
GST_MESSAGE_SEGMENT_DONE : constant GstMessageType := 131072;
GST_MESSAGE_DURATION : constant GstMessageType := 262144;
GST_MESSAGE_LATENCY : constant GstMessageType := 524288;
GST_MESSAGE_ASYNC_START : constant GstMessageType := 1048576;
GST_MESSAGE_ASYNC_DONE : constant GstMessageType := 2097152;
GST_MESSAGE_REQUEST_STATE : constant GstMessageType := 4194304;
GST_MESSAGE_STEP_START : constant GstMessageType := 8388608;
GST_MESSAGE_QOS : constant GstMessageType := 16777216;
GST_MESSAGE_PROGRESS : constant GstMessageType := 33554432;
GST_MESSAGE_ANY : constant GstMessageType := -1; -- gst/gstmessage.h:129
--*
-- * GST_MESSAGE_TRACE_NAME:
-- *
-- * The name used for memory allocation tracing
--
-- the lock is used to handle the synchronous handling of messages,
-- * the emiting thread is block until the handling thread processed
-- * the message using this mutex/cond pair
--*
-- * GST_MESSAGE_TYPE:
-- * @message: a #GstMessage
-- *
-- * Get the #GstMessageType of @message.
--
--*
-- * GST_MESSAGE_TYPE_NAME:
-- * @message: a #GstMessage
-- *
-- * Get a constant string representation of the #GstMessageType of @message.
-- *
-- * Since: 0.10.4
--
--*
-- * GST_MESSAGE_TIMESTAMP:
-- * @message: a #GstMessage
-- *
-- * Get the timestamp of @message. This is the timestamp when the message
-- * was created.
--
--*
-- * GST_MESSAGE_SRC:
-- * @message: a #GstMessage
-- *
-- * Get the object that posted @message.
--
--*
-- * GST_MESSAGE_SRC_NAME:
-- * @message: a #GstMessage
-- *
-- * Get the name of the object that posted @message. Returns "(NULL)" if
-- * the message has no source object set.
-- *
-- * Since: 0.10.24
--
--*
-- * GstStructureChangeType:
-- * @GST_STRUCTURE_CHANGE_TYPE_PAD_LINK: Pad linking is starting or done.
-- * @GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK: Pad unlinking is starting or done.
-- *
-- * The type of a %GST_MESSAGE_STRUCTURE_CHANGE.
-- *
-- * Since: 0.10.22
--
type GstStructureChangeType is
(GST_STRUCTURE_CHANGE_TYPE_PAD_LINK,
GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK);
pragma Convention (C, GstStructureChangeType); -- gst/gstmessage.h:217
--*
-- * GstStreamStatusType:
-- * @GST_STREAM_STATUS_TYPE_CREATE: A new thread need to be created.
-- * @GST_STREAM_STATUS_TYPE_ENTER: a thread entered its loop function
-- * @GST_STREAM_STATUS_TYPE_LEAVE: a thread left its loop function
-- * @GST_STREAM_STATUS_TYPE_DESTROY: a thread is destroyed
-- * @GST_STREAM_STATUS_TYPE_START: a thread is started
-- * @GST_STREAM_STATUS_TYPE_PAUSE: a thread is paused
-- * @GST_STREAM_STATUS_TYPE_STOP: a thread is stopped
-- *
-- * The type of a %GST_MESSAGE_STREAM_STATUS. The stream status messages inform the
-- * application of new streaming threads and their status.
-- *
-- * Since: 0.10.24
--
subtype GstStreamStatusType is unsigned;
GST_STREAM_STATUS_TYPE_CREATE : constant GstStreamStatusType := 0;
GST_STREAM_STATUS_TYPE_ENTER : constant GstStreamStatusType := 1;
GST_STREAM_STATUS_TYPE_LEAVE : constant GstStreamStatusType := 2;
GST_STREAM_STATUS_TYPE_DESTROY : constant GstStreamStatusType := 3;
GST_STREAM_STATUS_TYPE_START : constant GstStreamStatusType := 8;
GST_STREAM_STATUS_TYPE_PAUSE : constant GstStreamStatusType := 9;
GST_STREAM_STATUS_TYPE_STOP : constant GstStreamStatusType := 10; -- gst/gstmessage.h:243
--*
-- * GstProgressType:
-- * @GST_PROGRESS_TYPE_START: A new task started.
-- * @GST_PROGRESS_TYPE_CONTINUE: A task completed and a new one continues.
-- * @GST_PROGRESS_TYPE_COMPLETE: A task completed.
-- * @GST_PROGRESS_TYPE_CANCELED: A task was canceled.
-- * @GST_PROGRESS_TYPE_ERROR: A task caused an error. An error message is also
-- * posted on the bus.
-- *
-- * The type of a %GST_MESSAGE_PROGRESS. The progress messages inform the
-- * application of the status of assynchronous tasks.
-- *
-- * Since: 0.10.33
--
type GstProgressType is
(GST_PROGRESS_TYPE_START,
GST_PROGRESS_TYPE_CONTINUE,
GST_PROGRESS_TYPE_COMPLETE,
GST_PROGRESS_TYPE_CANCELED,
GST_PROGRESS_TYPE_ERROR);
pragma Convention (C, GstProgressType); -- gst/gstmessage.h:265
--*
-- * GstMessage:
-- * @mini_object: the parent structure
-- * @type: the #GstMessageType of the message
-- * @timestamp: the timestamp of the message
-- * @src: the src of the message
-- * @structure: the #GstStructure containing the message info.
-- *
-- * A #GstMessage.
--
type GstMessage is record
mini_object : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObject; -- gst/gstmessage.h:279
lock : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GMutex; -- gst/gstmessage.h:282
cond : access GStreamer.GST_Low_Level.glib_2_0_glib_gthread_h.GCond; -- gst/gstmessage.h:283
c_type : aliased GstMessageType; -- gst/gstmessage.h:286
timestamp : aliased GLIB.guint64; -- gst/gstmessage.h:287
src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; -- gst/gstmessage.h:288
structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure; -- gst/gstmessage.h:290
abidata : aliased anon_208; -- gst/gstmessage.h:299
end record;
pragma Convention (C_Pass_By_Copy, GstMessage); -- gst/gstmessage.h:277
--< private >
-- with MESSAGE_LOCK
-- lock and cond for async delivery
--< public >
-- with COW
--< private >
-- + 0 to mark ABI change for future greppage
type GstMessageClass is record
mini_object_class : aliased GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstminiobject_h.GstMiniObjectClass; -- gst/gstmessage.h:303
u_gst_reserved : u_GstMessageClass_u_gst_reserved_array; -- gst/gstmessage.h:306
end record;
pragma Convention (C_Pass_By_Copy, GstMessageClass); -- gst/gstmessage.h:302
--< private >
function gst_message_get_type return GLIB.GType; -- gst/gstmessage.h:309
pragma Import (C, gst_message_get_type, "gst_message_get_type");
function gst_message_type_get_name (c_type : GstMessageType) return access GLIB.gchar; -- gst/gstmessage.h:311
pragma Import (C, gst_message_type_get_name, "gst_message_type_get_name");
function gst_message_type_to_quark (c_type : GstMessageType) return Glib.GQuark; -- gst/gstmessage.h:312
pragma Import (C, gst_message_type_to_quark, "gst_message_type_to_quark");
-- refcounting
--*
-- * gst_message_ref:
-- * @msg: the message to ref
-- *
-- * Convenience macro to increase the reference count of the message.
-- *
-- * Returns: @msg (for convenience when doing assignments)
--
function gst_message_ref (msg : access GstMessage) return access GstMessage; -- gst/gstmessage.h:328
pragma Import (C, gst_message_ref, "gst_message_ref");
--*
-- * gst_message_unref:
-- * @msg: the message to unref
-- *
-- * Convenience macro to decrease the reference count of the message, possibly
-- * freeing it.
--
procedure gst_message_unref (msg : access GstMessage); -- gst/gstmessage.h:345
pragma Import (C, gst_message_unref, "gst_message_unref");
-- copy message
--*
-- * gst_message_copy:
-- * @msg: the message to copy
-- *
-- * Creates a copy of the message. Returns a copy of the message.
-- *
-- * Returns: (transfer full): a new copy of @msg.
-- *
-- * MT safe
--
function gst_message_copy (msg : access constant GstMessage) return access GstMessage; -- gst/gstmessage.h:366
pragma Import (C, gst_message_copy, "gst_message_copy");
--*
-- * gst_message_make_writable:
-- * @msg: (transfer full): the message to make writable
-- *
-- * Checks if a message is writable. If not, a writable copy is made and
-- * returned.
-- *
-- * Returns: (transfer full): a message (possibly a duplicate) that is writable.
-- *
-- * MT safe
--
-- identifiers for events and messages
function gst_message_get_seqnum (message : access GstMessage) return GLIB.guint32; -- gst/gstmessage.h:385
pragma Import (C, gst_message_get_seqnum, "gst_message_get_seqnum");
procedure gst_message_set_seqnum (message : access GstMessage; seqnum : GLIB.guint32); -- gst/gstmessage.h:386
pragma Import (C, gst_message_set_seqnum, "gst_message_set_seqnum");
-- EOS
function gst_message_new_eos (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GstMessage; -- gst/gstmessage.h:389
pragma Import (C, gst_message_new_eos, "gst_message_new_eos");
-- ERROR
function gst_message_new_error
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
error : access Glib.Error.GError;
debug : access GLIB.gchar) return access GstMessage; -- gst/gstmessage.h:393
pragma Import (C, gst_message_new_error, "gst_message_new_error");
procedure gst_message_parse_error
(message : access GstMessage;
the_gerror : System.Address;
debug : System.Address); -- gst/gstmessage.h:394
pragma Import (C, gst_message_parse_error, "gst_message_parse_error");
-- WARNING
function gst_message_new_warning
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
error : access Glib.Error.GError;
debug : access GLIB.gchar) return access GstMessage; -- gst/gstmessage.h:397
pragma Import (C, gst_message_new_warning, "gst_message_new_warning");
procedure gst_message_parse_warning
(message : access GstMessage;
the_gerror : System.Address;
debug : System.Address); -- gst/gstmessage.h:398
pragma Import (C, gst_message_parse_warning, "gst_message_parse_warning");
-- INFO
function gst_message_new_info
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
error : access Glib.Error.GError;
debug : access GLIB.gchar) return access GstMessage; -- gst/gstmessage.h:401
pragma Import (C, gst_message_new_info, "gst_message_new_info");
procedure gst_message_parse_info
(message : access GstMessage;
the_gerror : System.Address;
debug : System.Address); -- gst/gstmessage.h:402
pragma Import (C, gst_message_parse_info, "gst_message_parse_info");
-- TAG
function gst_message_new_tag (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; tag_list : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList) return access GstMessage; -- gst/gstmessage.h:405
pragma Import (C, gst_message_new_tag, "gst_message_new_tag");
function gst_message_new_tag_full
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
pad : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstpad_h.GstPad;
tag_list : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList) return access GstMessage; -- gst/gstmessage.h:406
pragma Import (C, gst_message_new_tag_full, "gst_message_new_tag_full");
procedure gst_message_parse_tag (message : access GstMessage; tag_list : System.Address); -- gst/gstmessage.h:407
pragma Import (C, gst_message_parse_tag, "gst_message_parse_tag");
procedure gst_message_parse_tag_full
(message : access GstMessage;
pad : System.Address;
tag_list : System.Address); -- gst/gstmessage.h:408
pragma Import (C, gst_message_parse_tag_full, "gst_message_parse_tag_full");
-- BUFFERING
function gst_message_new_buffering (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; percent : GLIB.gint) return access GstMessage; -- gst/gstmessage.h:411
pragma Import (C, gst_message_new_buffering, "gst_message_new_buffering");
procedure gst_message_parse_buffering (message : access GstMessage; percent : access GLIB.gint); -- gst/gstmessage.h:412
pragma Import (C, gst_message_parse_buffering, "gst_message_parse_buffering");
procedure gst_message_set_buffering_stats
(message : access GstMessage;
mode : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstBufferingMode;
avg_in : GLIB.gint;
avg_out : GLIB.gint;
buffering_left : GLIB.gint64); -- gst/gstmessage.h:413
pragma Import (C, gst_message_set_buffering_stats, "gst_message_set_buffering_stats");
procedure gst_message_parse_buffering_stats
(message : access GstMessage;
mode : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstquery_h.GstBufferingMode;
avg_in : access GLIB.gint;
avg_out : access GLIB.gint;
buffering_left : access GLIB.gint64); -- gst/gstmessage.h:416
pragma Import (C, gst_message_parse_buffering_stats, "gst_message_parse_buffering_stats");
-- STATE_CHANGED
function gst_message_new_state_changed
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
oldstate : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState;
newstate : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState;
pending : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState) return access GstMessage; -- gst/gstmessage.h:421
pragma Import (C, gst_message_new_state_changed, "gst_message_new_state_changed");
procedure gst_message_parse_state_changed
(message : access GstMessage;
oldstate : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState;
newstate : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState;
pending : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState); -- gst/gstmessage.h:423
pragma Import (C, gst_message_parse_state_changed, "gst_message_parse_state_changed");
-- STATE_DIRTY
function gst_message_new_state_dirty (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GstMessage; -- gst/gstmessage.h:427
pragma Import (C, gst_message_new_state_dirty, "gst_message_new_state_dirty");
-- STEP_DONE
function gst_message_new_step_done
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
amount : GLIB.guint64;
rate : GLIB.gdouble;
flush : GLIB.gboolean;
intermediate : GLIB.gboolean;
duration : GLIB.guint64;
eos : GLIB.gboolean) return access GstMessage; -- gst/gstmessage.h:430
pragma Import (C, gst_message_new_step_done, "gst_message_new_step_done");
procedure gst_message_parse_step_done
(message : access GstMessage;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
amount : access GLIB.guint64;
rate : access GLIB.gdouble;
flush : access GLIB.gboolean;
intermediate : access GLIB.gboolean;
duration : access GLIB.guint64;
eos : access GLIB.gboolean); -- gst/gstmessage.h:433
pragma Import (C, gst_message_parse_step_done, "gst_message_parse_step_done");
-- CLOCK_PROVIDE
function gst_message_new_clock_provide
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
clock : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock;
ready : GLIB.gboolean) return access GstMessage; -- gst/gstmessage.h:437
pragma Import (C, gst_message_new_clock_provide, "gst_message_new_clock_provide");
procedure gst_message_parse_clock_provide
(message : access GstMessage;
clock : System.Address;
ready : access GLIB.gboolean); -- gst/gstmessage.h:438
pragma Import (C, gst_message_parse_clock_provide, "gst_message_parse_clock_provide");
-- CLOCK_LOST
function gst_message_new_clock_lost (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; clock : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock) return access GstMessage; -- gst/gstmessage.h:442
pragma Import (C, gst_message_new_clock_lost, "gst_message_new_clock_lost");
procedure gst_message_parse_clock_lost (message : access GstMessage; clock : System.Address); -- gst/gstmessage.h:443
pragma Import (C, gst_message_parse_clock_lost, "gst_message_parse_clock_lost");
-- NEW_CLOCK
function gst_message_new_new_clock (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; clock : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstclock_h.GstClock) return access GstMessage; -- gst/gstmessage.h:446
pragma Import (C, gst_message_new_new_clock, "gst_message_new_new_clock");
procedure gst_message_parse_new_clock (message : access GstMessage; clock : System.Address); -- gst/gstmessage.h:447
pragma Import (C, gst_message_parse_new_clock, "gst_message_parse_new_clock");
-- APPLICATION
function gst_message_new_application (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure) return access GstMessage; -- gst/gstmessage.h:450
pragma Import (C, gst_message_new_application, "gst_message_new_application");
-- ELEMENT
function gst_message_new_element (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure) return access GstMessage; -- gst/gstmessage.h:453
pragma Import (C, gst_message_new_element, "gst_message_new_element");
-- SEGMENT_START
function gst_message_new_segment_start
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
position : GLIB.gint64) return access GstMessage; -- gst/gstmessage.h:456
pragma Import (C, gst_message_new_segment_start, "gst_message_new_segment_start");
procedure gst_message_parse_segment_start
(message : access GstMessage;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
position : access GLIB.gint64); -- gst/gstmessage.h:457
pragma Import (C, gst_message_parse_segment_start, "gst_message_parse_segment_start");
-- SEGMENT_DONE
function gst_message_new_segment_done
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
position : GLIB.gint64) return access GstMessage; -- gst/gstmessage.h:461
pragma Import (C, gst_message_new_segment_done, "gst_message_new_segment_done");
procedure gst_message_parse_segment_done
(message : access GstMessage;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
position : access GLIB.gint64); -- gst/gstmessage.h:462
pragma Import (C, gst_message_parse_segment_done, "gst_message_parse_segment_done");
-- DURATION
function gst_message_new_duration
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
duration : GLIB.gint64) return access GstMessage; -- gst/gstmessage.h:466
pragma Import (C, gst_message_new_duration, "gst_message_new_duration");
procedure gst_message_parse_duration
(message : access GstMessage;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
duration : access GLIB.gint64); -- gst/gstmessage.h:467
pragma Import (C, gst_message_parse_duration, "gst_message_parse_duration");
-- LATENCY
function gst_message_new_latency (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GstMessage; -- gst/gstmessage.h:471
pragma Import (C, gst_message_new_latency, "gst_message_new_latency");
-- ASYNC_START
function gst_message_new_async_start (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; new_base_time : GLIB.gboolean) return access GstMessage; -- gst/gstmessage.h:474
pragma Import (C, gst_message_new_async_start, "gst_message_new_async_start");
procedure gst_message_parse_async_start (message : access GstMessage; new_base_time : access GLIB.gboolean); -- gst/gstmessage.h:475
pragma Import (C, gst_message_parse_async_start, "gst_message_parse_async_start");
-- ASYNC_DONE
function gst_message_new_async_done (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject) return access GstMessage; -- gst/gstmessage.h:478
pragma Import (C, gst_message_new_async_done, "gst_message_new_async_done");
-- STRUCTURE CHANGE
function gst_message_new_structure_change
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
c_type : GstStructureChangeType;
owner : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement;
busy : GLIB.gboolean) return access GstMessage; -- gst/gstmessage.h:481
pragma Import (C, gst_message_new_structure_change, "gst_message_new_structure_change");
procedure gst_message_parse_structure_change
(message : access GstMessage;
c_type : access GstStructureChangeType;
owner : System.Address;
busy : access GLIB.gboolean); -- gst/gstmessage.h:483
pragma Import (C, gst_message_parse_structure_change, "gst_message_parse_structure_change");
-- STREAM STATUS
function gst_message_new_stream_status
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
c_type : GstStreamStatusType;
owner : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstElement) return access GstMessage; -- gst/gstmessage.h:487
pragma Import (C, gst_message_new_stream_status, "gst_message_new_stream_status");
procedure gst_message_parse_stream_status
(message : access GstMessage;
c_type : access GstStreamStatusType;
owner : System.Address); -- gst/gstmessage.h:489
pragma Import (C, gst_message_parse_stream_status, "gst_message_parse_stream_status");
procedure gst_message_set_stream_status_object (message : access GstMessage; object : access constant Glib.Values.GValue); -- gst/gstmessage.h:491
pragma Import (C, gst_message_set_stream_status_object, "gst_message_set_stream_status_object");
function gst_message_get_stream_status_object (message : access GstMessage) return access constant Glib.Values.GValue; -- gst/gstmessage.h:492
pragma Import (C, gst_message_get_stream_status_object, "gst_message_get_stream_status_object");
-- REQUEST_STATE
function gst_message_new_request_state (src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject; state : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState) return access GstMessage; -- gst/gstmessage.h:495
pragma Import (C, gst_message_new_request_state, "gst_message_new_request_state");
procedure gst_message_parse_request_state (message : access GstMessage; state : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstelement_h.GstState); -- gst/gstmessage.h:496
pragma Import (C, gst_message_parse_request_state, "gst_message_parse_request_state");
-- STEP_START
function gst_message_new_step_start
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
active : GLIB.gboolean;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
amount : GLIB.guint64;
rate : GLIB.gdouble;
flush : GLIB.gboolean;
intermediate : GLIB.gboolean) return access GstMessage; -- gst/gstmessage.h:499
pragma Import (C, gst_message_new_step_start, "gst_message_new_step_start");
procedure gst_message_parse_step_start
(message : access GstMessage;
active : access GLIB.gboolean;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
amount : access GLIB.guint64;
rate : access GLIB.gdouble;
flush : access GLIB.gboolean;
intermediate : access GLIB.gboolean); -- gst/gstmessage.h:502
pragma Import (C, gst_message_parse_step_start, "gst_message_parse_step_start");
-- QOS
function gst_message_new_qos
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
live : GLIB.gboolean;
running_time : GLIB.guint64;
stream_time : GLIB.guint64;
timestamp : GLIB.guint64;
duration : GLIB.guint64) return access GstMessage; -- gst/gstmessage.h:507
pragma Import (C, gst_message_new_qos, "gst_message_new_qos");
procedure gst_message_set_qos_values
(message : access GstMessage;
jitter : GLIB.gint64;
proportion : GLIB.gdouble;
quality : GLIB.gint); -- gst/gstmessage.h:509
pragma Import (C, gst_message_set_qos_values, "gst_message_set_qos_values");
procedure gst_message_set_qos_stats
(message : access GstMessage;
format : GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
processed : GLIB.guint64;
dropped : GLIB.guint64); -- gst/gstmessage.h:511
pragma Import (C, gst_message_set_qos_stats, "gst_message_set_qos_stats");
procedure gst_message_parse_qos
(message : access GstMessage;
live : access GLIB.gboolean;
running_time : access GLIB.guint64;
stream_time : access GLIB.guint64;
timestamp : access GLIB.guint64;
duration : access GLIB.guint64); -- gst/gstmessage.h:513
pragma Import (C, gst_message_parse_qos, "gst_message_parse_qos");
procedure gst_message_parse_qos_values
(message : access GstMessage;
jitter : access GLIB.gint64;
proportion : access GLIB.gdouble;
quality : access GLIB.gint); -- gst/gstmessage.h:515
pragma Import (C, gst_message_parse_qos_values, "gst_message_parse_qos_values");
procedure gst_message_parse_qos_stats
(message : access GstMessage;
format : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstformat_h.GstFormat;
processed : access GLIB.guint64;
dropped : access GLIB.guint64); -- gst/gstmessage.h:517
pragma Import (C, gst_message_parse_qos_stats, "gst_message_parse_qos_stats");
-- PROGRESS
function gst_message_new_progress
(src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
c_type : GstProgressType;
code : access GLIB.gchar;
text : access GLIB.gchar) return access GstMessage; -- gst/gstmessage.h:520
pragma Import (C, gst_message_new_progress, "gst_message_new_progress");
procedure gst_message_parse_progress
(message : access GstMessage;
c_type : access GstProgressType;
code : System.Address;
text : System.Address); -- gst/gstmessage.h:522
pragma Import (C, gst_message_parse_progress, "gst_message_parse_progress");
-- custom messages
function gst_message_new_custom
(c_type : GstMessageType;
src : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstobject_h.GstObject;
structure : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure) return access GstMessage; -- gst/gstmessage.h:527
pragma Import (C, gst_message_new_custom, "gst_message_new_custom");
function gst_message_get_structure (message : access GstMessage) return access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gststructure_h.GstStructure; -- gst/gstmessage.h:530
pragma Import (C, gst_message_get_structure, "gst_message_get_structure");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstmessage_h;
|
src/input.asm | AmFobes/MineAssemble | 479 | 11065 | ;
; This file contains all functions related to input handling
;
[bits 32]
%include "constants.asm"
global handle_input, handle_collision
extern handle_key, raytrace
extern colTolerance, zero
section .text
; void handle_input()
; Handle input of all key events
handle_input:
push dword KEY_UP
call handle_key
mov dword [esp], KEY_DOWN
call handle_key
mov dword [esp], KEY_LEFT
call handle_key
mov dword [esp], KEY_RIGHT
call handle_key
mov dword [esp], KEY_SPACE
call handle_key
mov dword [esp], KEY_Q
call handle_key
mov dword [esp], KEY_E
call handle_key
mov dword [esp], KEY_ESC
call handle_key
add esp, 4
ret
; void handle_collision(vec3 pos, vec3* velocity)
; Adjust velocity to prevent any collisions
handle_collision:
push ebp
mov ebp, esp
; Allocate space for hit info struct
sub esp, 32
; Trace ray with velocity as direction to check for collision
mov eax, ebp
sub eax, 32
push eax ; Pointer to hit info struct
mov eax, [ebp + 20] ; velocity pointer
push dword [eax + 8] ; Copy of velocity vec3 (in reverse because stack grows downwards)
push dword [eax + 4]
push dword [eax + 0]
push dword [ebp + 16] ; Copy of pos vec3
push dword [ebp + 12]
push dword [ebp + 8]
call raytrace
add esp, 28
; Check for hit
cmp byte [ebp - 32], 1
jne .finish
; Check if distance is < 0.1
fld dword [colTolerance]
fld dword [ebp - 4]
fcomip
fstp dword [ebp + 8] ; Discard colTolerance still on stack by writing over now unused pos
jae .finish
; Correct velocity to create sliding motion over surface
mov ecx, [zero] ; floating point zero
mov eax, [ebp + 20] ; velocity pointer
cmp dword [ebp - 16], 0 ; nx != 0 -> negate x velocity
je .nx_finish
mov dword [eax + 0], ecx
.nx_finish:
cmp dword [ebp - 12], 0 ; ny != 0 -> negate y velocity
je .ny_finish
mov dword [eax + 4], ecx
.ny_finish:
cmp dword [ebp - 8], 0 ; nz != 0 -> negate z velocity
je .finish
mov dword [eax + 8], ecx
.finish:
mov esp, ebp
pop ebp
ret |
Cscore.asm | ItaiCuker/Assembly8086CrossyRoad | 0 | 179930 | <reponame>ItaiCuker/Assembly8086CrossyRoad
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc printNumber
; enter – ax = number to print. di = position of number to print.
; exit – printing the numbers digit by digit (biggest to smallest)
doPush ax,bx,dx,si,di
mov bx, offset divisorArr ;divisor array of 5 digit number: 10000,1000,100,10,1
mov si, offset digitArr ;offset array for pictures of numbers
nextDigit:
xor dx,dx
div [word ptr bx] ;ax = div, dx = mod
mov si, offset digitArr
add si, ax ;adding ax twice because digitArr is a word array
add si, ax
call printDigit ;printing digit.
mov ax,dx ;dx = remainder
add bx,2 ;bx = address of divisor array
add di,15 ;di = position in screen
cmp [byte ptr bx],0 ;Have all divisors been done?
jne nextDigit
doPop di,si,dx,bx,ax
ret
endp printNumber
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc printDigit
; enter - si = array index of digit offset, di = position.
; exit - printing the digit in position
dopush dx,di,si
;setting variables for oring and anding
mov [widthh], 15
mov [height], 20
mov [pos],di
push si ;saving si because it is used in the oring procedure.
;deleting last digit.
mov si, offset digitMask ;mask to si.
call anding ;masking digit.
pop si ;returning si
mov si, [si] ;moving the offset of digit to si.
call oring ;printing digtit.
dopop si,di,dx
ret
endp printDigit
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc printScore
;enter - when new score is set.
;exit - printing new score.
dopush ax,bx,dx
mov di, 45 ;position to print in.
mov ax,[score] ;number to print (score).
call printNumber ;calling procedure to print number.
dopop dx,bx,ax
ret
endp printScore
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
proc printTop
;enter - when player dies. top score in variable topScore.
;exit - printing top score.
dopush ax,bx,dx
mov di, 154 ;position to print in.
mov ax,[topScore] ;number to print (top score).
call printNumber ;calling procedure to print number.
dopop dx,bx,ax
ret
endp printTop
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
;'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
libsrc/_DEVELOPMENT/inttypes/z80/asm__imaxdiv_.asm | teknoplop/z88dk | 0 | 2616 | <reponame>teknoplop/z88dk
; void _imaxdiv_(imaxdiv_t *md, intmax_t numer, intmax_t denom)
SECTION code_clib
SECTION code_inttypes
PUBLIC asm__imaxdiv_
EXTERN asm__ldiv
defc asm__imaxdiv_ = asm__ldiv
|
fileHandeling/writeToFile.asm | A2nkF/assembler-foo | 3 | 86405 | global start
section .text
start:
openFile:
mov eax, 5 ; Open system call = 5
push dword 0 ; Mode = 0
push dword 2 ; Read/Write flag
push dword path ; Path
sub esp, 4 ; Reserved space for system call
int 0x80
add esp, 16
mov ebx, eax
writeToFile:
mov eax, 4
push dword msg.len
push dword msg
push dword ebx
sub esp, 4
int 0x80
add esp, 16
Exit:
mov eax, 1
push 0
sub esp, 12
int 0x80
section .data
path: db "/Users/acebot/Stuff/hacktheplanet/binary-hacking/assembly/test/test.txt",0x0
msg: db "hacktheplanet",0x0
.len: equ $ - msg
|
theorems/cw/Sphere.agda | cmknapp/HoTT-Agda | 0 | 1242 | <gh_stars>0
{-# OPTIONS --without-K --termination-depth=2 #-}
open import HoTT
open import cw.CW
module cw.Sphere where
CWSphere-skel : ∀ n → Skeleton {lzero} n
CWSphere : ℕ → Type₀
CWSphere n = ⟦ CWSphere-skel n ⟧
Sphere-to-CWSphere : (n : ℕ) → Sphere n → CWSphere n
CWSphere-skel O = Bool
CWSphere-skel (S n) =
(CWSphere-skel n , Bool , cst (Sphere-to-CWSphere n))
{-
mapping:
hub true <-> north
hub false <-> south
incl _ -> north
spoke true x -> idp
spoke fales x -> merid x
! spoke true x ∙ spoke false x <- merid x
-}
private
module PosToCW n = SuspensionRec
{C = CWSphere (S n)}
(hub true) (hub false)
(λ x → (! (spoke true x)) ∙' spoke false x)
Sphere-to-CWSphere O = idf _
Sphere-to-CWSphere (S n) = PosToCW.f n
{-
Now proving the equivalence
-}
private
CWSphere-to-Sphere-incl : ∀ n → CWSphere n → Sphere (S n)
CWSphere-to-Sphere-incl _ _ = north
CWSphere-to-Sphere-hub : ∀ n → Bool → Sphere (S n)
CWSphere-to-Sphere-hub _ true = north
CWSphere-to-Sphere-hub _ false = south
CWSphere-to-Sphere-spoke : ∀ n (b : Bool) (x : Sphere n)
→ CWSphere-to-Sphere-incl n (Sphere-to-CWSphere n x)
== CWSphere-to-Sphere-hub n b
CWSphere-to-Sphere-spoke _ true _ = idp
CWSphere-to-Sphere-spoke _ false x = merid x
module PosFromCW n = AttachedRec
{attaching = cst (Sphere-to-CWSphere n)}
(CWSphere-to-Sphere-incl n)
(CWSphere-to-Sphere-hub n)
(CWSphere-to-Sphere-spoke n)
CWSphere-to-Sphere : ∀ n → CWSphere n → Sphere n
CWSphere-to-Sphere O = idf _
CWSphere-to-Sphere (S n) = PosFromCW.f n
private
from-to : ∀ n x → CWSphere-to-Sphere n (Sphere-to-CWSphere n x) == x
from-to O _ = idp
from-to (S n) = SuspensionElim.f idp idp path
where
to = Sphere-to-CWSphere (S n)
from = CWSphere-to-Sphere (S n)
module To = PosToCW n
module From = PosFromCW n
path : ∀ x → idp == idp [ (λ x → from (to x) == x) ↓ merid x ]
path x = ↓-app=idf-in $ ! $
ap (from ∘ to) (merid x) ∙ idp
=⟨ ∙-unit-r $ ap (from ∘ to) (merid x) ⟩
ap (from ∘ to) (merid x)
=⟨ ap-∘ from to (merid x) ⟩
ap from (ap to (merid x))
=⟨ To.merid-β x |in-ctx ap from ⟩
ap from (! (spoke true x) ∙' spoke false x)
=⟨ ap-∙' from (! (spoke true x)) (spoke false x) ⟩
ap from (! (spoke true x)) ∙' ap from (spoke false x)
=⟨ ap-! from (spoke true x) |in-ctx (λ p → p ∙' ap from (spoke false x)) ⟩
! (ap from (spoke true x)) ∙' ap from (spoke false x)
=⟨ From.spoke-β true x |in-ctx (λ p → ! p ∙' ap from (spoke false x)) ⟩
idp ∙' ap from (spoke false x)
=⟨ From.spoke-β false x |in-ctx (idp ∙'_) ⟩
idp ∙' merid x
∎
Sphere-to-CWSphere-is-equiv : ∀ n → is-equiv (Sphere-to-CWSphere n)
private
to-from : ∀ n x → Sphere-to-CWSphere n (CWSphere-to-Sphere n x) == x
Sphere-to-CWSphere-is-equiv n = is-eq _ (CWSphere-to-Sphere n) (to-from n) (from-to n)
to-from O _ = idp
to-from (S n) = AttachedElim.f to-from-incl to-from-hub to-from-spoke
where
to = Sphere-to-CWSphere (S n)
from = CWSphere-to-Sphere (S n)
module To = PosToCW n
module From = PosFromCW n
to-from-incl : ∀ (c : CWSphere n)
→ to (from (incl c)) == incl c
to-from-incl c =
! (spoke true (CWSphere-to-Sphere n c))
∙ ap incl (is-equiv.f-g (Sphere-to-CWSphere-is-equiv n) c)
to-from-hub : ∀ b → to (from (hub b)) == hub b
to-from-hub true = idp
to-from-hub false = idp
to-from-incl-to : ∀ (x : Sphere n)
→ to-from-incl (Sphere-to-CWSphere n x) == ! (spoke true x)
to-from-incl-to x =
! (spoke true (CWSphere-to-Sphere n (Sphere-to-CWSphere n x)))
∙ ap incl (is-equiv.f-g (Sphere-to-CWSphere-is-equiv n) (Sphere-to-CWSphere n x))
=⟨ ! $ is-equiv.adj (Sphere-to-CWSphere-is-equiv n) x
|in-ctx (λ p → ! (spoke true (CWSphere-to-Sphere n (Sphere-to-CWSphere n x))) ∙ ap incl p) ⟩
! (spoke true (CWSphere-to-Sphere n (Sphere-to-CWSphere n x)))
∙ ap incl (ap (Sphere-to-CWSphere n) (is-equiv.g-f (Sphere-to-CWSphere-is-equiv n) x))
=⟨ ! $ ap-∘ incl (Sphere-to-CWSphere n) (is-equiv.g-f (Sphere-to-CWSphere-is-equiv n) x)
|in-ctx (λ p → ! (spoke true (CWSphere-to-Sphere n (Sphere-to-CWSphere n x))) ∙ p) ⟩
! (spoke true (CWSphere-to-Sphere n (Sphere-to-CWSphere n x)))
∙ ap (incl ∘ Sphere-to-CWSphere n) (is-equiv.g-f (Sphere-to-CWSphere-is-equiv n) x)
=⟨ htpy-natural-cst=app (λ x → ! (spoke true x)) (is-equiv.g-f (Sphere-to-CWSphere-is-equiv n) x) ⟩
! (spoke true x)
∎
to-from-spoke : ∀ (b : Bool) (x : Sphere n)
→ to-from-incl (Sphere-to-CWSphere n x) == to-from-hub b
[ (λ x → to (from x) == x) ↓ spoke b x ]
to-from-spoke true x = ↓-app=idf-in $
to-from-incl (Sphere-to-CWSphere n x) ∙' spoke true x
=⟨ to-from-incl-to x |in-ctx (λ p → p ∙' spoke true x) ⟩
! (spoke true x) ∙' spoke true x
=⟨ !-inv'-l (spoke true x) ⟩
idp
=⟨ ! $ From.spoke-β true x |in-ctx (λ p → ap to p ∙ idp) ⟩
ap to (ap from (spoke true x)) ∙ idp
=⟨ ∘-ap to from (spoke true x) |in-ctx (λ p → p ∙ idp) ⟩
ap (to ∘ from) (spoke true x) ∙ idp
∎
to-from-spoke false x = ↓-app=idf-in $
to-from-incl (Sphere-to-CWSphere n x) ∙' spoke false x
=⟨ to-from-incl-to x |in-ctx (λ p → p ∙' spoke false x) ⟩
! (spoke true x) ∙' spoke false x
=⟨ ! $ To.merid-β x ⟩
ap to (merid x)
=⟨ ! $ From.spoke-β false x |in-ctx (ap to) ⟩
ap to (ap from (spoke false x))
=⟨ ∘-ap to from (spoke false x) ⟩
ap (to ∘ from) (spoke false x)
=⟨ ! $ ∙-unit-r _ ⟩
ap (to ∘ from) (spoke false x) ∙ idp
∎
Sphere-equiv-CWSphere : ∀ n → Sphere n ≃ CWSphere n
Sphere-equiv-CWSphere n = _ , Sphere-to-CWSphere-is-equiv n
CWSphere-has-dec-cells : ∀ n → has-dec-cells (CWSphere-skel n)
CWSphere-has-dec-cells 0 = Bool-has-dec-eq
CWSphere-has-dec-cells (S n) = CWSphere-has-dec-cells n , Bool-has-dec-eq
CWSphere-is-aligned : ∀ n → is-aligned (CWSphere-skel n)
CWSphere-is-aligned 0 = lift tt
CWSphere-is-aligned 1 = lift tt
CWSphere-is-aligned 2 = lift tt , (λ _ → true , spoke true true)
CWSphere-is-aligned (S (S (S n))) =
CWSphere-is-aligned (S (S n)) , (λ _ → hub true , spoke true north)
|
src/save.asm | awilkester/sm_practice_hack | 1 | 82294 | <reponame>awilkester/sm_practice_hack
; SD2SNES Savestate code
; by acmlm, total, Myria
;
org $80D000
; These can be modified to do game-specific things before and after saving and loading
; Both A and X/Y are 16-bit here
; SM specific features to restore the correct music when loading a state below
pre_load_state:
lda !MUSIC_BANK
sta !SRAM_MUSIC_BANK
lda !MUSIC_TRACK
sta !SRAM_MUSIC_TRACK
; Rerandomize
lda !sram_save_has_set_rng : bne +
lda !sram_rerandomize : and #$00ff : beq +
lda $05e5 : sta $770080
lda $05b6 : sta $770082
+
rts
post_load_state:
JSL stop_all_sounds
lda !SRAM_MUSIC_BANK
cmp !MUSIC_BANK
bne music_load_bank
lda !SRAM_MUSIC_TRACK
cmp !MUSIC_TRACK
bne music_load_track
jmp music_done
music_load_bank:
lda #$FF00
clc
adc !MUSIC_BANK
JSL !MUSIC_ROUTINE
music_load_track:
lda !MUSIC_TRACK
jsl !MUSIC_ROUTINE
music_done:
; Rerandomize
lda !sram_save_has_set_rng : bne +
lda !sram_rerandomize : and #$00ff : beq +
lda $770080
sta $05e5
lda $770082
sta $05b6
+
rts
; end of post_load_state
; These restored registers are game-specific and needs to be updated for different games
register_restore_return:
%a8()
lda $84
sta $4200
lda #$0F
sta $13
sta $2100
rtl
save_state:
pea $0000
plb
plb
; Store DMA registers to SRAM
%a8();
ldy #$0000
tyx
save_dma_regs:
lda $4300, x
sta !SRAM_DMA_BANK, x
inx
iny
cpy #$000B
bne save_dma_regs
cpx #$007B
beq save_dma_regs_done
inx #5
ldy #$0000
bra save_dma_regs
save_dma_regs_done:
%ai16()
ldx #save_write_table
run_vm:
pea !SS_BANK
plb
plb
jmp vm
save_write_table:
; Turn PPU off
dw $1000|$2100, $80
dw $1000|$4200, $00
; Single address, B bus -> A bus. B address = reflector to WRAM ($2180).
dw $0000|$4310, $8080 ; direction = B->A, byte reg, B addr = $2180
; Copy WRAM 7E0000-7E7FFF to SRAM 710000-717FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0071 ; A addr = $71xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $0000 ; WRAM addr = $xx0000
dw $1000|$2183, $00 ; WRAM addr = $7Exxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy WRAM 7E8000-7EFFFF to SRAM 720000-727FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0072 ; A addr = $72xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $8000 ; WRAM addr = $xx8000
dw $1000|$2183, $00 ; WRAM addr = $7Exxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy WRAM 7F0000-7F7FFF to SRAM 730000-737FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0073 ; A addr = $73xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $0000 ; WRAM addr = $xx0000
dw $1000|$2183, $01 ; WRAM addr = $7Fxxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy WRAM 7F8000-7FFFFF to SRAM 740000-747FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0074 ; A addr = $74xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $8000 ; WRAM addr = $xx8000
dw $1000|$2183, $01 ; WRAM addr = $7Fxxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Address pair, B bus -> A bus. B address = VRAM read ($2139).
dw $0000|$4310, $3981 ; direction = B->A, word reg, B addr = $2139
dw $1000|$2115, $0000 ; VRAM address increment mode.
; Copy VRAM 0000-7FFF to SRAM 750000-757FFF.
dw $0000|$2116, $0000 ; VRAM address >> 1.
dw $9000|$2139, $0000 ; VRAM dummy read.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0075 ; A addr = $75xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($0000), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy VRAM 8000-7FFF to SRAM 760000-767FFF.
dw $0000|$2116, $4000 ; VRAM address >> 1.
dw $9000|$2139, $0000 ; VRAM dummy read.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0076 ; A addr = $76xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($0000), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy CGRAM 000-1FF to SRAM 772000-7721FF.
dw $1000|$2121, $00 ; CGRAM address
dw $0000|$4310, $3B80 ; direction = B->A, byte reg, B addr = $213B
dw $0000|$4312, $2000 ; A addr = $xx2000
dw $0000|$4314, $0077 ; A addr = $77xxxx, size = $xx00
dw $0000|$4316, $0002 ; size = $02xx ($0200), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Done
dw $0000, save_return
save_return:
pea $0000
plb
plb
%ai16()
LDA !ram_room_has_set_rng : STA !sram_save_has_set_rng
tsc
sta !SRAM_SAVED_SP
jmp register_restore_return
load_state:
jsr pre_load_state
pea $0000
plb
plb
%a8()
ldx #load_write_table
jmp run_vm
load_write_table:
; Disable HDMA
dw $1000|$420C, $00
; Turn PPU off
dw $1000|$2100, $80
dw $1000|$4200, $00
; Single address, A bus -> B bus. B address = reflector to WRAM ($2180).
dw $0000|$4310, $8000 ; direction = A->B, B addr = $2180
; Copy SRAM 710000-717FFF to WRAM 7E0000-7E7FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0071 ; A addr = $71xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $0000 ; WRAM addr = $xx0000
dw $1000|$2183, $00 ; WRAM addr = $7Exxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy SRAM 720000-727FFF to WRAM 7E8000-7EFFFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0072 ; A addr = $72xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $8000 ; WRAM addr = $xx8000
dw $1000|$2183, $00 ; WRAM addr = $7Exxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy SRAM 730000-737FFF to WRAM 7F0000-7F7FFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0073 ; A addr = $73xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $0000 ; WRAM addr = $xx0000
dw $1000|$2183, $01 ; WRAM addr = $7Fxxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy SRAM 740000-747FFF to WRAM 7F8000-7FFFFF.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0074 ; A addr = $74xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($8000), unused bank reg = $00.
dw $0000|$2181, $8000 ; WRAM addr = $xx8000
dw $1000|$2183, $01 ; WRAM addr = $7Fxxxx (bank is relative to $7E)
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Address pair, A bus -> B bus. B address = VRAM write ($2118).
dw $0000|$4310, $1801 ; direction = A->B, B addr = $2118
dw $1000|$2115, $0000 ; VRAM address increment mode.
; Copy SRAM 750000-757FFF to VRAM 0000-7FFF.
dw $0000|$2116, $0000 ; VRAM address >> 1.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0075 ; A addr = $75xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($0000), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy SRAM 760000-767FFF to VRAM 8000-7FFF.
dw $0000|$2116, $4000 ; VRAM address >> 1.
dw $0000|$4312, $0000 ; A addr = $xx0000
dw $0000|$4314, $0076 ; A addr = $76xxxx, size = $xx00
dw $0000|$4316, $0080 ; size = $80xx ($0000), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Copy SRAM 772000-7721FF to CGRAM 000-1FF.
dw $1000|$2121, $00 ; CGRAM address
dw $0000|$4310, $2200 ; direction = A->B, byte reg, B addr = $2122
dw $0000|$4312, $2000 ; A addr = $xx2000
dw $0000|$4314, $0077 ; A addr = $77xxxx, size = $xx00
dw $0000|$4316, $0002 ; size = $02xx ($0200), unused bank reg = $00.
dw $1000|$420B, $02 ; Trigger DMA on channel 1
; Done
dw $0000, load_return
load_return:
%ai16()
lda !SRAM_SAVED_SP
tcs
pea $0000
plb
plb
; rewrite inputs so that holding load won't keep loading, as well as rewriting saving input to loading input
lda !SS_INPUT_CUR
eor !sram_ctrl_save_state
ora !sram_ctrl_load_state
sta !SS_INPUT_CUR
sta !SS_INPUT_NEW
sta !SS_INPUT_PREV
%a8()
ldx #$0000
txy
load_dma_regs:
lda !SRAM_DMA_BANK, x
sta $4300, x
inx
iny
cpy #$000B
bne load_dma_regs
cpx #$007B
beq load_dma_regs_done
inx #5
ldy #$0000
jmp load_dma_regs
load_dma_regs_done:
; Restore registers and return.
%ai16()
jsr post_load_state
jmp register_restore_return
vm:
; Data format: xx xx yy yy
; xxxx = little-endian address to write to .vm's bank
; yyyy = little-endian value to write
; If xxxx has high bit set, read and discard instead of write.
; If xxxx has bit 12 set ($1000), byte instead of word.
; If yyyy has $DD in the low half, it means that this operation is a byte
; write instead of a word write. If xxxx is $0000, end the VM.
rep #$30
; Read address to write to
lda.w $0000, x
beq vm_done
tay
inx
inx
; Check for byte mode
bit.w #$1000
beq vm_word_mode
and.w #$EFFF
tay
sep #$20
vm_word_mode:
; Read value
lda.w $0000, x
inx
inx
vm_write:
; Check for read mode (high bit of address)
cpy.w #$8000
bcs vm_read
sta $0000, y
bra vm
vm_read:
; "Subtract" $8000 from y by taking advantage of bank wrapping.
lda $8000, y
bra vm
vm_done:
; A, X and Y are 16-bit at exit.
; Return to caller. The word in the table after the terminator is the
; code address to return to.
jmp ($0002,x)
|
libsrc/graphics/kaypro/plot_end_83.asm | Toysoft/z88dk | 0 | 28339 | ;
; Kaypro II pseudo graphics routines
;
; <NAME> 2018
;
;
; $Id: plot_end_83.asm $
;
SECTION code_clib
PUBLIC plot_end_83
PUBLIC plot_decode_83
EXTERN __gfx_coords
.plot_decode_83
ld (__gfx_coords),hl
ld c,a
srl a
;and a
ld b,a ;y/2
ld a,h
ld hl,$3000
ld de,128
jr z,az
.yloop add hl,de
djnz yloop
.az
ld e,a
add hl,de
ld a,(hl)
and a ; ' = top
ld a,1
jr z,ydone
ld a,(hl)
cp ',' ; bottom
ld a,2
jr z,ydone
ld a,(hl)
cp '|' ; top+bottom
ld a,3
jr z,ydone
xor a
.ydone
rr c
ret
.plot_end_83
push hl
ld hl,chars
add l
ld l,a
jr nc,nocy
inc h
.nocy
ld a,(hl)
pop hl
ld (hl),a
pop bc
ret
.chars defb ' ',0,',','|'
|
sem_01/lab_02/part1/rudakov1997_62.1.asm | Justarone/bmstu-os | 5 | 178656 | <reponame>Justarone/bmstu-os<gh_stars>1-10
.386P ; (1) Разрешение команд МП 386 и 486
; Структура для описания дескрипторов сегментов
descr struc ; (2)
limit dw 0 ; (3) Граница (биты 0...15)
base_l dw 0 ; (4) База, биты 0...15
base_m db 0 ; (5) База, биты 16...23
attr_1 db 0 ; (6) Байт атрибутов 1
attr_2 db 0 ; (7) Граница (биты 16...19) и атрибуты 2
base_h db 0 ; (8) База, биты 24...31
descr ends ; (9)
data segment use16 ; (10) Начало сегмента данных
; Таблица глобальных дескрипторов GDT
gdt_null descr<0,0,0,0,0,0> ; (11) Нулевой дескриптор
gdt_data descr<data_size-1,0,0,92h> ; (12) Сел-р 8, сегмент данных
gdt_code descr<code_size-1,,,98h> ; (13) Селектор 16, сегмент команд
gdt_stack descr<255,0,0,92h,0,0> ; (14) Селектор 24, сегмент стека
gdt_screen descr<4095,8000h,0Bh,92h,0,0>; (15) Селектор 32, видеобуфер
gdt_size=$-gdt_null ; (16) Размер GDT
; Поля данных программы
pdescr df 0 ; (17) Псевдодескриптор для lgdt
sym db 1 ; (18) Символ для вывода на экран
attr db 1Eh ; (19) Его атрибут
mes db 27,'[31;42m Вернулись в реальный режим! ',27,'[0m$'; (20)
data_size=$-gdt_null ; (21) Размер сегмента данных
data ends ; (22) Конец сегмента данных
text segment 'code' use16 ; (23) Укажем 16-разрядный режим
assume cs:text,ds:data ; (24)
main proc ; (25)
xor eax, eax ; (26) Очистим EAX
mov ax,data ; (27) Загрузим в DS сегментный
mov ds,ax ; (28) адрес сегмента данных
; Вычислим 32-битовый линейный адрес сегмента данных и загрузим его
; в дескриптор сегмента данных в GDT.
shl eax,4 ; (29) В EAX линейный базовый адрес
mov ebp,eax ; (30) Сохраним его в EBP
mov bx,offset gdt_data; (31) В BX адрес дескриптора
mov [bx].base_l,ax ; (32) Загрузим младшую часть базы
rol eax,16 ; (33) Обмен старшей и младшей половин EAX
mov [bx].base_m,al ; (34) Загрузим среднюю часть базы
; Аналогично для линейного адреса сегмента команд
xor eax,eax ; (35) Очистим EAX
mov ax,cs ; (36) Адрес сегмента команд
shl eax,4 ; (37) Умножим на 16
mov bx,offset gdt_code; (38) Адрес дескриптора
mov [bx].base_l,ax ; (39) Загрузим младшую часть базы
rol eax,16 ; (40) Обмен половин EAX
mov [bx].base_m,al ; (41) загрузим среднюю часть базы
; Аналогично для линейного адреса сегмента стека
xor eax,eax ; (42)
mov ax,ss ; (43)
shl eax,4 ; (44)
mov bx,offset gdt_stack; (45)
mov [bx].base_l,ax ; (46)
rol eax,16 ; (47)
mov [bx].base_m,al ; (48)
; Подготовим псевдодескриптор pdescr и загрузим регистр GDTF
mov dword ptr pdescr+2,ebp ; (49) База GDT, биты 0...31
mov word ptr pdescr,gdt_size-1 ; (50) Граница GDT
lgdt pdescr ; (51) Загрузим регистр GDTR
; Подготовимся к переходу в защищённый режим
cli ; (52) Запрет аппаратных прерываний
mov al,80h ; (53) Запрет NMI
out 70h,al ; (54) Порт КМОП-микросхемы
; Переходим в защищённый режим
mov eax,cr0 ; (55) Получим содержимое CR0
or eax,1 ; (56) Установим бит PE
mov cr0,eax ; (57) Запишем назад в CR0
; Теперь процессор работает в защищённом режиме
; Загружаем в CS:IP селектор:смещение точки continue
; и заодно очищаем очередь команд
db 0EAh ; (58) Код команды far jmp
dw offset continue ; (59) Смещение
dw 16 ; (60) Селектор сегмента команд
continue: ; (61)
; Делаем адресуемыми данные
mov ax,8 ; (62) Селектор сегмента данных
mov ds,ax ; (63)
; Делаем адресуемым стек
mov ax,24 ; (64) Селектор сегмента стека
mov ss,ax ; (65)
; Инициализируем ES и выводим символы
mov ax,32 ; (66) Селектор сегмента видеобуфера
mov es,ax ; (67)
mov bx,800 ; (68) Начальное смещение на экране
mov cx,640 ; (69) Число выводимых символов
mov ax,word ptr sym ; (70) Начальный символ с атрибутом
screen: mov es:[bx], ax ; (71) Вывод в видеобуфер
add bx,2 ; (72) Сместится в видеобуфере
inc ax ; (73) Следующий символ
loop screen ; (74) Цикл вывода на экран
; Подготовим переход в реальный режим
; Сформируем и загрузим дескрипторы для реального режима
mov gdt_data.limit,0FFFFh ; (75) Граница сегмента данных
mov gdt_code.limit,0FFFFh ; (76) Граница сегмента команд
mov gdt_stack.limit,0FFFFh ; (77) Граница сегмента стека
mov gdt_screen.limit,0FFFFh ; (78) Граница дополнительного сегмента
mov ax,8 ; (79) Загрузим теневой регистр
mov ds,ax ; (80) сегмента данных
mov ax,24 ; (81) Загрузим теневой регистр
mov ss,ax ; (82) стека
mov ax,32 ; (83) Загрузим теневой регистр
mov es,ax ; (84) дополнительного сегмента
; Выполним дальний переход для того, чтобы заново загрузить
; селектор в регистр CS и модифицировать его теневой регистр
db 0EAh ; (85) Командой дальнего перехода
dw offset go ; (86) загрузим теневой регистр
dw 16 ; (87) сегмента команд
; Переключим режим процессора
go: mov eax,cr0 ; (88) Получим содержимое CR0
and eax,0FFFFFFFEh ; (89) Сбросим бит PE
mov cr0,eax ; (90) Запишем назад в CR0
db 0EAh ; (91) Код команды far jmp
dw offset return ; (92) Смещение
dw text ; (93) Сегмент
; Теперь процессор снова работает в реальном режиме
; Восстановим операционную среду реального режима
return: mov ax,data ; (94) Восстановим
mov ds,ax ; (95) адресуемость данных
mov ax,stk ; (96) Восстановим
mov ss,ax ; (97) адресуемость стека
; Разрешим аппаратные и немаскируемые прерывания
sti ; (98) Разрешение прерываний
mov al,0 ; (99) Сброс бита 7 в порте CMOS —
out 70h,al ; (100) — разрешение NMI
; Проверим выполнение функций DOS после возврата в реальный режим
mov ah,09h ; (101)
mov dx,offset mes ; (102)
int 21h ; (103)
mov ax,4C00h ; (104) Завершим программу
int 21h ; (105) обычным образом
main endp ; (106)
code_size=$-main ; (107) Размер сегмента команд
text ends ; (108)
stk segment stack 'stack' ; (109)
db 256 dup('^') ; (110)
stk ends ; (111)
end main ; (112)
|
lib/math/_fn.asm | locodarwin/xc-basic3 | 11 | 171192 | <reponame>locodarwin/xc-basic3<gh_stars>10-100
; XC-BASIC numeric functions
; DECLARE FUNCTION ABS AS BYTE (num AS BYTE) SHARED STATIC INLINE
MAC F_abs_byte
ENDM
; DECLARE FUNCTION ABS AS INT (num AS INT) SHARED STATIC INLINE
MAC F_abs_int
tsx
lda.wx stack+1
bpl .skip
eor #$ff
sta.wx stack+1
lda.wx stack+2
eor #$ff
clc
adc #$01
sta.wx stack+2
bne .skip
inc.wx stack+1
.skip
ENDM
; DECLARE FUNCTION ABS AS WORD (num AS WORD) SHARED STATIC INLINE
MAC F_abs_word
ENDM
; DECLARE FUNCTION ABS AS LONG (num AS LONG) SHARED STATIC INLINE
MAC F_abs_long
tsx
lda.wx stack + 1
bpl .skip
eor #$ff
sta.wx stack + 1
lda.wx stack + 2
eor #$ff
sta.wx stack + 2
lda.wx stack + 3
eor #$ff
clc
adc #$01
sta.wx stack + 3
bne .skip
inc.wx stack + 2
bne .skip
inc.wx stack + 1
.skip
ENDM
; DECLARE FUNCTION ABS AS FLOAT (num AS FLOAT) SHARED STATIC INLINE
MAC F_abs_float
tsx
lda.wx stack + 2
and #%01111111
sta.wx stack + 2
ENDM
; DECLARE FUNCTION SGN AS INT (num AS BYTE) SHARED STATIC INLINE
MAC F_sgn_byte ; @pull @push
IF !FPULL
pla
ENDIF
beq .z
lda #$01
.z
IF !FPUSH
pha
lda #$00
pha
ELSE
ldy #$00
ENDIF
ENDM
; DECLARE FUNCTION SGN AS INT (num AS INT) SHARED STATIC INLINE
MAC F_sgn_int ; @push
pla
bmi .neg
beq .plz
pla
.pos
pint 1
beq .end
.plz
pla
bne .pos
pint 0
beq .end
.neg
pla
pint -1
.end
ENDM
; DECLARE FUNCTION SGN AS INT (num AS WORD) SHARED STATIC INLINE
MAC F_sgn_word ; @push
pla
beq .plz
pla
.pos
pint 1
beq .end
.plz
pla
bne .pos
pint 0
.end
ENDM
; DECLARE FUNCTION SGN AS INTEGER (num AS LONG) SHARED STATIC INLINE
MAC F_sgn_long ; @push
pla
bmi .neg
pla
bne .pos
pla
bne .pos + 1
pint 0
beq .end
.pos
pla
pint 1
beq .end
.neg
pla
pla
pint -1
.end
ENDM
; DECLARE FUNCTION SGN AS INTEGER (num AS FLOAT) SHARED STATIC INLINE
MAC F_sgn_float ; @pull @push
IF !FPULL
pla
sta R0
pla
sta R1
pla
pla
ELSE
pla
stx R0
sty R1
ENDIF
lda R0
beq .q
lda R1
bmi .neg
lda #$01
bne .q
.neg
pint -1
bmi .end
.q
IF !FPUSH
pha
lda #0
pha
ELSE
ldy #0
ENDIF
.end
ENDM
; DECLARE FUNCTION POW AS LONG (base AS WORD, exp AS BYTE) SHARED STATIC INLINE
MAC F_pow_word_byte ; @pull @push
IF !FPULL
pla
ENDIF
tax
pla
sta FAC + 1
pla
sta FAC
txa
import I_EXP
jsr I_EXP
IF !FPUSH
lda R0
pha
lda R0 + 1
pha
lda R0 + 2
pha
ELSE
lda R0
ldy R0 + 1
ldx R0 + 2
ENDIF
ENDM
; DECLARE FUNCTION POW AS LONG (base AS INT, exp AS BYTE) OVERRIDE SHARED STATIC INLINE
; TODO FIND BUG
MAC F_pow_int_byte ; @pull @push
.SIGN EQU ARG
.EXP EQU ARG + 1
IF !FPULL
pla
ENDIF
sta .EXP
pla
sta FAC + 1
pla
sta FAC
lda #0
sta .SIGN
lda FAC + 1
bpl .pos
twoscplint FAC
inc .SIGN
.pos
lda .EXP
import I_EXP
jsr I_EXP
lda .SIGN
beq .q
lda .EXP
and #%00000001
beq .q
twoscpllong R0
.q
IF !FPUSH
lda R0
pha
lda R0 + 1
pha
lda R0 + 2
pha
ELSE
lda R0
ldy R0 + 1
ldx R0 + 2
ENDIF
ENDM
; Exponentiation
; taken from https://codebase64.org/doku.php?id=base:exponentiation
IFCONST I_EXP_IMPORTED
I_EXP SUBROUTINE
; input: B value to be raised
; A exponent
;
; algo: if .A=0 res=1
; if .A=1 res=B
; _
; | B if E=1
; Exp(B,E)= | B*Exp(B,E-1) if E is odd
; |_Exp(B,E/2)*Exp(B,E/2) if E is even
;
P EQU R0
M EQU R4
N EQU R8
; No more pseudo-regs, use FAC
B EQU FAC
tax
beq .res1 ; is E==0 ?
lda B
lsr
ora B + 1
beq .resB ; if B==0 or B==1 then result=B
txa
cmp #1
bne .ExpSub
.resB
lda #0 ; E==1 | B==1 | B==0, result=B
sta P + 2
sta P + 3
lda B
sta P
lda B + 1
sta P + 1
rts
.res1
sta P + 1 ; E=0, result=1
sta P + 2
sta P + 3
lda #1
sta P
rts
.ExpSub
lsr ; E = int(E/2)
beq .resB ; E is 1
bcs .ExpOdd ; E is Odd
.ExpEven
jsr .ExpSub ; E is Even
ldx #$3
.ldP
lda P,x ; multiply P by itself
sta M,x ; P is the result of a previous mult
sta N,x ; copy P in M and N
dex
bpl .ldP
bmi .Mult32
.ExpOdd
asl ; E = 2*int(E/2) (=E-1)
jsr .ExpSub
ldx #$4
.ldD
lda <P-1,x ; multiply P by B
sta <M-1,x ; P is the result of a previous mult
dex ; copy P in M
bne .ldD
lda B ; copy B in N
sta N
lda B + 1
sta N + 1
;lda #0
stx N + 2
stx N + 3
;jmp Mult32
.Mult32 ; 32=32*32
lda #0
sta P
sta P+1
sta P+2
sta P+3
ldy #$20
.loop
asl P
rol P+1
rol P+2
rol P+3
asl N
rol N+1
rol N+2
rol N+3
bcc .skip
clc
ldx #$fc
.add
lda.zx P-252
adc.zx M-252
sta.zx P-252
inx
bne .add
.skip
dey
bne .loop
rts
ENDIF
; DECLARE FUNCTION POW AS FLOAT (base AS FLOAT, exp AS FLOAT) SHARED STATIC INLINE
MAC F_pow_float_float ; @pull @push
plfloattofac
plfloattoarg
import I_FPLIB
jsr FPWRT
pfac
ENDM
; DECLARE FUNCTION EXP AS FLOAT (num AS FLOAT) SHARED STATIC INLINE
MAC F_exp_float ; @pull @push
plfloattofac
import I_FPLIB
jsr EXP
pfac
ENDM
; DECLARE FUNCTION LOG AS FLOAT (num AS FLOAT) SHARED STATIC INLINE
MAC F_log_float ; @pull @push
plfloattofac
import I_FPLIB
jsr LOG
pfac
ENDM
; DECLARE FUNCTION INT AS FLOAT (num AS FLOAT) SHARED STATIC INLINE
MAC F_int_float ; @pull @push
plfloattofac
import I_FPLIB
jsr INT
pfac
ENDM
; DECLARE FUNCTION SQR AS FLOAT (num AS FLOAT) SHARED STATIC INLINE
MAC F_sqr_float ; @pull @push
plfloattofac
import I_FPLIB
jsr SQR
pfac
ENDM
; DECLARE FUNCTION SQR AS BYTE (num AS WORD) SHARED STATIC INLINE
MAC F_sqr_word ; @pull @push
IF !FPULL
pla
sta R0 + 1
pla
sta R0
ELSE
sta R0
sty R0 + 1
ENDIF
import I_SQRW
jsr SQRW
IF !FPUSH
pha
ENDIF
ENDM
; DECLARE FUNCTION SQR AS BYTE (num AS INT) SHARED STATIC INLINE
MAC F_sqr_int ; @pull @push
IF !FPULL
pla
sta R0 + 1
pla
sta R0
ELSE
sta R0
sty R0 + 1
ENDIF
lda R0 + 1
bpl .ok
import I_RUNTIME_ERROR
lda #ERR_ILQTY
jmp RUNTIME_ERROR
.ok
import I_SQRW
jsr SQRW
IF !FPUSH
pha
ENDIF
ENDM
; Square root of a word in R0-R1
; Returns value in A
; Remainder in X
; https://codebase64.org/doku.php?id=base:16bit_and_24bit_sqrt
IFCONST I_SQRW_IMPORTED
SQRW SUBROUTINE
ldy #$01
sty R2
dey
sty R3
.do
sec
lda R0
tax
sbc R2
sta R0
lda R1
sbc R3
sta R1
bcc .nomore
iny
lda R2
adc #$01
sta R2
bcc .do
inc R3
bcs .do
.nomore
tya
rts
ENDIF
; DECLARE FUNCTION SQR AS WORD (num AS LONG) OVERRIDE SHARED STATIC INLINE
MAC F_sqr_long ; @pull @push
pllongvar R0
lda R0 + 2
bpl .pos
import I_RUNTIME_ERROR
lda #ERR_ILQTY
jmp RUNTIME_ERROR
.pos
import I_SQRL
jsr SQRL
pwordvar R8
ENDM
; Square Root of a 24bit number
; by Verz - Jul2019
; Input in R0
; Result in AY
IFCONST I_SQRL_IMPORTED
SQRL SUBROUTINE
ldy #1
sty R4
dey
sty R4 + 1
sty R4 + 2
sty R8
sty R8 + 1
.do
sec
lda R0
sta RA
sbc R4
sta R0
lda R0 + 1
sta RA + 1
sbc R4 + 1
sta R0 + 1
lda R0 + 2
sbc R4 + 2
sta R0 + 2
bcc .nomore
inc R8
bne .1
inc R8 + 1
.1
lda R4
adc #1
sta R4
bcc .do
lda R4 + 1
adc #0
sta R4 + 1
bcc .do
inc R4 + 2
bcs .do
.nomore
lda R8
ldy R8 + 1
rts
ENDIF
IFCONST I_RANDOMIZE_IMPORTED || I_RND_IMPORTED || I_RNDL_IMPORTED
MATH_RND_EXP HEX 80
MATH_RND HEX 00 00 00
ENDIF
; DECLARE FUNCTION RND AS FLOAT () SHARED STATIC INLINE
MAC F_rnd ; @push
import I_RND
jsr I_RND
pfloatvar MATH_RND_EXP
ENDM
; DECLARE FUNCTION RNDL AS LONG () SHARED STATIC INLINE
MAC F_rndl
import I_RNDL
REPEAT 3
jsr I_RNDL
lda MATH_RND
pha
REPEND
ENDM
; DECLARE FUNCTION RNDI AS INT () SHARED STATIC INLINE
MAC F_rndi
import I_RNDL
REPEAT 2
jsr I_RNDL
lda MATH_RND
pha
REPEND
ENDM
; DECLARE FUNCTION RNDW AS INT () SHARED STATIC INLINE
MAC F_rndw
F_rndi
ENDM
; DECLARE FUNCTION RNDB AS BYTE () SHARED STATIC INLINE
MAC F_rndb ; @ push
import I_RNDL
jsr I_RNDL
lda MATH_RND
IF !FPUSH
pha
ENDIF
ENDM
; 6502 LFSR PRNG - 24-bit
; <NAME>, 2019
; http://rainwarrior.ca
IFCONST I_RNDL_IMPORTED
I_RNDL SUBROUTINE
; rotate the middle byte left
ldy MATH_RND + 1 ; will move to seed + 2 at the end
; compute seed + 1 ($1B>>1 = %1101)
lda MATH_RND + 2
lsr
lsr
lsr
lsr
sta MATH_RND + 1 ; reverse: %1011
lsr
lsr
eor MATH_RND + 1
lsr
eor MATH_RND + 1
eor MATH_RND + 0
sta MATH_RND + 1
; compute seed+0 ($1B = %00011011)
lda MATH_RND + 2
asl
eor MATH_RND + 2
asl
asl
eor MATH_RND + 2
asl
eor MATH_RND + 2
sty MATH_RND + 2 ; finish rotating byte 1 into 2
sta MATH_RND
rts
ENDIF
IFCONST I_RND_IMPORTED
I_RND SUBROUTINE
import I_FPLIB
lda #<MATH_RND_EXP
ldy #>MATH_RND_EXP
jsr LOAD_FAC_FROM_YA
lda #<.C1
ldy #>.C1
jsr FMULT
lda #<.C2
ldy #>.C2
jsr FADD
lda FAC + 1
ldx FAC + 3
sta FAC + 3
stx FAC + 1
lda #0
sta FACSIGN
lda FAC
sta FACEXTENSION
lda #$80
sta FAC
sec
jsr NORMALIZE_FAC1
ldx #<MATH_RND_EXP
ldy #>MATH_RND_EXP
jmp STORE_FAC_AT_YX_ROUNDED
.C1 HEX 98 35 44 7A
.C2 HEX 68 28 B1 46
ENDIF
MAC F_shl_byte_byte ; @pull @push
lshiftbyte
ENDM
MAC F_shr_byte_byte ; @pull @push
rshiftbyte
ENDM
MAC F_shl_int_byte ; @pull
lshiftint
ENDM
MAC F_shr_int_byte ; @pull
rshiftint
ENDM
MAC F_shl_word_byte ; @pull
lshiftword
ENDM
MAC F_shr_word_byte ; @pull
rshiftword
ENDM
MAC F_shl_long_byte ; @pull
lshiftlong
ENDM
MAC F_shr_long_byte ; @pull
rshiftlong
ENDM
|
programs/oeis/238/A238535.asm | neoneye/loda | 22 | 19101 | <reponame>neoneye/loda
; A238535: Sum of divisors d of n where d > sqrt(n).
; 0,2,3,4,5,9,7,12,9,15,11,22,13,21,20,24,17,33,19,35,28,33,23,50,25,39,36,49,29,61,31,56,44,51,42,75,37,57,52,78,41,84,43,77,69,69,47,108,49,85,68,91,53,108,66,106,76,87,59,147,61,93,93,112,78,132,67,119,92,129,71,171,73,111,115,133,88,156,79,166,108,123,83,201,102,129,116,165,89,208,104,161,124,141,114,228,97,161,143,195
add $0,1
mov $2,$0
lpb $0
mov $3,$2
lpb $2,2
add $5,1
mov $26,$0
cmp $26,0
add $0,$26
dif $3,$0
lpb $3
cmp $3,$2
add $2,5
cmp $3,0
mul $3,$0
sub $3,1
lpe
lpe
sub $0,1
add $9,$5
lpe
mov $0,$9
|
externals/mpir-3.0.0/mpn/x86/pentium/hamdist.asm | JaminChan/eos_win | 1 | 8805 | dnl Intel P5 mpn_hamdist -- mpn hamming distance.
dnl Copyright 2001, 2002 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 2.1 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street,
dnl Fifth Floor, Boston, MA 02110-1301, USA.
include(`../config.m4')
C P5: 14.0 cycles/limb
C unsigned long mpn_hamdist (mp_srcptr src1, mp_srcptr src2, mp_size_t size);
C
C It might be possible to shave 1 cycle from the loop, and hence 2
C cycles/limb. The xorb is taking 2 cycles, but a separate load and xor
C would be 1, if the right schedule could be found (not found so far).
C Wanting to avoid potential cache bank clashes makes it tricky.
C The slightly strange quoting here helps the renaming done by tune/many.pl.
deflit(TABLE_NAME,
m4_assert_defined(`GSYM_PREFIX')
GSYM_PREFIX`'mpn_popcount``'_table')
defframe(PARAM_SIZE,12)
defframe(PARAM_SRC2, 8)
defframe(PARAM_SRC1, 4)
TEXT
ALIGN(8)
PROLOGUE(mpn_hamdist)
deflit(`FRAME',0)
movl PARAM_SIZE, %ecx
pushl %esi FRAME_pushl()
shll %ecx C size in byte pairs
pushl %edi FRAME_pushl()
ifdef(`PIC',`
pushl %ebx FRAME_pushl()
pushl %ebp FRAME_pushl()
call L(here) FRAME_pushl()
L(here):
movl PARAM_SRC1, %esi
popl %ebp FRAME_popl()
movl PARAM_SRC2, %edi
addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebp
xorl %ebx, %ebx C byte
xorl %edx, %edx C byte
movl TABLE_NAME@GOT(%ebp), %ebp
xorl %eax, %eax C total
define(TABLE,`(%ebp,$1)')
',`
dnl non-PIC
movl PARAM_SRC1, %esi
movl PARAM_SRC2, %edi
xorl %eax, %eax C total
pushl %ebx FRAME_pushl()
xorl %edx, %edx C byte
xorl %ebx, %ebx C byte
define(TABLE,`TABLE_NAME($1)')
')
C The nop after the xorb seems necessary. Although a movb might be
C expected to go down the V pipe in the second cycle of the xorb, it
C doesn't and costs an extra 2 cycles.
L(top):
C eax total
C ebx byte
C ecx counter, 2*size to 2
C edx byte
C esi src1
C edi src2
C ebp [PIC] table
addl %ebx, %eax
movb -1(%esi,%ecx,2), %bl
addl %edx, %eax
movb -1(%edi,%ecx,2), %dl
xorb %dl, %bl
movb -2(%esi,%ecx,2), %dl
xorb -2(%edi,%ecx,2), %dl
nop
movb TABLE(%ebx), %bl
decl %ecx
movb TABLE(%edx), %dl
jnz L(top)
ifdef(`PIC',`
popl %ebp
')
addl %ebx, %eax
popl %ebx
addl %edx, %eax
popl %edi
popl %esi
ret
EPILOGUE()
|
Outputs/mixers/filters/echo/echoa.asm | jgunthorpe/muse | 0 | 161458 | <reponame>jgunthorpe/muse
ideal ; TASM Ideal mode
p386 ; protected mode 386 code
model os2 flat, syscall ; os/2 flat model, system calling
nosmart
public syscall EchoMix1m
public syscall EchoMix2m
public syscall EchoMix3m
public syscall EchoMix4m
public syscall EchoMix5m
public syscall EchoMix6m
public syscall EchoMix7m
public syscall EchoMix8m
public syscall EchoMix1s
public syscall EchoMix2s
public syscall EchoMix3s
public syscall EchoMix4s
public syscall EchoMix5s
public syscall EchoMix6s
public syscall EchoMix7s
public syscall EchoMix8s
public syscall FeedbackMixS
public syscall FeedbackMixM
dataseg
StackSave DD ?
codeseg ; Start the code segment
MONO = 1
STEREO = 2
MACRO MIX1CODE
mov EAX, [ESI]
mov EBP, [EDI]
imul EBX
mov [ESP], EBP
shrd EAX, EDX, 16
add ESI, MOVE
add [EDI], EAX
add ESP, MOVE
add EDI, MOVE
@@MadeMono:
ENDM
MACRO MIX2CODE
mov ESP, [ESI+4]
mov EBP, [EDI]
mov EDX, [EBX+4]
mov EAX, [ESP]
add [DWORD ESI+4], MOVE
imul EDX
mov ESP, [ESI]
shrd EAX, EDX, 16
mov EDX, [EBX]
add [EDI], EAX
mov EAX, [ESP]
add [DWORD ESI], MOVE
imul EDX
mov ESP, [ESI+4*8]
shrd EAX, EDX, 16
mov [ESP], EBP
add [EDI], EAX
add [DWORD ESI+4*8], MOVE
add EDI, MOVE
ENDM
MACRO MIXNCODE NUMBER
mov ESP, [ESI+(NUMBER-1)*4]
mov EBP, [EDI]
mov EDX, [EBX+(NUMBER-1)*4]
mov EAX, [ESP]
add [DWORD ESI+(NUMBER-1)*4], MOVE
imul EDX
mov ESP, [ESI+(NUMBER-2)*4]
shrd EAX, EDX, 16
mov EDX, [EBX+(NUMBER-2)*4]
add [EDI], EAX
CURNUM = (NUMBER-2)
REPT (NUMBER-2)
LOCAL @@NoMakeMonox
mov EAX, [ESP]
add [DWORD ESI+CURNUM*4], MOVE
imul EDX
mov ESP, [ESI+(CURNUM-1)*4]
shrd EAX, EDX, 16
mov EDX, [EBX+(CURNUM-1)*4]
add [EDI], EAX
CURNUM=CURNUM-1
ENDM
mov EAX, [ESP]
add [DWORD ESI], MOVE
imul EDX
mov ESP, [ESI+4*8]
shrd EAX, EDX, 16
mov [ESP], EBP
add [EDI], EAX
add [DWORD ESI+4*8], MOVE
add EDI, MOVE
ENDM
MIXTYPE=MONO
MIXNUM=1
REPT 8
INCLUDE "echoa.inc"
MIXNUM=MIXNUM+1
ENDM
MIXTYPE=STEREO
MIXNUM=1
REPT 8
INCLUDE "echoa.inc"
MIXNUM=MIXNUM+1
ENDM
proc FeedbackMixS syscall
ARG @@ToPos:PTR DWORD,@@FromPos:PTR DWORD,@@Length:DWORD,@@Scale:DWORD
; Save volatile registers
pushad
push ebp
; Save esp and store MEnd
mov [StackSave],esp ; Stash esp in the dgroup
mov ESI, [@@FromPos]
mov EDI, [@@ToPos]
mov ECX, [@@Length]
mov EBX, [@@Scale]
shr ECX, 1
jz @@End
@@Top:
mov EAX, [ESI]
sub ESI, 8
imul EBX
shrd EAX, EDX, 16
add [EDI], EAX
sub EDI, 8
dec ECX
jnz @@Top
@@End:
; Restore the stack
mov esp,[StackSave]
; Restore the flags
pop ebp
popad
cld
ret
endp
proc FeedbackMixM syscall
ARG @@ToPos:PTR DWORD,@@FromPos:PTR DWORD,@@Length:DWORD,@@Scale:DWORD
; Save volatile registers
pushad
push ebp
; Save esp and store MEnd
mov [StackSave],esp ; Stash esp in the dgroup
mov ESI, [@@FromPos]
mov EDI, [@@ToPos]
mov ECX, [@@Length]
mov EBX, [@@Scale]
test ECX, ECX
jz @@End
@@Top:
mov EAX, [ESI]
sub ESI, 4
imul EBX
shrd EAX, EDX, 16
add [EDI], EAX
sub EDI, 4
dec ECX
jnz @@Top
@@End:
; Restore the stack
mov esp,[StackSave]
; Restore the flags
pop ebp
popad
cld
ret
endp
end
|
experiment08/4a_WSP_PUSH_POP_CALL_RET.asm | EmilyClaire/space_invader | 0 | 165491 | <reponame>EmilyClaire/space_invader
.EQU time_INSIDE_FOR_COUNT = 1;0x5E
.EQU time_MIDDLE_FOR_COUNT = 1;0xFF
.EQU time_OUTSIDE_FOR_COUNT = 1;0xFF
.EQU led_port = 0x40
.CSEG
.ORG 0x40
;This tests PUSH, POP, WSP, CALL, RET
;This assumes MOV, LD, ST, CMP, OUT, SUB, BRNE, BREQ, OR, ADD all work
;requires simulator 0.52 or greater to simulate test case 8
Main: MOV R31, 0x00
OUT R31, led_port
;--------- test 1 ---------------------------------------------------------------
;this tests only the push command by pushing a value and then loading directly.
;it does not initialize the stack pointer to test stack pointer initialization
;--------------------------------------------------------------------------------
MOV R0, 0x50
PUSH R0
LD R1, 0xFF
CMP R1, 0x50
BRNE endtest1
OR R31, 0x01
endtest1: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for1: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for1: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for1: SUB R3, 0x01
BRNE inside_for1
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for1
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for1
;------------------------------- end Pause -----------------------------------------------
;--------- test 2 ---------------------------------------------------------------
;this tests the push command by pushing a value and then loading directly.
;this tests the wsp command by changing the stack to point at a random location in the memory
;--------------------------------------------------------------------------------
MOV R1, 0xD1
WSP R1
MOV R0, 0x11
PUSH R0
LD R1, 0xD0
CMP R1, 0x11
BRNE endtest2
OR R31, 0x02
endtest2: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for2: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for2: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for2: SUB R3, 0x01
BRNE inside_for2
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for2
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for2
;------------------------------- end Pause -----------------------------------------------
;--------- test 3 ---------------------------------------------------------------
;this tests only the pop command by storing a variable directly and then popping it
;--------------------------------------------------------------------------------
MOV R1, 0xFF
WSP R1
MOV R0, 0x22
ST R0, 0xFF
POP R1
CMP R1, 0x22
BRNE endtest3
OR R31, 0x04
endtest3: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for3: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for3: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for3: SUB R3, 0x01
BRNE inside_for3
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for3
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for3
;------------------------------- end Pause -----------------------------------------------
;--------- test 4 ---------------------------------------------------------------
;this tests both the push and pop commands
;--------------------------------------------------------------------------------
MOV R1, 0x00
WSP R1
MOV R0, 0x42
PUSH R0
POP R1
CMP R1, 0x42
BRNE endtest4
OR R31, 0x08
endtest4: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for4: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for4: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for4: SUB R3, 0x01
BRNE inside_for4
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for4
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for4
;------------------------------- end Pause -----------------------------------------------
;--------- test 5 ---------------------------------------------------------------
;this tests multiple pushes with multiple pops
;--------------------------------------------------------------------------------
MOV R0, 0x11
PUSH R0
MOV R0, 0x22
PUSH R0
MOV R0, 0x33
PUSH R0
MOV R0, 0x44
PUSH R0
MOV R0, 0x55
PUSH R0
POP R1
CMP R1, 0x55
BRNE endtest5
POP R1
CMP R1, 0x44
BRNE endtest5
POP R1
CMP R1, 0x33
BRNE endtest5
POP R1
CMP R1, 0x22
BRNE endtest5
POP R1
CMP R1, 0x11
BRNE endtest5
OR R31, 0x10
endtest5: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for5: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for5: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for5: SUB R3, 0x01
BRNE inside_for5
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for5
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for5
;------------------------------- end Pause -----------------------------------------------
;--------- test 6 ---------------------------------------------------------------
;this tests a simple function call (call/ret)
;see bottom for all functions
;--------------------------------------------------------------------------------
CALL test6Func
CMP R1, 0x77
BRNE endtest6
OR R31, 0x20
endtest6: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for6: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for6: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for6: SUB R3, 0x01
BRNE inside_for6
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for6
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for6
;------------------------------- end Pause -----------------------------------------------
;--------- test 7 ---------------------------------------------------------------
;this tests a function which calls another function
;--------------------------------------------------------------------------------
CALL test7Func
CMP R1, 0x88
BRNE endtest7
OR R31, 0x40
endtest7: OUT R31, led_port
;--------------------- Pause 1/2 second ----------------------------------------
MOV R1, time_OUTSIDE_FOR_COUNT ;set outside for loop count
outside_for7: SUB R1, 0x01
MOV R2, time_MIDDLE_FOR_COUNT ;set middle for loop count
middle_for7: SUB R2, 0x01
MOV R3, time_INSIDE_FOR_COUNT ;set inside for loop count
inside_for7: SUB R3, 0x01
BRNE inside_for7
OR R2, 0x00 ;load flags for middle for counter
BRNE middle_for7
OR R1, 0x00 ;load flags for outsde for counter value
BRNE outside_for7
;------------------------------- end Pause -----------------------------------------------
;--------- test 8 ---------------------------------------------------------------
;this tests recursive functions by computing the 10th fibonacci number.
;--------------------------------------------------------------------------------
CALL test8Func
CMP R0, 0x59
BRNE endtest8
OR R31, 0x80
endtest8: OUT R31, led_port
;--------- wait indefinitely ------------------------------------------------------------
end: BRN end
;----------------functions -------------------------------------------------------------------
test6Func: MOV R1, 0x77
RET
test7Func: MOV R1, 0x30
CALL test7Func2
RET
test7Func2: MOV R1, 0x88
RET
test8Func: MOV R0, 0x01
MOV R1, 0x01
MOV R3, 0x0A
CALL test8Func2
RET
test8Func2: ADD R0,R1
MOV R4, R1
MOV R1, R0
MOV R0, R4
SUB R3, 0x01
BREQ endtest8Func2
CALL test8Func2
endtest8Func2: RET
|
Kernel/asm/shutdown.asm | LucasCasa/Kerner | 0 | 176023 | GLOBAL _shutdown_asm
_shutdown_asm:
cli
push rbp
mov rbp, rsp
mov al,0xFE
out 64h,al
leave
ret |
wof/lcs/enemy/38.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 95796 | copyright zengfr site:http://github.com/zengfr/romhack
001136 lea (A6,D0.w), A6 [123p+ 36, 123p+ 38, enemy+36, enemy+38]
001590 lea ($20,A0), A0
003D18 move.l (A1)+, ($36,A0) [enemy+5E]
003D1C move.l (A1)+, ($b8,A0) [enemy+36, enemy+38]
003D7A move.l (A1)+, ($36,A0) [enemy+8E]
003D7E move.l (A1)+, ($b8,A0) [enemy+36, enemy+38]
0051D8 move.w ($20,A6), D0 [enemy+36, enemy+38]
0051EE move.w ($20,A6), D0 [enemy+36, enemy+38]
00534C move.l #$5a26a, ($36,A0) [enemy+90]
005354 move.l #$2000200, ($28,A0) [enemy+36, enemy+38]
012268 move.l (A2)+, (A3)+ [enemy+34, enemy+36]
01226A move.l (A2)+, (A3)+ [enemy+38, enemy+3A]
01A75E dbra D4, $1a75c
032CF4 lea (A6,D0.w), A6 [enemy+36, enemy+38]
036A4E lea (A6,D0.w), A6 [enemy+36, enemy+38]
copyright zengfr site:http://github.com/zengfr/romhack
|
exercises/19_scas.asm | Catherine22/Assembly | 0 | 89891 | <reponame>Catherine22/Assembly
STDIN equ 0
STDOUT equ 1
SYS_EXIT equ 1
SYS_READ equ 3
SYS_WRITE equ 4
section .data
my_string db "password", 0
len equ $- my_string
msg_found db "found!", 0xA
len_found equ $- msg_found
msg_notfound db "not found!", 0xA
len_notfound equ $- msg_notfound
section .text
global main
main:
mov ecx, len
mov edi, my_string
mov al, 'a'
cld
repne scasb ;It is conditional repeat. It repeats the operation while the zero flag indicate not equal/zero.
;It stops when the ZF indicates equal/zero or when CX is decremented to zero.
;(for bytes - SCASB, for words - SCASW, for doublewords - SCASD)
je found ;when found
;if not found then the following code
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, msg_notfound
mov edx, len_notfound
int 0x80
mov eax, SYS_WRITE
mov ebx, STDIN
int 0x80
found:
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, msg_found
mov edx, len_found
int 0x80 |
libsrc/games/msx/bit_close.asm | grancier/z180 | 0 | 167354 | ; $Id: bit_close.asm,v 1.3 2016/06/16 20:23:51 dom Exp $
;
; MSX bit sound functions
;
; void bit_close();
;
; <NAME> - 3/12/2007
;
SECTION code_clib
PUBLIC bit_close
PUBLIC _bit_close
.bit_close
._bit_close
ei
ret
|
programs/oeis/081/A081074.asm | karttu/loda | 0 | 105128 | <reponame>karttu/loda
; A081074: Fibonacci(4n)-3, or Fibonacci(2n-2)*Lucas(2n+2).
; 0,18,141,984,6762,46365,317808,2178306,14930349,102334152,701408730,4807526973,32951280096,225851433714,1548008755917,10610209857720,72723460248138,498454011879261,3416454622906704,23416728348467682
mul $0,2
lpb $0,1
sub $0,1
add $2,3
add $3,5
mov $1,$3
add $2,$3
add $3,$2
lpe
|
source/nodes/program-nodes-enumeration_literal_specifications.ads | reznikmm/gela | 0 | 4784 | <reponame>reznikmm/gela
-- SPDX-FileCopyrightText: 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-------------------------------------------------------------
with Program.Elements.Defining_Names;
with Program.Elements.Enumeration_Literal_Specifications;
with Program.Element_Visitors;
package Program.Nodes.Enumeration_Literal_Specifications is
pragma Preelaborate;
type Enumeration_Literal_Specification is
new Program.Nodes.Node
and Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification
and Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Text
with private;
function Create
(Name : not null Program.Elements.Defining_Names.Defining_Name_Access)
return Enumeration_Literal_Specification;
type Implicit_Enumeration_Literal_Specification is
new Program.Nodes.Node
and Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification
with private;
function Create
(Name : not null Program.Elements.Defining_Names
.Defining_Name_Access;
Is_Part_Of_Implicit : Boolean := False;
Is_Part_Of_Inherited : Boolean := False;
Is_Part_Of_Instance : Boolean := False)
return Implicit_Enumeration_Literal_Specification
with Pre =>
Is_Part_Of_Implicit or Is_Part_Of_Inherited or Is_Part_Of_Instance;
private
type Base_Enumeration_Literal_Specification is
abstract new Program.Nodes.Node
and Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification
with record
Name : not null Program.Elements.Defining_Names.Defining_Name_Access;
end record;
procedure Initialize
(Self : in out Base_Enumeration_Literal_Specification'Class);
overriding procedure Visit
(Self : not null access Base_Enumeration_Literal_Specification;
Visitor : in out Program.Element_Visitors.Element_Visitor'Class);
overriding function Name
(Self : Base_Enumeration_Literal_Specification)
return not null Program.Elements.Defining_Names.Defining_Name_Access;
overriding function Is_Enumeration_Literal_Specification
(Self : Base_Enumeration_Literal_Specification)
return Boolean;
overriding function Is_Declaration
(Self : Base_Enumeration_Literal_Specification)
return Boolean;
type Enumeration_Literal_Specification is
new Base_Enumeration_Literal_Specification
and Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Text
with null record;
overriding function To_Enumeration_Literal_Specification_Text
(Self : in out Enumeration_Literal_Specification)
return Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Text_Access;
type Implicit_Enumeration_Literal_Specification is
new Base_Enumeration_Literal_Specification
with record
Is_Part_Of_Implicit : Boolean;
Is_Part_Of_Inherited : Boolean;
Is_Part_Of_Instance : Boolean;
end record;
overriding function To_Enumeration_Literal_Specification_Text
(Self : in out Implicit_Enumeration_Literal_Specification)
return Program.Elements.Enumeration_Literal_Specifications
.Enumeration_Literal_Specification_Text_Access;
overriding function Is_Part_Of_Implicit
(Self : Implicit_Enumeration_Literal_Specification)
return Boolean;
overriding function Is_Part_Of_Inherited
(Self : Implicit_Enumeration_Literal_Specification)
return Boolean;
overriding function Is_Part_Of_Instance
(Self : Implicit_Enumeration_Literal_Specification)
return Boolean;
end Program.Nodes.Enumeration_Literal_Specifications;
|
data/pokemon/dex_entries/rapidash.asm | Dev727/ancientplatinum | 28 | 16801 | <filename>data/pokemon/dex_entries/rapidash.asm
db "<NAME>SE@" ; species name
dw 507, 2090 ; height, weight
db "It just loves to"
next "gallop. The faster"
next "it goes, the long-"
page "er the swaying"
next "flames of its mane"
next "will become.@"
|
keyboard.asm | rudla/multiloops | 0 | 173584 | <reponame>rudla/multiloops
;Keyboard support.
;
;Keyboard codes are generally returned as ascii values of coresponding keys.
;Letters are returned as upper case.
MODULE_KEYBOARD
KEY_NONE = 0 ;returned when no key is pressed
BACKSPACE = $7e
ESC = 27
SPACE = 32
ENTER = 10
TAB = 9
KEY_CAPS_LOCK = $7f
KEY_INV = $7e
KEY_START = 1
KEY_SELECT = 2
KEY_OPTION = 3
KEY_HELP = 4
;Special keys
KEY_F1 = 5
KEY_F2 = 6
KEY_F3 = 7
KEY_F4 = 8
;Shift keys
KEY_SHIFT = 1
KEY_CTRL = 2
GetKeyPressed .PROC
;Purpose:
; Return currently pressed key and state of shift keys (SHIFT, CTRL).
; The key is returned as ascii code.
; If no key is pressed
; START,SELECT,OPTION and HELP are returned as 1,2,3,4 respectively.
;
;Result:
; a pushed key
; X shift state (shift may be returned as pushed even if no key is pressed)
; Z set if no key (not even shift) is currently pushed
lda skstat ;test, if any key is pressed
and #4
bne consol_key
lda kbcode ;yes, convert it
and #%00111111 ;ignore ctrl and shift state for now
tax
lda key_to_ascii,x
ldx kbcode ;[CTRL]
bpl no_ctrl
ldx #KEY_CTRL
bne shift
consol_key
ldx consol ;[OPTION], [SELECT], [START]
lda consol_tbl,x
no_ctrl
ldx #KEY_NONE
shift
pha
lda skstat ;[SHIFT] - we read it from skstat to be able to get it even without any other key pressed
and #8
bne @+
inx
@ pla
sne ;if no key, test if shift is empty
cpx #0
rts
consol_tbl
;%000 %001 %010 %011 %100 %101 %110 %111
dta b(KEY_START, KEY_SELECT, KEY_START, KEY_OPTION, KEY_START, KEY_SELECT, KEY_START, KEY_NONE)
.ENDP
WaitForKeyRelease .PROC
@ jsr GetKeyPressed
bne @-
rts
.ENDP
WaitForKey .PROC
;Purpose:
; Wait until user presses a key.
;Result:
; a pushed key
; x shift state
jsr WaitForKeyRelease
rep
ldy #2
@ jsr GetKeyPressed
beq rep
pha
lda timer
wait cmp timer
beq wait
pla
dey
bne @-
rts
.ENDP
/*
GetKey .PROC
;Purpose:
; Return currently pressed key.
;Result:
; a pushed key (0 if no key is pushed)
; X shift state
; Z set if no key is currently pushed
;Test START, OPTION, SELECT
lda $d01f
eor #$07
beq no_consol
tax
lda CONSOL_TBL-1,x
;We want to support SHIFT for these keys
shift
pha
ldx #0
lda $d20f
and #8
sne
inx
pla
rts
CONSOL_TBL
;%000 %001 %010 %011 %100 %101 %110 %111
dta b(KEY_START, KEY_SELECT, KEY_START, KEY_OPTION, KEY_START, KEY_SELECT, KEY_START, KEY_NONE)
no_consol
lda 764
cmp #$FF
bne key
lda #0
jsr shift
cpx #0
rts
key
and #63
tax
lda key_to_ascii,x
pha
lda 764 ;get shift state into X
ldx #$FF
stx 764
rol
rol
rol
and #3
tax
pla
rts
.ENDP
*/
key_to_ascii
dta 'L' ;$00 - l
dta 'J' ;$01 - j
dta ';' ;$02 - semicolon
dta KEY_F1 ;$03 - F1
dta KEY_F2 ;$04 - F2
dta 'K' ;$05 - k
dta '+' ;$06 - +
dta '*' ;$07 - *
dta 'O' ;$08 - o
dta 0 ;$09 - (invalid)
dta 'P' ;$0A - p
dta 'U' ;$0B - u
dta ENTER ;$0C - return
dta 'I' ;$0D - i
dta '-' ;$0E - -
dta '=' ;$0F - =
dta 'V' ;$10 - v
dta KEY_HELP ;$11 - HELP
dta 'C' ;$12 - c
dta KEY_F3 ;$13 - F3
dta KEY_F4 ;$14 - F4
dta 'B' ;$15 - b
dta 'X' ;$16 - x
dta 'Z' ;$17 - z
dta '4' ;$18 - 4
dta 0 ;$19 - (invalid)
dta '3' ;$1A - 3
dta '6' ;$1B - 6
dta ESC ;$1C - escape
dta '5' ;$1D - 5
dta '2' ;$1E - 2
dta '1' ;$1F - 1
dta ',' ;$20 - comma
dta SPACE ;$21 - space
dta '.' ;$22 - period
dta 'N' ;$23 - n
dta 0 ;$24 - (invalid)
dta 'M' ;$25 - m
dta '/' ;$26 - /
dta KEY_INV ;$27 - inverse
dta 'R' ;$28 - r
dta 0 ;$29 - (invalid)
dta 'E' ;$2A - e
dta 'Y' ;$2B - y
dta TAB ;$2C - tab
dta 'T' ;$2D - t
dta 'W' ;$2E - w
dta 'Q' ;$2F - q
dta '9' ;$30 - 9
dta 0 ;$31 - (invalid)
dta '0' ;$32 - 0
dta '7' ;$33 - 7
dta BACKSPACE ;$34 - backspace
dta '8' ;$35 - 8
dta '<' ;$36 - <
dta '>' ;$37 - >
dta 'F' ;$38 - f
dta 'H' ;$39 - h
dta 'D' ;$3A - d
dta 0 ;$3B - (invalid)
dta KEY_CAPS_LOCK ;$3C - CAPS
dta 'G' ;$3D - g
dta 'S' ;$3E - s
dta 'A' ;$3F - a
.print "Keyboard:", *-MODULE_KEYBOARD
|
RefactorAgdaEngine/ExplicitImplicitConversion.agda | omega12345/RefactorAgda | 5 | 15893 | <reponame>omega12345/RefactorAgda
module ExplicitImplicitConversion where
open import ExpressionChanging
open import Data.Nat
open import Data.List
open import ParseTree
open import ScopeState
open import Data.Vec using (Vec ; _∷_)
open import Data.Fin
open import Data.List.NonEmpty
open import AgdaHelperFunctions
open import Data.Bool
open import ParseTreeOperations
-- is given types before conversion
-- namedArgument for type, never just implicit!!!!!!
conversionIns : {n : ℕ} -> Vec Expr n -> Fin n -> (List Expr -> List Expr)
conversionIns Vec.[] () l
conversionIns _ _ [] = []
conversionIns (namedArgument _ {false} ∷ x₁) zero (implicit y ∷ list) = y ∷ list
-- expecting implicit and getting explicit, i.e. argument to be moved
-- isn't specified.
conversionIns (namedArgument _ {false} ∷ x₁) zero (y ∷ list) = newUnderscore ∷ y ∷ list
conversionIns (x ∷ x₁) zero (x₂ ∷ list) = implicit x₂ ∷ list
conversionIns (namedArgument _ {false} ∷ x₁) (suc n) (implicit x₂ ∷ list) =
implicit x₂ ∷ conversionIns x₁ n list
conversionIns (namedArgument _ {false} ∷ x₁) (suc n) (x₂ ∷ list) =
let result = conversionIns x₁ n (x₂ ∷ list)
in if headImplicit? result then (implicit newUnderscore) ∷ result
else result
where headImplicit? : List Expr -> Bool
headImplicit? (implicit x ∷ l) = true
headImplicit? _ = false
conversionIns (x ∷ x₁) (suc n) (x₂ ∷ list) = x₂ ∷ conversionIns x₁ n list
convertInExpr : TypeSignature -> ℕ -> ScopeState (List⁺ Expr -> List⁺ Expr)
convertInExpr t n = makeInstruction t n conversionIns
convertInSignature : {n : ℕ} -> Vec Expr (suc n) -> Fin n -> ScopeState (Vec Expr (suc n))
convertInSignature (namedArgument arg {isExplicit} {c}{c2} ∷ l) zero =
return $ namedArgument arg {not isExplicit}{c}{c2} ∷ l
convertInSignature (implicit x ∷ l) zero = return $ x ∷ l
convertInSignature (x ∷ l) zero = do
newName <- getUniqueIdentifier
return $ namedArgument (typeSignature newName x) {false} {[]} {[]} ∷ l
convertInSignature (x ∷ v) (suc f) = do
rest <- convertInSignature v f
return $ x ∷ rest
convert : List ParseTree -> (funcID : ℕ) -> (whichArgument : ℕ) -> ScopeState (List ParseTree)
convert code funcId whichArgument = doForArgument code funcId whichArgument convertInSignature convertInExpr
|
usertests.asm | willtran98/MIT_xv6 | 0 | 179514 | <filename>usertests.asm<gh_stars>0
_usertests: file format elf32-i386
Disassembly of section .text:
00000000 <validateint>:
printf(stdout, "sbrk test OK\n");
}
void
validateint(int *p)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
"int %2\n\t"
"mov %%ebx, %%esp" :
"=a" (res) :
"a" (SYS_sleep), "n" (T_SYSCALL), "c" (p) :
"ebx");
}
3: 5d pop %ebp
4: c3 ret
5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000010 <rand>:
unsigned long randstate = 1;
unsigned int
rand()
{
randstate = randstate * 1664525 + 1013904223;
10: 69 05 60 59 00 00 0d imul $0x19660d,0x5960,%eax
17: 66 19 00
}
unsigned long randstate = 1;
unsigned int
rand()
{
1a: 55 push %ebp
1b: 89 e5 mov %esp,%ebp
randstate = randstate * 1664525 + 1013904223;
return randstate;
}
1d: 5d pop %ebp
unsigned long randstate = 1;
unsigned int
rand()
{
randstate = randstate * 1664525 + 1013904223;
1e: 05 5f f3 6e 3c add $0x3c6ef35f,%eax
23: a3 60 59 00 00 mov %eax,0x5960
return randstate;
}
28: c3 ret
29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000030 <bsstest>:
// does unintialized data start out zero?
char uninit[10000];
void
bsstest(void)
{
30: 55 push %ebp
31: 89 e5 mov %esp,%ebp
33: 83 ec 18 sub $0x18,%esp
int i;
printf(stdout, "bss test\n");
36: a1 5c 59 00 00 mov 0x595c,%eax
3b: c7 44 24 04 98 41 00 movl $0x4198,0x4(%esp)
42: 00
43: 89 04 24 mov %eax,(%esp)
46: e8 d5 3d 00 00 call 3e20 <printf>
for(i = 0; i < sizeof(uninit); i++){
if(uninit[i] != '\0'){
4b: 80 3d 20 5a 00 00 00 cmpb $0x0,0x5a20
52: 75 36 jne 8a <bsstest+0x5a>
54: b8 01 00 00 00 mov $0x1,%eax
59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
60: 80 b8 20 5a 00 00 00 cmpb $0x0,0x5a20(%eax)
67: 75 21 jne 8a <bsstest+0x5a>
bsstest(void)
{
int i;
printf(stdout, "bss test\n");
for(i = 0; i < sizeof(uninit); i++){
69: 83 c0 01 add $0x1,%eax
6c: 3d 10 27 00 00 cmp $0x2710,%eax
71: 75 ed jne 60 <bsstest+0x30>
if(uninit[i] != '\0'){
printf(stdout, "bss test failed\n");
exit();
}
}
printf(stdout, "bss test ok\n");
73: a1 5c 59 00 00 mov 0x595c,%eax
78: c7 44 24 04 b3 41 00 movl $0x41b3,0x4(%esp)
7f: 00
80: 89 04 24 mov %eax,(%esp)
83: e8 98 3d 00 00 call 3e20 <printf>
}
88: c9 leave
89: c3 ret
int i;
printf(stdout, "bss test\n");
for(i = 0; i < sizeof(uninit); i++){
if(uninit[i] != '\0'){
printf(stdout, "bss test failed\n");
8a: a1 5c 59 00 00 mov 0x595c,%eax
8f: c7 44 24 04 a2 41 00 movl $0x41a2,0x4(%esp)
96: 00
97: 89 04 24 mov %eax,(%esp)
9a: e8 81 3d 00 00 call 3e20 <printf>
exit();
9f: e8 21 3c 00 00 call 3cc5 <exit>
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <opentest>:
// simple file system tests
void
opentest(void)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 83 ec 18 sub $0x18,%esp
int fd;
printf(stdout, "open test\n");
b6: a1 5c 59 00 00 mov 0x595c,%eax
bb: c7 44 24 04 c0 41 00 movl $0x41c0,0x4(%esp)
c2: 00
c3: 89 04 24 mov %eax,(%esp)
c6: e8 55 3d 00 00 call 3e20 <printf>
fd = open("echo", 0);
cb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
d2: 00
d3: c7 04 24 cb 41 00 00 movl $0x41cb,(%esp)
da: e8 26 3c 00 00 call 3d05 <open>
if(fd < 0){
df: 85 c0 test %eax,%eax
e1: 78 37 js 11a <opentest+0x6a>
printf(stdout, "open echo failed!\n");
exit();
}
close(fd);
e3: 89 04 24 mov %eax,(%esp)
e6: e8 02 3c 00 00 call 3ced <close>
fd = open("doesnotexist", 0);
eb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
f2: 00
f3: c7 04 24 e3 41 00 00 movl $0x41e3,(%esp)
fa: e8 06 3c 00 00 call 3d05 <open>
if(fd >= 0){
ff: 85 c0 test %eax,%eax
101: 79 31 jns 134 <opentest+0x84>
printf(stdout, "open doesnotexist succeeded!\n");
exit();
}
printf(stdout, "open test ok\n");
103: a1 5c 59 00 00 mov 0x595c,%eax
108: c7 44 24 04 0e 42 00 movl $0x420e,0x4(%esp)
10f: 00
110: 89 04 24 mov %eax,(%esp)
113: e8 08 3d 00 00 call 3e20 <printf>
}
118: c9 leave
119: c3 ret
int fd;
printf(stdout, "open test\n");
fd = open("echo", 0);
if(fd < 0){
printf(stdout, "open echo failed!\n");
11a: a1 5c 59 00 00 mov 0x595c,%eax
11f: c7 44 24 04 d0 41 00 movl $0x41d0,0x4(%esp)
126: 00
127: 89 04 24 mov %eax,(%esp)
12a: e8 f1 3c 00 00 call 3e20 <printf>
exit();
12f: e8 91 3b 00 00 call 3cc5 <exit>
}
close(fd);
fd = open("doesnotexist", 0);
if(fd >= 0){
printf(stdout, "open doesnotexist succeeded!\n");
134: a1 5c 59 00 00 mov 0x595c,%eax
139: c7 44 24 04 f0 41 00 movl $0x41f0,0x4(%esp)
140: 00
141: 89 04 24 mov %eax,(%esp)
144: e8 d7 3c 00 00 call 3e20 <printf>
exit();
149: e8 77 3b 00 00 call 3cc5 <exit>
14e: 66 90 xchg %ax,%ax
00000150 <argptest>:
wait();
printf(1, "uio test done\n");
}
void argptest()
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 83 ec 14 sub $0x14,%esp
int fd;
fd = open("init", O_RDONLY);
157: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
15e: 00
15f: c7 04 24 1c 42 00 00 movl $0x421c,(%esp)
166: e8 9a 3b 00 00 call 3d05 <open>
if (fd < 0) {
16b: 85 c0 test %eax,%eax
}
void argptest()
{
int fd;
fd = open("init", O_RDONLY);
16d: 89 c3 mov %eax,%ebx
if (fd < 0) {
16f: 78 45 js 1b6 <argptest+0x66>
printf(2, "open failed\n");
exit();
}
read(fd, sbrk(0) - 1, -1);
171: c7 04 24 00 00 00 00 movl $0x0,(%esp)
178: e8 d0 3b 00 00 call 3d4d <sbrk>
17d: 89 1c 24 mov %ebx,(%esp)
180: c7 44 24 08 ff ff ff movl $0xffffffff,0x8(%esp)
187: ff
188: 83 e8 01 sub $0x1,%eax
18b: 89 44 24 04 mov %eax,0x4(%esp)
18f: e8 49 3b 00 00 call 3cdd <read>
close(fd);
194: 89 1c 24 mov %ebx,(%esp)
197: e8 51 3b 00 00 call 3ced <close>
printf(1, "arg test passed\n");
19c: c7 44 24 04 2e 42 00 movl $0x422e,0x4(%esp)
1a3: 00
1a4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ab: e8 70 3c 00 00 call 3e20 <printf>
}
1b0: 83 c4 14 add $0x14,%esp
1b3: 5b pop %ebx
1b4: 5d pop %ebp
1b5: c3 ret
void argptest()
{
int fd;
fd = open("init", O_RDONLY);
if (fd < 0) {
printf(2, "open failed\n");
1b6: c7 44 24 04 21 42 00 movl $0x4221,0x4(%esp)
1bd: 00
1be: c7 04 24 02 00 00 00 movl $0x2,(%esp)
1c5: e8 56 3c 00 00 call 3e20 <printf>
exit();
1ca: e8 f6 3a 00 00 call 3cc5 <exit>
1cf: 90 nop
000001d0 <uio>:
printf(1, "fsfull test finished\n");
}
void
uio()
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 83 ec 18 sub $0x18,%esp
ushort port = 0;
uchar val = 0;
int pid;
printf(1, "uio test\n");
1d6: c7 44 24 04 3f 42 00 movl $0x423f,0x4(%esp)
1dd: 00
1de: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e5: e8 36 3c 00 00 call 3e20 <printf>
pid = fork();
1ea: e8 ce 3a 00 00 call 3cbd <fork>
if(pid == 0){
1ef: 83 f8 00 cmp $0x0,%eax
1f2: 74 1f je 213 <uio+0x43>
asm volatile("outb %0,%1"::"a"(val), "d" (port));
port = RTC_DATA;
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
printf(1, "uio: uio succeeded; test FAILED\n");
exit();
} else if(pid < 0){
1f4: 7c 44 jl 23a <uio+0x6a>
1f6: 66 90 xchg %ax,%ax
printf (1, "fork failed\n");
exit();
}
wait();
1f8: e8 d0 3a 00 00 call 3ccd <wait>
printf(1, "uio test done\n");
1fd: c7 44 24 04 49 42 00 movl $0x4249,0x4(%esp)
204: 00
205: c7 04 24 01 00 00 00 movl $0x1,(%esp)
20c: e8 0f 3c 00 00 call 3e20 <printf>
}
211: c9 leave
212: c3 ret
pid = fork();
if(pid == 0){
port = RTC_ADDR;
val = 0x09; /* year */
/* http://wiki.osdev.org/Inline_Assembly/Examples */
asm volatile("outb %0,%1"::"a"(val), "d" (port));
213: ba 70 00 00 00 mov $0x70,%edx
218: b8 09 00 00 00 mov $0x9,%eax
21d: ee out %al,(%dx)
port = RTC_DATA;
asm volatile("inb %1,%0" : "=a" (val) : "d" (port));
21e: b2 71 mov $0x71,%dl
220: ec in (%dx),%al
printf(1, "uio: uio succeeded; test FAILED\n");
221: c7 44 24 04 bc 51 00 movl $0x51bc,0x4(%esp)
228: 00
229: c7 04 24 01 00 00 00 movl $0x1,(%esp)
230: e8 eb 3b 00 00 call 3e20 <printf>
exit();
235: e8 8b 3a 00 00 call 3cc5 <exit>
} else if(pid < 0){
printf (1, "fork failed\n");
23a: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
241: 00
242: c7 04 24 01 00 00 00 movl $0x1,(%esp)
249: e8 d2 3b 00 00 call 3e20 <printf>
exit();
24e: e8 72 3a 00 00 call 3cc5 <exit>
253: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <forktest>:
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
int n, pid;
printf(1, "fork test\n");
264: 31 db xor %ebx,%ebx
// test that fork fails gracefully
// the forktest binary also does this, but it runs out of proc entries first.
// inside the bigger usertests binary, we run out of memory first.
void
forktest(void)
{
266: 83 ec 14 sub $0x14,%esp
int n, pid;
printf(1, "fork test\n");
269: c7 44 24 04 58 42 00 movl $0x4258,0x4(%esp)
270: 00
271: c7 04 24 01 00 00 00 movl $0x1,(%esp)
278: e8 a3 3b 00 00 call 3e20 <printf>
27d: eb 13 jmp 292 <forktest+0x32>
27f: 90 nop
for(n=0; n<1000; n++){
pid = fork();
if(pid < 0)
break;
if(pid == 0)
280: 74 72 je 2f4 <forktest+0x94>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<1000; n++){
282: 83 c3 01 add $0x1,%ebx
285: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
28b: 90 nop
28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
290: 74 4e je 2e0 <forktest+0x80>
292: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
pid = fork();
298: e8 20 3a 00 00 call 3cbd <fork>
if(pid < 0)
29d: 83 f8 00 cmp $0x0,%eax
2a0: 7d de jge 280 <forktest+0x20>
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
exit();
}
for(; n > 0; n--){
2a2: 85 db test %ebx,%ebx
2a4: 74 11 je 2b7 <forktest+0x57>
2a6: 66 90 xchg %ax,%ax
if(wait() < 0){
2a8: e8 20 3a 00 00 call 3ccd <wait>
2ad: 85 c0 test %eax,%eax
2af: 90 nop
2b0: 78 47 js 2f9 <forktest+0x99>
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
exit();
}
for(; n > 0; n--){
2b2: 83 eb 01 sub $0x1,%ebx
2b5: 75 f1 jne 2a8 <forktest+0x48>
2b7: 90 nop
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
2b8: e8 10 3a 00 00 call 3ccd <wait>
2bd: 83 f8 ff cmp $0xffffffff,%eax
2c0: 75 50 jne 312 <forktest+0xb2>
printf(1, "wait got too many\n");
exit();
}
printf(1, "fork test OK\n");
2c2: c7 44 24 04 8a 42 00 movl $0x428a,0x4(%esp)
2c9: 00
2ca: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2d1: e8 4a 3b 00 00 call 3e20 <printf>
}
2d6: 83 c4 14 add $0x14,%esp
2d9: 5b pop %ebx
2da: 5d pop %ebp
2db: c3 ret
2dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid == 0)
exit();
}
if(n == 1000){
printf(1, "fork claimed to work 1000 times!\n");
2e0: c7 44 24 04 e0 51 00 movl $0x51e0,0x4(%esp)
2e7: 00
2e8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ef: e8 2c 3b 00 00 call 3e20 <printf>
exit();
2f4: e8 cc 39 00 00 call 3cc5 <exit>
}
for(; n > 0; n--){
if(wait() < 0){
printf(1, "wait stopped early\n");
2f9: c7 44 24 04 63 42 00 movl $0x4263,0x4(%esp)
300: 00
301: c7 04 24 01 00 00 00 movl $0x1,(%esp)
308: e8 13 3b 00 00 call 3e20 <printf>
exit();
30d: e8 b3 39 00 00 call 3cc5 <exit>
}
}
if(wait() != -1){
printf(1, "wait got too many\n");
312: c7 44 24 04 77 42 00 movl $0x4277,0x4(%esp)
319: 00
31a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
321: e8 fa 3a 00 00 call 3e20 <printf>
exit();
326: e8 9a 39 00 00 call 3cc5 <exit>
32b: 90 nop
32c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000330 <exitwait>:
}
// try to find any races between exit and wait
void
exitwait(void)
{
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 56 push %esi
334: 31 f6 xor %esi,%esi
336: 53 push %ebx
337: 83 ec 10 sub $0x10,%esp
33a: eb 17 jmp 353 <exitwait+0x23>
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
return;
}
if(pid){
340: 74 79 je 3bb <exitwait+0x8b>
if(wait() != pid){
342: e8 86 39 00 00 call 3ccd <wait>
347: 39 c3 cmp %eax,%ebx
349: 75 35 jne 380 <exitwait+0x50>
void
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
34b: 83 c6 01 add $0x1,%esi
34e: 83 fe 64 cmp $0x64,%esi
351: 74 4d je 3a0 <exitwait+0x70>
pid = fork();
353: e8 65 39 00 00 call 3cbd <fork>
if(pid < 0){
358: 83 f8 00 cmp $0x0,%eax
exitwait(void)
{
int i, pid;
for(i = 0; i < 100; i++){
pid = fork();
35b: 89 c3 mov %eax,%ebx
if(pid < 0){
35d: 7d e1 jge 340 <exitwait+0x10>
printf(1, "fork failed\n");
35f: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
366: 00
367: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36e: e8 ad 3a 00 00 call 3e20 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
373: 83 c4 10 add $0x10,%esp
376: 5b pop %ebx
377: 5e pop %esi
378: 5d pop %ebp
379: c3 ret
37a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
return;
}
if(pid){
if(wait() != pid){
printf(1, "wait wrong pid\n");
380: c7 44 24 04 98 42 00 movl $0x4298,0x4(%esp)
387: 00
388: c7 04 24 01 00 00 00 movl $0x1,(%esp)
38f: e8 8c 3a 00 00 call 3e20 <printf>
} else {
exit();
}
}
printf(1, "exitwait ok\n");
}
394: 83 c4 10 add $0x10,%esp
397: 5b pop %ebx
398: 5e pop %esi
399: 5d pop %ebp
39a: c3 ret
39b: 90 nop
39c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
} else {
exit();
}
}
printf(1, "exitwait ok\n");
3a0: c7 44 24 04 a8 42 00 movl $0x42a8,0x4(%esp)
3a7: 00
3a8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3af: e8 6c 3a 00 00 call 3e20 <printf>
}
3b4: 83 c4 10 add $0x10,%esp
3b7: 5b pop %ebx
3b8: 5e pop %esi
3b9: 5d pop %ebp
3ba: c3 ret
if(wait() != pid){
printf(1, "wait wrong pid\n");
return;
}
} else {
exit();
3bb: e8 05 39 00 00 call 3cc5 <exit>
000003c0 <fsfull>:
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 57 push %edi
3c4: 56 push %esi
3c5: 53 push %ebx
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
3c6: 31 db xor %ebx,%ebx
// what happens when the file system runs out of blocks?
// answer: balloc panics, so this test is not useful.
void
fsfull()
{
3c8: 83 ec 5c sub $0x5c,%esp
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
3cb: c7 44 24 04 b5 42 00 movl $0x42b5,0x4(%esp)
3d2: 00
3d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3da: e8 41 3a 00 00 call 3e20 <printf>
3df: 90 nop
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3e0: b8 d3 4d 62 10 mov $0x10624dd3,%eax
3e5: 89 d9 mov %ebx,%ecx
3e7: f7 eb imul %ebx
3e9: c1 f9 1f sar $0x1f,%ecx
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
3ec: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
3f0: c6 45 ad 00 movb $0x0,-0x53(%ebp)
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3f4: c1 fa 06 sar $0x6,%edx
3f7: 29 ca sub %ecx,%edx
name[2] = '0' + (nfiles % 1000) / 100;
3f9: 69 f2 e8 03 00 00 imul $0x3e8,%edx,%esi
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
3ff: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
402: 89 da mov %ebx,%edx
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
404: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
407: b8 1f 85 eb 51 mov $0x51eb851f,%eax
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
40c: c7 44 24 04 c2 42 00 movl $0x42c2,0x4(%esp)
413: 00
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
414: 29 f2 sub %esi,%edx
416: 89 d6 mov %edx,%esi
418: f7 ea imul %edx
name[3] = '0' + (nfiles % 100) / 10;
41a: b8 1f 85 eb 51 mov $0x51eb851f,%eax
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
41f: c1 fe 1f sar $0x1f,%esi
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
422: c7 04 24 01 00 00 00 movl $0x1,(%esp)
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
429: c1 fa 05 sar $0x5,%edx
42c: 29 f2 sub %esi,%edx
name[3] = '0' + (nfiles % 100) / 10;
42e: be 67 66 66 66 mov $0x66666667,%esi
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
433: 83 c2 30 add $0x30,%edx
436: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
439: f7 eb imul %ebx
43b: c1 fa 05 sar $0x5,%edx
43e: 29 ca sub %ecx,%edx
440: 6b fa 64 imul $0x64,%edx,%edi
443: 89 da mov %ebx,%edx
445: 29 fa sub %edi,%edx
447: 89 d0 mov %edx,%eax
449: 89 d7 mov %edx,%edi
44b: f7 ee imul %esi
name[4] = '0' + (nfiles % 10);
44d: 89 d8 mov %ebx,%eax
for(nfiles = 0; ; nfiles++){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
44f: c1 ff 1f sar $0x1f,%edi
452: c1 fa 02 sar $0x2,%edx
455: 29 fa sub %edi,%edx
457: 83 c2 30 add $0x30,%edx
45a: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
45d: f7 ee imul %esi
45f: c1 fa 02 sar $0x2,%edx
462: 29 ca sub %ecx,%edx
464: 8d 04 92 lea (%edx,%edx,4),%eax
467: 89 da mov %ebx,%edx
469: 01 c0 add %eax,%eax
46b: 29 c2 sub %eax,%edx
46d: 89 d0 mov %edx,%eax
46f: 83 c0 30 add $0x30,%eax
472: 88 45 ac mov %al,-0x54(%ebp)
name[5] = '\0';
printf(1, "writing %s\n", name);
475: 8d 45 a8 lea -0x58(%ebp),%eax
478: 89 44 24 08 mov %eax,0x8(%esp)
47c: e8 9f 39 00 00 call 3e20 <printf>
int fd = open(name, O_CREATE|O_RDWR);
481: 8d 55 a8 lea -0x58(%ebp),%edx
484: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
48b: 00
48c: 89 14 24 mov %edx,(%esp)
48f: e8 71 38 00 00 call 3d05 <open>
if(fd < 0){
494: 85 c0 test %eax,%eax
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
int fd = open(name, O_CREATE|O_RDWR);
496: 89 c7 mov %eax,%edi
if(fd < 0){
498: 78 53 js 4ed <fsfull+0x12d>
printf(1, "open %s failed\n", name);
break;
49a: 31 f6 xor %esi,%esi
49c: eb 04 jmp 4a2 <fsfull+0xe2>
49e: 66 90 xchg %ax,%ax
int total = 0;
while(1){
int cc = write(fd, buf, 512);
if(cc < 512)
break;
total += cc;
4a0: 01 c6 add %eax,%esi
printf(1, "open %s failed\n", name);
break;
}
int total = 0;
while(1){
int cc = write(fd, buf, 512);
4a2: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
4a9: 00
4aa: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
4b1: 00
4b2: 89 3c 24 mov %edi,(%esp)
4b5: e8 2b 38 00 00 call 3ce5 <write>
if(cc < 512)
4ba: 3d ff 01 00 00 cmp $0x1ff,%eax
4bf: 7f df jg 4a0 <fsfull+0xe0>
break;
total += cc;
fsblocks++;
}
printf(1, "wrote %d bytes\n", total);
4c1: 89 74 24 08 mov %esi,0x8(%esp)
4c5: c7 44 24 04 de 42 00 movl $0x42de,0x4(%esp)
4cc: 00
4cd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
4d4: e8 47 39 00 00 call 3e20 <printf>
close(fd);
4d9: 89 3c 24 mov %edi,(%esp)
4dc: e8 0c 38 00 00 call 3ced <close>
if(total == 0)
4e1: 85 f6 test %esi,%esi
4e3: 74 23 je 508 <fsfull+0x148>
int nfiles;
int fsblocks = 0;
printf(1, "fsfull test\n");
for(nfiles = 0; ; nfiles++){
4e5: 83 c3 01 add $0x1,%ebx
}
printf(1, "wrote %d bytes\n", total);
close(fd);
if(total == 0)
break;
}
4e8: e9 f3 fe ff ff jmp 3e0 <fsfull+0x20>
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
printf(1, "writing %s\n", name);
int fd = open(name, O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "open %s failed\n", name);
4ed: 8d 45 a8 lea -0x58(%ebp),%eax
4f0: 89 44 24 08 mov %eax,0x8(%esp)
4f4: c7 44 24 04 ce 42 00 movl $0x42ce,0x4(%esp)
4fb: 00
4fc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
503: e8 18 39 00 00 call 3e20 <printf>
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
508: b8 d3 4d 62 10 mov $0x10624dd3,%eax
50d: 89 d9 mov %ebx,%ecx
50f: f7 eb imul %ebx
511: c1 f9 1f sar $0x1f,%ecx
break;
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
514: c6 45 a8 66 movb $0x66,-0x58(%ebp)
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
name[5] = '\0';
518: c6 45 ad 00 movb $0x0,-0x53(%ebp)
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
51c: c1 fa 06 sar $0x6,%edx
51f: 29 ca sub %ecx,%edx
name[2] = '0' + (nfiles % 1000) / 100;
521: 69 f2 e8 03 00 00 imul $0x3e8,%edx,%esi
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
527: 8d 42 30 lea 0x30(%edx),%eax
name[2] = '0' + (nfiles % 1000) / 100;
52a: 89 da mov %ebx,%edx
}
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
52c: 88 45 a9 mov %al,-0x57(%ebp)
name[2] = '0' + (nfiles % 1000) / 100;
52f: b8 1f 85 eb 51 mov $0x51eb851f,%eax
534: 29 f2 sub %esi,%edx
536: 89 d6 mov %edx,%esi
538: f7 ea imul %edx
name[3] = '0' + (nfiles % 100) / 10;
53a: b8 1f 85 eb 51 mov $0x51eb851f,%eax
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
53f: c1 fe 1f sar $0x1f,%esi
542: c1 fa 05 sar $0x5,%edx
545: 29 f2 sub %esi,%edx
name[3] = '0' + (nfiles % 100) / 10;
547: be 67 66 66 66 mov $0x66666667,%esi
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
54c: 83 c2 30 add $0x30,%edx
54f: 88 55 aa mov %dl,-0x56(%ebp)
name[3] = '0' + (nfiles % 100) / 10;
552: f7 eb imul %ebx
554: c1 fa 05 sar $0x5,%edx
557: 29 ca sub %ecx,%edx
559: 6b fa 64 imul $0x64,%edx,%edi
55c: 89 da mov %ebx,%edx
55e: 29 fa sub %edi,%edx
560: 89 d0 mov %edx,%eax
562: 89 d7 mov %edx,%edi
564: f7 ee imul %esi
name[4] = '0' + (nfiles % 10);
566: 89 d8 mov %ebx,%eax
while(nfiles >= 0){
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
568: c1 ff 1f sar $0x1f,%edi
56b: c1 fa 02 sar $0x2,%edx
56e: 29 fa sub %edi,%edx
570: 83 c2 30 add $0x30,%edx
573: 88 55 ab mov %dl,-0x55(%ebp)
name[4] = '0' + (nfiles % 10);
576: f7 ee imul %esi
578: c1 fa 02 sar $0x2,%edx
57b: 29 ca sub %ecx,%edx
57d: 8d 04 92 lea (%edx,%edx,4),%eax
580: 89 da mov %ebx,%edx
582: 01 c0 add %eax,%eax
name[5] = '\0';
unlink(name);
nfiles--;
584: 83 eb 01 sub $0x1,%ebx
char name[64];
name[0] = 'f';
name[1] = '0' + nfiles / 1000;
name[2] = '0' + (nfiles % 1000) / 100;
name[3] = '0' + (nfiles % 100) / 10;
name[4] = '0' + (nfiles % 10);
587: 29 c2 sub %eax,%edx
589: 89 d0 mov %edx,%eax
58b: 83 c0 30 add $0x30,%eax
58e: 88 45 ac mov %al,-0x54(%ebp)
name[5] = '\0';
unlink(name);
591: 8d 45 a8 lea -0x58(%ebp),%eax
594: 89 04 24 mov %eax,(%esp)
597: e8 79 37 00 00 call 3d15 <unlink>
close(fd);
if(total == 0)
break;
}
while(nfiles >= 0){
59c: 83 fb ff cmp $0xffffffff,%ebx
59f: 0f 85 63 ff ff ff jne 508 <fsfull+0x148>
name[5] = '\0';
unlink(name);
nfiles--;
}
printf(1, "fsfull test finished\n");
5a5: c7 44 24 04 ee 42 00 movl $0x42ee,0x4(%esp)
5ac: 00
5ad: c7 04 24 01 00 00 00 movl $0x1,(%esp)
5b4: e8 67 38 00 00 call 3e20 <printf>
}
5b9: 83 c4 5c add $0x5c,%esp
5bc: 5b pop %ebx
5bd: 5e pop %esi
5be: 5f pop %edi
5bf: 5d pop %ebp
5c0: c3 ret
5c1: eb 0d jmp 5d0 <bigwrite>
5c3: 90 nop
5c4: 90 nop
5c5: 90 nop
5c6: 90 nop
5c7: 90 nop
5c8: 90 nop
5c9: 90 nop
5ca: 90 nop
5cb: 90 nop
5cc: 90 nop
5cd: 90 nop
5ce: 90 nop
5cf: 90 nop
000005d0 <bigwrite>:
}
// test writes that are larger than the log.
void
bigwrite(void)
{
5d0: 55 push %ebp
5d1: 89 e5 mov %esp,%ebp
5d3: 56 push %esi
5d4: 53 push %ebx
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
5d5: bb f3 01 00 00 mov $0x1f3,%ebx
}
// test writes that are larger than the log.
void
bigwrite(void)
{
5da: 83 ec 10 sub $0x10,%esp
int fd, sz;
printf(1, "bigwrite test\n");
5dd: c7 44 24 04 04 43 00 movl $0x4304,0x4(%esp)
5e4: 00
5e5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
5ec: e8 2f 38 00 00 call 3e20 <printf>
unlink("bigwrite");
5f1: c7 04 24 13 43 00 00 movl $0x4313,(%esp)
5f8: e8 18 37 00 00 call 3d15 <unlink>
5fd: 8d 76 00 lea 0x0(%esi),%esi
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
600: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
607: 00
608: c7 04 24 13 43 00 00 movl $0x4313,(%esp)
60f: e8 f1 36 00 00 call 3d05 <open>
if(fd < 0){
614: 85 c0 test %eax,%eax
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
616: 89 c6 mov %eax,%esi
if(fd < 0){
618: 0f 88 8e 00 00 00 js 6ac <bigwrite+0xdc>
printf(1, "cannot create bigwrite\n");
exit();
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
61e: 89 5c 24 08 mov %ebx,0x8(%esp)
622: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
629: 00
62a: 89 04 24 mov %eax,(%esp)
62d: e8 b3 36 00 00 call 3ce5 <write>
if(cc != sz){
632: 39 c3 cmp %eax,%ebx
634: 75 55 jne 68b <bigwrite+0xbb>
printf(1, "cannot create bigwrite\n");
exit();
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
636: 89 5c 24 08 mov %ebx,0x8(%esp)
63a: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
641: 00
642: 89 34 24 mov %esi,(%esp)
645: e8 9b 36 00 00 call 3ce5 <write>
if(cc != sz){
64a: 39 d8 cmp %ebx,%eax
64c: 75 3d jne 68b <bigwrite+0xbb>
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
64e: 81 c3 d7 01 00 00 add $0x1d7,%ebx
if(cc != sz){
printf(1, "write(%d) ret %d\n", sz, cc);
exit();
}
}
close(fd);
654: 89 34 24 mov %esi,(%esp)
657: e8 91 36 00 00 call 3ced <close>
unlink("bigwrite");
65c: c7 04 24 13 43 00 00 movl $0x4313,(%esp)
663: e8 ad 36 00 00 call 3d15 <unlink>
int fd, sz;
printf(1, "bigwrite test\n");
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
668: 81 fb 07 18 00 00 cmp $0x1807,%ebx
66e: 75 90 jne 600 <bigwrite+0x30>
}
close(fd);
unlink("bigwrite");
}
printf(1, "bigwrite ok\n");
670: c7 44 24 04 46 43 00 movl $0x4346,0x4(%esp)
677: 00
678: c7 04 24 01 00 00 00 movl $0x1,(%esp)
67f: e8 9c 37 00 00 call 3e20 <printf>
}
684: 83 c4 10 add $0x10,%esp
687: 5b pop %ebx
688: 5e pop %esi
689: 5d pop %ebp
68a: c3 ret
}
int i;
for(i = 0; i < 2; i++){
int cc = write(fd, buf, sz);
if(cc != sz){
printf(1, "write(%d) ret %d\n", sz, cc);
68b: 89 44 24 0c mov %eax,0xc(%esp)
68f: 89 5c 24 08 mov %ebx,0x8(%esp)
693: c7 44 24 04 34 43 00 movl $0x4334,0x4(%esp)
69a: 00
69b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6a2: e8 79 37 00 00 call 3e20 <printf>
exit();
6a7: e8 19 36 00 00 call 3cc5 <exit>
unlink("bigwrite");
for(sz = 499; sz < 12*512; sz += 471){
fd = open("bigwrite", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigwrite\n");
6ac: c7 44 24 04 1c 43 00 movl $0x431c,0x4(%esp)
6b3: 00
6b4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6bb: e8 60 37 00 00 call 3e20 <printf>
exit();
6c0: e8 00 36 00 00 call 3cc5 <exit>
6c5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
6c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000006d0 <unlinkread>:
}
// can I unlink a file and still read it?
void
unlinkread(void)
{
6d0: 55 push %ebp
6d1: 89 e5 mov %esp,%ebp
6d3: 56 push %esi
6d4: 53 push %ebx
6d5: 83 ec 10 sub $0x10,%esp
int fd, fd1;
printf(1, "unlinkread test\n");
6d8: c7 44 24 04 53 43 00 movl $0x4353,0x4(%esp)
6df: 00
6e0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6e7: e8 34 37 00 00 call 3e20 <printf>
fd = open("unlinkread", O_CREATE | O_RDWR);
6ec: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
6f3: 00
6f4: c7 04 24 64 43 00 00 movl $0x4364,(%esp)
6fb: e8 05 36 00 00 call 3d05 <open>
if(fd < 0){
700: 85 c0 test %eax,%eax
unlinkread(void)
{
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
702: 89 c3 mov %eax,%ebx
if(fd < 0){
704: 0f 88 fe 00 00 00 js 808 <unlinkread+0x138>
printf(1, "create unlinkread failed\n");
exit();
}
write(fd, "hello", 5);
70a: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
711: 00
712: c7 44 24 04 89 43 00 movl $0x4389,0x4(%esp)
719: 00
71a: 89 04 24 mov %eax,(%esp)
71d: e8 c3 35 00 00 call 3ce5 <write>
close(fd);
722: 89 1c 24 mov %ebx,(%esp)
725: e8 c3 35 00 00 call 3ced <close>
fd = open("unlinkread", O_RDWR);
72a: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
731: 00
732: c7 04 24 64 43 00 00 movl $0x4364,(%esp)
739: e8 c7 35 00 00 call 3d05 <open>
if(fd < 0){
73e: 85 c0 test %eax,%eax
exit();
}
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
740: 89 c3 mov %eax,%ebx
if(fd < 0){
742: 0f 88 3d 01 00 00 js 885 <unlinkread+0x1b5>
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
748: c7 04 24 64 43 00 00 movl $0x4364,(%esp)
74f: e8 c1 35 00 00 call 3d15 <unlink>
754: 85 c0 test %eax,%eax
756: 0f 85 10 01 00 00 jne 86c <unlinkread+0x19c>
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
75c: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
763: 00
764: c7 04 24 64 43 00 00 movl $0x4364,(%esp)
76b: e8 95 35 00 00 call 3d05 <open>
write(fd1, "yyy", 3);
770: c7 44 24 08 03 00 00 movl $0x3,0x8(%esp)
777: 00
778: c7 44 24 04 c1 43 00 movl $0x43c1,0x4(%esp)
77f: 00
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
exit();
}
fd1 = open("unlinkread", O_CREATE | O_RDWR);
780: 89 c6 mov %eax,%esi
write(fd1, "yyy", 3);
782: 89 04 24 mov %eax,(%esp)
785: e8 5b 35 00 00 call 3ce5 <write>
close(fd1);
78a: 89 34 24 mov %esi,(%esp)
78d: e8 5b 35 00 00 call 3ced <close>
if(read(fd, buf, sizeof(buf)) != 5){
792: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
799: 00
79a: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
7a1: 00
7a2: 89 1c 24 mov %ebx,(%esp)
7a5: e8 33 35 00 00 call 3cdd <read>
7aa: 83 f8 05 cmp $0x5,%eax
7ad: 0f 85 a0 00 00 00 jne 853 <unlinkread+0x183>
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
7b3: 80 3d 40 81 00 00 68 cmpb $0x68,0x8140
7ba: 75 7e jne 83a <unlinkread+0x16a>
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
7bc: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
7c3: 00
7c4: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
7cb: 00
7cc: 89 1c 24 mov %ebx,(%esp)
7cf: e8 11 35 00 00 call 3ce5 <write>
7d4: 83 f8 0a cmp $0xa,%eax
7d7: 75 48 jne 821 <unlinkread+0x151>
printf(1, "unlinkread write failed\n");
exit();
}
close(fd);
7d9: 89 1c 24 mov %ebx,(%esp)
7dc: e8 0c 35 00 00 call 3ced <close>
unlink("unlinkread");
7e1: c7 04 24 64 43 00 00 movl $0x4364,(%esp)
7e8: e8 28 35 00 00 call 3d15 <unlink>
printf(1, "unlinkread ok\n");
7ed: c7 44 24 04 0c 44 00 movl $0x440c,0x4(%esp)
7f4: 00
7f5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7fc: e8 1f 36 00 00 call 3e20 <printf>
}
801: 83 c4 10 add $0x10,%esp
804: 5b pop %ebx
805: 5e pop %esi
806: 5d pop %ebp
807: c3 ret
int fd, fd1;
printf(1, "unlinkread test\n");
fd = open("unlinkread", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create unlinkread failed\n");
808: c7 44 24 04 6f 43 00 movl $0x436f,0x4(%esp)
80f: 00
810: c7 04 24 01 00 00 00 movl $0x1,(%esp)
817: e8 04 36 00 00 call 3e20 <printf>
exit();
81c: e8 a4 34 00 00 call 3cc5 <exit>
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
exit();
}
if(write(fd, buf, 10) != 10){
printf(1, "unlinkread write failed\n");
821: c7 44 24 04 f3 43 00 movl $0x43f3,0x4(%esp)
828: 00
829: c7 04 24 01 00 00 00 movl $0x1,(%esp)
830: e8 eb 35 00 00 call 3e20 <printf>
exit();
835: e8 8b 34 00 00 call 3cc5 <exit>
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
exit();
}
if(buf[0] != 'h'){
printf(1, "unlinkread wrong data\n");
83a: c7 44 24 04 dc 43 00 movl $0x43dc,0x4(%esp)
841: 00
842: c7 04 24 01 00 00 00 movl $0x1,(%esp)
849: e8 d2 35 00 00 call 3e20 <printf>
exit();
84e: e8 72 34 00 00 call 3cc5 <exit>
fd1 = open("unlinkread", O_CREATE | O_RDWR);
write(fd1, "yyy", 3);
close(fd1);
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "unlinkread read failed");
853: c7 44 24 04 c5 43 00 movl $0x43c5,0x4(%esp)
85a: 00
85b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
862: e8 b9 35 00 00 call 3e20 <printf>
exit();
867: e8 59 34 00 00 call 3cc5 <exit>
if(fd < 0){
printf(1, "open unlinkread failed\n");
exit();
}
if(unlink("unlinkread") != 0){
printf(1, "unlink unlinkread failed\n");
86c: c7 44 24 04 a7 43 00 movl $0x43a7,0x4(%esp)
873: 00
874: c7 04 24 01 00 00 00 movl $0x1,(%esp)
87b: e8 a0 35 00 00 call 3e20 <printf>
exit();
880: e8 40 34 00 00 call 3cc5 <exit>
write(fd, "hello", 5);
close(fd);
fd = open("unlinkread", O_RDWR);
if(fd < 0){
printf(1, "open unlinkread failed\n");
885: c7 44 24 04 8f 43 00 movl $0x438f,0x4(%esp)
88c: 00
88d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
894: e8 87 35 00 00 call 3e20 <printf>
exit();
899: e8 27 34 00 00 call 3cc5 <exit>
89e: 66 90 xchg %ax,%ax
000008a0 <createdelete>:
}
// four processes create and delete different files in same directory
void
createdelete(void)
{
8a0: 55 push %ebp
8a1: 89 e5 mov %esp,%ebp
8a3: 57 push %edi
8a4: 56 push %esi
8a5: 53 push %ebx
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
8a6: 31 db xor %ebx,%ebx
}
// four processes create and delete different files in same directory
void
createdelete(void)
{
8a8: 83 ec 4c sub $0x4c,%esp
enum { N = 20 };
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
8ab: c7 44 24 04 1b 44 00 movl $0x441b,0x4(%esp)
8b2: 00
8b3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8ba: e8 61 35 00 00 call 3e20 <printf>
for(pi = 0; pi < 4; pi++){
pid = fork();
8bf: e8 f9 33 00 00 call 3cbd <fork>
if(pid < 0){
8c4: 83 f8 00 cmp $0x0,%eax
8c7: 0f 8c c8 01 00 00 jl a95 <createdelete+0x1f5>
8cd: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
8d0: 0f 84 e9 00 00 00 je 9bf <createdelete+0x11f>
int pid, i, fd, pi;
char name[32];
printf(1, "createdelete test\n");
for(pi = 0; pi < 4; pi++){
8d6: 83 c3 01 add $0x1,%ebx
8d9: 83 fb 04 cmp $0x4,%ebx
8dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
8e0: 75 dd jne 8bf <createdelete+0x1f>
8e2: 8d 75 c8 lea -0x38(%ebp),%esi
for(pi = 0; pi < 4; pi++){
wait();
}
name[0] = name[1] = name[2] = 0;
8e5: 31 ff xor %edi,%edi
exit();
}
}
for(pi = 0; pi < 4; pi++){
wait();
8e7: e8 e1 33 00 00 call 3ccd <wait>
8ec: e8 dc 33 00 00 call 3ccd <wait>
8f1: e8 d7 33 00 00 call 3ccd <wait>
8f6: e8 d2 33 00 00 call 3ccd <wait>
}
name[0] = name[1] = name[2] = 0;
8fb: c6 45 ca 00 movb $0x0,-0x36(%ebp)
8ff: 89 75 c0 mov %esi,-0x40(%ebp)
902: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(i = 0; i < N; i++){
908: 85 ff test %edi,%edi
90a: bb 70 00 00 00 mov $0x70,%ebx
90f: 8d 47 30 lea 0x30(%edi),%eax
912: 0f 94 c2 sete %dl
915: 83 ff 09 cmp $0x9,%edi
918: 89 d6 mov %edx,%esi
91a: 88 45 c4 mov %al,-0x3c(%ebp)
91d: 0f 9f c0 setg %al
920: 09 c6 or %eax,%esi
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
922: 8d 47 ff lea -0x1(%edi),%eax
925: 89 45 bc mov %eax,-0x44(%ebp)
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
fd = open(name, 0);
928: 8b 55 c0 mov -0x40(%ebp),%edx
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
92b: 0f b6 45 c4 movzbl -0x3c(%ebp),%eax
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
92f: 88 5d c8 mov %bl,-0x38(%ebp)
name[1] = '0' + i;
fd = open(name, 0);
932: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
939: 00
93a: 89 14 24 mov %edx,(%esp)
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
93d: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, 0);
940: e8 c0 33 00 00 call 3d05 <open>
if((i == 0 || i >= N/2) && fd < 0){
945: 89 f2 mov %esi,%edx
947: 84 d2 test %dl,%dl
949: 74 08 je 953 <createdelete+0xb3>
94b: 85 c0 test %eax,%eax
94d: 0f 88 ee 00 00 00 js a41 <createdelete+0x1a1>
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
953: 85 c0 test %eax,%eax
955: 0f 89 06 01 00 00 jns a61 <createdelete+0x1c1>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
close(fd);
95b: 83 c3 01 add $0x1,%ebx
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
95e: 80 fb 74 cmp $0x74,%bl
961: 75 c5 jne 928 <createdelete+0x88>
for(pi = 0; pi < 4; pi++){
wait();
}
name[0] = name[1] = name[2] = 0;
for(i = 0; i < N; i++){
963: 83 c7 01 add $0x1,%edi
966: 83 ff 14 cmp $0x14,%edi
969: 75 9d jne 908 <createdelete+0x68>
96b: 8b 75 c0 mov -0x40(%ebp),%esi
96e: bf 70 00 00 00 mov $0x70,%edi
973: 89 75 c4 mov %esi,-0x3c(%ebp)
976: 66 90 xchg %ax,%ax
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
978: 8d 77 c0 lea -0x40(%edi),%esi
97b: 31 db xor %ebx,%ebx
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + i;
97d: 89 fa mov %edi,%edx
name[1] = '0' + i;
97f: 89 f0 mov %esi,%eax
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + i;
981: 88 55 c8 mov %dl,-0x38(%ebp)
name[1] = '0' + i;
unlink(name);
984: 8b 55 c4 mov -0x3c(%ebp),%edx
close(fd);
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
987: 83 c3 01 add $0x1,%ebx
name[0] = 'p' + i;
name[1] = '0' + i;
98a: 88 45 c9 mov %al,-0x37(%ebp)
unlink(name);
98d: 89 14 24 mov %edx,(%esp)
990: e8 80 33 00 00 call 3d15 <unlink>
close(fd);
}
}
for(i = 0; i < N; i++){
for(pi = 0; pi < 4; pi++){
995: 83 fb 04 cmp $0x4,%ebx
998: 75 e3 jne 97d <createdelete+0xdd>
99a: 83 c7 01 add $0x1,%edi
if(fd >= 0)
close(fd);
}
}
for(i = 0; i < N; i++){
99d: 89 f8 mov %edi,%eax
99f: 3c 84 cmp $0x84,%al
9a1: 75 d5 jne 978 <createdelete+0xd8>
name[1] = '0' + i;
unlink(name);
}
}
printf(1, "createdelete ok\n");
9a3: c7 44 24 04 3d 44 00 movl $0x443d,0x4(%esp)
9aa: 00
9ab: c7 04 24 01 00 00 00 movl $0x1,(%esp)
9b2: e8 69 34 00 00 call 3e20 <printf>
}
9b7: 83 c4 4c add $0x4c,%esp
9ba: 5b pop %ebx
9bb: 5e pop %esi
9bc: 5f pop %edi
9bd: 5d pop %ebp
9be: c3 ret
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
9bf: 83 c3 70 add $0x70,%ebx
name[2] = '\0';
9c2: bf 01 00 00 00 mov $0x1,%edi
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
9c7: 88 5d c8 mov %bl,-0x38(%ebp)
9ca: 8d 75 c8 lea -0x38(%ebp),%esi
name[2] = '\0';
9cd: 31 db xor %ebx,%ebx
9cf: c6 45 ca 00 movb $0x0,-0x36(%ebp)
9d3: eb 0e jmp 9e3 <createdelete+0x143>
9d5: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < N; i++){
9d8: 83 ff 13 cmp $0x13,%edi
9db: 7f 7f jg a5c <createdelete+0x1bc>
exit();
}
if(pid == 0){
name[0] = 'p' + pi;
name[2] = '\0';
9dd: 83 c3 01 add $0x1,%ebx
9e0: 83 c7 01 add $0x1,%edi
for(i = 0; i < N; i++){
name[1] = '0' + i;
9e3: 8d 43 30 lea 0x30(%ebx),%eax
9e6: 88 45 c9 mov %al,-0x37(%ebp)
fd = open(name, O_CREATE | O_RDWR);
9e9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
9f0: 00
9f1: 89 34 24 mov %esi,(%esp)
9f4: e8 0c 33 00 00 call 3d05 <open>
if(fd < 0){
9f9: 85 c0 test %eax,%eax
9fb: 0f 88 ad 00 00 00 js aae <createdelete+0x20e>
printf(1, "create failed\n");
exit();
}
close(fd);
a01: 89 04 24 mov %eax,(%esp)
a04: e8 e4 32 00 00 call 3ced <close>
if(i > 0 && (i % 2 ) == 0){
a09: 85 db test %ebx,%ebx
a0b: 74 d0 je 9dd <createdelete+0x13d>
a0d: f6 c3 01 test $0x1,%bl
a10: 75 c6 jne 9d8 <createdelete+0x138>
name[1] = '0' + (i / 2);
a12: 89 d8 mov %ebx,%eax
a14: d1 f8 sar %eax
a16: 83 c0 30 add $0x30,%eax
a19: 88 45 c9 mov %al,-0x37(%ebp)
if(unlink(name) < 0){
a1c: 89 34 24 mov %esi,(%esp)
a1f: e8 f1 32 00 00 call 3d15 <unlink>
a24: 85 c0 test %eax,%eax
a26: 79 b0 jns 9d8 <createdelete+0x138>
printf(1, "unlink failed\n");
a28: c7 44 24 04 2e 44 00 movl $0x442e,0x4(%esp)
a2f: 00
a30: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a37: e8 e4 33 00 00 call 3e20 <printf>
exit();
a3c: e8 84 32 00 00 call 3cc5 <exit>
a41: 8b 75 c0 mov -0x40(%ebp),%esi
for(pi = 0; pi < 4; pi++){
name[0] = 'p' + pi;
name[1] = '0' + i;
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
a44: c7 44 24 04 04 52 00 movl $0x5204,0x4(%esp)
a4b: 00
a4c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a53: 89 74 24 08 mov %esi,0x8(%esp)
a57: e8 c4 33 00 00 call 3e20 <printf>
exit();
a5c: e8 64 32 00 00 call 3cc5 <exit>
} else if((i >= 1 && i < N/2) && fd >= 0){
a61: 83 7d bc 08 cmpl $0x8,-0x44(%ebp)
a65: 76 0e jbe a75 <createdelete+0x1d5>
printf(1, "oops createdelete %s did exist\n", name);
exit();
}
if(fd >= 0)
close(fd);
a67: 89 04 24 mov %eax,(%esp)
a6a: e8 7e 32 00 00 call 3ced <close>
a6f: 90 nop
a70: e9 e6 fe ff ff jmp 95b <createdelete+0xbb>
a75: 8b 75 c0 mov -0x40(%ebp),%esi
fd = open(name, 0);
if((i == 0 || i >= N/2) && fd < 0){
printf(1, "oops createdelete %s didn't exist\n", name);
exit();
} else if((i >= 1 && i < N/2) && fd >= 0){
printf(1, "oops createdelete %s did exist\n", name);
a78: c7 44 24 04 28 52 00 movl $0x5228,0x4(%esp)
a7f: 00
a80: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a87: 89 74 24 08 mov %esi,0x8(%esp)
a8b: e8 90 33 00 00 call 3e20 <printf>
exit();
a90: e8 30 32 00 00 call 3cc5 <exit>
printf(1, "createdelete test\n");
for(pi = 0; pi < 4; pi++){
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
a95: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
a9c: 00
a9d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
aa4: e8 77 33 00 00 call 3e20 <printf>
exit();
aa9: e8 17 32 00 00 call 3cc5 <exit>
name[2] = '\0';
for(i = 0; i < N; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
aae: c7 44 24 04 a5 46 00 movl $0x46a5,0x4(%esp)
ab5: 00
ab6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
abd: e8 5e 33 00 00 call 3e20 <printf>
exit();
ac2: e8 fe 31 00 00 call 3cc5 <exit>
ac7: 89 f6 mov %esi,%esi
ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ad0 <createtest>:
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
ad0: 55 push %ebp
ad1: 89 e5 mov %esp,%ebp
ad3: 53 push %ebx
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
ad4: bb 30 00 00 00 mov $0x30,%ebx
printf(stdout, "big files ok\n");
}
void
createtest(void)
{
ad9: 83 ec 14 sub $0x14,%esp
int i, fd;
printf(stdout, "many creates, followed by unlink test\n");
adc: a1 5c 59 00 00 mov 0x595c,%eax
ae1: c7 44 24 04 48 52 00 movl $0x5248,0x4(%esp)
ae8: 00
ae9: 89 04 24 mov %eax,(%esp)
aec: e8 2f 33 00 00 call 3e20 <printf>
name[0] = 'a';
af1: c6 05 40 a1 00 00 61 movb $0x61,0xa140
name[2] = '\0';
af8: c6 05 42 a1 00 00 00 movb $0x0,0xa142
aff: 90 nop
for(i = 0; i < 52; i++){
name[1] = '0' + i;
b00: 88 1d 41 a1 00 00 mov %bl,0xa141
fd = open(name, O_CREATE|O_RDWR);
close(fd);
b06: 83 c3 01 add $0x1,%ebx
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
b09: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
b10: 00
b11: c7 04 24 40 a1 00 00 movl $0xa140,(%esp)
b18: e8 e8 31 00 00 call 3d05 <open>
close(fd);
b1d: 89 04 24 mov %eax,(%esp)
b20: e8 c8 31 00 00 call 3ced <close>
printf(stdout, "many creates, followed by unlink test\n");
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
b25: 80 fb 64 cmp $0x64,%bl
b28: 75 d6 jne b00 <createtest+0x30>
name[1] = '0' + i;
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
b2a: c6 05 40 a1 00 00 61 movb $0x61,0xa140
name[2] = '\0';
b31: bb 30 00 00 00 mov $0x30,%ebx
b36: c6 05 42 a1 00 00 00 movb $0x0,0xa142
b3d: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < 52; i++){
name[1] = '0' + i;
b40: 88 1d 41 a1 00 00 mov %bl,0xa141
unlink(name);
b46: 83 c3 01 add $0x1,%ebx
b49: c7 04 24 40 a1 00 00 movl $0xa140,(%esp)
b50: e8 c0 31 00 00 call 3d15 <unlink>
fd = open(name, O_CREATE|O_RDWR);
close(fd);
}
name[0] = 'a';
name[2] = '\0';
for(i = 0; i < 52; i++){
b55: 80 fb 64 cmp $0x64,%bl
b58: 75 e6 jne b40 <createtest+0x70>
name[1] = '0' + i;
unlink(name);
}
printf(stdout, "many creates, followed by unlink; ok\n");
b5a: a1 5c 59 00 00 mov 0x595c,%eax
b5f: c7 44 24 04 70 52 00 movl $0x5270,0x4(%esp)
b66: 00
b67: 89 04 24 mov %eax,(%esp)
b6a: e8 b1 32 00 00 call 3e20 <printf>
}
b6f: 83 c4 14 add $0x14,%esp
b72: 5b pop %ebx
b73: 5d pop %ebp
b74: c3 ret
b75: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000b80 <writetest1>:
printf(stdout, "small file test ok\n");
}
void
writetest1(void)
{
b80: 55 push %ebp
b81: 89 e5 mov %esp,%ebp
b83: 56 push %esi
b84: 53 push %ebx
b85: 83 ec 10 sub $0x10,%esp
int i, fd, n;
printf(stdout, "big files test\n");
b88: a1 5c 59 00 00 mov 0x595c,%eax
b8d: c7 44 24 04 4e 44 00 movl $0x444e,0x4(%esp)
b94: 00
b95: 89 04 24 mov %eax,(%esp)
b98: e8 83 32 00 00 call 3e20 <printf>
fd = open("big", O_CREATE|O_RDWR);
b9d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
ba4: 00
ba5: c7 04 24 c8 44 00 00 movl $0x44c8,(%esp)
bac: e8 54 31 00 00 call 3d05 <open>
if(fd < 0){
bb1: 85 c0 test %eax,%eax
{
int i, fd, n;
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
bb3: 89 c6 mov %eax,%esi
if(fd < 0){
bb5: 0f 88 7a 01 00 00 js d35 <writetest1+0x1b5>
printf(stdout, "error: creat big failed!\n");
exit();
bbb: 31 db xor %ebx,%ebx
bbd: 8d 76 00 lea 0x0(%esi),%esi
}
for(i = 0; i < MAXFILE; i++){
((int*)buf)[0] = i;
bc0: 89 1d 40 81 00 00 mov %ebx,0x8140
if(write(fd, buf, 512) != 512){
bc6: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
bcd: 00
bce: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
bd5: 00
bd6: 89 34 24 mov %esi,(%esp)
bd9: e8 07 31 00 00 call 3ce5 <write>
bde: 3d 00 02 00 00 cmp $0x200,%eax
be3: 0f 85 b2 00 00 00 jne c9b <writetest1+0x11b>
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
exit();
}
for(i = 0; i < MAXFILE; i++){
be9: 83 c3 01 add $0x1,%ebx
bec: 81 fb 8c 00 00 00 cmp $0x8c,%ebx
bf2: 75 cc jne bc0 <writetest1+0x40>
printf(stdout, "error: write big file failed\n", i);
exit();
}
}
close(fd);
bf4: 89 34 24 mov %esi,(%esp)
bf7: e8 f1 30 00 00 call 3ced <close>
fd = open("big", O_RDONLY);
bfc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
c03: 00
c04: c7 04 24 c8 44 00 00 movl $0x44c8,(%esp)
c0b: e8 f5 30 00 00 call 3d05 <open>
if(fd < 0){
c10: 85 c0 test %eax,%eax
}
}
close(fd);
fd = open("big", O_RDONLY);
c12: 89 c6 mov %eax,%esi
if(fd < 0){
c14: 0f 88 01 01 00 00 js d1b <writetest1+0x19b>
printf(stdout, "error: open big failed!\n");
exit();
c1a: 31 db xor %ebx,%ebx
c1c: eb 1d jmp c3b <writetest1+0xbb>
c1e: 66 90 xchg %ax,%ax
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512){
c20: 3d 00 02 00 00 cmp $0x200,%eax
c25: 0f 85 b0 00 00 00 jne cdb <writetest1+0x15b>
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
c2b: a1 40 81 00 00 mov 0x8140,%eax
c30: 39 d8 cmp %ebx,%eax
c32: 0f 85 81 00 00 00 jne cb9 <writetest1+0x139>
printf(stdout, "read content of block %d is %d\n",
n, ((int*)buf)[0]);
exit();
}
n++;
c38: 83 c3 01 add $0x1,%ebx
exit();
}
n = 0;
for(;;){
i = read(fd, buf, 512);
c3b: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
c42: 00
c43: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
c4a: 00
c4b: 89 34 24 mov %esi,(%esp)
c4e: e8 8a 30 00 00 call 3cdd <read>
if(i == 0){
c53: 85 c0 test %eax,%eax
c55: 75 c9 jne c20 <writetest1+0xa0>
if(n == MAXFILE - 1){
c57: 81 fb 8b 00 00 00 cmp $0x8b,%ebx
c5d: 0f 84 96 00 00 00 je cf9 <writetest1+0x179>
n, ((int*)buf)[0]);
exit();
}
n++;
}
close(fd);
c63: 89 34 24 mov %esi,(%esp)
c66: e8 82 30 00 00 call 3ced <close>
if(unlink("big") < 0){
c6b: c7 04 24 c8 44 00 00 movl $0x44c8,(%esp)
c72: e8 9e 30 00 00 call 3d15 <unlink>
c77: 85 c0 test %eax,%eax
c79: 0f 88 d0 00 00 00 js d4f <writetest1+0x1cf>
printf(stdout, "unlink big failed\n");
exit();
}
printf(stdout, "big files ok\n");
c7f: a1 5c 59 00 00 mov 0x595c,%eax
c84: c7 44 24 04 ef 44 00 movl $0x44ef,0x4(%esp)
c8b: 00
c8c: 89 04 24 mov %eax,(%esp)
c8f: e8 8c 31 00 00 call 3e20 <printf>
}
c94: 83 c4 10 add $0x10,%esp
c97: 5b pop %ebx
c98: 5e pop %esi
c99: 5d pop %ebp
c9a: c3 ret
}
for(i = 0; i < MAXFILE; i++){
((int*)buf)[0] = i;
if(write(fd, buf, 512) != 512){
printf(stdout, "error: write big file failed\n", i);
c9b: a1 5c 59 00 00 mov 0x595c,%eax
ca0: 89 5c 24 08 mov %ebx,0x8(%esp)
ca4: c7 44 24 04 78 44 00 movl $0x4478,0x4(%esp)
cab: 00
cac: 89 04 24 mov %eax,(%esp)
caf: e8 6c 31 00 00 call 3e20 <printf>
exit();
cb4: e8 0c 30 00 00 call 3cc5 <exit>
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
exit();
}
if(((int*)buf)[0] != n){
printf(stdout, "read content of block %d is %d\n",
cb9: 89 44 24 0c mov %eax,0xc(%esp)
cbd: a1 5c 59 00 00 mov 0x595c,%eax
cc2: 89 5c 24 08 mov %ebx,0x8(%esp)
cc6: c7 44 24 04 98 52 00 movl $0x5298,0x4(%esp)
ccd: 00
cce: 89 04 24 mov %eax,(%esp)
cd1: e8 4a 31 00 00 call 3e20 <printf>
n, ((int*)buf)[0]);
exit();
cd6: e8 ea 2f 00 00 call 3cc5 <exit>
printf(stdout, "read only %d blocks from big", n);
exit();
}
break;
} else if(i != 512){
printf(stdout, "read failed %d\n", i);
cdb: 89 44 24 08 mov %eax,0x8(%esp)
cdf: a1 5c 59 00 00 mov 0x595c,%eax
ce4: c7 44 24 04 cc 44 00 movl $0x44cc,0x4(%esp)
ceb: 00
cec: 89 04 24 mov %eax,(%esp)
cef: e8 2c 31 00 00 call 3e20 <printf>
exit();
cf4: e8 cc 2f 00 00 call 3cc5 <exit>
n = 0;
for(;;){
i = read(fd, buf, 512);
if(i == 0){
if(n == MAXFILE - 1){
printf(stdout, "read only %d blocks from big", n);
cf9: a1 5c 59 00 00 mov 0x595c,%eax
cfe: c7 44 24 08 8b 00 00 movl $0x8b,0x8(%esp)
d05: 00
d06: c7 44 24 04 af 44 00 movl $0x44af,0x4(%esp)
d0d: 00
d0e: 89 04 24 mov %eax,(%esp)
d11: e8 0a 31 00 00 call 3e20 <printf>
exit();
d16: e8 aa 2f 00 00 call 3cc5 <exit>
close(fd);
fd = open("big", O_RDONLY);
if(fd < 0){
printf(stdout, "error: open big failed!\n");
d1b: a1 5c 59 00 00 mov 0x595c,%eax
d20: c7 44 24 04 96 44 00 movl $0x4496,0x4(%esp)
d27: 00
d28: 89 04 24 mov %eax,(%esp)
d2b: e8 f0 30 00 00 call 3e20 <printf>
exit();
d30: e8 90 2f 00 00 call 3cc5 <exit>
printf(stdout, "big files test\n");
fd = open("big", O_CREATE|O_RDWR);
if(fd < 0){
printf(stdout, "error: creat big failed!\n");
d35: a1 5c 59 00 00 mov 0x595c,%eax
d3a: c7 44 24 04 5e 44 00 movl $0x445e,0x4(%esp)
d41: 00
d42: 89 04 24 mov %eax,(%esp)
d45: e8 d6 30 00 00 call 3e20 <printf>
exit();
d4a: e8 76 2f 00 00 call 3cc5 <exit>
}
n++;
}
close(fd);
if(unlink("big") < 0){
printf(stdout, "unlink big failed\n");
d4f: a1 5c 59 00 00 mov 0x595c,%eax
d54: c7 44 24 04 dc 44 00 movl $0x44dc,0x4(%esp)
d5b: 00
d5c: 89 04 24 mov %eax,(%esp)
d5f: e8 bc 30 00 00 call 3e20 <printf>
exit();
d64: e8 5c 2f 00 00 call 3cc5 <exit>
d69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d70 <writetest>:
printf(stdout, "open test ok\n");
}
void
writetest(void)
{
d70: 55 push %ebp
d71: 89 e5 mov %esp,%ebp
d73: 56 push %esi
d74: 53 push %ebx
d75: 83 ec 10 sub $0x10,%esp
int fd;
int i;
printf(stdout, "small file test\n");
d78: a1 5c 59 00 00 mov 0x595c,%eax
d7d: c7 44 24 04 fd 44 00 movl $0x44fd,0x4(%esp)
d84: 00
d85: 89 04 24 mov %eax,(%esp)
d88: e8 93 30 00 00 call 3e20 <printf>
fd = open("small", O_CREATE|O_RDWR);
d8d: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
d94: 00
d95: c7 04 24 0e 45 00 00 movl $0x450e,(%esp)
d9c: e8 64 2f 00 00 call 3d05 <open>
if(fd >= 0){
da1: 85 c0 test %eax,%eax
{
int fd;
int i;
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
da3: 89 c6 mov %eax,%esi
if(fd >= 0){
da5: 0f 88 b1 01 00 00 js f5c <writetest+0x1ec>
printf(stdout, "creat small succeeded; ok\n");
dab: a1 5c 59 00 00 mov 0x595c,%eax
db0: 31 db xor %ebx,%ebx
db2: c7 44 24 04 14 45 00 movl $0x4514,0x4(%esp)
db9: 00
dba: 89 04 24 mov %eax,(%esp)
dbd: e8 5e 30 00 00 call 3e20 <printf>
dc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
dc8: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
dcf: 00
dd0: c7 44 24 04 4b 45 00 movl $0x454b,0x4(%esp)
dd7: 00
dd8: 89 34 24 mov %esi,(%esp)
ddb: e8 05 2f 00 00 call 3ce5 <write>
de0: 83 f8 0a cmp $0xa,%eax
de3: 0f 85 e9 00 00 00 jne ed2 <writetest+0x162>
printf(stdout, "error: write aa %d new file failed\n", i);
exit();
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
de9: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
df0: 00
df1: c7 44 24 04 56 45 00 movl $0x4556,0x4(%esp)
df8: 00
df9: 89 34 24 mov %esi,(%esp)
dfc: e8 e4 2e 00 00 call 3ce5 <write>
e01: 83 f8 0a cmp $0xa,%eax
e04: 0f 85 e6 00 00 00 jne ef0 <writetest+0x180>
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
e0a: 83 c3 01 add $0x1,%ebx
e0d: 83 fb 64 cmp $0x64,%ebx
e10: 75 b6 jne dc8 <writetest+0x58>
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
exit();
}
}
printf(stdout, "writes ok\n");
e12: a1 5c 59 00 00 mov 0x595c,%eax
e17: c7 44 24 04 61 45 00 movl $0x4561,0x4(%esp)
e1e: 00
e1f: 89 04 24 mov %eax,(%esp)
e22: e8 f9 2f 00 00 call 3e20 <printf>
close(fd);
e27: 89 34 24 mov %esi,(%esp)
e2a: e8 be 2e 00 00 call 3ced <close>
fd = open("small", O_RDONLY);
e2f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
e36: 00
e37: c7 04 24 0e 45 00 00 movl $0x450e,(%esp)
e3e: e8 c2 2e 00 00 call 3d05 <open>
if(fd >= 0){
e43: 85 c0 test %eax,%eax
exit();
}
}
printf(stdout, "writes ok\n");
close(fd);
fd = open("small", O_RDONLY);
e45: 89 c3 mov %eax,%ebx
if(fd >= 0){
e47: 0f 88 c1 00 00 00 js f0e <writetest+0x19e>
printf(stdout, "open small succeeded ok\n");
e4d: a1 5c 59 00 00 mov 0x595c,%eax
e52: c7 44 24 04 6c 45 00 movl $0x456c,0x4(%esp)
e59: 00
e5a: 89 04 24 mov %eax,(%esp)
e5d: e8 be 2f 00 00 call 3e20 <printf>
} else {
printf(stdout, "error: open small failed!\n");
exit();
}
i = read(fd, buf, 2000);
e62: c7 44 24 08 d0 07 00 movl $0x7d0,0x8(%esp)
e69: 00
e6a: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
e71: 00
e72: 89 1c 24 mov %ebx,(%esp)
e75: e8 63 2e 00 00 call 3cdd <read>
if(i == 2000){
e7a: 3d d0 07 00 00 cmp $0x7d0,%eax
e7f: 0f 85 a3 00 00 00 jne f28 <writetest+0x1b8>
printf(stdout, "read succeeded ok\n");
e85: a1 5c 59 00 00 mov 0x595c,%eax
e8a: c7 44 24 04 a0 45 00 movl $0x45a0,0x4(%esp)
e91: 00
e92: 89 04 24 mov %eax,(%esp)
e95: e8 86 2f 00 00 call 3e20 <printf>
} else {
printf(stdout, "read failed\n");
exit();
}
close(fd);
e9a: 89 1c 24 mov %ebx,(%esp)
e9d: e8 4b 2e 00 00 call 3ced <close>
if(unlink("small") < 0){
ea2: c7 04 24 0e 45 00 00 movl $0x450e,(%esp)
ea9: e8 67 2e 00 00 call 3d15 <unlink>
eae: 85 c0 test %eax,%eax
eb0: 0f 88 8c 00 00 00 js f42 <writetest+0x1d2>
printf(stdout, "unlink small failed\n");
exit();
}
printf(stdout, "small file test ok\n");
eb6: a1 5c 59 00 00 mov 0x595c,%eax
ebb: c7 44 24 04 c8 45 00 movl $0x45c8,0x4(%esp)
ec2: 00
ec3: 89 04 24 mov %eax,(%esp)
ec6: e8 55 2f 00 00 call 3e20 <printf>
}
ecb: 83 c4 10 add $0x10,%esp
ece: 5b pop %ebx
ecf: 5e pop %esi
ed0: 5d pop %ebp
ed1: c3 ret
printf(stdout, "error: creat small failed!\n");
exit();
}
for(i = 0; i < 100; i++){
if(write(fd, "aaaaaaaaaa", 10) != 10){
printf(stdout, "error: write aa %d new file failed\n", i);
ed2: a1 5c 59 00 00 mov 0x595c,%eax
ed7: 89 5c 24 08 mov %ebx,0x8(%esp)
edb: c7 44 24 04 b8 52 00 movl $0x52b8,0x4(%esp)
ee2: 00
ee3: 89 04 24 mov %eax,(%esp)
ee6: e8 35 2f 00 00 call 3e20 <printf>
exit();
eeb: e8 d5 2d 00 00 call 3cc5 <exit>
}
if(write(fd, "bbbbbbbbbb", 10) != 10){
printf(stdout, "error: write bb %d new file failed\n", i);
ef0: a1 5c 59 00 00 mov 0x595c,%eax
ef5: 89 5c 24 08 mov %ebx,0x8(%esp)
ef9: c7 44 24 04 dc 52 00 movl $0x52dc,0x4(%esp)
f00: 00
f01: 89 04 24 mov %eax,(%esp)
f04: e8 17 2f 00 00 call 3e20 <printf>
exit();
f09: e8 b7 2d 00 00 call 3cc5 <exit>
close(fd);
fd = open("small", O_RDONLY);
if(fd >= 0){
printf(stdout, "open small succeeded ok\n");
} else {
printf(stdout, "error: open small failed!\n");
f0e: a1 5c 59 00 00 mov 0x595c,%eax
f13: c7 44 24 04 85 45 00 movl $0x4585,0x4(%esp)
f1a: 00
f1b: 89 04 24 mov %eax,(%esp)
f1e: e8 fd 2e 00 00 call 3e20 <printf>
exit();
f23: e8 9d 2d 00 00 call 3cc5 <exit>
}
i = read(fd, buf, 2000);
if(i == 2000){
printf(stdout, "read succeeded ok\n");
} else {
printf(stdout, "read failed\n");
f28: a1 5c 59 00 00 mov 0x595c,%eax
f2d: c7 44 24 04 7c 43 00 movl $0x437c,0x4(%esp)
f34: 00
f35: 89 04 24 mov %eax,(%esp)
f38: e8 e3 2e 00 00 call 3e20 <printf>
exit();
f3d: e8 83 2d 00 00 call 3cc5 <exit>
}
close(fd);
if(unlink("small") < 0){
printf(stdout, "unlink small failed\n");
f42: a1 5c 59 00 00 mov 0x595c,%eax
f47: c7 44 24 04 b3 45 00 movl $0x45b3,0x4(%esp)
f4e: 00
f4f: 89 04 24 mov %eax,(%esp)
f52: e8 c9 2e 00 00 call 3e20 <printf>
exit();
f57: e8 69 2d 00 00 call 3cc5 <exit>
printf(stdout, "small file test\n");
fd = open("small", O_CREATE|O_RDWR);
if(fd >= 0){
printf(stdout, "creat small succeeded; ok\n");
} else {
printf(stdout, "error: creat small failed!\n");
f5c: a1 5c 59 00 00 mov 0x595c,%eax
f61: c7 44 24 04 2f 45 00 movl $0x452f,0x4(%esp)
f68: 00
f69: 89 04 24 mov %eax,(%esp)
f6c: e8 af 2e 00 00 call 3e20 <printf>
exit();
f71: e8 4f 2d 00 00 call 3cc5 <exit>
f76: 8d 76 00 lea 0x0(%esi),%esi
f79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000f80 <bigargtest>:
// does exec return an error if the arguments
// are larger than a page? or does it write
// below the stack and wreck the instructions/data?
void
bigargtest(void)
{
f80: 55 push %ebp
f81: 89 e5 mov %esp,%ebp
f83: 83 ec 18 sub $0x18,%esp
int pid, fd;
unlink("bigarg-ok");
f86: c7 04 24 dc 45 00 00 movl $0x45dc,(%esp)
f8d: e8 83 2d 00 00 call 3d15 <unlink>
pid = fork();
f92: e8 26 2d 00 00 call 3cbd <fork>
if(pid == 0){
f97: 83 f8 00 cmp $0x0,%eax
f9a: 74 44 je fe0 <bigargtest+0x60>
f9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exec("echo", args);
printf(stdout, "bigarg test ok\n");
fd = open("bigarg-ok", O_CREATE);
close(fd);
exit();
} else if(pid < 0){
fa0: 0f 8c d0 00 00 00 jl 1076 <bigargtest+0xf6>
fa6: 66 90 xchg %ax,%ax
printf(stdout, "bigargtest: fork failed\n");
exit();
}
wait();
fa8: e8 20 2d 00 00 call 3ccd <wait>
fd = open("bigarg-ok", 0);
fad: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
fb4: 00
fb5: c7 04 24 dc 45 00 00 movl $0x45dc,(%esp)
fbc: e8 44 2d 00 00 call 3d05 <open>
if(fd < 0){
fc1: 85 c0 test %eax,%eax
fc3: 0f 88 93 00 00 00 js 105c <bigargtest+0xdc>
printf(stdout, "bigarg test failed!\n");
exit();
}
close(fd);
fc9: 89 04 24 mov %eax,(%esp)
fcc: e8 1c 2d 00 00 call 3ced <close>
unlink("bigarg-ok");
fd1: c7 04 24 dc 45 00 00 movl $0x45dc,(%esp)
fd8: e8 38 2d 00 00 call 3d15 <unlink>
}
fdd: c9 leave
fde: c3 ret
fdf: 90 nop
pid = fork();
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
args[i] = "bigargs test: failed\n ";
fe0: c7 04 85 80 59 00 00 movl $0x5300,0x5980(,%eax,4)
fe7: 00 53 00 00
unlink("bigarg-ok");
pid = fork();
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
feb: 83 c0 01 add $0x1,%eax
fee: 83 f8 1f cmp $0x1f,%eax
ff1: 75 ed jne fe0 <bigargtest+0x60>
args[i] = "bigargs test: failed\n ";
args[MAXARG-1] = 0;
printf(stdout, "bigarg test\n");
ff3: a1 5c 59 00 00 mov 0x595c,%eax
if(pid == 0){
static char *args[MAXARG];
int i;
for(i = 0; i < MAXARG-1; i++)
args[i] = "bigargs test: failed\n ";
args[MAXARG-1] = 0;
ff8: c7 05 fc 59 00 00 00 movl $0x0,0x59fc
fff: 00 00 00
printf(stdout, "bigarg test\n");
1002: c7 44 24 04 e6 45 00 movl $0x45e6,0x4(%esp)
1009: 00
100a: 89 04 24 mov %eax,(%esp)
100d: e8 0e 2e 00 00 call 3e20 <printf>
exec("echo", args);
1012: c7 44 24 04 80 59 00 movl $0x5980,0x4(%esp)
1019: 00
101a: c7 04 24 cb 41 00 00 movl $0x41cb,(%esp)
1021: e8 d7 2c 00 00 call 3cfd <exec>
printf(stdout, "bigarg test ok\n");
1026: a1 5c 59 00 00 mov 0x595c,%eax
102b: c7 44 24 04 f3 45 00 movl $0x45f3,0x4(%esp)
1032: 00
1033: 89 04 24 mov %eax,(%esp)
1036: e8 e5 2d 00 00 call 3e20 <printf>
fd = open("bigarg-ok", O_CREATE);
103b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
1042: 00
1043: c7 04 24 dc 45 00 00 movl $0x45dc,(%esp)
104a: e8 b6 2c 00 00 call 3d05 <open>
close(fd);
104f: 89 04 24 mov %eax,(%esp)
1052: e8 96 2c 00 00 call 3ced <close>
exit();
1057: e8 69 2c 00 00 call 3cc5 <exit>
exit();
}
wait();
fd = open("bigarg-ok", 0);
if(fd < 0){
printf(stdout, "bigarg test failed!\n");
105c: a1 5c 59 00 00 mov 0x595c,%eax
1061: c7 44 24 04 1c 46 00 movl $0x461c,0x4(%esp)
1068: 00
1069: 89 04 24 mov %eax,(%esp)
106c: e8 af 2d 00 00 call 3e20 <printf>
exit();
1071: e8 4f 2c 00 00 call 3cc5 <exit>
printf(stdout, "bigarg test ok\n");
fd = open("bigarg-ok", O_CREATE);
close(fd);
exit();
} else if(pid < 0){
printf(stdout, "bigargtest: fork failed\n");
1076: a1 5c 59 00 00 mov 0x595c,%eax
107b: c7 44 24 04 03 46 00 movl $0x4603,0x4(%esp)
1082: 00
1083: 89 04 24 mov %eax,(%esp)
1086: e8 95 2d 00 00 call 3e20 <printf>
exit();
108b: e8 35 2c 00 00 call 3cc5 <exit>
00001090 <exectest>:
printf(stdout, "mkdir test ok\n");
}
void
exectest(void)
{
1090: 55 push %ebp
1091: 89 e5 mov %esp,%ebp
1093: 83 ec 18 sub $0x18,%esp
printf(stdout, "exec test\n");
1096: a1 5c 59 00 00 mov 0x595c,%eax
109b: c7 44 24 04 31 46 00 movl $0x4631,0x4(%esp)
10a2: 00
10a3: 89 04 24 mov %eax,(%esp)
10a6: e8 75 2d 00 00 call 3e20 <printf>
if(exec("echo", echoargv) < 0){
10ab: c7 44 24 04 48 59 00 movl $0x5948,0x4(%esp)
10b2: 00
10b3: c7 04 24 cb 41 00 00 movl $0x41cb,(%esp)
10ba: e8 3e 2c 00 00 call 3cfd <exec>
10bf: 85 c0 test %eax,%eax
10c1: 78 02 js 10c5 <exectest+0x35>
printf(stdout, "exec echo failed\n");
exit();
}
}
10c3: c9 leave
10c4: c3 ret
void
exectest(void)
{
printf(stdout, "exec test\n");
if(exec("echo", echoargv) < 0){
printf(stdout, "exec echo failed\n");
10c5: a1 5c 59 00 00 mov 0x595c,%eax
10ca: c7 44 24 04 3c 46 00 movl $0x463c,0x4(%esp)
10d1: 00
10d2: 89 04 24 mov %eax,(%esp)
10d5: e8 46 2d 00 00 call 3e20 <printf>
exit();
10da: e8 e6 2b 00 00 call 3cc5 <exit>
10df: 90 nop
000010e0 <validatetest>:
"ebx");
}
void
validatetest(void)
{
10e0: 55 push %ebp
10e1: 89 e5 mov %esp,%ebp
10e3: 56 push %esi
10e4: 53 push %ebx
int hi, pid;
uint p;
printf(stdout, "validate test\n");
10e5: 31 db xor %ebx,%ebx
"ebx");
}
void
validatetest(void)
{
10e7: 83 ec 10 sub $0x10,%esp
int hi, pid;
uint p;
printf(stdout, "validate test\n");
10ea: a1 5c 59 00 00 mov 0x595c,%eax
10ef: c7 44 24 04 4e 46 00 movl $0x464e,0x4(%esp)
10f6: 00
10f7: 89 04 24 mov %eax,(%esp)
10fa: e8 21 2d 00 00 call 3e20 <printf>
10ff: 90 nop
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){
if((pid = fork()) == 0){
1100: e8 b8 2b 00 00 call 3cbd <fork>
1105: 85 c0 test %eax,%eax
1107: 89 c6 mov %eax,%esi
1109: 74 79 je 1184 <validatetest+0xa4>
// try to crash the kernel by passing in a badly placed integer
validateint((int*)p);
exit();
}
sleep(0);
110b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1112: e8 3e 2c 00 00 call 3d55 <sleep>
sleep(0);
1117: c7 04 24 00 00 00 00 movl $0x0,(%esp)
111e: e8 32 2c 00 00 call 3d55 <sleep>
kill(pid);
1123: 89 34 24 mov %esi,(%esp)
1126: e8 ca 2b 00 00 call 3cf5 <kill>
wait();
112b: e8 9d 2b 00 00 call 3ccd <wait>
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
1130: 89 5c 24 04 mov %ebx,0x4(%esp)
1134: c7 04 24 5d 46 00 00 movl $0x465d,(%esp)
113b: e8 e5 2b 00 00 call 3d25 <link>
1140: 83 f8 ff cmp $0xffffffff,%eax
1143: 75 2a jne 116f <validatetest+0x8f>
uint p;
printf(stdout, "validate test\n");
hi = 1100*1024;
for(p = 0; p <= (uint)hi; p += 4096){
1145: 81 c3 00 10 00 00 add $0x1000,%ebx
114b: 81 fb 00 40 11 00 cmp $0x114000,%ebx
1151: 75 ad jne 1100 <validatetest+0x20>
printf(stdout, "link should not succeed\n");
exit();
}
}
printf(stdout, "validate ok\n");
1153: a1 5c 59 00 00 mov 0x595c,%eax
1158: c7 44 24 04 81 46 00 movl $0x4681,0x4(%esp)
115f: 00
1160: 89 04 24 mov %eax,(%esp)
1163: e8 b8 2c 00 00 call 3e20 <printf>
}
1168: 83 c4 10 add $0x10,%esp
116b: 5b pop %ebx
116c: 5e pop %esi
116d: 5d pop %ebp
116e: c3 ret
kill(pid);
wait();
// try to crash the kernel by passing in a bad string pointer
if(link("nosuchfile", (char*)p) != -1){
printf(stdout, "link should not succeed\n");
116f: a1 5c 59 00 00 mov 0x595c,%eax
1174: c7 44 24 04 68 46 00 movl $0x4668,0x4(%esp)
117b: 00
117c: 89 04 24 mov %eax,(%esp)
117f: e8 9c 2c 00 00 call 3e20 <printf>
exit();
1184: e8 3c 2b 00 00 call 3cc5 <exit>
1189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001190 <bigdir>:
}
// directory that uses indirect blocks
void
bigdir(void)
{
1190: 55 push %ebp
1191: 89 e5 mov %esp,%ebp
1193: 56 push %esi
1194: 53 push %ebx
1195: 83 ec 20 sub $0x20,%esp
int i, fd;
char name[10];
printf(1, "bigdir test\n");
1198: c7 44 24 04 8e 46 00 movl $0x468e,0x4(%esp)
119f: 00
11a0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
11a7: e8 74 2c 00 00 call 3e20 <printf>
unlink("bd");
11ac: c7 04 24 9b 46 00 00 movl $0x469b,(%esp)
11b3: e8 5d 2b 00 00 call 3d15 <unlink>
fd = open("bd", O_CREATE);
11b8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
11bf: 00
11c0: c7 04 24 9b 46 00 00 movl $0x469b,(%esp)
11c7: e8 39 2b 00 00 call 3d05 <open>
if(fd < 0){
11cc: 85 c0 test %eax,%eax
11ce: 0f 88 e6 00 00 00 js 12ba <bigdir+0x12a>
printf(1, "bigdir create failed\n");
exit();
}
close(fd);
11d4: 89 04 24 mov %eax,(%esp)
11d7: 31 db xor %ebx,%ebx
11d9: e8 0f 2b 00 00 call 3ced <close>
11de: 8d 75 ee lea -0x12(%ebp),%esi
11e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 500; i++){
name[0] = 'x';
name[1] = '0' + (i / 64);
11e8: 89 d8 mov %ebx,%eax
11ea: c1 f8 06 sar $0x6,%eax
11ed: 83 c0 30 add $0x30,%eax
11f0: 88 45 ef mov %al,-0x11(%ebp)
name[2] = '0' + (i % 64);
11f3: 89 d8 mov %ebx,%eax
11f5: 83 e0 3f and $0x3f,%eax
11f8: 83 c0 30 add $0x30,%eax
exit();
}
close(fd);
for(i = 0; i < 500; i++){
name[0] = 'x';
11fb: c6 45 ee 78 movb $0x78,-0x12(%ebp)
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
11ff: 88 45 f0 mov %al,-0x10(%ebp)
name[3] = '\0';
1202: c6 45 f1 00 movb $0x0,-0xf(%ebp)
if(link("bd", name) != 0){
1206: 89 74 24 04 mov %esi,0x4(%esp)
120a: c7 04 24 9b 46 00 00 movl $0x469b,(%esp)
1211: e8 0f 2b 00 00 call 3d25 <link>
1216: 85 c0 test %eax,%eax
1218: 75 6e jne 1288 <bigdir+0xf8>
printf(1, "bigdir create failed\n");
exit();
}
close(fd);
for(i = 0; i < 500; i++){
121a: 83 c3 01 add $0x1,%ebx
121d: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
1223: 75 c3 jne 11e8 <bigdir+0x58>
printf(1, "bigdir link failed\n");
exit();
}
}
unlink("bd");
1225: c7 04 24 9b 46 00 00 movl $0x469b,(%esp)
122c: 66 31 db xor %bx,%bx
122f: e8 e1 2a 00 00 call 3d15 <unlink>
1234: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 500; i++){
name[0] = 'x';
name[1] = '0' + (i / 64);
1238: 89 d8 mov %ebx,%eax
123a: c1 f8 06 sar $0x6,%eax
123d: 83 c0 30 add $0x30,%eax
1240: 88 45 ef mov %al,-0x11(%ebp)
name[2] = '0' + (i % 64);
1243: 89 d8 mov %ebx,%eax
1245: 83 e0 3f and $0x3f,%eax
1248: 83 c0 30 add $0x30,%eax
}
}
unlink("bd");
for(i = 0; i < 500; i++){
name[0] = 'x';
124b: c6 45 ee 78 movb $0x78,-0x12(%ebp)
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
124f: 88 45 f0 mov %al,-0x10(%ebp)
name[3] = '\0';
1252: c6 45 f1 00 movb $0x0,-0xf(%ebp)
if(unlink(name) != 0){
1256: 89 34 24 mov %esi,(%esp)
1259: e8 b7 2a 00 00 call 3d15 <unlink>
125e: 85 c0 test %eax,%eax
1260: 75 3f jne 12a1 <bigdir+0x111>
exit();
}
}
unlink("bd");
for(i = 0; i < 500; i++){
1262: 83 c3 01 add $0x1,%ebx
1265: 81 fb f4 01 00 00 cmp $0x1f4,%ebx
126b: 75 cb jne 1238 <bigdir+0xa8>
printf(1, "bigdir unlink failed");
exit();
}
}
printf(1, "bigdir ok\n");
126d: c7 44 24 04 dd 46 00 movl $0x46dd,0x4(%esp)
1274: 00
1275: c7 04 24 01 00 00 00 movl $0x1,(%esp)
127c: e8 9f 2b 00 00 call 3e20 <printf>
}
1281: 83 c4 20 add $0x20,%esp
1284: 5b pop %ebx
1285: 5e pop %esi
1286: 5d pop %ebp
1287: c3 ret
name[0] = 'x';
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
name[3] = '\0';
if(link("bd", name) != 0){
printf(1, "bigdir link failed\n");
1288: c7 44 24 04 b4 46 00 movl $0x46b4,0x4(%esp)
128f: 00
1290: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1297: e8 84 2b 00 00 call 3e20 <printf>
exit();
129c: e8 24 2a 00 00 call 3cc5 <exit>
name[0] = 'x';
name[1] = '0' + (i / 64);
name[2] = '0' + (i % 64);
name[3] = '\0';
if(unlink(name) != 0){
printf(1, "bigdir unlink failed");
12a1: c7 44 24 04 c8 46 00 movl $0x46c8,0x4(%esp)
12a8: 00
12a9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12b0: e8 6b 2b 00 00 call 3e20 <printf>
exit();
12b5: e8 0b 2a 00 00 call 3cc5 <exit>
printf(1, "bigdir test\n");
unlink("bd");
fd = open("bd", O_CREATE);
if(fd < 0){
printf(1, "bigdir create failed\n");
12ba: c7 44 24 04 9e 46 00 movl $0x469e,0x4(%esp)
12c1: 00
12c2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12c9: e8 52 2b 00 00 call 3e20 <printf>
exit();
12ce: e8 f2 29 00 00 call 3cc5 <exit>
12d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000012e0 <linkunlink>:
// another concurrent link/unlink/create test,
// to look for deadlocks.
void
linkunlink()
{
12e0: 55 push %ebp
12e1: 89 e5 mov %esp,%ebp
12e3: 57 push %edi
12e4: 56 push %esi
12e5: 53 push %ebx
12e6: 83 ec 2c sub $0x2c,%esp
int pid, i;
printf(1, "linkunlink test\n");
12e9: c7 44 24 04 e8 46 00 movl $0x46e8,0x4(%esp)
12f0: 00
12f1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
12f8: e8 23 2b 00 00 call 3e20 <printf>
unlink("x");
12fd: c7 04 24 c5 4d 00 00 movl $0x4dc5,(%esp)
1304: e8 0c 2a 00 00 call 3d15 <unlink>
pid = fork();
1309: e8 af 29 00 00 call 3cbd <fork>
if(pid < 0){
130e: 85 c0 test %eax,%eax
int pid, i;
printf(1, "linkunlink test\n");
unlink("x");
pid = fork();
1310: 89 45 e4 mov %eax,-0x1c(%ebp)
if(pid < 0){
1313: 0f 88 b8 00 00 00 js 13d1 <linkunlink+0xf1>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
1319: 83 7d e4 01 cmpl $0x1,-0x1c(%ebp)
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
131d: bf ab aa aa aa mov $0xaaaaaaab,%edi
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
1322: 19 db sbb %ebx,%ebx
1324: 31 f6 xor %esi,%esi
1326: 83 e3 60 and $0x60,%ebx
1329: 83 c3 01 add $0x1,%ebx
132c: eb 1f jmp 134d <linkunlink+0x6d>
132e: 66 90 xchg %ax,%ax
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
} else if((x % 3) == 1){
1330: 83 f8 01 cmp $0x1,%eax
1333: 0f 84 7f 00 00 00 je 13b8 <linkunlink+0xd8>
link("cat", "x");
} else {
unlink("x");
1339: c7 04 24 c5 4d 00 00 movl $0x4dc5,(%esp)
1340: e8 d0 29 00 00 call 3d15 <unlink>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1345: 83 c6 01 add $0x1,%esi
1348: 83 fe 64 cmp $0x64,%esi
134b: 74 3f je 138c <linkunlink+0xac>
x = x * 1103515245 + 12345;
134d: 69 db 6d 4e c6 41 imul $0x41c64e6d,%ebx,%ebx
1353: 81 c3 39 30 00 00 add $0x3039,%ebx
if((x % 3) == 0){
1359: 89 d8 mov %ebx,%eax
135b: f7 e7 mul %edi
135d: 89 d8 mov %ebx,%eax
135f: d1 ea shr %edx
1361: 8d 14 52 lea (%edx,%edx,2),%edx
1364: 29 d0 sub %edx,%eax
1366: 75 c8 jne 1330 <linkunlink+0x50>
close(open("x", O_RDWR | O_CREATE));
1368: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
136f: 00
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1370: 83 c6 01 add $0x1,%esi
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
1373: c7 04 24 c5 4d 00 00 movl $0x4dc5,(%esp)
137a: e8 86 29 00 00 call 3d05 <open>
137f: 89 04 24 mov %eax,(%esp)
1382: e8 66 29 00 00 call 3ced <close>
printf(1, "fork failed\n");
exit();
}
unsigned int x = (pid ? 1 : 97);
for(i = 0; i < 100; i++){
1387: 83 fe 64 cmp $0x64,%esi
138a: 75 c1 jne 134d <linkunlink+0x6d>
} else {
unlink("x");
}
}
if(pid)
138c: 8b 45 e4 mov -0x1c(%ebp),%eax
138f: 85 c0 test %eax,%eax
1391: 74 57 je 13ea <linkunlink+0x10a>
wait();
1393: e8 35 29 00 00 call 3ccd <wait>
else
exit();
printf(1, "linkunlink ok\n");
1398: c7 44 24 04 fd 46 00 movl $0x46fd,0x4(%esp)
139f: 00
13a0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
13a7: e8 74 2a 00 00 call 3e20 <printf>
}
13ac: 83 c4 2c add $0x2c,%esp
13af: 5b pop %ebx
13b0: 5e pop %esi
13b1: 5f pop %edi
13b2: 5d pop %ebp
13b3: c3 ret
13b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 100; i++){
x = x * 1103515245 + 12345;
if((x % 3) == 0){
close(open("x", O_RDWR | O_CREATE));
} else if((x % 3) == 1){
link("cat", "x");
13b8: c7 44 24 04 c5 4d 00 movl $0x4dc5,0x4(%esp)
13bf: 00
13c0: c7 04 24 f9 46 00 00 movl $0x46f9,(%esp)
13c7: e8 59 29 00 00 call 3d25 <link>
13cc: e9 74 ff ff ff jmp 1345 <linkunlink+0x65>
printf(1, "linkunlink test\n");
unlink("x");
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
13d1: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
13d8: 00
13d9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
13e0: e8 3b 2a 00 00 call 3e20 <printf>
exit();
13e5: e8 db 28 00 00 call 3cc5 <exit>
}
if(pid)
wait();
else
exit();
13ea: e8 d6 28 00 00 call 3cc5 <exit>
13ef: 90 nop
000013f0 <linktest>:
printf(1, "unlinkread ok\n");
}
void
linktest(void)
{
13f0: 55 push %ebp
13f1: 89 e5 mov %esp,%ebp
13f3: 53 push %ebx
13f4: 83 ec 14 sub $0x14,%esp
int fd;
printf(1, "linktest\n");
13f7: c7 44 24 04 0c 47 00 movl $0x470c,0x4(%esp)
13fe: 00
13ff: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1406: e8 15 2a 00 00 call 3e20 <printf>
unlink("lf1");
140b: c7 04 24 16 47 00 00 movl $0x4716,(%esp)
1412: e8 fe 28 00 00 call 3d15 <unlink>
unlink("lf2");
1417: c7 04 24 1a 47 00 00 movl $0x471a,(%esp)
141e: e8 f2 28 00 00 call 3d15 <unlink>
fd = open("lf1", O_CREATE|O_RDWR);
1423: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
142a: 00
142b: c7 04 24 16 47 00 00 movl $0x4716,(%esp)
1432: e8 ce 28 00 00 call 3d05 <open>
if(fd < 0){
1437: 85 c0 test %eax,%eax
printf(1, "linktest\n");
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
1439: 89 c3 mov %eax,%ebx
if(fd < 0){
143b: 0f 88 26 01 00 00 js 1567 <linktest+0x177>
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
1441: c7 44 24 08 05 00 00 movl $0x5,0x8(%esp)
1448: 00
1449: c7 44 24 04 89 43 00 movl $0x4389,0x4(%esp)
1450: 00
1451: 89 04 24 mov %eax,(%esp)
1454: e8 8c 28 00 00 call 3ce5 <write>
1459: 83 f8 05 cmp $0x5,%eax
145c: 0f 85 cd 01 00 00 jne 162f <linktest+0x23f>
printf(1, "write lf1 failed\n");
exit();
}
close(fd);
1462: 89 1c 24 mov %ebx,(%esp)
1465: e8 83 28 00 00 call 3ced <close>
if(link("lf1", "lf2") < 0){
146a: c7 44 24 04 1a 47 00 movl $0x471a,0x4(%esp)
1471: 00
1472: c7 04 24 16 47 00 00 movl $0x4716,(%esp)
1479: e8 a7 28 00 00 call 3d25 <link>
147e: 85 c0 test %eax,%eax
1480: 0f 88 90 01 00 00 js 1616 <linktest+0x226>
printf(1, "link lf1 lf2 failed\n");
exit();
}
unlink("lf1");
1486: c7 04 24 16 47 00 00 movl $0x4716,(%esp)
148d: e8 83 28 00 00 call 3d15 <unlink>
if(open("lf1", 0) >= 0){
1492: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1499: 00
149a: c7 04 24 16 47 00 00 movl $0x4716,(%esp)
14a1: e8 5f 28 00 00 call 3d05 <open>
14a6: 85 c0 test %eax,%eax
14a8: 0f 89 4f 01 00 00 jns 15fd <linktest+0x20d>
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
14ae: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
14b5: 00
14b6: c7 04 24 1a 47 00 00 movl $0x471a,(%esp)
14bd: e8 43 28 00 00 call 3d05 <open>
if(fd < 0){
14c2: 85 c0 test %eax,%eax
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
exit();
}
fd = open("lf2", 0);
14c4: 89 c3 mov %eax,%ebx
if(fd < 0){
14c6: 0f 88 18 01 00 00 js 15e4 <linktest+0x1f4>
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
14cc: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
14d3: 00
14d4: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
14db: 00
14dc: 89 04 24 mov %eax,(%esp)
14df: e8 f9 27 00 00 call 3cdd <read>
14e4: 83 f8 05 cmp $0x5,%eax
14e7: 0f 85 de 00 00 00 jne 15cb <linktest+0x1db>
printf(1, "read lf2 failed\n");
exit();
}
close(fd);
14ed: 89 1c 24 mov %ebx,(%esp)
14f0: e8 f8 27 00 00 call 3ced <close>
if(link("lf2", "lf2") >= 0){
14f5: c7 44 24 04 1a 47 00 movl $0x471a,0x4(%esp)
14fc: 00
14fd: c7 04 24 1a 47 00 00 movl $0x471a,(%esp)
1504: e8 1c 28 00 00 call 3d25 <link>
1509: 85 c0 test %eax,%eax
150b: 0f 89 a1 00 00 00 jns 15b2 <linktest+0x1c2>
printf(1, "link lf2 lf2 succeeded! oops\n");
exit();
}
unlink("lf2");
1511: c7 04 24 1a 47 00 00 movl $0x471a,(%esp)
1518: e8 f8 27 00 00 call 3d15 <unlink>
if(link("lf2", "lf1") >= 0){
151d: c7 44 24 04 16 47 00 movl $0x4716,0x4(%esp)
1524: 00
1525: c7 04 24 1a 47 00 00 movl $0x471a,(%esp)
152c: e8 f4 27 00 00 call 3d25 <link>
1531: 85 c0 test %eax,%eax
1533: 79 64 jns 1599 <linktest+0x1a9>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
1535: c7 44 24 04 16 47 00 movl $0x4716,0x4(%esp)
153c: 00
153d: c7 04 24 e2 4c 00 00 movl $0x4ce2,(%esp)
1544: e8 dc 27 00 00 call 3d25 <link>
1549: 85 c0 test %eax,%eax
154b: 79 33 jns 1580 <linktest+0x190>
printf(1, "link . lf1 succeeded! oops\n");
exit();
}
printf(1, "linktest ok\n");
154d: c7 44 24 04 b4 47 00 movl $0x47b4,0x4(%esp)
1554: 00
1555: c7 04 24 01 00 00 00 movl $0x1,(%esp)
155c: e8 bf 28 00 00 call 3e20 <printf>
}
1561: 83 c4 14 add $0x14,%esp
1564: 5b pop %ebx
1565: 5d pop %ebp
1566: c3 ret
unlink("lf1");
unlink("lf2");
fd = open("lf1", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "create lf1 failed\n");
1567: c7 44 24 04 1e 47 00 movl $0x471e,0x4(%esp)
156e: 00
156f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1576: e8 a5 28 00 00 call 3e20 <printf>
exit();
157b: e8 45 27 00 00 call 3cc5 <exit>
printf(1, "link non-existant succeeded! oops\n");
exit();
}
if(link(".", "lf1") >= 0){
printf(1, "link . lf1 succeeded! oops\n");
1580: c7 44 24 04 98 47 00 movl $0x4798,0x4(%esp)
1587: 00
1588: c7 04 24 01 00 00 00 movl $0x1,(%esp)
158f: e8 8c 28 00 00 call 3e20 <printf>
exit();
1594: e8 2c 27 00 00 call 3cc5 <exit>
exit();
}
unlink("lf2");
if(link("lf2", "lf1") >= 0){
printf(1, "link non-existant succeeded! oops\n");
1599: c7 44 24 04 08 54 00 movl $0x5408,0x4(%esp)
15a0: 00
15a1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15a8: e8 73 28 00 00 call 3e20 <printf>
exit();
15ad: e8 13 27 00 00 call 3cc5 <exit>
exit();
}
close(fd);
if(link("lf2", "lf2") >= 0){
printf(1, "link lf2 lf2 succeeded! oops\n");
15b2: c7 44 24 04 7a 47 00 movl $0x477a,0x4(%esp)
15b9: 00
15ba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15c1: e8 5a 28 00 00 call 3e20 <printf>
exit();
15c6: e8 fa 26 00 00 call 3cc5 <exit>
if(fd < 0){
printf(1, "open lf2 failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 5){
printf(1, "read lf2 failed\n");
15cb: c7 44 24 04 69 47 00 movl $0x4769,0x4(%esp)
15d2: 00
15d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15da: e8 41 28 00 00 call 3e20 <printf>
exit();
15df: e8 e1 26 00 00 call 3cc5 <exit>
exit();
}
fd = open("lf2", 0);
if(fd < 0){
printf(1, "open lf2 failed\n");
15e4: c7 44 24 04 58 47 00 movl $0x4758,0x4(%esp)
15eb: 00
15ec: c7 04 24 01 00 00 00 movl $0x1,(%esp)
15f3: e8 28 28 00 00 call 3e20 <printf>
exit();
15f8: e8 c8 26 00 00 call 3cc5 <exit>
exit();
}
unlink("lf1");
if(open("lf1", 0) >= 0){
printf(1, "unlinked lf1 but it is still there!\n");
15fd: c7 44 24 04 e0 53 00 movl $0x53e0,0x4(%esp)
1604: 00
1605: c7 04 24 01 00 00 00 movl $0x1,(%esp)
160c: e8 0f 28 00 00 call 3e20 <printf>
exit();
1611: e8 af 26 00 00 call 3cc5 <exit>
exit();
}
close(fd);
if(link("lf1", "lf2") < 0){
printf(1, "link lf1 lf2 failed\n");
1616: c7 44 24 04 43 47 00 movl $0x4743,0x4(%esp)
161d: 00
161e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1625: e8 f6 27 00 00 call 3e20 <printf>
exit();
162a: e8 96 26 00 00 call 3cc5 <exit>
if(fd < 0){
printf(1, "create lf1 failed\n");
exit();
}
if(write(fd, "hello", 5) != 5){
printf(1, "write lf1 failed\n");
162f: c7 44 24 04 31 47 00 movl $0x4731,0x4(%esp)
1636: 00
1637: c7 04 24 01 00 00 00 movl $0x1,(%esp)
163e: e8 dd 27 00 00 call 3e20 <printf>
exit();
1643: e8 7d 26 00 00 call 3cc5 <exit>
1648: 90 nop
1649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00001650 <sbrktest>:
printf(1, "fork test OK\n");
}
void
sbrktest(void)
{
1650: 55 push %ebp
1651: 89 e5 mov %esp,%ebp
1653: 57 push %edi
1654: 56 push %esi
printf(stdout, "sbrk test\n");
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
1655: 31 f6 xor %esi,%esi
printf(1, "fork test OK\n");
}
void
sbrktest(void)
{
1657: 53 push %ebx
1658: 83 ec 7c sub $0x7c,%esp
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(stdout, "sbrk test\n");
165b: a1 5c 59 00 00 mov 0x595c,%eax
1660: c7 44 24 04 c1 47 00 movl $0x47c1,0x4(%esp)
1667: 00
1668: 89 04 24 mov %eax,(%esp)
166b: e8 b0 27 00 00 call 3e20 <printf>
oldbrk = sbrk(0);
1670: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1677: e8 d1 26 00 00 call 3d4d <sbrk>
// can one sbrk() less than a page?
a = sbrk(0);
167c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
int fds[2], pid, pids[10], ppid;
char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch;
uint amt;
printf(stdout, "sbrk test\n");
oldbrk = sbrk(0);
1683: 89 45 a4 mov %eax,-0x5c(%ebp)
// can one sbrk() less than a page?
a = sbrk(0);
1686: e8 c2 26 00 00 call 3d4d <sbrk>
168b: 89 c3 mov %eax,%ebx
168d: 8d 76 00 lea 0x0(%esi),%esi
int i;
for(i = 0; i < 5000; i++){
b = sbrk(1);
1690: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1697: e8 b1 26 00 00 call 3d4d <sbrk>
if(b != a){
169c: 39 c3 cmp %eax,%ebx
169e: 0f 85 8a 02 00 00 jne 192e <sbrktest+0x2de>
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
16a4: 83 c6 01 add $0x1,%esi
b = sbrk(1);
if(b != a){
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
exit();
}
*b = 1;
16a7: c6 03 01 movb $0x1,(%ebx)
a = b + 1;
16aa: 83 c3 01 add $0x1,%ebx
oldbrk = sbrk(0);
// can one sbrk() less than a page?
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
16ad: 81 fe 88 13 00 00 cmp $0x1388,%esi
16b3: 75 db jne 1690 <sbrktest+0x40>
exit();
}
*b = 1;
a = b + 1;
}
pid = fork();
16b5: e8 03 26 00 00 call 3cbd <fork>
if(pid < 0){
16ba: 85 c0 test %eax,%eax
exit();
}
*b = 1;
a = b + 1;
}
pid = fork();
16bc: 89 c6 mov %eax,%esi
if(pid < 0){
16be: 0f 88 d8 03 00 00 js 1a9c <sbrktest+0x44c>
printf(stdout, "sbrk test fork failed\n");
exit();
}
c = sbrk(1);
16c4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c = sbrk(1);
if(c != a + 1){
16cb: 83 c3 01 add $0x1,%ebx
pid = fork();
if(pid < 0){
printf(stdout, "sbrk test fork failed\n");
exit();
}
c = sbrk(1);
16ce: e8 7a 26 00 00 call 3d4d <sbrk>
c = sbrk(1);
16d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
16da: e8 6e 26 00 00 call 3d4d <sbrk>
if(c != a + 1){
16df: 39 d8 cmp %ebx,%eax
16e1: 0f 85 9b 03 00 00 jne 1a82 <sbrktest+0x432>
printf(stdout, "sbrk test failed post-fork\n");
exit();
}
if(pid == 0)
16e7: 85 f6 test %esi,%esi
16e9: 0f 84 8e 03 00 00 je 1a7d <sbrktest+0x42d>
16ef: 90 nop
exit();
wait();
16f0: e8 d8 25 00 00 call 3ccd <wait>
// can one grow address space to something big?
#define BIG (100*1024*1024)
a = sbrk(0);
16f5: c7 04 24 00 00 00 00 movl $0x0,(%esp)
16fc: e8 4c 26 00 00 call 3d4d <sbrk>
1701: 89 c3 mov %eax,%ebx
amt = (BIG) - (uint)a;
p = sbrk(amt);
1703: b8 00 00 40 06 mov $0x6400000,%eax
1708: 29 d8 sub %ebx,%eax
170a: 89 04 24 mov %eax,(%esp)
170d: e8 3b 26 00 00 call 3d4d <sbrk>
if (p != a) {
1712: 39 c3 cmp %eax,%ebx
1714: 0f 85 4e 03 00 00 jne 1a68 <sbrktest+0x418>
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
exit();
}
lastaddr = (char*) (BIG-1);
*lastaddr = 99;
171a: c6 05 ff ff 3f 06 63 movb $0x63,0x63fffff
// can one de-allocate?
a = sbrk(0);
1721: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1728: e8 20 26 00 00 call 3d4d <sbrk>
c = sbrk(-4096);
172d: c7 04 24 00 f0 ff ff movl $0xfffff000,(%esp)
}
lastaddr = (char*) (BIG-1);
*lastaddr = 99;
// can one de-allocate?
a = sbrk(0);
1734: 89 c3 mov %eax,%ebx
c = sbrk(-4096);
1736: e8 12 26 00 00 call 3d4d <sbrk>
if(c == (char*)0xffffffff){
173b: 83 f8 ff cmp $0xffffffff,%eax
173e: 0f 84 0a 03 00 00 je 1a4e <sbrktest+0x3fe>
printf(stdout, "sbrk could not deallocate\n");
exit();
}
c = sbrk(0);
1744: c7 04 24 00 00 00 00 movl $0x0,(%esp)
174b: e8 fd 25 00 00 call 3d4d <sbrk>
if(c != a - 4096){
1750: 8d 93 00 f0 ff ff lea -0x1000(%ebx),%edx
1756: 39 d0 cmp %edx,%eax
1758: 0f 85 ce 02 00 00 jne 1a2c <sbrktest+0x3dc>
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
exit();
}
// can one re-allocate that page?
a = sbrk(0);
175e: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1765: e8 e3 25 00 00 call 3d4d <sbrk>
c = sbrk(4096);
176a: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
exit();
}
// can one re-allocate that page?
a = sbrk(0);
1771: 89 c3 mov %eax,%ebx
c = sbrk(4096);
1773: e8 d5 25 00 00 call 3d4d <sbrk>
if(c != a || sbrk(0) != a + 4096){
1778: 39 c3 cmp %eax,%ebx
exit();
}
// can one re-allocate that page?
a = sbrk(0);
c = sbrk(4096);
177a: 89 c6 mov %eax,%esi
if(c != a || sbrk(0) != a + 4096){
177c: 0f 85 88 02 00 00 jne 1a0a <sbrktest+0x3ba>
1782: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1789: e8 bf 25 00 00 call 3d4d <sbrk>
178e: 8d 93 00 10 00 00 lea 0x1000(%ebx),%edx
1794: 39 d0 cmp %edx,%eax
1796: 0f 85 6e 02 00 00 jne 1a0a <sbrktest+0x3ba>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
exit();
}
if(*lastaddr == 99){
179c: 80 3d ff ff 3f 06 63 cmpb $0x63,0x63fffff
17a3: 0f 84 47 02 00 00 je 19f0 <sbrktest+0x3a0>
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17a9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
c = sbrk(-(sbrk(0) - oldbrk));
if(c != a){
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
17b0: bb 00 00 00 80 mov $0x80000000,%ebx
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17b5: e8 93 25 00 00 call 3d4d <sbrk>
c = sbrk(-(sbrk(0) - oldbrk));
17ba: c7 04 24 00 00 00 00 movl $0x0,(%esp)
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
exit();
}
a = sbrk(0);
17c1: 89 c6 mov %eax,%esi
c = sbrk(-(sbrk(0) - oldbrk));
17c3: e8 85 25 00 00 call 3d4d <sbrk>
17c8: 8b 55 a4 mov -0x5c(%ebp),%edx
17cb: 29 c2 sub %eax,%edx
17cd: 89 14 24 mov %edx,(%esp)
17d0: e8 78 25 00 00 call 3d4d <sbrk>
if(c != a){
17d5: 39 c6 cmp %eax,%esi
17d7: 0f 85 f1 01 00 00 jne 19ce <sbrktest+0x37e>
17dd: 8d 76 00 lea 0x0(%esi),%esi
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
ppid = getpid();
17e0: e8 60 25 00 00 call 3d45 <getpid>
17e5: 89 c6 mov %eax,%esi
pid = fork();
17e7: e8 d1 24 00 00 call 3cbd <fork>
if(pid < 0){
17ec: 83 f8 00 cmp $0x0,%eax
17ef: 0f 8c bf 01 00 00 jl 19b4 <sbrktest+0x364>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
17f5: 0f 84 8c 01 00 00 je 1987 <sbrktest+0x337>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
17fb: 81 c3 50 c3 00 00 add $0xc350,%ebx
1801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(pid == 0){
printf(stdout, "oops could read %x = %x\n", a, *a);
kill(ppid);
exit();
}
wait();
1808: e8 c0 24 00 00 call 3ccd <wait>
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
exit();
}
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
180d: 81 fb 80 84 1e 80 cmp $0x801e8480,%ebx
1813: 75 cb jne 17e0 <sbrktest+0x190>
wait();
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
1815: 8d 45 dc lea -0x24(%ebp),%eax
1818: 89 04 24 mov %eax,(%esp)
181b: e8 b5 24 00 00 call 3cd5 <pipe>
1820: 85 c0 test %eax,%eax
1822: 0f 85 46 01 00 00 jne 196e <sbrktest+0x31e>
printf(1, "pipe() failed\n");
exit();
1828: 31 db xor %ebx,%ebx
182a: 8d 7d b4 lea -0x4c(%ebp),%edi
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
182d: e8 8b 24 00 00 call 3cbd <fork>
1832: 85 c0 test %eax,%eax
1834: 89 c6 mov %eax,%esi
1836: 0f 84 a7 00 00 00 je 18e3 <sbrktest+0x293>
sbrk(BIG - (uint)sbrk(0));
write(fds[1], "x", 1);
// sit around until killed
for(;;) sleep(1000);
}
if(pids[i] != -1)
183c: 83 f8 ff cmp $0xffffffff,%eax
183f: 74 1a je 185b <sbrktest+0x20b>
read(fds[0], &scratch, 1);
1841: 8d 45 e7 lea -0x19(%ebp),%eax
1844: 89 44 24 04 mov %eax,0x4(%esp)
1848: 8b 45 dc mov -0x24(%ebp),%eax
184b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1852: 00
1853: 89 04 24 mov %eax,(%esp)
1856: e8 82 24 00 00 call 3cdd <read>
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
185b: 89 34 9f mov %esi,(%edi,%ebx,4)
// failed allocation?
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
185e: 83 c3 01 add $0x1,%ebx
1861: 83 fb 0a cmp $0xa,%ebx
1864: 75 c7 jne 182d <sbrktest+0x1dd>
if(pids[i] != -1)
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
1866: c7 04 24 00 10 00 00 movl $0x1000,(%esp)
186d: 30 db xor %bl,%bl
186f: e8 d9 24 00 00 call 3d4d <sbrk>
1874: 89 c6 mov %eax,%esi
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if(pids[i] == -1)
1876: 8b 04 9f mov (%edi,%ebx,4),%eax
1879: 83 f8 ff cmp $0xffffffff,%eax
187c: 74 0d je 188b <sbrktest+0x23b>
continue;
kill(pids[i]);
187e: 89 04 24 mov %eax,(%esp)
1881: e8 6f 24 00 00 call 3cf5 <kill>
wait();
1886: e8 42 24 00 00 call 3ccd <wait>
read(fds[0], &scratch, 1);
}
// if those failed allocations freed up the pages they did allocate,
// we'll be able to allocate here
c = sbrk(4096);
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
188b: 83 c3 01 add $0x1,%ebx
188e: 83 fb 0a cmp $0xa,%ebx
1891: 75 e3 jne 1876 <sbrktest+0x226>
if(pids[i] == -1)
continue;
kill(pids[i]);
wait();
}
if(c == (char*)0xffffffff){
1893: 83 fe ff cmp $0xffffffff,%esi
1896: 0f 84 b8 00 00 00 je 1954 <sbrktest+0x304>
printf(stdout, "failed sbrk leaked memory\n");
exit();
}
if(sbrk(0) > oldbrk)
189c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
18a3: e8 a5 24 00 00 call 3d4d <sbrk>
18a8: 39 45 a4 cmp %eax,-0x5c(%ebp)
18ab: 73 19 jae 18c6 <sbrktest+0x276>
sbrk(-(sbrk(0) - oldbrk));
18ad: c7 04 24 00 00 00 00 movl $0x0,(%esp)
18b4: e8 94 24 00 00 call 3d4d <sbrk>
18b9: 8b 55 a4 mov -0x5c(%ebp),%edx
18bc: 29 c2 sub %eax,%edx
18be: 89 14 24 mov %edx,(%esp)
18c1: e8 87 24 00 00 call 3d4d <sbrk>
printf(stdout, "sbrk test OK\n");
18c6: a1 5c 59 00 00 mov 0x595c,%eax
18cb: c7 44 24 04 78 48 00 movl $0x4878,0x4(%esp)
18d2: 00
18d3: 89 04 24 mov %eax,(%esp)
18d6: e8 45 25 00 00 call 3e20 <printf>
}
18db: 83 c4 7c add $0x7c,%esp
18de: 5b pop %ebx
18df: 5e pop %esi
18e0: 5f pop %edi
18e1: 5d pop %ebp
18e2: c3 ret
exit();
}
for(i = 0; i < sizeof(pids)/sizeof(pids[0]); i++){
if((pids[i] = fork()) == 0){
// allocate a lot of memory
sbrk(BIG - (uint)sbrk(0));
18e3: c7 04 24 00 00 00 00 movl $0x0,(%esp)
18ea: e8 5e 24 00 00 call 3d4d <sbrk>
18ef: ba 00 00 40 06 mov $0x6400000,%edx
18f4: 29 c2 sub %eax,%edx
18f6: 89 14 24 mov %edx,(%esp)
18f9: e8 4f 24 00 00 call 3d4d <sbrk>
write(fds[1], "x", 1);
18fe: 8b 45 e0 mov -0x20(%ebp),%eax
1901: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1908: 00
1909: c7 44 24 04 c5 4d 00 movl $0x4dc5,0x4(%esp)
1910: 00
1911: 89 04 24 mov %eax,(%esp)
1914: e8 cc 23 00 00 call 3ce5 <write>
1919: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
// sit around until killed
for(;;) sleep(1000);
1920: c7 04 24 e8 03 00 00 movl $0x3e8,(%esp)
1927: e8 29 24 00 00 call 3d55 <sleep>
192c: eb f2 jmp 1920 <sbrktest+0x2d0>
a = sbrk(0);
int i;
for(i = 0; i < 5000; i++){
b = sbrk(1);
if(b != a){
printf(stdout, "sbrk test failed %d %x %x\n", i, a, b);
192e: 89 44 24 10 mov %eax,0x10(%esp)
1932: a1 5c 59 00 00 mov 0x595c,%eax
1937: 89 5c 24 0c mov %ebx,0xc(%esp)
193b: 89 74 24 08 mov %esi,0x8(%esp)
193f: c7 44 24 04 cc 47 00 movl $0x47cc,0x4(%esp)
1946: 00
1947: 89 04 24 mov %eax,(%esp)
194a: e8 d1 24 00 00 call 3e20 <printf>
exit();
194f: e8 71 23 00 00 call 3cc5 <exit>
continue;
kill(pids[i]);
wait();
}
if(c == (char*)0xffffffff){
printf(stdout, "failed sbrk leaked memory\n");
1954: a1 5c 59 00 00 mov 0x595c,%eax
1959: c7 44 24 04 5d 48 00 movl $0x485d,0x4(%esp)
1960: 00
1961: 89 04 24 mov %eax,(%esp)
1964: e8 b7 24 00 00 call 3e20 <printf>
exit();
1969: e8 57 23 00 00 call 3cc5 <exit>
}
// if we run the system out of memory, does it clean up the last
// failed allocation?
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
196e: c7 44 24 04 4e 48 00 movl $0x484e,0x4(%esp)
1975: 00
1976: c7 04 24 01 00 00 00 movl $0x1,(%esp)
197d: e8 9e 24 00 00 call 3e20 <printf>
exit();
1982: e8 3e 23 00 00 call 3cc5 <exit>
if(pid < 0){
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
printf(stdout, "oops could read %x = %x\n", a, *a);
1987: 0f be 03 movsbl (%ebx),%eax
198a: 89 5c 24 08 mov %ebx,0x8(%esp)
198e: c7 44 24 04 35 48 00 movl $0x4835,0x4(%esp)
1995: 00
1996: 89 44 24 0c mov %eax,0xc(%esp)
199a: a1 5c 59 00 00 mov 0x595c,%eax
199f: 89 04 24 mov %eax,(%esp)
19a2: e8 79 24 00 00 call 3e20 <printf>
kill(ppid);
19a7: 89 34 24 mov %esi,(%esp)
19aa: e8 46 23 00 00 call 3cf5 <kill>
exit();
19af: e8 11 23 00 00 call 3cc5 <exit>
// can we read the kernel's memory?
for(a = (char*)(KERNBASE); a < (char*) (KERNBASE+2000000); a += 50000){
ppid = getpid();
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
19b4: a1 5c 59 00 00 mov 0x595c,%eax
19b9: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
19c0: 00
19c1: 89 04 24 mov %eax,(%esp)
19c4: e8 57 24 00 00 call 3e20 <printf>
exit();
19c9: e8 f7 22 00 00 call 3cc5 <exit>
}
a = sbrk(0);
c = sbrk(-(sbrk(0) - oldbrk));
if(c != a){
printf(stdout, "sbrk downsize failed, a %x c %x\n", a, c);
19ce: 89 44 24 0c mov %eax,0xc(%esp)
19d2: a1 5c 59 00 00 mov 0x595c,%eax
19d7: 89 74 24 08 mov %esi,0x8(%esp)
19db: c7 44 24 04 fc 54 00 movl $0x54fc,0x4(%esp)
19e2: 00
19e3: 89 04 24 mov %eax,(%esp)
19e6: e8 35 24 00 00 call 3e20 <printf>
exit();
19eb: e8 d5 22 00 00 call 3cc5 <exit>
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
exit();
}
if(*lastaddr == 99){
// should be zero
printf(stdout, "sbrk de-allocation didn't really deallocate\n");
19f0: a1 5c 59 00 00 mov 0x595c,%eax
19f5: c7 44 24 04 cc 54 00 movl $0x54cc,0x4(%esp)
19fc: 00
19fd: 89 04 24 mov %eax,(%esp)
1a00: e8 1b 24 00 00 call 3e20 <printf>
exit();
1a05: e8 bb 22 00 00 call 3cc5 <exit>
// can one re-allocate that page?
a = sbrk(0);
c = sbrk(4096);
if(c != a || sbrk(0) != a + 4096){
printf(stdout, "sbrk re-allocation failed, a %x c %x\n", a, c);
1a0a: a1 5c 59 00 00 mov 0x595c,%eax
1a0f: 89 74 24 0c mov %esi,0xc(%esp)
1a13: 89 5c 24 08 mov %ebx,0x8(%esp)
1a17: c7 44 24 04 a4 54 00 movl $0x54a4,0x4(%esp)
1a1e: 00
1a1f: 89 04 24 mov %eax,(%esp)
1a22: e8 f9 23 00 00 call 3e20 <printf>
exit();
1a27: e8 99 22 00 00 call 3cc5 <exit>
printf(stdout, "sbrk could not deallocate\n");
exit();
}
c = sbrk(0);
if(c != a - 4096){
printf(stdout, "sbrk deallocation produced wrong address, a %x c %x\n", a, c);
1a2c: 89 44 24 0c mov %eax,0xc(%esp)
1a30: a1 5c 59 00 00 mov 0x595c,%eax
1a35: 89 5c 24 08 mov %ebx,0x8(%esp)
1a39: c7 44 24 04 6c 54 00 movl $0x546c,0x4(%esp)
1a40: 00
1a41: 89 04 24 mov %eax,(%esp)
1a44: e8 d7 23 00 00 call 3e20 <printf>
exit();
1a49: e8 77 22 00 00 call 3cc5 <exit>
// can one de-allocate?
a = sbrk(0);
c = sbrk(-4096);
if(c == (char*)0xffffffff){
printf(stdout, "sbrk could not deallocate\n");
1a4e: a1 5c 59 00 00 mov 0x595c,%eax
1a53: c7 44 24 04 1a 48 00 movl $0x481a,0x4(%esp)
1a5a: 00
1a5b: 89 04 24 mov %eax,(%esp)
1a5e: e8 bd 23 00 00 call 3e20 <printf>
exit();
1a63: e8 5d 22 00 00 call 3cc5 <exit>
#define BIG (100*1024*1024)
a = sbrk(0);
amt = (BIG) - (uint)a;
p = sbrk(amt);
if (p != a) {
printf(stdout, "sbrk test failed to grow big address space; enough phys mem?\n");
1a68: a1 5c 59 00 00 mov 0x595c,%eax
1a6d: c7 44 24 04 2c 54 00 movl $0x542c,0x4(%esp)
1a74: 00
1a75: 89 04 24 mov %eax,(%esp)
1a78: e8 a3 23 00 00 call 3e20 <printf>
exit();
1a7d: e8 43 22 00 00 call 3cc5 <exit>
exit();
}
c = sbrk(1);
c = sbrk(1);
if(c != a + 1){
printf(stdout, "sbrk test failed post-fork\n");
1a82: a1 5c 59 00 00 mov 0x595c,%eax
1a87: c7 44 24 04 fe 47 00 movl $0x47fe,0x4(%esp)
1a8e: 00
1a8f: 89 04 24 mov %eax,(%esp)
1a92: e8 89 23 00 00 call 3e20 <printf>
exit();
1a97: e8 29 22 00 00 call 3cc5 <exit>
*b = 1;
a = b + 1;
}
pid = fork();
if(pid < 0){
printf(stdout, "sbrk test fork failed\n");
1a9c: a1 5c 59 00 00 mov 0x595c,%eax
1aa1: c7 44 24 04 e7 47 00 movl $0x47e7,0x4(%esp)
1aa8: 00
1aa9: 89 04 24 mov %eax,(%esp)
1aac: e8 6f 23 00 00 call 3e20 <printf>
exit();
1ab1: e8 0f 22 00 00 call 3cc5 <exit>
1ab6: 8d 76 00 lea 0x0(%esi),%esi
1ab9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001ac0 <preempt>:
}
// meant to be run w/ at most two CPUs
void
preempt(void)
{
1ac0: 55 push %ebp
1ac1: 89 e5 mov %esp,%ebp
1ac3: 57 push %edi
1ac4: 56 push %esi
1ac5: 53 push %ebx
1ac6: 83 ec 2c sub $0x2c,%esp
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
1ac9: c7 44 24 04 86 48 00 movl $0x4886,0x4(%esp)
1ad0: 00
1ad1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ad8: e8 43 23 00 00 call 3e20 <printf>
pid1 = fork();
1add: e8 db 21 00 00 call 3cbd <fork>
if(pid1 == 0)
1ae2: 85 c0 test %eax,%eax
{
int pid1, pid2, pid3;
int pfds[2];
printf(1, "preempt: ");
pid1 = fork();
1ae4: 89 c7 mov %eax,%edi
if(pid1 == 0)
1ae6: 75 02 jne 1aea <preempt+0x2a>
1ae8: eb fe jmp 1ae8 <preempt+0x28>
1aea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for(;;)
;
pid2 = fork();
1af0: e8 c8 21 00 00 call 3cbd <fork>
if(pid2 == 0)
1af5: 85 c0 test %eax,%eax
pid1 = fork();
if(pid1 == 0)
for(;;)
;
pid2 = fork();
1af7: 89 c6 mov %eax,%esi
if(pid2 == 0)
1af9: 75 02 jne 1afd <preempt+0x3d>
1afb: eb fe jmp 1afb <preempt+0x3b>
for(;;)
;
pipe(pfds);
1afd: 8d 45 e0 lea -0x20(%ebp),%eax
1b00: 89 04 24 mov %eax,(%esp)
1b03: e8 cd 21 00 00 call 3cd5 <pipe>
pid3 = fork();
1b08: e8 b0 21 00 00 call 3cbd <fork>
if(pid3 == 0){
1b0d: 85 c0 test %eax,%eax
if(pid2 == 0)
for(;;)
;
pipe(pfds);
pid3 = fork();
1b0f: 89 c3 mov %eax,%ebx
if(pid3 == 0){
1b11: 75 4c jne 1b5f <preempt+0x9f>
close(pfds[0]);
1b13: 8b 45 e0 mov -0x20(%ebp),%eax
1b16: 89 04 24 mov %eax,(%esp)
1b19: e8 cf 21 00 00 call 3ced <close>
if(write(pfds[1], "x", 1) != 1)
1b1e: 8b 45 e4 mov -0x1c(%ebp),%eax
1b21: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1b28: 00
1b29: c7 44 24 04 c5 4d 00 movl $0x4dc5,0x4(%esp)
1b30: 00
1b31: 89 04 24 mov %eax,(%esp)
1b34: e8 ac 21 00 00 call 3ce5 <write>
1b39: 83 f8 01 cmp $0x1,%eax
1b3c: 74 14 je 1b52 <preempt+0x92>
printf(1, "preempt write error");
1b3e: c7 44 24 04 90 48 00 movl $0x4890,0x4(%esp)
1b45: 00
1b46: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b4d: e8 ce 22 00 00 call 3e20 <printf>
close(pfds[1]);
1b52: 8b 45 e4 mov -0x1c(%ebp),%eax
1b55: 89 04 24 mov %eax,(%esp)
1b58: e8 90 21 00 00 call 3ced <close>
1b5d: eb fe jmp 1b5d <preempt+0x9d>
for(;;)
;
}
close(pfds[1]);
1b5f: 8b 45 e4 mov -0x1c(%ebp),%eax
1b62: 89 04 24 mov %eax,(%esp)
1b65: e8 83 21 00 00 call 3ced <close>
if(read(pfds[0], buf, sizeof(buf)) != 1){
1b6a: 8b 45 e0 mov -0x20(%ebp),%eax
1b6d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
1b74: 00
1b75: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
1b7c: 00
1b7d: 89 04 24 mov %eax,(%esp)
1b80: e8 58 21 00 00 call 3cdd <read>
1b85: 83 f8 01 cmp $0x1,%eax
1b88: 74 1c je 1ba6 <preempt+0xe6>
printf(1, "preempt read error");
1b8a: c7 44 24 04 a4 48 00 movl $0x48a4,0x4(%esp)
1b91: 00
1b92: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1b99: e8 82 22 00 00 call 3e20 <printf>
printf(1, "wait... ");
wait();
wait();
wait();
printf(1, "preempt ok\n");
}
1b9e: 83 c4 2c add $0x2c,%esp
1ba1: 5b pop %ebx
1ba2: 5e pop %esi
1ba3: 5f pop %edi
1ba4: 5d pop %ebp
1ba5: c3 ret
close(pfds[1]);
if(read(pfds[0], buf, sizeof(buf)) != 1){
printf(1, "preempt read error");
return;
}
close(pfds[0]);
1ba6: 8b 45 e0 mov -0x20(%ebp),%eax
1ba9: 89 04 24 mov %eax,(%esp)
1bac: e8 3c 21 00 00 call 3ced <close>
printf(1, "kill... ");
1bb1: c7 44 24 04 b7 48 00 movl $0x48b7,0x4(%esp)
1bb8: 00
1bb9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1bc0: e8 5b 22 00 00 call 3e20 <printf>
kill(pid1);
1bc5: 89 3c 24 mov %edi,(%esp)
1bc8: e8 28 21 00 00 call 3cf5 <kill>
kill(pid2);
1bcd: 89 34 24 mov %esi,(%esp)
1bd0: e8 20 21 00 00 call 3cf5 <kill>
kill(pid3);
1bd5: 89 1c 24 mov %ebx,(%esp)
1bd8: e8 18 21 00 00 call 3cf5 <kill>
printf(1, "wait... ");
1bdd: c7 44 24 04 c0 48 00 movl $0x48c0,0x4(%esp)
1be4: 00
1be5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1bec: e8 2f 22 00 00 call 3e20 <printf>
wait();
1bf1: e8 d7 20 00 00 call 3ccd <wait>
wait();
1bf6: e8 d2 20 00 00 call 3ccd <wait>
1bfb: 90 nop
1bfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
wait();
1c00: e8 c8 20 00 00 call 3ccd <wait>
printf(1, "preempt ok\n");
1c05: c7 44 24 04 c9 48 00 movl $0x48c9,0x4(%esp)
1c0c: 00
1c0d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1c14: e8 07 22 00 00 call 3e20 <printf>
1c19: eb 83 jmp 1b9e <preempt+0xde>
1c1b: 90 nop
1c1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001c20 <pipe1>:
// simple fork and pipe read/write
void
pipe1(void)
{
1c20: 55 push %ebp
1c21: 89 e5 mov %esp,%ebp
1c23: 57 push %edi
1c24: 56 push %esi
1c25: 53 push %ebx
1c26: 83 ec 2c sub $0x2c,%esp
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
1c29: 8d 45 e0 lea -0x20(%ebp),%eax
1c2c: 89 04 24 mov %eax,(%esp)
1c2f: e8 a1 20 00 00 call 3cd5 <pipe>
1c34: 85 c0 test %eax,%eax
1c36: 0f 85 44 01 00 00 jne 1d80 <pipe1+0x160>
printf(1, "pipe() failed\n");
exit();
}
pid = fork();
1c3c: e8 7c 20 00 00 call 3cbd <fork>
seq = 0;
if(pid == 0){
1c41: 83 f8 00 cmp $0x0,%eax
1c44: 0f 84 88 00 00 00 je 1cd2 <pipe1+0xb2>
1c4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "pipe1 oops 1\n");
exit();
}
}
exit();
} else if(pid > 0){
1c50: 0f 8e 43 01 00 00 jle 1d99 <pipe1+0x179>
close(fds[1]);
1c56: 8b 45 e4 mov -0x1c(%ebp),%eax
1c59: 31 ff xor %edi,%edi
1c5b: be 01 00 00 00 mov $0x1,%esi
1c60: 31 db xor %ebx,%ebx
1c62: 89 04 24 mov %eax,(%esp)
1c65: e8 83 20 00 00 call 3ced <close>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
1c6a: 8b 45 e0 mov -0x20(%ebp),%eax
1c6d: 89 74 24 08 mov %esi,0x8(%esp)
1c71: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
1c78: 00
1c79: 89 04 24 mov %eax,(%esp)
1c7c: e8 5c 20 00 00 call 3cdd <read>
1c81: 85 c0 test %eax,%eax
1c83: 0f 8e ac 00 00 00 jle 1d35 <pipe1+0x115>
1c89: 31 d2 xor %edx,%edx
1c8b: 90 nop
1c8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
1c90: 38 9a 40 81 00 00 cmp %bl,0x8140(%edx)
1c96: 75 1e jne 1cb6 <pipe1+0x96>
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
1c98: 83 c2 01 add $0x1,%edx
if((buf[i] & 0xff) != (seq++ & 0xff)){
1c9b: 83 c3 01 add $0x1,%ebx
} else if(pid > 0){
close(fds[1]);
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
1c9e: 39 d0 cmp %edx,%eax
1ca0: 7f ee jg 1c90 <pipe1+0x70>
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
cc = cc * 2;
1ca2: 01 f6 add %esi,%esi
if(cc > sizeof(buf))
1ca4: ba 00 20 00 00 mov $0x2000,%edx
1ca9: 81 fe 01 20 00 00 cmp $0x2001,%esi
1caf: 0f 43 f2 cmovae %edx,%esi
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
return;
}
}
total += n;
1cb2: 01 c7 add %eax,%edi
1cb4: eb b4 jmp 1c6a <pipe1+0x4a>
total = 0;
cc = 1;
while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
printf(1, "pipe1 oops 2\n");
1cb6: c7 44 24 04 e3 48 00 movl $0x48e3,0x4(%esp)
1cbd: 00
1cbe: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1cc5: e8 56 21 00 00 call 3e20 <printf>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
}
1cca: 83 c4 2c add $0x2c,%esp
1ccd: 5b pop %ebx
1cce: 5e pop %esi
1ccf: 5f pop %edi
1cd0: 5d pop %ebp
1cd1: c3 ret
exit();
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
1cd2: 8b 45 e0 mov -0x20(%ebp),%eax
1cd5: 31 db xor %ebx,%ebx
1cd7: 89 04 24 mov %eax,(%esp)
1cda: e8 0e 20 00 00 call 3ced <close>
for(n = 0; n < 5; n++){
1cdf: 31 c0 xor %eax,%eax
1ce1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 1033; i++)
buf[i] = seq++;
1ce8: 8d 14 18 lea (%eax,%ebx,1),%edx
1ceb: 88 90 40 81 00 00 mov %dl,0x8140(%eax)
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
1cf1: 83 c0 01 add $0x1,%eax
1cf4: 3d 09 04 00 00 cmp $0x409,%eax
1cf9: 75 ed jne 1ce8 <pipe1+0xc8>
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
1cfb: 8b 45 e4 mov -0x1c(%ebp),%eax
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
1cfe: 81 c3 09 04 00 00 add $0x409,%ebx
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
1d04: c7 44 24 08 09 04 00 movl $0x409,0x8(%esp)
1d0b: 00
1d0c: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
1d13: 00
1d14: 89 04 24 mov %eax,(%esp)
1d17: e8 c9 1f 00 00 call 3ce5 <write>
1d1c: 3d 09 04 00 00 cmp $0x409,%eax
1d21: 0f 85 8b 00 00 00 jne 1db2 <pipe1+0x192>
}
pid = fork();
seq = 0;
if(pid == 0){
close(fds[0]);
for(n = 0; n < 5; n++){
1d27: 81 fb 2d 14 00 00 cmp $0x142d,%ebx
1d2d: 75 b0 jne 1cdf <pipe1+0xbf>
1d2f: 90 nop
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
printf(1, "pipe1 oops 3 total %d\n", total);
exit();
1d30: e8 90 1f 00 00 call 3cc5 <exit>
total += n;
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
1d35: 81 ff 2d 14 00 00 cmp $0x142d,%edi
1d3b: 75 29 jne 1d66 <pipe1+0x146>
printf(1, "pipe1 oops 3 total %d\n", total);
exit();
}
close(fds[0]);
1d3d: 8b 45 e0 mov -0x20(%ebp),%eax
1d40: 89 04 24 mov %eax,(%esp)
1d43: e8 a5 1f 00 00 call 3ced <close>
wait();
1d48: e8 80 1f 00 00 call 3ccd <wait>
} else {
printf(1, "fork() failed\n");
exit();
}
printf(1, "pipe1 ok\n");
1d4d: c7 44 24 04 08 49 00 movl $0x4908,0x4(%esp)
1d54: 00
1d55: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d5c: e8 bf 20 00 00 call 3e20 <printf>
1d61: e9 64 ff ff ff jmp 1cca <pipe1+0xaa>
cc = cc * 2;
if(cc > sizeof(buf))
cc = sizeof(buf);
}
if(total != 5 * 1033){
printf(1, "pipe1 oops 3 total %d\n", total);
1d66: 89 7c 24 08 mov %edi,0x8(%esp)
1d6a: c7 44 24 04 f1 48 00 movl $0x48f1,0x4(%esp)
1d71: 00
1d72: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d79: e8 a2 20 00 00 call 3e20 <printf>
1d7e: eb af jmp 1d2f <pipe1+0x10f>
{
int fds[2], pid;
int seq, i, n, cc, total;
if(pipe(fds) != 0){
printf(1, "pipe() failed\n");
1d80: c7 44 24 04 4e 48 00 movl $0x484e,0x4(%esp)
1d87: 00
1d88: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d8f: e8 8c 20 00 00 call 3e20 <printf>
exit();
1d94: e8 2c 1f 00 00 call 3cc5 <exit>
exit();
}
close(fds[0]);
wait();
} else {
printf(1, "fork() failed\n");
1d99: c7 44 24 04 12 49 00 movl $0x4912,0x4(%esp)
1da0: 00
1da1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1da8: e8 73 20 00 00 call 3e20 <printf>
exit();
1dad: e8 13 1f 00 00 call 3cc5 <exit>
close(fds[0]);
for(n = 0; n < 5; n++){
for(i = 0; i < 1033; i++)
buf[i] = seq++;
if(write(fds[1], buf, 1033) != 1033){
printf(1, "pipe1 oops 1\n");
1db2: c7 44 24 04 d5 48 00 movl $0x48d5,0x4(%esp)
1db9: 00
1dba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1dc1: e8 5a 20 00 00 call 3e20 <printf>
exit();
1dc6: e8 fa 1e 00 00 call 3cc5 <exit>
1dcb: 90 nop
1dcc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00001dd0 <fourteen>:
printf(1, "bigfile test ok\n");
}
void
fourteen(void)
{
1dd0: 55 push %ebp
1dd1: 89 e5 mov %esp,%ebp
1dd3: 83 ec 18 sub $0x18,%esp
int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n");
1dd6: c7 44 24 04 21 49 00 movl $0x4921,0x4(%esp)
1ddd: 00
1dde: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1de5: e8 36 20 00 00 call 3e20 <printf>
if(mkdir("12345678901234") != 0){
1dea: c7 04 24 5c 49 00 00 movl $0x495c,(%esp)
1df1: e8 37 1f 00 00 call 3d2d <mkdir>
1df6: 85 c0 test %eax,%eax
1df8: 0f 85 92 00 00 00 jne 1e90 <fourteen+0xc0>
printf(1, "mkdir 12345678901234 failed\n");
exit();
}
if(mkdir("12345678901234/123456789012345") != 0){
1dfe: c7 04 24 20 55 00 00 movl $0x5520,(%esp)
1e05: e8 23 1f 00 00 call 3d2d <mkdir>
1e0a: 85 c0 test %eax,%eax
1e0c: 0f 85 fb 00 00 00 jne 1f0d <fourteen+0x13d>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
exit();
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
1e12: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
1e19: 00
1e1a: c7 04 24 70 55 00 00 movl $0x5570,(%esp)
1e21: e8 df 1e 00 00 call 3d05 <open>
if(fd < 0){
1e26: 85 c0 test %eax,%eax
1e28: 0f 88 c6 00 00 00 js 1ef4 <fourteen+0x124>
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
exit();
}
close(fd);
1e2e: 89 04 24 mov %eax,(%esp)
1e31: e8 b7 1e 00 00 call 3ced <close>
fd = open("12345678901234/12345678901234/12345678901234", 0);
1e36: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1e3d: 00
1e3e: c7 04 24 e0 55 00 00 movl $0x55e0,(%esp)
1e45: e8 bb 1e 00 00 call 3d05 <open>
if(fd < 0){
1e4a: 85 c0 test %eax,%eax
1e4c: 0f 88 89 00 00 00 js 1edb <fourteen+0x10b>
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
exit();
}
close(fd);
1e52: 89 04 24 mov %eax,(%esp)
1e55: e8 93 1e 00 00 call 3ced <close>
if(mkdir("12345678901234/12345678901234") == 0){
1e5a: c7 04 24 4d 49 00 00 movl $0x494d,(%esp)
1e61: e8 c7 1e 00 00 call 3d2d <mkdir>
1e66: 85 c0 test %eax,%eax
1e68: 74 58 je 1ec2 <fourteen+0xf2>
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
exit();
}
if(mkdir("123456789012345/12345678901234") == 0){
1e6a: c7 04 24 7c 56 00 00 movl $0x567c,(%esp)
1e71: e8 b7 1e 00 00 call 3d2d <mkdir>
1e76: 85 c0 test %eax,%eax
1e78: 74 2f je 1ea9 <fourteen+0xd9>
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
exit();
}
printf(1, "fourteen ok\n");
1e7a: c7 44 24 04 6b 49 00 movl $0x496b,0x4(%esp)
1e81: 00
1e82: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e89: e8 92 1f 00 00 call 3e20 <printf>
}
1e8e: c9 leave
1e8f: c3 ret
// DIRSIZ is 14.
printf(1, "fourteen test\n");
if(mkdir("12345678901234") != 0){
printf(1, "mkdir 12345678901234 failed\n");
1e90: c7 44 24 04 30 49 00 movl $0x4930,0x4(%esp)
1e97: 00
1e98: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e9f: e8 7c 1f 00 00 call 3e20 <printf>
exit();
1ea4: e8 1c 1e 00 00 call 3cc5 <exit>
if(mkdir("12345678901234/12345678901234") == 0){
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
exit();
}
if(mkdir("123456789012345/12345678901234") == 0){
printf(1, "mkdir 12345678901234/123456789012345 succeeded!\n");
1ea9: c7 44 24 04 9c 56 00 movl $0x569c,0x4(%esp)
1eb0: 00
1eb1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1eb8: e8 63 1f 00 00 call 3e20 <printf>
exit();
1ebd: e8 03 1e 00 00 call 3cc5 <exit>
exit();
}
close(fd);
if(mkdir("12345678901234/12345678901234") == 0){
printf(1, "mkdir 12345678901234/12345678901234 succeeded!\n");
1ec2: c7 44 24 04 4c 56 00 movl $0x564c,0x4(%esp)
1ec9: 00
1eca: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ed1: e8 4a 1f 00 00 call 3e20 <printf>
exit();
1ed6: e8 ea 1d 00 00 call 3cc5 <exit>
exit();
}
close(fd);
fd = open("12345678901234/12345678901234/12345678901234", 0);
if(fd < 0){
printf(1, "open 12345678901234/12345678901234/12345678901234 failed\n");
1edb: c7 44 24 04 10 56 00 movl $0x5610,0x4(%esp)
1ee2: 00
1ee3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1eea: e8 31 1f 00 00 call 3e20 <printf>
exit();
1eef: e8 d1 1d 00 00 call 3cc5 <exit>
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
exit();
}
fd = open("123456789012345/123456789012345/123456789012345", O_CREATE);
if(fd < 0){
printf(1, "create 123456789012345/123456789012345/123456789012345 failed\n");
1ef4: c7 44 24 04 a0 55 00 movl $0x55a0,0x4(%esp)
1efb: 00
1efc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f03: e8 18 1f 00 00 call 3e20 <printf>
exit();
1f08: e8 b8 1d 00 00 call 3cc5 <exit>
if(mkdir("12345678901234") != 0){
printf(1, "mkdir 12345678901234 failed\n");
exit();
}
if(mkdir("12345678901234/123456789012345") != 0){
printf(1, "mkdir 12345678901234/123456789012345 failed\n");
1f0d: c7 44 24 04 40 55 00 movl $0x5540,0x4(%esp)
1f14: 00
1f15: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f1c: e8 ff 1e 00 00 call 3e20 <printf>
exit();
1f21: e8 9f 1d 00 00 call 3cc5 <exit>
1f26: 8d 76 00 lea 0x0(%esi),%esi
1f29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00001f30 <openiputtest>:
// for(i = 0; i < 10000; i++)
// yield();
// }
void
openiputtest(void)
{
1f30: 55 push %ebp
1f31: 89 e5 mov %esp,%ebp
1f33: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "openiput test\n");
1f36: a1 5c 59 00 00 mov 0x595c,%eax
1f3b: c7 44 24 04 78 49 00 movl $0x4978,0x4(%esp)
1f42: 00
1f43: 89 04 24 mov %eax,(%esp)
1f46: e8 d5 1e 00 00 call 3e20 <printf>
if(mkdir("oidir") < 0){
1f4b: c7 04 24 87 49 00 00 movl $0x4987,(%esp)
1f52: e8 d6 1d 00 00 call 3d2d <mkdir>
1f57: 85 c0 test %eax,%eax
1f59: 0f 88 9e 00 00 00 js 1ffd <openiputtest+0xcd>
printf(stdout, "mkdir oidir failed\n");
exit();
}
pid = fork();
1f5f: e8 59 1d 00 00 call 3cbd <fork>
if(pid < 0){
1f64: 83 f8 00 cmp $0x0,%eax
1f67: 0f 8c aa 00 00 00 jl 2017 <openiputtest+0xe7>
1f6d: 8d 76 00 lea 0x0(%esi),%esi
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
1f70: 75 36 jne 1fa8 <openiputtest+0x78>
int fd = open("oidir", O_RDWR);
1f72: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
1f79: 00
1f7a: c7 04 24 87 49 00 00 movl $0x4987,(%esp)
1f81: e8 7f 1d 00 00 call 3d05 <open>
if(fd >= 0){
1f86: 85 c0 test %eax,%eax
1f88: 78 6e js 1ff8 <openiputtest+0xc8>
printf(stdout, "open directory for write succeeded\n");
1f8a: a1 5c 59 00 00 mov 0x595c,%eax
1f8f: c7 44 24 04 d0 56 00 movl $0x56d0,0x4(%esp)
1f96: 00
1f97: 89 04 24 mov %eax,(%esp)
1f9a: e8 81 1e 00 00 call 3e20 <printf>
exit();
1f9f: e8 21 1d 00 00 call 3cc5 <exit>
1fa4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
}
exit();
}
sleep(1);
1fa8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1faf: e8 a1 1d 00 00 call 3d55 <sleep>
if(unlink("oidir") != 0){
1fb4: c7 04 24 87 49 00 00 movl $0x4987,(%esp)
1fbb: e8 55 1d 00 00 call 3d15 <unlink>
1fc0: 85 c0 test %eax,%eax
1fc2: 75 1c jne 1fe0 <openiputtest+0xb0>
printf(stdout, "unlink failed\n");
exit();
}
wait();
1fc4: e8 04 1d 00 00 call 3ccd <wait>
printf(stdout, "openiput test ok\n");
1fc9: a1 5c 59 00 00 mov 0x595c,%eax
1fce: c7 44 24 04 a1 49 00 movl $0x49a1,0x4(%esp)
1fd5: 00
1fd6: 89 04 24 mov %eax,(%esp)
1fd9: e8 42 1e 00 00 call 3e20 <printf>
}
1fde: c9 leave
1fdf: c3 ret
}
exit();
}
sleep(1);
if(unlink("oidir") != 0){
printf(stdout, "unlink failed\n");
1fe0: a1 5c 59 00 00 mov 0x595c,%eax
1fe5: c7 44 24 04 2e 44 00 movl $0x442e,0x4(%esp)
1fec: 00
1fed: 89 04 24 mov %eax,(%esp)
1ff0: e8 2b 1e 00 00 call 3e20 <printf>
1ff5: 8d 76 00 lea 0x0(%esi),%esi
exit();
1ff8: e8 c8 1c 00 00 call 3cc5 <exit>
{
int pid;
printf(stdout, "openiput test\n");
if(mkdir("oidir") < 0){
printf(stdout, "mkdir oidir failed\n");
1ffd: a1 5c 59 00 00 mov 0x595c,%eax
2002: c7 44 24 04 8d 49 00 movl $0x498d,0x4(%esp)
2009: 00
200a: 89 04 24 mov %eax,(%esp)
200d: e8 0e 1e 00 00 call 3e20 <printf>
exit();
2012: e8 ae 1c 00 00 call 3cc5 <exit>
}
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
2017: a1 5c 59 00 00 mov 0x595c,%eax
201c: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
2023: 00
2024: 89 04 24 mov %eax,(%esp)
2027: e8 f4 1d 00 00 call 3e20 <printf>
exit();
202c: e8 94 1c 00 00 call 3cc5 <exit>
2031: eb 0d jmp 2040 <iref>
2033: 90 nop
2034: 90 nop
2035: 90 nop
2036: 90 nop
2037: 90 nop
2038: 90 nop
2039: 90 nop
203a: 90 nop
203b: 90 nop
203c: 90 nop
203d: 90 nop
203e: 90 nop
203f: 90 nop
00002040 <iref>:
}
// test that iput() is called at the end of _namei()
void
iref(void)
{
2040: 55 push %ebp
2041: 89 e5 mov %esp,%ebp
2043: 53 push %ebx
int i, fd;
printf(1, "empty file name\n");
2044: 31 db xor %ebx,%ebx
}
// test that iput() is called at the end of _namei()
void
iref(void)
{
2046: 83 ec 14 sub $0x14,%esp
int i, fd;
printf(1, "empty file name\n");
2049: c7 44 24 04 b3 49 00 movl $0x49b3,0x4(%esp)
2050: 00
2051: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2058: e8 c3 1d 00 00 call 3e20 <printf>
205d: 8d 76 00 lea 0x0(%esi),%esi
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
if(mkdir("irefd") != 0){
2060: c7 04 24 c4 49 00 00 movl $0x49c4,(%esp)
2067: e8 c1 1c 00 00 call 3d2d <mkdir>
206c: 85 c0 test %eax,%eax
206e: 0f 85 b2 00 00 00 jne 2126 <iref+0xe6>
printf(1, "mkdir irefd failed\n");
exit();
}
if(chdir("irefd") != 0){
2074: c7 04 24 c4 49 00 00 movl $0x49c4,(%esp)
207b: e8 b5 1c 00 00 call 3d35 <chdir>
2080: 85 c0 test %eax,%eax
2082: 0f 85 b7 00 00 00 jne 213f <iref+0xff>
printf(1, "chdir irefd failed\n");
exit();
}
mkdir("");
2088: c7 04 24 7d 51 00 00 movl $0x517d,(%esp)
208f: e8 99 1c 00 00 call 3d2d <mkdir>
link("README", "");
2094: c7 44 24 04 7d 51 00 movl $0x517d,0x4(%esp)
209b: 00
209c: c7 04 24 f2 49 00 00 movl $0x49f2,(%esp)
20a3: e8 7d 1c 00 00 call 3d25 <link>
fd = open("", O_CREATE);
20a8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
20af: 00
20b0: c7 04 24 7d 51 00 00 movl $0x517d,(%esp)
20b7: e8 49 1c 00 00 call 3d05 <open>
if(fd >= 0)
20bc: 85 c0 test %eax,%eax
20be: 78 08 js 20c8 <iref+0x88>
close(fd);
20c0: 89 04 24 mov %eax,(%esp)
20c3: e8 25 1c 00 00 call 3ced <close>
fd = open("xx", O_CREATE);
20c8: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
20cf: 00
20d0: c7 04 24 c4 4d 00 00 movl $0x4dc4,(%esp)
20d7: e8 29 1c 00 00 call 3d05 <open>
if(fd >= 0)
20dc: 85 c0 test %eax,%eax
20de: 78 08 js 20e8 <iref+0xa8>
close(fd);
20e0: 89 04 24 mov %eax,(%esp)
20e3: e8 05 1c 00 00 call 3ced <close>
int i, fd;
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
20e8: 83 c3 01 add $0x1,%ebx
if(fd >= 0)
close(fd);
fd = open("xx", O_CREATE);
if(fd >= 0)
close(fd);
unlink("xx");
20eb: c7 04 24 c4 4d 00 00 movl $0x4dc4,(%esp)
20f2: e8 1e 1c 00 00 call 3d15 <unlink>
int i, fd;
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
20f7: 83 fb 33 cmp $0x33,%ebx
20fa: 0f 85 60 ff ff ff jne 2060 <iref+0x20>
if(fd >= 0)
close(fd);
unlink("xx");
}
chdir("/");
2100: c7 04 24 f9 49 00 00 movl $0x49f9,(%esp)
2107: e8 29 1c 00 00 call 3d35 <chdir>
printf(1, "empty file name OK\n");
210c: c7 44 24 04 fb 49 00 movl $0x49fb,0x4(%esp)
2113: 00
2114: c7 04 24 01 00 00 00 movl $0x1,(%esp)
211b: e8 00 1d 00 00 call 3e20 <printf>
}
2120: 83 c4 14 add $0x14,%esp
2123: 5b pop %ebx
2124: 5d pop %ebp
2125: c3 ret
printf(1, "empty file name\n");
// the 50 is NINODE
for(i = 0; i < 50 + 1; i++){
if(mkdir("irefd") != 0){
printf(1, "mkdir irefd failed\n");
2126: c7 44 24 04 ca 49 00 movl $0x49ca,0x4(%esp)
212d: 00
212e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2135: e8 e6 1c 00 00 call 3e20 <printf>
exit();
213a: e8 86 1b 00 00 call 3cc5 <exit>
}
if(chdir("irefd") != 0){
printf(1, "chdir irefd failed\n");
213f: c7 44 24 04 de 49 00 movl $0x49de,0x4(%esp)
2146: 00
2147: c7 04 24 01 00 00 00 movl $0x1,(%esp)
214e: e8 cd 1c 00 00 call 3e20 <printf>
exit();
2153: e8 6d 1b 00 00 call 3cc5 <exit>
2158: 90 nop
2159: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00002160 <dirfile>:
printf(1, "rmdot ok\n");
}
void
dirfile(void)
{
2160: 55 push %ebp
2161: 89 e5 mov %esp,%ebp
2163: 53 push %ebx
2164: 83 ec 14 sub $0x14,%esp
int fd;
printf(1, "dir vs file\n");
2167: c7 44 24 04 0f 4a 00 movl $0x4a0f,0x4(%esp)
216e: 00
216f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2176: e8 a5 1c 00 00 call 3e20 <printf>
fd = open("dirfile", O_CREATE);
217b: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
2182: 00
2183: c7 04 24 1c 4a 00 00 movl $0x4a1c,(%esp)
218a: e8 76 1b 00 00 call 3d05 <open>
if(fd < 0){
218f: 85 c0 test %eax,%eax
2191: 0f 88 4e 01 00 00 js 22e5 <dirfile+0x185>
printf(1, "create dirfile failed\n");
exit();
}
close(fd);
2197: 89 04 24 mov %eax,(%esp)
219a: e8 4e 1b 00 00 call 3ced <close>
if(chdir("dirfile") == 0){
219f: c7 04 24 1c 4a 00 00 movl $0x4a1c,(%esp)
21a6: e8 8a 1b 00 00 call 3d35 <chdir>
21ab: 85 c0 test %eax,%eax
21ad: 0f 84 19 01 00 00 je 22cc <dirfile+0x16c>
printf(1, "chdir dirfile succeeded!\n");
exit();
}
fd = open("dirfile/xx", 0);
21b3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
21ba: 00
21bb: c7 04 24 55 4a 00 00 movl $0x4a55,(%esp)
21c2: e8 3e 1b 00 00 call 3d05 <open>
if(fd >= 0){
21c7: 85 c0 test %eax,%eax
21c9: 0f 89 e4 00 00 00 jns 22b3 <dirfile+0x153>
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
fd = open("dirfile/xx", O_CREATE);
21cf: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
21d6: 00
21d7: c7 04 24 55 4a 00 00 movl $0x4a55,(%esp)
21de: e8 22 1b 00 00 call 3d05 <open>
if(fd >= 0){
21e3: 85 c0 test %eax,%eax
21e5: 0f 89 c8 00 00 00 jns 22b3 <dirfile+0x153>
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
if(mkdir("dirfile/xx") == 0){
21eb: c7 04 24 55 4a 00 00 movl $0x4a55,(%esp)
21f2: e8 36 1b 00 00 call 3d2d <mkdir>
21f7: 85 c0 test %eax,%eax
21f9: 0f 84 7c 01 00 00 je 237b <dirfile+0x21b>
printf(1, "mkdir dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile/xx") == 0){
21ff: c7 04 24 55 4a 00 00 movl $0x4a55,(%esp)
2206: e8 0a 1b 00 00 call 3d15 <unlink>
220b: 85 c0 test %eax,%eax
220d: 0f 84 4f 01 00 00 je 2362 <dirfile+0x202>
printf(1, "unlink dirfile/xx succeeded!\n");
exit();
}
if(link("README", "dirfile/xx") == 0){
2213: c7 44 24 04 55 4a 00 movl $0x4a55,0x4(%esp)
221a: 00
221b: c7 04 24 f2 49 00 00 movl $0x49f2,(%esp)
2222: e8 fe 1a 00 00 call 3d25 <link>
2227: 85 c0 test %eax,%eax
2229: 0f 84 1a 01 00 00 je 2349 <dirfile+0x1e9>
printf(1, "link to dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile") != 0){
222f: c7 04 24 1c 4a 00 00 movl $0x4a1c,(%esp)
2236: e8 da 1a 00 00 call 3d15 <unlink>
223b: 85 c0 test %eax,%eax
223d: 0f 85 ed 00 00 00 jne 2330 <dirfile+0x1d0>
printf(1, "unlink dirfile failed!\n");
exit();
}
fd = open(".", O_RDWR);
2243: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
224a: 00
224b: c7 04 24 e2 4c 00 00 movl $0x4ce2,(%esp)
2252: e8 ae 1a 00 00 call 3d05 <open>
if(fd >= 0){
2257: 85 c0 test %eax,%eax
2259: 0f 89 b8 00 00 00 jns 2317 <dirfile+0x1b7>
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
225f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2266: 00
2267: c7 04 24 e2 4c 00 00 movl $0x4ce2,(%esp)
226e: e8 92 1a 00 00 call 3d05 <open>
if(write(fd, "x", 1) > 0){
2273: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
227a: 00
227b: c7 44 24 04 c5 4d 00 movl $0x4dc5,0x4(%esp)
2282: 00
fd = open(".", O_RDWR);
if(fd >= 0){
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
2283: 89 c3 mov %eax,%ebx
if(write(fd, "x", 1) > 0){
2285: 89 04 24 mov %eax,(%esp)
2288: e8 58 1a 00 00 call 3ce5 <write>
228d: 85 c0 test %eax,%eax
228f: 7f 6d jg 22fe <dirfile+0x19e>
printf(1, "write . succeeded!\n");
exit();
}
close(fd);
2291: 89 1c 24 mov %ebx,(%esp)
2294: e8 54 1a 00 00 call 3ced <close>
printf(1, "dir vs file OK\n");
2299: c7 44 24 04 e5 4a 00 movl $0x4ae5,0x4(%esp)
22a0: 00
22a1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22a8: e8 73 1b 00 00 call 3e20 <printf>
}
22ad: 83 c4 14 add $0x14,%esp
22b0: 5b pop %ebx
22b1: 5d pop %ebp
22b2: c3 ret
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
fd = open("dirfile/xx", O_CREATE);
if(fd >= 0){
printf(1, "create dirfile/xx succeeded!\n");
22b3: c7 44 24 04 60 4a 00 movl $0x4a60,0x4(%esp)
22ba: 00
22bb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22c2: e8 59 1b 00 00 call 3e20 <printf>
exit();
22c7: e8 f9 19 00 00 call 3cc5 <exit>
printf(1, "create dirfile failed\n");
exit();
}
close(fd);
if(chdir("dirfile") == 0){
printf(1, "chdir dirfile succeeded!\n");
22cc: c7 44 24 04 3b 4a 00 movl $0x4a3b,0x4(%esp)
22d3: 00
22d4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22db: e8 40 1b 00 00 call 3e20 <printf>
exit();
22e0: e8 e0 19 00 00 call 3cc5 <exit>
printf(1, "dir vs file\n");
fd = open("dirfile", O_CREATE);
if(fd < 0){
printf(1, "create dirfile failed\n");
22e5: c7 44 24 04 24 4a 00 movl $0x4a24,0x4(%esp)
22ec: 00
22ed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
22f4: e8 27 1b 00 00 call 3e20 <printf>
exit();
22f9: e8 c7 19 00 00 call 3cc5 <exit>
printf(1, "open . for writing succeeded!\n");
exit();
}
fd = open(".", 0);
if(write(fd, "x", 1) > 0){
printf(1, "write . succeeded!\n");
22fe: c7 44 24 04 d1 4a 00 movl $0x4ad1,0x4(%esp)
2305: 00
2306: c7 04 24 01 00 00 00 movl $0x1,(%esp)
230d: e8 0e 1b 00 00 call 3e20 <printf>
exit();
2312: e8 ae 19 00 00 call 3cc5 <exit>
exit();
}
fd = open(".", O_RDWR);
if(fd >= 0){
printf(1, "open . for writing succeeded!\n");
2317: c7 44 24 04 14 57 00 movl $0x5714,0x4(%esp)
231e: 00
231f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2326: e8 f5 1a 00 00 call 3e20 <printf>
exit();
232b: e8 95 19 00 00 call 3cc5 <exit>
if(link("README", "dirfile/xx") == 0){
printf(1, "link to dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile") != 0){
printf(1, "unlink dirfile failed!\n");
2330: c7 44 24 04 b9 4a 00 movl $0x4ab9,0x4(%esp)
2337: 00
2338: c7 04 24 01 00 00 00 movl $0x1,(%esp)
233f: e8 dc 1a 00 00 call 3e20 <printf>
exit();
2344: e8 7c 19 00 00 call 3cc5 <exit>
if(unlink("dirfile/xx") == 0){
printf(1, "unlink dirfile/xx succeeded!\n");
exit();
}
if(link("README", "dirfile/xx") == 0){
printf(1, "link to dirfile/xx succeeded!\n");
2349: c7 44 24 04 f4 56 00 movl $0x56f4,0x4(%esp)
2350: 00
2351: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2358: e8 c3 1a 00 00 call 3e20 <printf>
exit();
235d: e8 63 19 00 00 call 3cc5 <exit>
if(mkdir("dirfile/xx") == 0){
printf(1, "mkdir dirfile/xx succeeded!\n");
exit();
}
if(unlink("dirfile/xx") == 0){
printf(1, "unlink dirfile/xx succeeded!\n");
2362: c7 44 24 04 9b 4a 00 movl $0x4a9b,0x4(%esp)
2369: 00
236a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2371: e8 aa 1a 00 00 call 3e20 <printf>
exit();
2376: e8 4a 19 00 00 call 3cc5 <exit>
if(fd >= 0){
printf(1, "create dirfile/xx succeeded!\n");
exit();
}
if(mkdir("dirfile/xx") == 0){
printf(1, "mkdir dirfile/xx succeeded!\n");
237b: c7 44 24 04 7e 4a 00 movl $0x4a7e,0x4(%esp)
2382: 00
2383: c7 04 24 01 00 00 00 movl $0x1,(%esp)
238a: e8 91 1a 00 00 call 3e20 <printf>
exit();
238f: e8 31 19 00 00 call 3cc5 <exit>
2394: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
239a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000023a0 <rmdot>:
printf(1, "fourteen ok\n");
}
void
rmdot(void)
{
23a0: 55 push %ebp
23a1: 89 e5 mov %esp,%ebp
23a3: 83 ec 18 sub $0x18,%esp
printf(1, "rmdot test\n");
23a6: c7 44 24 04 f5 4a 00 movl $0x4af5,0x4(%esp)
23ad: 00
23ae: c7 04 24 01 00 00 00 movl $0x1,(%esp)
23b5: e8 66 1a 00 00 call 3e20 <printf>
if(mkdir("dots") != 0){
23ba: c7 04 24 01 4b 00 00 movl $0x4b01,(%esp)
23c1: e8 67 19 00 00 call 3d2d <mkdir>
23c6: 85 c0 test %eax,%eax
23c8: 0f 85 9a 00 00 00 jne 2468 <rmdot+0xc8>
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
23ce: c7 04 24 01 4b 00 00 movl $0x4b01,(%esp)
23d5: e8 5b 19 00 00 call 3d35 <chdir>
23da: 85 c0 test %eax,%eax
23dc: 0f 85 35 01 00 00 jne 2517 <rmdot+0x177>
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
23e2: c7 04 24 e2 4c 00 00 movl $0x4ce2,(%esp)
23e9: e8 27 19 00 00 call 3d15 <unlink>
23ee: 85 c0 test %eax,%eax
23f0: 0f 84 08 01 00 00 je 24fe <rmdot+0x15e>
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
23f6: c7 04 24 e1 4c 00 00 movl $0x4ce1,(%esp)
23fd: e8 13 19 00 00 call 3d15 <unlink>
2402: 85 c0 test %eax,%eax
2404: 0f 84 db 00 00 00 je 24e5 <rmdot+0x145>
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
240a: c7 04 24 f9 49 00 00 movl $0x49f9,(%esp)
2411: e8 1f 19 00 00 call 3d35 <chdir>
2416: 85 c0 test %eax,%eax
2418: 0f 85 ae 00 00 00 jne 24cc <rmdot+0x12c>
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
241e: c7 04 24 59 4b 00 00 movl $0x4b59,(%esp)
2425: e8 eb 18 00 00 call 3d15 <unlink>
242a: 85 c0 test %eax,%eax
242c: 0f 84 81 00 00 00 je 24b3 <rmdot+0x113>
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
2432: c7 04 24 77 4b 00 00 movl $0x4b77,(%esp)
2439: e8 d7 18 00 00 call 3d15 <unlink>
243e: 85 c0 test %eax,%eax
2440: 74 58 je 249a <rmdot+0xfa>
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
2442: c7 04 24 01 4b 00 00 movl $0x4b01,(%esp)
2449: e8 c7 18 00 00 call 3d15 <unlink>
244e: 85 c0 test %eax,%eax
2450: 75 2f jne 2481 <rmdot+0xe1>
printf(1, "unlink dots failed!\n");
exit();
}
printf(1, "rmdot ok\n");
2452: c7 44 24 04 ac 4b 00 movl $0x4bac,0x4(%esp)
2459: 00
245a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2461: e8 ba 19 00 00 call 3e20 <printf>
}
2466: c9 leave
2467: c3 ret
void
rmdot(void)
{
printf(1, "rmdot test\n");
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
2468: c7 44 24 04 06 4b 00 movl $0x4b06,0x4(%esp)
246f: 00
2470: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2477: e8 a4 19 00 00 call 3e20 <printf>
exit();
247c: e8 44 18 00 00 call 3cc5 <exit>
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
printf(1, "unlink dots failed!\n");
2481: c7 44 24 04 97 4b 00 movl $0x4b97,0x4(%esp)
2488: 00
2489: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2490: e8 8b 19 00 00 call 3e20 <printf>
exit();
2495: e8 2b 18 00 00 call 3cc5 <exit>
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
249a: c7 44 24 04 7f 4b 00 movl $0x4b7f,0x4(%esp)
24a1: 00
24a2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24a9: e8 72 19 00 00 call 3e20 <printf>
exit();
24ae: e8 12 18 00 00 call 3cc5 <exit>
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
24b3: c7 44 24 04 60 4b 00 movl $0x4b60,0x4(%esp)
24ba: 00
24bb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24c2: e8 59 19 00 00 call 3e20 <printf>
exit();
24c7: e8 f9 17 00 00 call 3cc5 <exit>
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
24cc: c7 44 24 04 49 4b 00 movl $0x4b49,0x4(%esp)
24d3: 00
24d4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24db: e8 40 19 00 00 call 3e20 <printf>
exit();
24e0: e8 e0 17 00 00 call 3cc5 <exit>
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
24e5: c7 44 24 04 3a 4b 00 movl $0x4b3a,0x4(%esp)
24ec: 00
24ed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24f4: e8 27 19 00 00 call 3e20 <printf>
exit();
24f9: e8 c7 17 00 00 call 3cc5 <exit>
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
24fe: c7 44 24 04 2c 4b 00 movl $0x4b2c,0x4(%esp)
2505: 00
2506: c7 04 24 01 00 00 00 movl $0x1,(%esp)
250d: e8 0e 19 00 00 call 3e20 <printf>
exit();
2512: e8 ae 17 00 00 call 3cc5 <exit>
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
2517: c7 44 24 04 19 4b 00 movl $0x4b19,0x4(%esp)
251e: 00
251f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2526: e8 f5 18 00 00 call 3e20 <printf>
exit();
252b: e8 95 17 00 00 call 3cc5 <exit>
00002530 <subdir>:
printf(1, "bigdir ok\n");
}
void
subdir(void)
{
2530: 55 push %ebp
2531: 89 e5 mov %esp,%ebp
2533: 53 push %ebx
2534: 83 ec 14 sub $0x14,%esp
int fd, cc;
printf(1, "subdir test\n");
2537: c7 44 24 04 b6 4b 00 movl $0x4bb6,0x4(%esp)
253e: 00
253f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2546: e8 d5 18 00 00 call 3e20 <printf>
unlink("ff");
254b: c7 04 24 3f 4c 00 00 movl $0x4c3f,(%esp)
2552: e8 be 17 00 00 call 3d15 <unlink>
if(mkdir("dd") != 0){
2557: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
255e: e8 ca 17 00 00 call 3d2d <mkdir>
2563: 85 c0 test %eax,%eax
2565: 0f 85 07 06 00 00 jne 2b72 <subdir+0x642>
printf(1, "subdir mkdir dd failed\n");
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
256b: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2572: 00
2573: c7 04 24 15 4c 00 00 movl $0x4c15,(%esp)
257a: e8 86 17 00 00 call 3d05 <open>
if(fd < 0){
257f: 85 c0 test %eax,%eax
if(mkdir("dd") != 0){
printf(1, "subdir mkdir dd failed\n");
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
2581: 89 c3 mov %eax,%ebx
if(fd < 0){
2583: 0f 88 d0 05 00 00 js 2b59 <subdir+0x629>
printf(1, "create dd/ff failed\n");
exit();
}
write(fd, "ff", 2);
2589: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
2590: 00
2591: c7 44 24 04 3f 4c 00 movl $0x4c3f,0x4(%esp)
2598: 00
2599: 89 04 24 mov %eax,(%esp)
259c: e8 44 17 00 00 call 3ce5 <write>
close(fd);
25a1: 89 1c 24 mov %ebx,(%esp)
25a4: e8 44 17 00 00 call 3ced <close>
if(unlink("dd") >= 0){
25a9: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
25b0: e8 60 17 00 00 call 3d15 <unlink>
25b5: 85 c0 test %eax,%eax
25b7: 0f 89 83 05 00 00 jns 2b40 <subdir+0x610>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
exit();
}
if(mkdir("/dd/dd") != 0){
25bd: c7 04 24 f0 4b 00 00 movl $0x4bf0,(%esp)
25c4: e8 64 17 00 00 call 3d2d <mkdir>
25c9: 85 c0 test %eax,%eax
25cb: 0f 85 56 05 00 00 jne 2b27 <subdir+0x5f7>
printf(1, "subdir mkdir dd/dd failed\n");
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
25d1: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
25d8: 00
25d9: c7 04 24 12 4c 00 00 movl $0x4c12,(%esp)
25e0: e8 20 17 00 00 call 3d05 <open>
if(fd < 0){
25e5: 85 c0 test %eax,%eax
if(mkdir("/dd/dd") != 0){
printf(1, "subdir mkdir dd/dd failed\n");
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
25e7: 89 c3 mov %eax,%ebx
if(fd < 0){
25e9: 0f 88 25 04 00 00 js 2a14 <subdir+0x4e4>
printf(1, "create dd/dd/ff failed\n");
exit();
}
write(fd, "FF", 2);
25ef: c7 44 24 08 02 00 00 movl $0x2,0x8(%esp)
25f6: 00
25f7: c7 44 24 04 33 4c 00 movl $0x4c33,0x4(%esp)
25fe: 00
25ff: 89 04 24 mov %eax,(%esp)
2602: e8 de 16 00 00 call 3ce5 <write>
close(fd);
2607: 89 1c 24 mov %ebx,(%esp)
260a: e8 de 16 00 00 call 3ced <close>
fd = open("dd/dd/../ff", 0);
260f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2616: 00
2617: c7 04 24 36 4c 00 00 movl $0x4c36,(%esp)
261e: e8 e2 16 00 00 call 3d05 <open>
if(fd < 0){
2623: 85 c0 test %eax,%eax
exit();
}
write(fd, "FF", 2);
close(fd);
fd = open("dd/dd/../ff", 0);
2625: 89 c3 mov %eax,%ebx
if(fd < 0){
2627: 0f 88 ce 03 00 00 js 29fb <subdir+0x4cb>
printf(1, "open dd/dd/../ff failed\n");
exit();
}
cc = read(fd, buf, sizeof(buf));
262d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
2634: 00
2635: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
263c: 00
263d: 89 04 24 mov %eax,(%esp)
2640: e8 98 16 00 00 call 3cdd <read>
if(cc != 2 || buf[0] != 'f'){
2645: 83 f8 02 cmp $0x2,%eax
2648: 0f 85 fe 02 00 00 jne 294c <subdir+0x41c>
264e: 80 3d 40 81 00 00 66 cmpb $0x66,0x8140
2655: 0f 85 f1 02 00 00 jne 294c <subdir+0x41c>
printf(1, "dd/dd/../ff wrong content\n");
exit();
}
close(fd);
265b: 89 1c 24 mov %ebx,(%esp)
265e: e8 8a 16 00 00 call 3ced <close>
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
2663: c7 44 24 04 76 4c 00 movl $0x4c76,0x4(%esp)
266a: 00
266b: c7 04 24 12 4c 00 00 movl $0x4c12,(%esp)
2672: e8 ae 16 00 00 call 3d25 <link>
2677: 85 c0 test %eax,%eax
2679: 0f 85 c7 03 00 00 jne 2a46 <subdir+0x516>
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
exit();
}
if(unlink("dd/dd/ff") != 0){
267f: c7 04 24 12 4c 00 00 movl $0x4c12,(%esp)
2686: e8 8a 16 00 00 call 3d15 <unlink>
268b: 85 c0 test %eax,%eax
268d: 0f 85 eb 02 00 00 jne 297e <subdir+0x44e>
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
2693: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
269a: 00
269b: c7 04 24 12 4c 00 00 movl $0x4c12,(%esp)
26a2: e8 5e 16 00 00 call 3d05 <open>
26a7: 85 c0 test %eax,%eax
26a9: 0f 89 5f 04 00 00 jns 2b0e <subdir+0x5de>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
exit();
}
if(chdir("dd") != 0){
26af: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
26b6: e8 7a 16 00 00 call 3d35 <chdir>
26bb: 85 c0 test %eax,%eax
26bd: 0f 85 32 04 00 00 jne 2af5 <subdir+0x5c5>
printf(1, "chdir dd failed\n");
exit();
}
if(chdir("dd/../../dd") != 0){
26c3: c7 04 24 aa 4c 00 00 movl $0x4caa,(%esp)
26ca: e8 66 16 00 00 call 3d35 <chdir>
26cf: 85 c0 test %eax,%eax
26d1: 0f 85 8e 02 00 00 jne 2965 <subdir+0x435>
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("dd/../../../dd") != 0){
26d7: c7 04 24 d0 4c 00 00 movl $0x4cd0,(%esp)
26de: e8 52 16 00 00 call 3d35 <chdir>
26e3: 85 c0 test %eax,%eax
26e5: 0f 85 7a 02 00 00 jne 2965 <subdir+0x435>
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("./..") != 0){
26eb: c7 04 24 df 4c 00 00 movl $0x4cdf,(%esp)
26f2: e8 3e 16 00 00 call 3d35 <chdir>
26f7: 85 c0 test %eax,%eax
26f9: 0f 85 2e 03 00 00 jne 2a2d <subdir+0x4fd>
printf(1, "chdir ./.. failed\n");
exit();
}
fd = open("dd/dd/ffff", 0);
26ff: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2706: 00
2707: c7 04 24 76 4c 00 00 movl $0x4c76,(%esp)
270e: e8 f2 15 00 00 call 3d05 <open>
if(fd < 0){
2713: 85 c0 test %eax,%eax
if(chdir("./..") != 0){
printf(1, "chdir ./.. failed\n");
exit();
}
fd = open("dd/dd/ffff", 0);
2715: 89 c3 mov %eax,%ebx
if(fd < 0){
2717: 0f 88 81 05 00 00 js 2c9e <subdir+0x76e>
printf(1, "open dd/dd/ffff failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 2){
271d: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
2724: 00
2725: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
272c: 00
272d: 89 04 24 mov %eax,(%esp)
2730: e8 a8 15 00 00 call 3cdd <read>
2735: 83 f8 02 cmp $0x2,%eax
2738: 0f 85 47 05 00 00 jne 2c85 <subdir+0x755>
printf(1, "read dd/dd/ffff wrong len\n");
exit();
}
close(fd);
273e: 89 1c 24 mov %ebx,(%esp)
2741: e8 a7 15 00 00 call 3ced <close>
if(open("dd/dd/ff", O_RDONLY) >= 0){
2746: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
274d: 00
274e: c7 04 24 12 4c 00 00 movl $0x4c12,(%esp)
2755: e8 ab 15 00 00 call 3d05 <open>
275a: 85 c0 test %eax,%eax
275c: 0f 89 4e 02 00 00 jns 29b0 <subdir+0x480>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
exit();
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
2762: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2769: 00
276a: c7 04 24 2a 4d 00 00 movl $0x4d2a,(%esp)
2771: e8 8f 15 00 00 call 3d05 <open>
2776: 85 c0 test %eax,%eax
2778: 0f 89 19 02 00 00 jns 2997 <subdir+0x467>
printf(1, "create dd/ff/ff succeeded!\n");
exit();
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
277e: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2785: 00
2786: c7 04 24 4f 4d 00 00 movl $0x4d4f,(%esp)
278d: e8 73 15 00 00 call 3d05 <open>
2792: 85 c0 test %eax,%eax
2794: 0f 89 42 03 00 00 jns 2adc <subdir+0x5ac>
printf(1, "create dd/xx/ff succeeded!\n");
exit();
}
if(open("dd", O_CREATE) >= 0){
279a: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
27a1: 00
27a2: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
27a9: e8 57 15 00 00 call 3d05 <open>
27ae: 85 c0 test %eax,%eax
27b0: 0f 89 0d 03 00 00 jns 2ac3 <subdir+0x593>
printf(1, "create dd succeeded!\n");
exit();
}
if(open("dd", O_RDWR) >= 0){
27b6: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
27bd: 00
27be: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
27c5: e8 3b 15 00 00 call 3d05 <open>
27ca: 85 c0 test %eax,%eax
27cc: 0f 89 d8 02 00 00 jns 2aaa <subdir+0x57a>
printf(1, "open dd rdwr succeeded!\n");
exit();
}
if(open("dd", O_WRONLY) >= 0){
27d2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
27d9: 00
27da: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
27e1: e8 1f 15 00 00 call 3d05 <open>
27e6: 85 c0 test %eax,%eax
27e8: 0f 89 a3 02 00 00 jns 2a91 <subdir+0x561>
printf(1, "open dd wronly succeeded!\n");
exit();
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
27ee: c7 44 24 04 be 4d 00 movl $0x4dbe,0x4(%esp)
27f5: 00
27f6: c7 04 24 2a 4d 00 00 movl $0x4d2a,(%esp)
27fd: e8 23 15 00 00 call 3d25 <link>
2802: 85 c0 test %eax,%eax
2804: 0f 84 6e 02 00 00 je 2a78 <subdir+0x548>
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
280a: c7 44 24 04 be 4d 00 movl $0x4dbe,0x4(%esp)
2811: 00
2812: c7 04 24 4f 4d 00 00 movl $0x4d4f,(%esp)
2819: e8 07 15 00 00 call 3d25 <link>
281e: 85 c0 test %eax,%eax
2820: 0f 84 39 02 00 00 je 2a5f <subdir+0x52f>
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/ff", "dd/dd/ffff") == 0){
2826: c7 44 24 04 76 4c 00 movl $0x4c76,0x4(%esp)
282d: 00
282e: c7 04 24 15 4c 00 00 movl $0x4c15,(%esp)
2835: e8 eb 14 00 00 call 3d25 <link>
283a: 85 c0 test %eax,%eax
283c: 0f 84 a0 01 00 00 je 29e2 <subdir+0x4b2>
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
exit();
}
if(mkdir("dd/ff/ff") == 0){
2842: c7 04 24 2a 4d 00 00 movl $0x4d2a,(%esp)
2849: e8 df 14 00 00 call 3d2d <mkdir>
284e: 85 c0 test %eax,%eax
2850: 0f 84 73 01 00 00 je 29c9 <subdir+0x499>
printf(1, "mkdir dd/ff/ff succeeded!\n");
exit();
}
if(mkdir("dd/xx/ff") == 0){
2856: c7 04 24 4f 4d 00 00 movl $0x4d4f,(%esp)
285d: e8 cb 14 00 00 call 3d2d <mkdir>
2862: 85 c0 test %eax,%eax
2864: 0f 84 02 04 00 00 je 2c6c <subdir+0x73c>
printf(1, "mkdir dd/xx/ff succeeded!\n");
exit();
}
if(mkdir("dd/dd/ffff") == 0){
286a: c7 04 24 76 4c 00 00 movl $0x4c76,(%esp)
2871: e8 b7 14 00 00 call 3d2d <mkdir>
2876: 85 c0 test %eax,%eax
2878: 0f 84 d5 03 00 00 je 2c53 <subdir+0x723>
printf(1, "mkdir dd/dd/ffff succeeded!\n");
exit();
}
if(unlink("dd/xx/ff") == 0){
287e: c7 04 24 4f 4d 00 00 movl $0x4d4f,(%esp)
2885: e8 8b 14 00 00 call 3d15 <unlink>
288a: 85 c0 test %eax,%eax
288c: 0f 84 a8 03 00 00 je 2c3a <subdir+0x70a>
printf(1, "unlink dd/xx/ff succeeded!\n");
exit();
}
if(unlink("dd/ff/ff") == 0){
2892: c7 04 24 2a 4d 00 00 movl $0x4d2a,(%esp)
2899: e8 77 14 00 00 call 3d15 <unlink>
289e: 85 c0 test %eax,%eax
28a0: 0f 84 7b 03 00 00 je 2c21 <subdir+0x6f1>
printf(1, "unlink dd/ff/ff succeeded!\n");
exit();
}
if(chdir("dd/ff") == 0){
28a6: c7 04 24 15 4c 00 00 movl $0x4c15,(%esp)
28ad: e8 83 14 00 00 call 3d35 <chdir>
28b2: 85 c0 test %eax,%eax
28b4: 0f 84 4e 03 00 00 je 2c08 <subdir+0x6d8>
printf(1, "chdir dd/ff succeeded!\n");
exit();
}
if(chdir("dd/xx") == 0){
28ba: c7 04 24 c1 4d 00 00 movl $0x4dc1,(%esp)
28c1: e8 6f 14 00 00 call 3d35 <chdir>
28c6: 85 c0 test %eax,%eax
28c8: 0f 84 21 03 00 00 je 2bef <subdir+0x6bf>
printf(1, "chdir dd/xx succeeded!\n");
exit();
}
if(unlink("dd/dd/ffff") != 0){
28ce: c7 04 24 76 4c 00 00 movl $0x4c76,(%esp)
28d5: e8 3b 14 00 00 call 3d15 <unlink>
28da: 85 c0 test %eax,%eax
28dc: 0f 85 9c 00 00 00 jne 297e <subdir+0x44e>
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(unlink("dd/ff") != 0){
28e2: c7 04 24 15 4c 00 00 movl $0x4c15,(%esp)
28e9: e8 27 14 00 00 call 3d15 <unlink>
28ee: 85 c0 test %eax,%eax
28f0: 0f 85 e0 02 00 00 jne 2bd6 <subdir+0x6a6>
printf(1, "unlink dd/ff failed\n");
exit();
}
if(unlink("dd") == 0){
28f6: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
28fd: e8 13 14 00 00 call 3d15 <unlink>
2902: 85 c0 test %eax,%eax
2904: 0f 84 b3 02 00 00 je 2bbd <subdir+0x68d>
printf(1, "unlink non-empty dd succeeded!\n");
exit();
}
if(unlink("dd/dd") < 0){
290a: c7 04 24 f1 4b 00 00 movl $0x4bf1,(%esp)
2911: e8 ff 13 00 00 call 3d15 <unlink>
2916: 85 c0 test %eax,%eax
2918: 0f 88 86 02 00 00 js 2ba4 <subdir+0x674>
printf(1, "unlink dd/dd failed\n");
exit();
}
if(unlink("dd") < 0){
291e: c7 04 24 dc 4c 00 00 movl $0x4cdc,(%esp)
2925: e8 eb 13 00 00 call 3d15 <unlink>
292a: 85 c0 test %eax,%eax
292c: 0f 88 59 02 00 00 js 2b8b <subdir+0x65b>
printf(1, "unlink dd failed\n");
exit();
}
printf(1, "subdir ok\n");
2932: c7 44 24 04 be 4e 00 movl $0x4ebe,0x4(%esp)
2939: 00
293a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2941: e8 da 14 00 00 call 3e20 <printf>
}
2946: 83 c4 14 add $0x14,%esp
2949: 5b pop %ebx
294a: 5d pop %ebp
294b: c3 ret
printf(1, "open dd/dd/../ff failed\n");
exit();
}
cc = read(fd, buf, sizeof(buf));
if(cc != 2 || buf[0] != 'f'){
printf(1, "dd/dd/../ff wrong content\n");
294c: c7 44 24 04 5b 4c 00 movl $0x4c5b,0x4(%esp)
2953: 00
2954: c7 04 24 01 00 00 00 movl $0x1,(%esp)
295b: e8 c0 14 00 00 call 3e20 <printf>
exit();
2960: e8 60 13 00 00 call 3cc5 <exit>
if(chdir("dd/../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("dd/../../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
2965: c7 44 24 04 b6 4c 00 movl $0x4cb6,0x4(%esp)
296c: 00
296d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2974: e8 a7 14 00 00 call 3e20 <printf>
exit();
2979: e8 47 13 00 00 call 3cc5 <exit>
printf(1, "chdir dd/xx succeeded!\n");
exit();
}
if(unlink("dd/dd/ffff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
297e: c7 44 24 04 81 4c 00 movl $0x4c81,0x4(%esp)
2985: 00
2986: c7 04 24 01 00 00 00 movl $0x1,(%esp)
298d: e8 8e 14 00 00 call 3e20 <printf>
exit();
2992: e8 2e 13 00 00 call 3cc5 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
exit();
}
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/ff/ff succeeded!\n");
2997: c7 44 24 04 33 4d 00 movl $0x4d33,0x4(%esp)
299e: 00
299f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29a6: e8 75 14 00 00 call 3e20 <printf>
exit();
29ab: e8 15 13 00 00 call 3cc5 <exit>
exit();
}
close(fd);
if(open("dd/dd/ff", O_RDONLY) >= 0){
printf(1, "open (unlinked) dd/dd/ff succeeded!\n");
29b0: c7 44 24 04 a4 57 00 movl $0x57a4,0x4(%esp)
29b7: 00
29b8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29bf: e8 5c 14 00 00 call 3e20 <printf>
exit();
29c4: e8 fc 12 00 00 call 3cc5 <exit>
if(link("dd/ff", "dd/dd/ffff") == 0){
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
exit();
}
if(mkdir("dd/ff/ff") == 0){
printf(1, "mkdir dd/ff/ff succeeded!\n");
29c9: c7 44 24 04 c7 4d 00 movl $0x4dc7,0x4(%esp)
29d0: 00
29d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29d8: e8 43 14 00 00 call 3e20 <printf>
exit();
29dd: e8 e3 12 00 00 call 3cc5 <exit>
if(link("dd/xx/ff", "dd/dd/xx") == 0){
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/ff", "dd/dd/ffff") == 0){
printf(1, "link dd/ff dd/dd/ffff succeeded!\n");
29e2: c7 44 24 04 14 58 00 movl $0x5814,0x4(%esp)
29e9: 00
29ea: c7 04 24 01 00 00 00 movl $0x1,(%esp)
29f1: e8 2a 14 00 00 call 3e20 <printf>
exit();
29f6: e8 ca 12 00 00 call 3cc5 <exit>
write(fd, "FF", 2);
close(fd);
fd = open("dd/dd/../ff", 0);
if(fd < 0){
printf(1, "open dd/dd/../ff failed\n");
29fb: c7 44 24 04 42 4c 00 movl $0x4c42,0x4(%esp)
2a02: 00
2a03: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a0a: e8 11 14 00 00 call 3e20 <printf>
exit();
2a0f: e8 b1 12 00 00 call 3cc5 <exit>
exit();
}
fd = open("dd/dd/ff", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create dd/dd/ff failed\n");
2a14: c7 44 24 04 1b 4c 00 movl $0x4c1b,0x4(%esp)
2a1b: 00
2a1c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a23: e8 f8 13 00 00 call 3e20 <printf>
exit();
2a28: e8 98 12 00 00 call 3cc5 <exit>
if(chdir("dd/../../../dd") != 0){
printf(1, "chdir dd/../../dd failed\n");
exit();
}
if(chdir("./..") != 0){
printf(1, "chdir ./.. failed\n");
2a2d: c7 44 24 04 e4 4c 00 movl $0x4ce4,0x4(%esp)
2a34: 00
2a35: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a3c: e8 df 13 00 00 call 3e20 <printf>
exit();
2a41: e8 7f 12 00 00 call 3cc5 <exit>
exit();
}
close(fd);
if(link("dd/dd/ff", "dd/dd/ffff") != 0){
printf(1, "link dd/dd/ff dd/dd/ffff failed\n");
2a46: c7 44 24 04 5c 57 00 movl $0x575c,0x4(%esp)
2a4d: 00
2a4e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a55: e8 c6 13 00 00 call 3e20 <printf>
exit();
2a5a: e8 66 12 00 00 call 3cc5 <exit>
if(link("dd/ff/ff", "dd/dd/xx") == 0){
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
exit();
}
if(link("dd/xx/ff", "dd/dd/xx") == 0){
printf(1, "link dd/xx/ff dd/dd/xx succeeded!\n");
2a5f: c7 44 24 04 f0 57 00 movl $0x57f0,0x4(%esp)
2a66: 00
2a67: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a6e: e8 ad 13 00 00 call 3e20 <printf>
exit();
2a73: e8 4d 12 00 00 call 3cc5 <exit>
if(open("dd", O_WRONLY) >= 0){
printf(1, "open dd wronly succeeded!\n");
exit();
}
if(link("dd/ff/ff", "dd/dd/xx") == 0){
printf(1, "link dd/ff/ff dd/dd/xx succeeded!\n");
2a78: c7 44 24 04 cc 57 00 movl $0x57cc,0x4(%esp)
2a7f: 00
2a80: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a87: e8 94 13 00 00 call 3e20 <printf>
exit();
2a8c: e8 34 12 00 00 call 3cc5 <exit>
if(open("dd", O_RDWR) >= 0){
printf(1, "open dd rdwr succeeded!\n");
exit();
}
if(open("dd", O_WRONLY) >= 0){
printf(1, "open dd wronly succeeded!\n");
2a91: c7 44 24 04 a3 4d 00 movl $0x4da3,0x4(%esp)
2a98: 00
2a99: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2aa0: e8 7b 13 00 00 call 3e20 <printf>
exit();
2aa5: e8 1b 12 00 00 call 3cc5 <exit>
if(open("dd", O_CREATE) >= 0){
printf(1, "create dd succeeded!\n");
exit();
}
if(open("dd", O_RDWR) >= 0){
printf(1, "open dd rdwr succeeded!\n");
2aaa: c7 44 24 04 8a 4d 00 movl $0x4d8a,0x4(%esp)
2ab1: 00
2ab2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ab9: e8 62 13 00 00 call 3e20 <printf>
exit();
2abe: e8 02 12 00 00 call 3cc5 <exit>
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/xx/ff succeeded!\n");
exit();
}
if(open("dd", O_CREATE) >= 0){
printf(1, "create dd succeeded!\n");
2ac3: c7 44 24 04 74 4d 00 movl $0x4d74,0x4(%esp)
2aca: 00
2acb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ad2: e8 49 13 00 00 call 3e20 <printf>
exit();
2ad7: e8 e9 11 00 00 call 3cc5 <exit>
if(open("dd/ff/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/ff/ff succeeded!\n");
exit();
}
if(open("dd/xx/ff", O_CREATE|O_RDWR) >= 0){
printf(1, "create dd/xx/ff succeeded!\n");
2adc: c7 44 24 04 58 4d 00 movl $0x4d58,0x4(%esp)
2ae3: 00
2ae4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2aeb: e8 30 13 00 00 call 3e20 <printf>
exit();
2af0: e8 d0 11 00 00 call 3cc5 <exit>
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
exit();
}
if(chdir("dd") != 0){
printf(1, "chdir dd failed\n");
2af5: c7 44 24 04 99 4c 00 movl $0x4c99,0x4(%esp)
2afc: 00
2afd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b04: e8 17 13 00 00 call 3e20 <printf>
exit();
2b09: e8 b7 11 00 00 call 3cc5 <exit>
if(unlink("dd/dd/ff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(open("dd/dd/ff", O_RDONLY) >= 0){
printf(1, "open (unlinked) dd/dd/ff succeeded\n");
2b0e: c7 44 24 04 80 57 00 movl $0x5780,0x4(%esp)
2b15: 00
2b16: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b1d: e8 fe 12 00 00 call 3e20 <printf>
exit();
2b22: e8 9e 11 00 00 call 3cc5 <exit>
printf(1, "unlink dd (non-empty dir) succeeded!\n");
exit();
}
if(mkdir("/dd/dd") != 0){
printf(1, "subdir mkdir dd/dd failed\n");
2b27: c7 44 24 04 f7 4b 00 movl $0x4bf7,0x4(%esp)
2b2e: 00
2b2f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b36: e8 e5 12 00 00 call 3e20 <printf>
exit();
2b3b: e8 85 11 00 00 call 3cc5 <exit>
}
write(fd, "ff", 2);
close(fd);
if(unlink("dd") >= 0){
printf(1, "unlink dd (non-empty dir) succeeded!\n");
2b40: c7 44 24 04 34 57 00 movl $0x5734,0x4(%esp)
2b47: 00
2b48: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b4f: e8 cc 12 00 00 call 3e20 <printf>
exit();
2b54: e8 6c 11 00 00 call 3cc5 <exit>
exit();
}
fd = open("dd/ff", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create dd/ff failed\n");
2b59: c7 44 24 04 db 4b 00 movl $0x4bdb,0x4(%esp)
2b60: 00
2b61: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b68: e8 b3 12 00 00 call 3e20 <printf>
exit();
2b6d: e8 53 11 00 00 call 3cc5 <exit>
printf(1, "subdir test\n");
unlink("ff");
if(mkdir("dd") != 0){
printf(1, "subdir mkdir dd failed\n");
2b72: c7 44 24 04 c3 4b 00 movl $0x4bc3,0x4(%esp)
2b79: 00
2b7a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b81: e8 9a 12 00 00 call 3e20 <printf>
exit();
2b86: e8 3a 11 00 00 call 3cc5 <exit>
if(unlink("dd/dd") < 0){
printf(1, "unlink dd/dd failed\n");
exit();
}
if(unlink("dd") < 0){
printf(1, "unlink dd failed\n");
2b8b: c7 44 24 04 ac 4e 00 movl $0x4eac,0x4(%esp)
2b92: 00
2b93: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2b9a: e8 81 12 00 00 call 3e20 <printf>
exit();
2b9f: e8 21 11 00 00 call 3cc5 <exit>
if(unlink("dd") == 0){
printf(1, "unlink non-empty dd succeeded!\n");
exit();
}
if(unlink("dd/dd") < 0){
printf(1, "unlink dd/dd failed\n");
2ba4: c7 44 24 04 97 4e 00 movl $0x4e97,0x4(%esp)
2bab: 00
2bac: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bb3: e8 68 12 00 00 call 3e20 <printf>
exit();
2bb8: e8 08 11 00 00 call 3cc5 <exit>
if(unlink("dd/ff") != 0){
printf(1, "unlink dd/ff failed\n");
exit();
}
if(unlink("dd") == 0){
printf(1, "unlink non-empty dd succeeded!\n");
2bbd: c7 44 24 04 38 58 00 movl $0x5838,0x4(%esp)
2bc4: 00
2bc5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bcc: e8 4f 12 00 00 call 3e20 <printf>
exit();
2bd1: e8 ef 10 00 00 call 3cc5 <exit>
if(unlink("dd/dd/ffff") != 0){
printf(1, "unlink dd/dd/ff failed\n");
exit();
}
if(unlink("dd/ff") != 0){
printf(1, "unlink dd/ff failed\n");
2bd6: c7 44 24 04 82 4e 00 movl $0x4e82,0x4(%esp)
2bdd: 00
2bde: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2be5: e8 36 12 00 00 call 3e20 <printf>
exit();
2bea: e8 d6 10 00 00 call 3cc5 <exit>
if(chdir("dd/ff") == 0){
printf(1, "chdir dd/ff succeeded!\n");
exit();
}
if(chdir("dd/xx") == 0){
printf(1, "chdir dd/xx succeeded!\n");
2bef: c7 44 24 04 6a 4e 00 movl $0x4e6a,0x4(%esp)
2bf6: 00
2bf7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bfe: e8 1d 12 00 00 call 3e20 <printf>
exit();
2c03: e8 bd 10 00 00 call 3cc5 <exit>
if(unlink("dd/ff/ff") == 0){
printf(1, "unlink dd/ff/ff succeeded!\n");
exit();
}
if(chdir("dd/ff") == 0){
printf(1, "chdir dd/ff succeeded!\n");
2c08: c7 44 24 04 52 4e 00 movl $0x4e52,0x4(%esp)
2c0f: 00
2c10: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c17: e8 04 12 00 00 call 3e20 <printf>
exit();
2c1c: e8 a4 10 00 00 call 3cc5 <exit>
if(unlink("dd/xx/ff") == 0){
printf(1, "unlink dd/xx/ff succeeded!\n");
exit();
}
if(unlink("dd/ff/ff") == 0){
printf(1, "unlink dd/ff/ff succeeded!\n");
2c21: c7 44 24 04 36 4e 00 movl $0x4e36,0x4(%esp)
2c28: 00
2c29: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c30: e8 eb 11 00 00 call 3e20 <printf>
exit();
2c35: e8 8b 10 00 00 call 3cc5 <exit>
if(mkdir("dd/dd/ffff") == 0){
printf(1, "mkdir dd/dd/ffff succeeded!\n");
exit();
}
if(unlink("dd/xx/ff") == 0){
printf(1, "unlink dd/xx/ff succeeded!\n");
2c3a: c7 44 24 04 1a 4e 00 movl $0x4e1a,0x4(%esp)
2c41: 00
2c42: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c49: e8 d2 11 00 00 call 3e20 <printf>
exit();
2c4e: e8 72 10 00 00 call 3cc5 <exit>
if(mkdir("dd/xx/ff") == 0){
printf(1, "mkdir dd/xx/ff succeeded!\n");
exit();
}
if(mkdir("dd/dd/ffff") == 0){
printf(1, "mkdir dd/dd/ffff succeeded!\n");
2c53: c7 44 24 04 fd 4d 00 movl $0x4dfd,0x4(%esp)
2c5a: 00
2c5b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c62: e8 b9 11 00 00 call 3e20 <printf>
exit();
2c67: e8 59 10 00 00 call 3cc5 <exit>
if(mkdir("dd/ff/ff") == 0){
printf(1, "mkdir dd/ff/ff succeeded!\n");
exit();
}
if(mkdir("dd/xx/ff") == 0){
printf(1, "mkdir dd/xx/ff succeeded!\n");
2c6c: c7 44 24 04 e2 4d 00 movl $0x4de2,0x4(%esp)
2c73: 00
2c74: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c7b: e8 a0 11 00 00 call 3e20 <printf>
exit();
2c80: e8 40 10 00 00 call 3cc5 <exit>
if(fd < 0){
printf(1, "open dd/dd/ffff failed\n");
exit();
}
if(read(fd, buf, sizeof(buf)) != 2){
printf(1, "read dd/dd/ffff wrong len\n");
2c85: c7 44 24 04 0f 4d 00 movl $0x4d0f,0x4(%esp)
2c8c: 00
2c8d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2c94: e8 87 11 00 00 call 3e20 <printf>
exit();
2c99: e8 27 10 00 00 call 3cc5 <exit>
exit();
}
fd = open("dd/dd/ffff", 0);
if(fd < 0){
printf(1, "open dd/dd/ffff failed\n");
2c9e: c7 44 24 04 f7 4c 00 movl $0x4cf7,0x4(%esp)
2ca5: 00
2ca6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2cad: e8 6e 11 00 00 call 3e20 <printf>
exit();
2cb2: e8 0e 10 00 00 call 3cc5 <exit>
2cb7: 89 f6 mov %esi,%esi
2cb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00002cc0 <dirtest>:
}
printf(stdout, "many creates, followed by unlink; ok\n");
}
void dirtest(void)
{
2cc0: 55 push %ebp
2cc1: 89 e5 mov %esp,%ebp
2cc3: 83 ec 18 sub $0x18,%esp
printf(stdout, "mkdir test\n");
2cc6: a1 5c 59 00 00 mov 0x595c,%eax
2ccb: c7 44 24 04 c9 4e 00 movl $0x4ec9,0x4(%esp)
2cd2: 00
2cd3: 89 04 24 mov %eax,(%esp)
2cd6: e8 45 11 00 00 call 3e20 <printf>
if(mkdir("dir0") < 0){
2cdb: c7 04 24 d5 4e 00 00 movl $0x4ed5,(%esp)
2ce2: e8 46 10 00 00 call 3d2d <mkdir>
2ce7: 85 c0 test %eax,%eax
2ce9: 78 4b js 2d36 <dirtest+0x76>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0){
2ceb: c7 04 24 d5 4e 00 00 movl $0x4ed5,(%esp)
2cf2: e8 3e 10 00 00 call 3d35 <chdir>
2cf7: 85 c0 test %eax,%eax
2cf9: 0f 88 85 00 00 00 js 2d84 <dirtest+0xc4>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0){
2cff: c7 04 24 e1 4c 00 00 movl $0x4ce1,(%esp)
2d06: e8 2a 10 00 00 call 3d35 <chdir>
2d0b: 85 c0 test %eax,%eax
2d0d: 78 5b js 2d6a <dirtest+0xaa>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0){
2d0f: c7 04 24 d5 4e 00 00 movl $0x4ed5,(%esp)
2d16: e8 fa 0f 00 00 call 3d15 <unlink>
2d1b: 85 c0 test %eax,%eax
2d1d: 78 31 js 2d50 <dirtest+0x90>
printf(stdout, "unlink dir0 failed\n");
exit();
}
printf(stdout, "mkdir test ok\n");
2d1f: a1 5c 59 00 00 mov 0x595c,%eax
2d24: c7 44 24 04 20 4f 00 movl $0x4f20,0x4(%esp)
2d2b: 00
2d2c: 89 04 24 mov %eax,(%esp)
2d2f: e8 ec 10 00 00 call 3e20 <printf>
}
2d34: c9 leave
2d35: c3 ret
void dirtest(void)
{
printf(stdout, "mkdir test\n");
if(mkdir("dir0") < 0){
printf(stdout, "mkdir failed\n");
2d36: a1 5c 59 00 00 mov 0x595c,%eax
2d3b: c7 44 24 04 da 4e 00 movl $0x4eda,0x4(%esp)
2d42: 00
2d43: 89 04 24 mov %eax,(%esp)
2d46: e8 d5 10 00 00 call 3e20 <printf>
exit();
2d4b: e8 75 0f 00 00 call 3cc5 <exit>
printf(stdout, "chdir .. failed\n");
exit();
}
if(unlink("dir0") < 0){
printf(stdout, "unlink dir0 failed\n");
2d50: a1 5c 59 00 00 mov 0x595c,%eax
2d55: c7 44 24 04 0c 4f 00 movl $0x4f0c,0x4(%esp)
2d5c: 00
2d5d: 89 04 24 mov %eax,(%esp)
2d60: e8 bb 10 00 00 call 3e20 <printf>
exit();
2d65: e8 5b 0f 00 00 call 3cc5 <exit>
printf(stdout, "chdir dir0 failed\n");
exit();
}
if(chdir("..") < 0){
printf(stdout, "chdir .. failed\n");
2d6a: a1 5c 59 00 00 mov 0x595c,%eax
2d6f: c7 44 24 04 fb 4e 00 movl $0x4efb,0x4(%esp)
2d76: 00
2d77: 89 04 24 mov %eax,(%esp)
2d7a: e8 a1 10 00 00 call 3e20 <printf>
exit();
2d7f: e8 41 0f 00 00 call 3cc5 <exit>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("dir0") < 0){
printf(stdout, "chdir dir0 failed\n");
2d84: a1 5c 59 00 00 mov 0x595c,%eax
2d89: c7 44 24 04 e8 4e 00 movl $0x4ee8,0x4(%esp)
2d90: 00
2d91: 89 04 24 mov %eax,(%esp)
2d94: e8 87 10 00 00 call 3e20 <printf>
exit();
2d99: e8 27 0f 00 00 call 3cc5 <exit>
2d9e: 66 90 xchg %ax,%ax
00002da0 <exitiputtest>:
}
// does exit() call iput(p->cwd) in a transaction?
void
exitiputtest(void)
{
2da0: 55 push %ebp
2da1: 89 e5 mov %esp,%ebp
2da3: 83 ec 18 sub $0x18,%esp
int pid;
printf(stdout, "exitiput test\n");
2da6: a1 5c 59 00 00 mov 0x595c,%eax
2dab: c7 44 24 04 2f 4f 00 movl $0x4f2f,0x4(%esp)
2db2: 00
2db3: 89 04 24 mov %eax,(%esp)
2db6: e8 65 10 00 00 call 3e20 <printf>
pid = fork();
2dbb: e8 fd 0e 00 00 call 3cbd <fork>
if(pid < 0){
2dc0: 83 f8 00 cmp $0x0,%eax
2dc3: 7c 75 jl 2e3a <exitiputtest+0x9a>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
2dc5: 75 39 jne 2e00 <exitiputtest+0x60>
if(mkdir("iputdir") < 0){
2dc7: c7 04 24 55 4f 00 00 movl $0x4f55,(%esp)
2dce: e8 5a 0f 00 00 call 3d2d <mkdir>
2dd3: 85 c0 test %eax,%eax
2dd5: 0f 88 93 00 00 00 js 2e6e <exitiputtest+0xce>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
2ddb: c7 04 24 55 4f 00 00 movl $0x4f55,(%esp)
2de2: e8 4e 0f 00 00 call 3d35 <chdir>
2de7: 85 c0 test %eax,%eax
2de9: 78 69 js 2e54 <exitiputtest+0xb4>
printf(stdout, "child chdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
2deb: c7 04 24 52 4f 00 00 movl $0x4f52,(%esp)
2df2: e8 1e 0f 00 00 call 3d15 <unlink>
2df7: 85 c0 test %eax,%eax
2df9: 78 25 js 2e20 <exitiputtest+0x80>
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
exit();
2dfb: e8 c5 0e 00 00 call 3cc5 <exit>
}
wait();
2e00: e8 c8 0e 00 00 call 3ccd <wait>
printf(stdout, "exitiput test ok\n");
2e05: a1 5c 59 00 00 mov 0x595c,%eax
2e0a: c7 44 24 04 77 4f 00 movl $0x4f77,0x4(%esp)
2e11: 00
2e12: 89 04 24 mov %eax,(%esp)
2e15: e8 06 10 00 00 call 3e20 <printf>
}
2e1a: c9 leave
2e1b: c3 ret
2e1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(chdir("iputdir") < 0){
printf(stdout, "child chdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
2e20: a1 5c 59 00 00 mov 0x595c,%eax
2e25: c7 44 24 04 5d 4f 00 movl $0x4f5d,0x4(%esp)
2e2c: 00
2e2d: 89 04 24 mov %eax,(%esp)
2e30: e8 eb 0f 00 00 call 3e20 <printf>
exit();
2e35: e8 8b 0e 00 00 call 3cc5 <exit>
printf(stdout, "exitiput test\n");
pid = fork();
if(pid < 0){
printf(stdout, "fork failed\n");
2e3a: a1 5c 59 00 00 mov 0x595c,%eax
2e3f: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
2e46: 00
2e47: 89 04 24 mov %eax,(%esp)
2e4a: e8 d1 0f 00 00 call 3e20 <printf>
exit();
2e4f: e8 71 0e 00 00 call 3cc5 <exit>
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
printf(stdout, "child chdir failed\n");
2e54: a1 5c 59 00 00 mov 0x595c,%eax
2e59: c7 44 24 04 3e 4f 00 movl $0x4f3e,0x4(%esp)
2e60: 00
2e61: 89 04 24 mov %eax,(%esp)
2e64: e8 b7 0f 00 00 call 3e20 <printf>
exit();
2e69: e8 57 0e 00 00 call 3cc5 <exit>
printf(stdout, "fork failed\n");
exit();
}
if(pid == 0){
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
2e6e: a1 5c 59 00 00 mov 0x595c,%eax
2e73: c7 44 24 04 da 4e 00 movl $0x4eda,0x4(%esp)
2e7a: 00
2e7b: 89 04 24 mov %eax,(%esp)
2e7e: e8 9d 0f 00 00 call 3e20 <printf>
exit();
2e83: e8 3d 0e 00 00 call 3cc5 <exit>
2e88: 90 nop
2e89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00002e90 <iputtest>:
int stdout = 1;
// does chdir() call iput(p->cwd) in a transaction?
void
iputtest(void)
{
2e90: 55 push %ebp
2e91: 89 e5 mov %esp,%ebp
2e93: 83 ec 18 sub $0x18,%esp
printf(stdout, "iput test\n");
2e96: a1 5c 59 00 00 mov 0x595c,%eax
2e9b: c7 44 24 04 7c 49 00 movl $0x497c,0x4(%esp)
2ea2: 00
2ea3: 89 04 24 mov %eax,(%esp)
2ea6: e8 75 0f 00 00 call 3e20 <printf>
if(mkdir("iputdir") < 0){
2eab: c7 04 24 55 4f 00 00 movl $0x4f55,(%esp)
2eb2: e8 76 0e 00 00 call 3d2d <mkdir>
2eb7: 85 c0 test %eax,%eax
2eb9: 78 4b js 2f06 <iputtest+0x76>
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
2ebb: c7 04 24 55 4f 00 00 movl $0x4f55,(%esp)
2ec2: e8 6e 0e 00 00 call 3d35 <chdir>
2ec7: 85 c0 test %eax,%eax
2ec9: 0f 88 85 00 00 00 js 2f54 <iputtest+0xc4>
printf(stdout, "chdir iputdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
2ecf: c7 04 24 52 4f 00 00 movl $0x4f52,(%esp)
2ed6: e8 3a 0e 00 00 call 3d15 <unlink>
2edb: 85 c0 test %eax,%eax
2edd: 78 5b js 2f3a <iputtest+0xaa>
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
if(chdir("/") < 0){
2edf: c7 04 24 f9 49 00 00 movl $0x49f9,(%esp)
2ee6: e8 4a 0e 00 00 call 3d35 <chdir>
2eeb: 85 c0 test %eax,%eax
2eed: 78 31 js 2f20 <iputtest+0x90>
printf(stdout, "chdir / failed\n");
exit();
}
printf(stdout, "iput test ok\n");
2eef: a1 5c 59 00 00 mov 0x595c,%eax
2ef4: c7 44 24 04 a5 49 00 movl $0x49a5,0x4(%esp)
2efb: 00
2efc: 89 04 24 mov %eax,(%esp)
2eff: e8 1c 0f 00 00 call 3e20 <printf>
}
2f04: c9 leave
2f05: c3 ret
iputtest(void)
{
printf(stdout, "iput test\n");
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
2f06: a1 5c 59 00 00 mov 0x595c,%eax
2f0b: c7 44 24 04 da 4e 00 movl $0x4eda,0x4(%esp)
2f12: 00
2f13: 89 04 24 mov %eax,(%esp)
2f16: e8 05 0f 00 00 call 3e20 <printf>
exit();
2f1b: e8 a5 0d 00 00 call 3cc5 <exit>
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
exit();
}
if(chdir("/") < 0){
printf(stdout, "chdir / failed\n");
2f20: a1 5c 59 00 00 mov 0x595c,%eax
2f25: c7 44 24 04 49 4b 00 movl $0x4b49,0x4(%esp)
2f2c: 00
2f2d: 89 04 24 mov %eax,(%esp)
2f30: e8 eb 0e 00 00 call 3e20 <printf>
exit();
2f35: e8 8b 0d 00 00 call 3cc5 <exit>
if(chdir("iputdir") < 0){
printf(stdout, "chdir iputdir failed\n");
exit();
}
if(unlink("../iputdir") < 0){
printf(stdout, "unlink ../iputdir failed\n");
2f3a: a1 5c 59 00 00 mov 0x595c,%eax
2f3f: c7 44 24 04 5d 4f 00 movl $0x4f5d,0x4(%esp)
2f46: 00
2f47: 89 04 24 mov %eax,(%esp)
2f4a: e8 d1 0e 00 00 call 3e20 <printf>
exit();
2f4f: e8 71 0d 00 00 call 3cc5 <exit>
if(mkdir("iputdir") < 0){
printf(stdout, "mkdir failed\n");
exit();
}
if(chdir("iputdir") < 0){
printf(stdout, "chdir iputdir failed\n");
2f54: a1 5c 59 00 00 mov 0x595c,%eax
2f59: c7 44 24 04 89 4f 00 movl $0x4f89,0x4(%esp)
2f60: 00
2f61: 89 04 24 mov %eax,(%esp)
2f64: e8 b7 0e 00 00 call 3e20 <printf>
exit();
2f69: e8 57 0d 00 00 call 3cc5 <exit>
2f6e: 66 90 xchg %ax,%ax
00002f70 <bigfile>:
printf(1, "bigwrite ok\n");
}
void
bigfile(void)
{
2f70: 55 push %ebp
2f71: 89 e5 mov %esp,%ebp
2f73: 57 push %edi
2f74: 56 push %esi
2f75: 53 push %ebx
2f76: 83 ec 1c sub $0x1c,%esp
int fd, i, total, cc;
printf(1, "bigfile test\n");
2f79: c7 44 24 04 9f 4f 00 movl $0x4f9f,0x4(%esp)
2f80: 00
2f81: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f88: e8 93 0e 00 00 call 3e20 <printf>
unlink("bigfile");
2f8d: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp)
2f94: e8 7c 0d 00 00 call 3d15 <unlink>
fd = open("bigfile", O_CREATE | O_RDWR);
2f99: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
2fa0: 00
2fa1: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp)
2fa8: e8 58 0d 00 00 call 3d05 <open>
if(fd < 0){
2fad: 85 c0 test %eax,%eax
int fd, i, total, cc;
printf(1, "bigfile test\n");
unlink("bigfile");
fd = open("bigfile", O_CREATE | O_RDWR);
2faf: 89 c6 mov %eax,%esi
if(fd < 0){
2fb1: 0f 88 7f 01 00 00 js 3136 <bigfile+0x1c6>
printf(1, "cannot create bigfile");
exit();
2fb7: 31 db xor %ebx,%ebx
2fb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
}
for(i = 0; i < 20; i++){
memset(buf, i, 600);
2fc0: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
2fc7: 00
2fc8: 89 5c 24 04 mov %ebx,0x4(%esp)
2fcc: c7 04 24 40 81 00 00 movl $0x8140,(%esp)
2fd3: e8 68 0b 00 00 call 3b40 <memset>
if(write(fd, buf, 600) != 600){
2fd8: c7 44 24 08 58 02 00 movl $0x258,0x8(%esp)
2fdf: 00
2fe0: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
2fe7: 00
2fe8: 89 34 24 mov %esi,(%esp)
2feb: e8 f5 0c 00 00 call 3ce5 <write>
2ff0: 3d 58 02 00 00 cmp $0x258,%eax
2ff5: 0f 85 09 01 00 00 jne 3104 <bigfile+0x194>
fd = open("bigfile", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigfile");
exit();
}
for(i = 0; i < 20; i++){
2ffb: 83 c3 01 add $0x1,%ebx
2ffe: 83 fb 14 cmp $0x14,%ebx
3001: 75 bd jne 2fc0 <bigfile+0x50>
if(write(fd, buf, 600) != 600){
printf(1, "write bigfile failed\n");
exit();
}
}
close(fd);
3003: 89 34 24 mov %esi,(%esp)
3006: e8 e2 0c 00 00 call 3ced <close>
fd = open("bigfile", 0);
300b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3012: 00
3013: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp)
301a: e8 e6 0c 00 00 call 3d05 <open>
if(fd < 0){
301f: 85 c0 test %eax,%eax
exit();
}
}
close(fd);
fd = open("bigfile", 0);
3021: 89 c7 mov %eax,%edi
if(fd < 0){
3023: 0f 88 f4 00 00 00 js 311d <bigfile+0x1ad>
printf(1, "cannot open bigfile\n");
exit();
3029: 31 f6 xor %esi,%esi
302b: 31 db xor %ebx,%ebx
302d: eb 2f jmp 305e <bigfile+0xee>
302f: 90 nop
printf(1, "read bigfile failed\n");
exit();
}
if(cc == 0)
break;
if(cc != 300){
3030: 3d 2c 01 00 00 cmp $0x12c,%eax
3035: 0f 85 97 00 00 00 jne 30d2 <bigfile+0x162>
printf(1, "short read bigfile\n");
exit();
}
if(buf[0] != i/2 || buf[299] != i/2){
303b: 0f be 05 40 81 00 00 movsbl 0x8140,%eax
3042: 89 da mov %ebx,%edx
3044: d1 fa sar %edx
3046: 39 d0 cmp %edx,%eax
3048: 75 6f jne 30b9 <bigfile+0x149>
304a: 0f be 15 6b 82 00 00 movsbl 0x826b,%edx
3051: 39 d0 cmp %edx,%eax
3053: 75 64 jne 30b9 <bigfile+0x149>
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
3055: 81 c6 2c 01 00 00 add $0x12c,%esi
if(fd < 0){
printf(1, "cannot open bigfile\n");
exit();
}
total = 0;
for(i = 0; ; i++){
305b: 83 c3 01 add $0x1,%ebx
cc = read(fd, buf, 300);
305e: c7 44 24 08 2c 01 00 movl $0x12c,0x8(%esp)
3065: 00
3066: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
306d: 00
306e: 89 3c 24 mov %edi,(%esp)
3071: e8 67 0c 00 00 call 3cdd <read>
if(cc < 0){
3076: 83 f8 00 cmp $0x0,%eax
3079: 7c 70 jl 30eb <bigfile+0x17b>
printf(1, "read bigfile failed\n");
exit();
}
if(cc == 0)
307b: 75 b3 jne 3030 <bigfile+0xc0>
printf(1, "read bigfile wrong data\n");
exit();
}
total += cc;
}
close(fd);
307d: 89 3c 24 mov %edi,(%esp)
3080: e8 68 0c 00 00 call 3ced <close>
if(total != 20*600){
3085: 81 fe e0 2e 00 00 cmp $0x2ee0,%esi
308b: 0f 85 be 00 00 00 jne 314f <bigfile+0x1df>
printf(1, "read bigfile wrong total\n");
exit();
}
unlink("bigfile");
3091: c7 04 24 bb 4f 00 00 movl $0x4fbb,(%esp)
3098: e8 78 0c 00 00 call 3d15 <unlink>
printf(1, "bigfile test ok\n");
309d: c7 44 24 04 4a 50 00 movl $0x504a,0x4(%esp)
30a4: 00
30a5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30ac: e8 6f 0d 00 00 call 3e20 <printf>
}
30b1: 83 c4 1c add $0x1c,%esp
30b4: 5b pop %ebx
30b5: 5e pop %esi
30b6: 5f pop %edi
30b7: 5d pop %ebp
30b8: c3 ret
if(cc != 300){
printf(1, "short read bigfile\n");
exit();
}
if(buf[0] != i/2 || buf[299] != i/2){
printf(1, "read bigfile wrong data\n");
30b9: c7 44 24 04 17 50 00 movl $0x5017,0x4(%esp)
30c0: 00
30c1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30c8: e8 53 0d 00 00 call 3e20 <printf>
exit();
30cd: e8 f3 0b 00 00 call 3cc5 <exit>
exit();
}
if(cc == 0)
break;
if(cc != 300){
printf(1, "short read bigfile\n");
30d2: c7 44 24 04 03 50 00 movl $0x5003,0x4(%esp)
30d9: 00
30da: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30e1: e8 3a 0d 00 00 call 3e20 <printf>
exit();
30e6: e8 da 0b 00 00 call 3cc5 <exit>
}
total = 0;
for(i = 0; ; i++){
cc = read(fd, buf, 300);
if(cc < 0){
printf(1, "read bigfile failed\n");
30eb: c7 44 24 04 ee 4f 00 movl $0x4fee,0x4(%esp)
30f2: 00
30f3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
30fa: e8 21 0d 00 00 call 3e20 <printf>
exit();
30ff: e8 c1 0b 00 00 call 3cc5 <exit>
exit();
}
for(i = 0; i < 20; i++){
memset(buf, i, 600);
if(write(fd, buf, 600) != 600){
printf(1, "write bigfile failed\n");
3104: c7 44 24 04 c3 4f 00 movl $0x4fc3,0x4(%esp)
310b: 00
310c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3113: e8 08 0d 00 00 call 3e20 <printf>
exit();
3118: e8 a8 0b 00 00 call 3cc5 <exit>
}
close(fd);
fd = open("bigfile", 0);
if(fd < 0){
printf(1, "cannot open bigfile\n");
311d: c7 44 24 04 d9 4f 00 movl $0x4fd9,0x4(%esp)
3124: 00
3125: c7 04 24 01 00 00 00 movl $0x1,(%esp)
312c: e8 ef 0c 00 00 call 3e20 <printf>
exit();
3131: e8 8f 0b 00 00 call 3cc5 <exit>
printf(1, "bigfile test\n");
unlink("bigfile");
fd = open("bigfile", O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "cannot create bigfile");
3136: c7 44 24 04 ad 4f 00 movl $0x4fad,0x4(%esp)
313d: 00
313e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3145: e8 d6 0c 00 00 call 3e20 <printf>
exit();
314a: e8 76 0b 00 00 call 3cc5 <exit>
}
total += cc;
}
close(fd);
if(total != 20*600){
printf(1, "read bigfile wrong total\n");
314f: c7 44 24 04 30 50 00 movl $0x5030,0x4(%esp)
3156: 00
3157: c7 04 24 01 00 00 00 movl $0x1,(%esp)
315e: e8 bd 0c 00 00 call 3e20 <printf>
exit();
3163: e8 5d 0b 00 00 call 3cc5 <exit>
3168: 90 nop
3169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00003170 <concreate>:
}
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
3170: 55 push %ebp
3171: 89 e5 mov %esp,%ebp
3173: 57 push %edi
3174: 56 push %esi
3175: 53 push %ebx
char name[14];
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
3176: 31 db xor %ebx,%ebx
}
// test concurrent create/link/unlink of the same file
void
concreate(void)
{
3178: 83 ec 6c sub $0x6c,%esp
struct {
ushort inum;
char name[14];
} de;
printf(1, "concreate test\n");
317b: c7 44 24 04 5b 50 00 movl $0x505b,0x4(%esp)
3182: 00
3183: 8d 75 e5 lea -0x1b(%ebp),%esi
3186: c7 04 24 01 00 00 00 movl $0x1,(%esp)
318d: e8 8e 0c 00 00 call 3e20 <printf>
file[0] = 'C';
3192: c6 45 e5 43 movb $0x43,-0x1b(%ebp)
file[2] = '\0';
3196: c6 45 e7 00 movb $0x0,-0x19(%ebp)
319a: eb 4f jmp 31eb <concreate+0x7b>
319c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
31a0: b8 56 55 55 55 mov $0x55555556,%eax
31a5: f7 eb imul %ebx
31a7: 89 d8 mov %ebx,%eax
31a9: c1 f8 1f sar $0x1f,%eax
31ac: 29 c2 sub %eax,%edx
31ae: 8d 04 52 lea (%edx,%edx,2),%eax
31b1: 89 da mov %ebx,%edx
31b3: 29 c2 sub %eax,%edx
31b5: 83 fa 01 cmp $0x1,%edx
31b8: 74 7e je 3238 <concreate+0xc8>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
link("C0", file);
} else {
fd = open(file, O_CREATE | O_RDWR);
31ba: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
31c1: 00
31c2: 89 34 24 mov %esi,(%esp)
31c5: e8 3b 0b 00 00 call 3d05 <open>
if(fd < 0){
31ca: 85 c0 test %eax,%eax
31cc: 0f 88 5b 02 00 00 js 342d <concreate+0x2bd>
printf(1, "concreate create %s failed\n", file);
exit();
}
close(fd);
31d2: 89 04 24 mov %eax,(%esp)
31d5: e8 13 0b 00 00 call 3ced <close>
}
if(pid == 0)
31da: 85 ff test %edi,%edi
31dc: 74 52 je 3230 <concreate+0xc0>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
31de: 83 c3 01 add $0x1,%ebx
close(fd);
}
if(pid == 0)
exit();
else
wait();
31e1: e8 e7 0a 00 00 call 3ccd <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
31e6: 83 fb 28 cmp $0x28,%ebx
31e9: 74 6d je 3258 <concreate+0xe8>
file[1] = '0' + i;
31eb: 8d 43 30 lea 0x30(%ebx),%eax
31ee: 88 45 e6 mov %al,-0x1a(%ebp)
unlink(file);
31f1: 89 34 24 mov %esi,(%esp)
31f4: e8 1c 0b 00 00 call 3d15 <unlink>
pid = fork();
31f9: e8 bf 0a 00 00 call 3cbd <fork>
if(pid && (i % 3) == 1){
31fe: 85 c0 test %eax,%eax
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
file[1] = '0' + i;
unlink(file);
pid = fork();
3200: 89 c7 mov %eax,%edi
if(pid && (i % 3) == 1){
3202: 75 9c jne 31a0 <concreate+0x30>
link("C0", file);
} else if(pid == 0 && (i % 5) == 1){
3204: b8 67 66 66 66 mov $0x66666667,%eax
3209: f7 eb imul %ebx
320b: 89 d8 mov %ebx,%eax
320d: c1 f8 1f sar $0x1f,%eax
3210: d1 fa sar %edx
3212: 29 c2 sub %eax,%edx
3214: 8d 04 92 lea (%edx,%edx,4),%eax
3217: 89 da mov %ebx,%edx
3219: 29 c2 sub %eax,%edx
321b: 83 fa 01 cmp $0x1,%edx
321e: 75 9a jne 31ba <concreate+0x4a>
link("C0", file);
3220: 89 74 24 04 mov %esi,0x4(%esp)
3224: c7 04 24 6b 50 00 00 movl $0x506b,(%esp)
322b: e8 f5 0a 00 00 call 3d25 <link>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
i = de.name[1] - '0';
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
exit();
3230: e8 90 0a 00 00 call 3cc5 <exit>
3235: 8d 76 00 lea 0x0(%esi),%esi
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
3238: 83 c3 01 add $0x1,%ebx
file[1] = '0' + i;
unlink(file);
pid = fork();
if(pid && (i % 3) == 1){
link("C0", file);
323b: 89 74 24 04 mov %esi,0x4(%esp)
323f: c7 04 24 6b 50 00 00 movl $0x506b,(%esp)
3246: e8 da 0a 00 00 call 3d25 <link>
close(fd);
}
if(pid == 0)
exit();
else
wait();
324b: e8 7d 0a 00 00 call 3ccd <wait>
} de;
printf(1, "concreate test\n");
file[0] = 'C';
file[2] = '\0';
for(i = 0; i < 40; i++){
3250: 83 fb 28 cmp $0x28,%ebx
3253: 75 96 jne 31eb <concreate+0x7b>
3255: 8d 76 00 lea 0x0(%esi),%esi
exit();
else
wait();
}
memset(fa, 0, sizeof(fa));
3258: 8d 45 ac lea -0x54(%ebp),%eax
325b: c7 44 24 08 28 00 00 movl $0x28,0x8(%esp)
3262: 00
3263: 8d 7d d4 lea -0x2c(%ebp),%edi
3266: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
326d: 00
326e: 89 04 24 mov %eax,(%esp)
3271: e8 ca 08 00 00 call 3b40 <memset>
fd = open(".", 0);
3276: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
327d: 00
327e: c7 04 24 e2 4c 00 00 movl $0x4ce2,(%esp)
3285: e8 7b 0a 00 00 call 3d05 <open>
328a: c7 45 a4 00 00 00 00 movl $0x0,-0x5c(%ebp)
3291: 89 c3 mov %eax,%ebx
3293: 90 nop
3294: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = 0;
while(read(fd, &de, sizeof(de)) > 0){
3298: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
329f: 00
32a0: 89 7c 24 04 mov %edi,0x4(%esp)
32a4: 89 1c 24 mov %ebx,(%esp)
32a7: e8 31 0a 00 00 call 3cdd <read>
32ac: 85 c0 test %eax,%eax
32ae: 7e 40 jle 32f0 <concreate+0x180>
if(de.inum == 0)
32b0: 66 83 7d d4 00 cmpw $0x0,-0x2c(%ebp)
32b5: 74 e1 je 3298 <concreate+0x128>
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
32b7: 80 7d d6 43 cmpb $0x43,-0x2a(%ebp)
32bb: 90 nop
32bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
32c0: 75 d6 jne 3298 <concreate+0x128>
32c2: 80 7d d8 00 cmpb $0x0,-0x28(%ebp)
32c6: 75 d0 jne 3298 <concreate+0x128>
i = de.name[1] - '0';
32c8: 0f be 45 d7 movsbl -0x29(%ebp),%eax
32cc: 83 e8 30 sub $0x30,%eax
if(i < 0 || i >= sizeof(fa)){
32cf: 83 f8 27 cmp $0x27,%eax
32d2: 0f 87 72 01 00 00 ja 344a <concreate+0x2da>
printf(1, "concreate weird file %s\n", de.name);
exit();
}
if(fa[i]){
32d8: 80 7c 05 ac 00 cmpb $0x0,-0x54(%ebp,%eax,1)
32dd: 0f 85 a0 01 00 00 jne 3483 <concreate+0x313>
printf(1, "concreate duplicate file %s\n", de.name);
exit();
}
fa[i] = 1;
32e3: c6 44 05 ac 01 movb $0x1,-0x54(%ebp,%eax,1)
n++;
32e8: 83 45 a4 01 addl $0x1,-0x5c(%ebp)
32ec: eb aa jmp 3298 <concreate+0x128>
32ee: 66 90 xchg %ax,%ax
}
}
close(fd);
32f0: 89 1c 24 mov %ebx,(%esp)
32f3: e8 f5 09 00 00 call 3ced <close>
if(n != 40){
32f8: 83 7d a4 28 cmpl $0x28,-0x5c(%ebp)
32fc: 0f 85 68 01 00 00 jne 346a <concreate+0x2fa>
printf(1, "concreate not enough files in directory listing\n");
exit();
3302: 31 db xor %ebx,%ebx
3304: e9 92 00 00 00 jmp 339b <concreate+0x22b>
3309: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
exit();
}
if(((i % 3) == 0 && pid == 0) ||
3310: 83 f8 01 cmp $0x1,%eax
3313: 0f 85 b6 00 00 00 jne 33cf <concreate+0x25f>
3319: 85 ff test %edi,%edi
331b: 90 nop
331c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3320: 0f 84 a9 00 00 00 je 33cf <concreate+0x25f>
((i % 3) == 1 && pid != 0)){
close(open(file, 0));
3326: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
332d: 00
332e: 89 34 24 mov %esi,(%esp)
3331: e8 cf 09 00 00 call 3d05 <open>
3336: 89 04 24 mov %eax,(%esp)
3339: e8 af 09 00 00 call 3ced <close>
close(open(file, 0));
333e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3345: 00
3346: 89 34 24 mov %esi,(%esp)
3349: e8 b7 09 00 00 call 3d05 <open>
334e: 89 04 24 mov %eax,(%esp)
3351: e8 97 09 00 00 call 3ced <close>
close(open(file, 0));
3356: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
335d: 00
335e: 89 34 24 mov %esi,(%esp)
3361: e8 9f 09 00 00 call 3d05 <open>
3366: 89 04 24 mov %eax,(%esp)
3369: e8 7f 09 00 00 call 3ced <close>
close(open(file, 0));
336e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3375: 00
3376: 89 34 24 mov %esi,(%esp)
3379: e8 87 09 00 00 call 3d05 <open>
337e: 89 04 24 mov %eax,(%esp)
3381: e8 67 09 00 00 call 3ced <close>
unlink(file);
unlink(file);
unlink(file);
unlink(file);
}
if(pid == 0)
3386: 85 ff test %edi,%edi
3388: 0f 84 a2 fe ff ff je 3230 <concreate+0xc0>
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
exit();
}
for(i = 0; i < 40; i++){
338e: 83 c3 01 add $0x1,%ebx
unlink(file);
}
if(pid == 0)
exit();
else
wait();
3391: e8 37 09 00 00 call 3ccd <wait>
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
exit();
}
for(i = 0; i < 40; i++){
3396: 83 fb 28 cmp $0x28,%ebx
3399: 74 5d je 33f8 <concreate+0x288>
file[1] = '0' + i;
339b: 8d 43 30 lea 0x30(%ebx),%eax
339e: 88 45 e6 mov %al,-0x1a(%ebp)
pid = fork();
33a1: e8 17 09 00 00 call 3cbd <fork>
if(pid < 0){
33a6: 85 c0 test %eax,%eax
exit();
}
for(i = 0; i < 40; i++){
file[1] = '0' + i;
pid = fork();
33a8: 89 c7 mov %eax,%edi
if(pid < 0){
33aa: 78 68 js 3414 <concreate+0x2a4>
printf(1, "fork failed\n");
exit();
}
if(((i % 3) == 0 && pid == 0) ||
33ac: b8 56 55 55 55 mov $0x55555556,%eax
33b1: f7 eb imul %ebx
33b3: 89 d8 mov %ebx,%eax
33b5: c1 f8 1f sar $0x1f,%eax
33b8: 29 c2 sub %eax,%edx
33ba: 89 d8 mov %ebx,%eax
33bc: 8d 14 52 lea (%edx,%edx,2),%edx
33bf: 29 d0 sub %edx,%eax
33c1: 0f 85 49 ff ff ff jne 3310 <concreate+0x1a0>
33c7: 85 ff test %edi,%edi
33c9: 0f 84 57 ff ff ff je 3326 <concreate+0x1b6>
close(open(file, 0));
close(open(file, 0));
close(open(file, 0));
close(open(file, 0));
} else {
unlink(file);
33cf: 89 34 24 mov %esi,(%esp)
33d2: e8 3e 09 00 00 call 3d15 <unlink>
unlink(file);
33d7: 89 34 24 mov %esi,(%esp)
33da: e8 36 09 00 00 call 3d15 <unlink>
unlink(file);
33df: 89 34 24 mov %esi,(%esp)
33e2: e8 2e 09 00 00 call 3d15 <unlink>
unlink(file);
33e7: 89 34 24 mov %esi,(%esp)
33ea: e8 26 09 00 00 call 3d15 <unlink>
33ef: eb 95 jmp 3386 <concreate+0x216>
33f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
exit();
else
wait();
}
printf(1, "concreate ok\n");
33f8: c7 44 24 04 c0 50 00 movl $0x50c0,0x4(%esp)
33ff: 00
3400: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3407: e8 14 0a 00 00 call 3e20 <printf>
}
340c: 83 c4 6c add $0x6c,%esp
340f: 5b pop %ebx
3410: 5e pop %esi
3411: 5f pop %edi
3412: 5d pop %ebp
3413: c3 ret
for(i = 0; i < 40; i++){
file[1] = '0' + i;
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
3414: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
341b: 00
341c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3423: e8 f8 09 00 00 call 3e20 <printf>
exit();
3428: e8 98 08 00 00 call 3cc5 <exit>
} else if(pid == 0 && (i % 5) == 1){
link("C0", file);
} else {
fd = open(file, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "concreate create %s failed\n", file);
342d: 89 74 24 08 mov %esi,0x8(%esp)
3431: c7 44 24 04 6e 50 00 movl $0x506e,0x4(%esp)
3438: 00
3439: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3440: e8 db 09 00 00 call 3e20 <printf>
exit();
3445: e8 7b 08 00 00 call 3cc5 <exit>
if(de.inum == 0)
continue;
if(de.name[0] == 'C' && de.name[2] == '\0'){
i = de.name[1] - '0';
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
344a: 8d 45 d6 lea -0x2a(%ebp),%eax
344d: 89 44 24 08 mov %eax,0x8(%esp)
3451: c7 44 24 04 8a 50 00 movl $0x508a,0x4(%esp)
3458: 00
3459: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3460: e8 bb 09 00 00 call 3e20 <printf>
3465: e9 c6 fd ff ff jmp 3230 <concreate+0xc0>
}
}
close(fd);
if(n != 40){
printf(1, "concreate not enough files in directory listing\n");
346a: c7 44 24 04 58 58 00 movl $0x5858,0x4(%esp)
3471: 00
3472: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3479: e8 a2 09 00 00 call 3e20 <printf>
exit();
347e: e8 42 08 00 00 call 3cc5 <exit>
if(i < 0 || i >= sizeof(fa)){
printf(1, "concreate weird file %s\n", de.name);
exit();
}
if(fa[i]){
printf(1, "concreate duplicate file %s\n", de.name);
3483: 8d 45 d6 lea -0x2a(%ebp),%eax
3486: 89 44 24 08 mov %eax,0x8(%esp)
348a: c7 44 24 04 a3 50 00 movl $0x50a3,0x4(%esp)
3491: 00
3492: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3499: e8 82 09 00 00 call 3e20 <printf>
exit();
349e: e8 22 08 00 00 call 3cc5 <exit>
34a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
34a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000034b0 <fourfiles>:
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
34b0: 55 push %ebp
34b1: 89 e5 mov %esp,%ebp
34b3: 57 push %edi
34b4: 56 push %esi
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
34b5: be ce 50 00 00 mov $0x50ce,%esi
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
34ba: 53 push %ebx
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
34bb: 31 db xor %ebx,%ebx
// four processes write different files at the same
// time, to test block allocation.
void
fourfiles(void)
{
34bd: 83 ec 3c sub $0x3c,%esp
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
34c0: c7 44 24 04 d4 50 00 movl $0x50d4,0x4(%esp)
34c7: 00
for(pi = 0; pi < 4; pi++){
34c8: 8d 7d d8 lea -0x28(%ebp),%edi
// time, to test block allocation.
void
fourfiles(void)
{
int fd, pid, i, j, n, total, pi;
char *names[] = { "f0", "f1", "f2", "f3" };
34cb: c7 45 d8 ce 50 00 00 movl $0x50ce,-0x28(%ebp)
34d2: c7 45 dc 17 47 00 00 movl $0x4717,-0x24(%ebp)
34d9: c7 45 e0 1b 47 00 00 movl $0x471b,-0x20(%ebp)
34e0: c7 45 e4 d1 50 00 00 movl $0x50d1,-0x1c(%ebp)
char *fname;
printf(1, "fourfiles test\n");
34e7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
34ee: e8 2d 09 00 00 call 3e20 <printf>
for(pi = 0; pi < 4; pi++){
fname = names[pi];
unlink(fname);
34f3: 89 34 24 mov %esi,(%esp)
34f6: e8 1a 08 00 00 call 3d15 <unlink>
pid = fork();
34fb: e8 bd 07 00 00 call 3cbd <fork>
if(pid < 0){
3500: 83 f8 00 cmp $0x0,%eax
3503: 0f 8c 88 01 00 00 jl 3691 <fourfiles+0x1e1>
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
3509: 0f 84 e8 00 00 00 je 35f7 <fourfiles+0x147>
char *names[] = { "f0", "f1", "f2", "f3" };
char *fname;
printf(1, "fourfiles test\n");
for(pi = 0; pi < 4; pi++){
350f: 83 c3 01 add $0x1,%ebx
3512: 83 fb 04 cmp $0x4,%ebx
3515: 74 05 je 351c <fourfiles+0x6c>
3517: 8b 34 9f mov (%edi,%ebx,4),%esi
351a: eb d7 jmp 34f3 <fourfiles+0x43>
351c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exit();
}
}
for(pi = 0; pi < 4; pi++){
wait();
3520: e8 a8 07 00 00 call 3ccd <wait>
3525: bb 30 00 00 00 mov $0x30,%ebx
352a: e8 9e 07 00 00 call 3ccd <wait>
352f: e8 99 07 00 00 call 3ccd <wait>
3534: e8 94 07 00 00 call 3ccd <wait>
3539: c7 45 d4 ce 50 00 00 movl $0x50ce,-0x2c(%ebp)
}
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
3540: 8b 45 d4 mov -0x2c(%ebp),%eax
3543: 31 f6 xor %esi,%esi
3545: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
354c: 00
354d: 89 04 24 mov %eax,(%esp)
3550: e8 b0 07 00 00 call 3d05 <open>
3555: 89 c7 mov %eax,%edi
3557: 90 nop
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
3558: c7 44 24 08 00 20 00 movl $0x2000,0x8(%esp)
355f: 00
3560: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
3567: 00
3568: 89 3c 24 mov %edi,(%esp)
356b: e8 6d 07 00 00 call 3cdd <read>
3570: 85 c0 test %eax,%eax
3572: 7e 1a jle 358e <fourfiles+0xde>
3574: 31 d2 xor %edx,%edx
3576: 66 90 xchg %ax,%ax
for(j = 0; j < n; j++){
if(buf[j] != '0'+i){
3578: 0f be 8a 40 81 00 00 movsbl 0x8140(%edx),%ecx
357f: 39 d9 cmp %ebx,%ecx
3581: 75 5b jne 35de <fourfiles+0x12e>
for(i = 0; i < 2; i++){
fname = names[i];
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
3583: 83 c2 01 add $0x1,%edx
3586: 39 d0 cmp %edx,%eax
3588: 7f ee jg 3578 <fourfiles+0xc8>
if(buf[j] != '0'+i){
printf(1, "wrong char\n");
exit();
}
}
total += n;
358a: 01 c6 add %eax,%esi
358c: eb ca jmp 3558 <fourfiles+0xa8>
}
close(fd);
358e: 89 3c 24 mov %edi,(%esp)
3591: e8 57 07 00 00 call 3ced <close>
if(total != 12*500){
3596: 81 fe 70 17 00 00 cmp $0x1770,%esi
359c: 0f 85 d2 00 00 00 jne 3674 <fourfiles+0x1c4>
printf(1, "wrong length %d\n", total);
exit();
}
unlink(fname);
35a2: 8b 45 d4 mov -0x2c(%ebp),%eax
35a5: 89 04 24 mov %eax,(%esp)
35a8: e8 68 07 00 00 call 3d15 <unlink>
for(pi = 0; pi < 4; pi++){
wait();
}
for(i = 0; i < 2; i++){
35ad: 83 fb 31 cmp $0x31,%ebx
35b0: 75 1c jne 35ce <fourfiles+0x11e>
exit();
}
unlink(fname);
}
printf(1, "fourfiles ok\n");
35b2: c7 44 24 04 12 51 00 movl $0x5112,0x4(%esp)
35b9: 00
35ba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
35c1: e8 5a 08 00 00 call 3e20 <printf>
}
35c6: 83 c4 3c add $0x3c,%esp
35c9: 5b pop %ebx
35ca: 5e pop %esi
35cb: 5f pop %edi
35cc: 5d pop %ebp
35cd: c3 ret
for(pi = 0; pi < 4; pi++){
wait();
}
for(i = 0; i < 2; i++){
35ce: 8b 45 dc mov -0x24(%ebp),%eax
35d1: bb 31 00 00 00 mov $0x31,%ebx
35d6: 89 45 d4 mov %eax,-0x2c(%ebp)
35d9: e9 62 ff ff ff jmp 3540 <fourfiles+0x90>
fd = open(fname, 0);
total = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(j = 0; j < n; j++){
if(buf[j] != '0'+i){
printf(1, "wrong char\n");
35de: c7 44 24 04 f5 50 00 movl $0x50f5,0x4(%esp)
35e5: 00
35e6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
35ed: e8 2e 08 00 00 call 3e20 <printf>
exit();
35f2: e8 ce 06 00 00 call 3cc5 <exit>
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
35f7: 89 34 24 mov %esi,(%esp)
35fa: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
3601: 00
3602: e8 fe 06 00 00 call 3d05 <open>
if(fd < 0){
3607: 85 c0 test %eax,%eax
printf(1, "fork failed\n");
exit();
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
3609: 89 c6 mov %eax,%esi
if(fd < 0){
360b: 0f 88 99 00 00 00 js 36aa <fourfiles+0x1fa>
printf(1, "create failed\n");
exit();
}
memset(buf, '0'+pi, 512);
3611: 83 c3 30 add $0x30,%ebx
3614: 89 5c 24 04 mov %ebx,0x4(%esp)
3618: 31 db xor %ebx,%ebx
361a: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
3621: 00
3622: c7 04 24 40 81 00 00 movl $0x8140,(%esp)
3629: e8 12 05 00 00 call 3b40 <memset>
362e: eb 08 jmp 3638 <fourfiles+0x188>
for(i = 0; i < 12; i++){
3630: 83 c3 01 add $0x1,%ebx
3633: 83 fb 0c cmp $0xc,%ebx
3636: 74 ba je 35f2 <fourfiles+0x142>
if((n = write(fd, buf, 500)) != 500){
3638: c7 44 24 08 f4 01 00 movl $0x1f4,0x8(%esp)
363f: 00
3640: c7 44 24 04 40 81 00 movl $0x8140,0x4(%esp)
3647: 00
3648: 89 34 24 mov %esi,(%esp)
364b: e8 95 06 00 00 call 3ce5 <write>
3650: 3d f4 01 00 00 cmp $0x1f4,%eax
3655: 74 d9 je 3630 <fourfiles+0x180>
printf(1, "write failed %d\n", n);
3657: 89 44 24 08 mov %eax,0x8(%esp)
365b: c7 44 24 04 e4 50 00 movl $0x50e4,0x4(%esp)
3662: 00
3663: c7 04 24 01 00 00 00 movl $0x1,(%esp)
366a: e8 b1 07 00 00 call 3e20 <printf>
exit();
366f: e8 51 06 00 00 call 3cc5 <exit>
}
total += n;
}
close(fd);
if(total != 12*500){
printf(1, "wrong length %d\n", total);
3674: 89 74 24 08 mov %esi,0x8(%esp)
3678: c7 44 24 04 01 51 00 movl $0x5101,0x4(%esp)
367f: 00
3680: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3687: e8 94 07 00 00 call 3e20 <printf>
exit();
368c: e8 34 06 00 00 call 3cc5 <exit>
fname = names[pi];
unlink(fname);
pid = fork();
if(pid < 0){
printf(1, "fork failed\n");
3691: c7 44 24 04 0f 46 00 movl $0x460f,0x4(%esp)
3698: 00
3699: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36a0: e8 7b 07 00 00 call 3e20 <printf>
exit();
36a5: e8 1b 06 00 00 call 3cc5 <exit>
}
if(pid == 0){
fd = open(fname, O_CREATE | O_RDWR);
if(fd < 0){
printf(1, "create failed\n");
36aa: c7 44 24 04 a5 46 00 movl $0x46a5,0x4(%esp)
36b1: 00
36b2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36b9: e8 62 07 00 00 call 3e20 <printf>
exit();
36be: e8 02 06 00 00 call 3cc5 <exit>
36c3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
36c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000036d0 <sharedfd>:
// two processes write to the same file descriptor
// is the offset shared? does inode locking work?
void
sharedfd(void)
{
36d0: 55 push %ebp
36d1: 89 e5 mov %esp,%ebp
36d3: 57 push %edi
36d4: 56 push %esi
36d5: 53 push %ebx
36d6: 83 ec 3c sub $0x3c,%esp
int fd, pid, i, n, nc, np;
char buf[10];
printf(1, "sharedfd test\n");
36d9: c7 44 24 04 20 51 00 movl $0x5120,0x4(%esp)
36e0: 00
36e1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
36e8: e8 33 07 00 00 call 3e20 <printf>
unlink("sharedfd");
36ed: c7 04 24 2f 51 00 00 movl $0x512f,(%esp)
36f4: e8 1c 06 00 00 call 3d15 <unlink>
fd = open("sharedfd", O_CREATE|O_RDWR);
36f9: c7 44 24 04 02 02 00 movl $0x202,0x4(%esp)
3700: 00
3701: c7 04 24 2f 51 00 00 movl $0x512f,(%esp)
3708: e8 f8 05 00 00 call 3d05 <open>
if(fd < 0){
370d: 85 c0 test %eax,%eax
char buf[10];
printf(1, "sharedfd test\n");
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
370f: 89 c7 mov %eax,%edi
if(fd < 0){
3711: 0f 88 2d 01 00 00 js 3844 <sharedfd+0x174>
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
3717: e8 a1 05 00 00 call 3cbd <fork>
memset(buf, pid==0?'c':'p', sizeof(buf));
371c: 8d 75 de lea -0x22(%ebp),%esi
371f: 83 f8 01 cmp $0x1,%eax
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
return;
}
pid = fork();
3722: 89 45 d4 mov %eax,-0x2c(%ebp)
memset(buf, pid==0?'c':'p', sizeof(buf));
3725: 19 c0 sbb %eax,%eax
3727: 31 db xor %ebx,%ebx
3729: 83 e0 f3 and $0xfffffff3,%eax
372c: 83 c0 70 add $0x70,%eax
372f: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
3736: 00
3737: 89 44 24 04 mov %eax,0x4(%esp)
373b: 89 34 24 mov %esi,(%esp)
373e: e8 fd 03 00 00 call 3b40 <memset>
3743: eb 0e jmp 3753 <sharedfd+0x83>
3745: 8d 76 00 lea 0x0(%esi),%esi
for(i = 0; i < 1000; i++){
3748: 83 c3 01 add $0x1,%ebx
374b: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
3751: 74 2d je 3780 <sharedfd+0xb0>
if(write(fd, buf, sizeof(buf)) != sizeof(buf)){
3753: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
375a: 00
375b: 89 74 24 04 mov %esi,0x4(%esp)
375f: 89 3c 24 mov %edi,(%esp)
3762: e8 7e 05 00 00 call 3ce5 <write>
3767: 83 f8 0a cmp $0xa,%eax
376a: 74 dc je 3748 <sharedfd+0x78>
printf(1, "fstests: write sharedfd failed\n");
376c: c7 44 24 04 b8 58 00 movl $0x58b8,0x4(%esp)
3773: 00
3774: c7 04 24 01 00 00 00 movl $0x1,(%esp)
377b: e8 a0 06 00 00 call 3e20 <printf>
break;
}
}
if(pid == 0)
3780: 8b 55 d4 mov -0x2c(%ebp),%edx
3783: 85 d2 test %edx,%edx
3785: 0f 84 07 01 00 00 je 3892 <sharedfd+0x1c2>
exit();
else
wait();
378b: e8 3d 05 00 00 call 3ccd <wait>
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
3790: 31 db xor %ebx,%ebx
}
if(pid == 0)
exit();
else
wait();
close(fd);
3792: 89 3c 24 mov %edi,(%esp)
fd = open("sharedfd", 0);
if(fd < 0){
3795: 31 ff xor %edi,%edi
}
if(pid == 0)
exit();
else
wait();
close(fd);
3797: e8 51 05 00 00 call 3ced <close>
fd = open("sharedfd", 0);
379c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
37a3: 00
37a4: c7 04 24 2f 51 00 00 movl $0x512f,(%esp)
37ab: e8 55 05 00 00 call 3d05 <open>
if(fd < 0){
37b0: 85 c0 test %eax,%eax
if(pid == 0)
exit();
else
wait();
close(fd);
fd = open("sharedfd", 0);
37b2: 89 45 d4 mov %eax,-0x2c(%ebp)
if(fd < 0){
37b5: 0f 88 a5 00 00 00 js 3860 <sharedfd+0x190>
37bb: 90 nop
37bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
37c0: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
37c7: 00
37c8: 89 74 24 04 mov %esi,0x4(%esp)
37cc: 8b 45 d4 mov -0x2c(%ebp),%eax
37cf: 89 04 24 mov %eax,(%esp)
37d2: e8 06 05 00 00 call 3cdd <read>
37d7: 85 c0 test %eax,%eax
37d9: 7e 26 jle 3801 <sharedfd+0x131>
wait();
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
37db: 31 c0 xor %eax,%eax
37dd: eb 14 jmp 37f3 <sharedfd+0x123>
37df: 90 nop
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
if(buf[i] == 'c')
nc++;
if(buf[i] == 'p')
np++;
37e0: 80 fa 70 cmp $0x70,%dl
37e3: 0f 94 c2 sete %dl
37e6: 0f b6 d2 movzbl %dl,%edx
37e9: 01 d3 add %edx,%ebx
printf(1, "fstests: cannot open sharedfd for reading\n");
return;
}
nc = np = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i = 0; i < sizeof(buf); i++){
37eb: 83 c0 01 add $0x1,%eax
37ee: 83 f8 0a cmp $0xa,%eax
37f1: 74 cd je 37c0 <sharedfd+0xf0>
if(buf[i] == 'c')
37f3: 0f b6 14 06 movzbl (%esi,%eax,1),%edx
37f7: 80 fa 63 cmp $0x63,%dl
37fa: 75 e4 jne 37e0 <sharedfd+0x110>
nc++;
37fc: 83 c7 01 add $0x1,%edi
37ff: eb ea jmp 37eb <sharedfd+0x11b>
if(buf[i] == 'p')
np++;
}
}
close(fd);
3801: 8b 45 d4 mov -0x2c(%ebp),%eax
3804: 89 04 24 mov %eax,(%esp)
3807: e8 e1 04 00 00 call 3ced <close>
unlink("sharedfd");
380c: c7 04 24 2f 51 00 00 movl $0x512f,(%esp)
3813: e8 fd 04 00 00 call 3d15 <unlink>
if(nc == 10000 && np == 10000){
3818: 81 fb 10 27 00 00 cmp $0x2710,%ebx
381e: 75 56 jne 3876 <sharedfd+0x1a6>
3820: 81 ff 10 27 00 00 cmp $0x2710,%edi
3826: 75 4e jne 3876 <sharedfd+0x1a6>
printf(1, "sharedfd ok\n");
3828: c7 44 24 04 38 51 00 movl $0x5138,0x4(%esp)
382f: 00
3830: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3837: e8 e4 05 00 00 call 3e20 <printf>
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
exit();
}
}
383c: 83 c4 3c add $0x3c,%esp
383f: 5b pop %ebx
3840: 5e pop %esi
3841: 5f pop %edi
3842: 5d pop %ebp
3843: c3 ret
printf(1, "sharedfd test\n");
unlink("sharedfd");
fd = open("sharedfd", O_CREATE|O_RDWR);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for writing");
3844: c7 44 24 04 8c 58 00 movl $0x588c,0x4(%esp)
384b: 00
384c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3853: e8 c8 05 00 00 call 3e20 <printf>
printf(1, "sharedfd ok\n");
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
exit();
}
}
3858: 83 c4 3c add $0x3c,%esp
385b: 5b pop %ebx
385c: 5e pop %esi
385d: 5f pop %edi
385e: 5d pop %ebp
385f: c3 ret
else
wait();
close(fd);
fd = open("sharedfd", 0);
if(fd < 0){
printf(1, "fstests: cannot open sharedfd for reading\n");
3860: c7 44 24 04 d8 58 00 movl $0x58d8,0x4(%esp)
3867: 00
3868: c7 04 24 01 00 00 00 movl $0x1,(%esp)
386f: e8 ac 05 00 00 call 3e20 <printf>
return;
3874: eb c6 jmp 383c <sharedfd+0x16c>
close(fd);
unlink("sharedfd");
if(nc == 10000 && np == 10000){
printf(1, "sharedfd ok\n");
} else {
printf(1, "sharedfd oops %d %d\n", nc, np);
3876: 89 5c 24 0c mov %ebx,0xc(%esp)
387a: 89 7c 24 08 mov %edi,0x8(%esp)
387e: c7 44 24 04 45 51 00 movl $0x5145,0x4(%esp)
3885: 00
3886: c7 04 24 01 00 00 00 movl $0x1,(%esp)
388d: e8 8e 05 00 00 call 3e20 <printf>
exit();
3892: e8 2e 04 00 00 call 3cc5 <exit>
3897: 89 f6 mov %esi,%esi
3899: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000038a0 <mem>:
printf(1, "exitwait ok\n");
}
void
mem(void)
{
38a0: 55 push %ebp
38a1: 89 e5 mov %esp,%ebp
38a3: 57 push %edi
38a4: 56 push %esi
38a5: 53 push %ebx
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
ppid = getpid();
if((pid = fork()) == 0){
38a6: 31 db xor %ebx,%ebx
printf(1, "exitwait ok\n");
}
void
mem(void)
{
38a8: 83 ec 1c sub $0x1c,%esp
void *m1, *m2;
int pid, ppid;
printf(1, "mem test\n");
38ab: c7 44 24 04 5a 51 00 movl $0x515a,0x4(%esp)
38b2: 00
38b3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
38ba: e8 61 05 00 00 call 3e20 <printf>
ppid = getpid();
38bf: e8 81 04 00 00 call 3d45 <getpid>
38c4: 89 c6 mov %eax,%esi
if((pid = fork()) == 0){
38c6: e8 f2 03 00 00 call 3cbd <fork>
38cb: 85 c0 test %eax,%eax
38cd: 74 0d je 38dc <mem+0x3c>
38cf: 90 nop
38d0: eb 5f jmp 3931 <mem+0x91>
38d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
m1 = 0;
while((m2 = malloc(10001)) != 0){
*(char**)m2 = m1;
38d8: 89 18 mov %ebx,(%eax)
38da: 89 c3 mov %eax,%ebx
printf(1, "mem test\n");
ppid = getpid();
if((pid = fork()) == 0){
m1 = 0;
while((m2 = malloc(10001)) != 0){
38dc: c7 04 24 11 27 00 00 movl $0x2711,(%esp)
38e3: e8 c8 07 00 00 call 40b0 <malloc>
38e8: 85 c0 test %eax,%eax
38ea: 75 ec jne 38d8 <mem+0x38>
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
38ec: 85 db test %ebx,%ebx
38ee: 74 10 je 3900 <mem+0x60>
m2 = *(char**)m1;
38f0: 8b 3b mov (%ebx),%edi
free(m1);
38f2: 89 1c 24 mov %ebx,(%esp)
38f5: e8 26 07 00 00 call 4020 <free>
38fa: 89 fb mov %edi,%ebx
m1 = 0;
while((m2 = malloc(10001)) != 0){
*(char**)m2 = m1;
m1 = m2;
}
while(m1){
38fc: 85 db test %ebx,%ebx
38fe: 75 f0 jne 38f0 <mem+0x50>
m2 = *(char**)m1;
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
3900: c7 04 24 00 50 00 00 movl $0x5000,(%esp)
3907: e8 a4 07 00 00 call 40b0 <malloc>
if(m1 == 0){
390c: 85 c0 test %eax,%eax
390e: 74 30 je 3940 <mem+0xa0>
printf(1, "couldn't allocate mem?!!\n");
kill(ppid);
exit();
}
free(m1);
3910: 89 04 24 mov %eax,(%esp)
3913: e8 08 07 00 00 call 4020 <free>
printf(1, "mem ok\n");
3918: c7 44 24 04 7e 51 00 movl $0x517e,0x4(%esp)
391f: 00
3920: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3927: e8 f4 04 00 00 call 3e20 <printf>
exit();
392c: e8 94 03 00 00 call 3cc5 <exit>
} else {
wait();
}
}
3931: 83 c4 1c add $0x1c,%esp
3934: 5b pop %ebx
3935: 5e pop %esi
3936: 5f pop %edi
3937: 5d pop %ebp
}
free(m1);
printf(1, "mem ok\n");
exit();
} else {
wait();
3938: e9 90 03 00 00 jmp 3ccd <wait>
393d: 8d 76 00 lea 0x0(%esi),%esi
free(m1);
m1 = m2;
}
m1 = malloc(1024*20);
if(m1 == 0){
printf(1, "couldn't allocate mem?!!\n");
3940: c7 44 24 04 64 51 00 movl $0x5164,0x4(%esp)
3947: 00
3948: c7 04 24 01 00 00 00 movl $0x1,(%esp)
394f: e8 cc 04 00 00 call 3e20 <printf>
kill(ppid);
3954: 89 34 24 mov %esi,(%esp)
3957: e8 99 03 00 00 call 3cf5 <kill>
exit();
395c: e8 64 03 00 00 call 3cc5 <exit>
3961: eb 0d jmp 3970 <main>
3963: 90 nop
3964: 90 nop
3965: 90 nop
3966: 90 nop
3967: 90 nop
3968: 90 nop
3969: 90 nop
396a: 90 nop
396b: 90 nop
396c: 90 nop
396d: 90 nop
396e: 90 nop
396f: 90 nop
00003970 <main>:
return randstate;
}
int
main(int argc, char *argv[])
{
3970: 55 push %ebp
3971: 89 e5 mov %esp,%ebp
3973: 83 e4 f0 and $0xfffffff0,%esp
3976: 83 ec 10 sub $0x10,%esp
printf(1, "usertests starting\n");
3979: c7 44 24 04 86 51 00 movl $0x5186,0x4(%esp)
3980: 00
3981: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3988: e8 93 04 00 00 call 3e20 <printf>
if(open("usertests.ran", 0) >= 0){
398d: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3994: 00
3995: c7 04 24 9a 51 00 00 movl $0x519a,(%esp)
399c: e8 64 03 00 00 call 3d05 <open>
39a1: 85 c0 test %eax,%eax
39a3: 78 1b js 39c0 <main+0x50>
printf(1, "already ran user tests -- rebuild fs.img\n");
39a5: c7 44 24 04 04 59 00 movl $0x5904,0x4(%esp)
39ac: 00
39ad: c7 04 24 01 00 00 00 movl $0x1,(%esp)
39b4: e8 67 04 00 00 call 3e20 <printf>
exit();
39b9: e8 07 03 00 00 call 3cc5 <exit>
39be: 66 90 xchg %ax,%ax
}
close(open("usertests.ran", O_CREATE));
39c0: c7 44 24 04 00 02 00 movl $0x200,0x4(%esp)
39c7: 00
39c8: c7 04 24 9a 51 00 00 movl $0x519a,(%esp)
39cf: e8 31 03 00 00 call 3d05 <open>
39d4: 89 04 24 mov %eax,(%esp)
39d7: e8 11 03 00 00 call 3ced <close>
argptest();
39dc: e8 6f c7 ff ff call 150 <argptest>
createdelete();
39e1: e8 ba ce ff ff call 8a0 <createdelete>
linkunlink();
39e6: e8 f5 d8 ff ff call 12e0 <linkunlink>
39eb: 90 nop
39ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
concreate();
39f0: e8 7b f7 ff ff call 3170 <concreate>
fourfiles();
39f5: e8 b6 fa ff ff call 34b0 <fourfiles>
sharedfd();
39fa: e8 d1 fc ff ff call 36d0 <sharedfd>
39ff: 90 nop
bigargtest();
3a00: e8 7b d5 ff ff call f80 <bigargtest>
bigwrite();
3a05: e8 c6 cb ff ff call 5d0 <bigwrite>
bigargtest();
3a0a: e8 71 d5 ff ff call f80 <bigargtest>
3a0f: 90 nop
bsstest();
3a10: e8 1b c6 ff ff call 30 <bsstest>
sbrktest();
3a15: e8 36 dc ff ff call 1650 <sbrktest>
validatetest();
3a1a: e8 c1 d6 ff ff call 10e0 <validatetest>
3a1f: 90 nop
opentest();
3a20: e8 8b c6 ff ff call b0 <opentest>
writetest();
3a25: e8 46 d3 ff ff call d70 <writetest>
writetest1();
3a2a: e8 51 d1 ff ff call b80 <writetest1>
3a2f: 90 nop
createtest();
3a30: e8 9b d0 ff ff call ad0 <createtest>
openiputtest();
3a35: e8 f6 e4 ff ff call 1f30 <openiputtest>
exitiputtest();
3a3a: e8 61 f3 ff ff call 2da0 <exitiputtest>
3a3f: 90 nop
iputtest();
3a40: e8 4b f4 ff ff call 2e90 <iputtest>
mem();
3a45: e8 56 fe ff ff call 38a0 <mem>
pipe1();
3a4a: e8 d1 e1 ff ff call 1c20 <pipe1>
3a4f: 90 nop
preempt();
3a50: e8 6b e0 ff ff call 1ac0 <preempt>
exitwait();
3a55: e8 d6 c8 ff ff call 330 <exitwait>
rmdot();
3a5a: e8 41 e9 ff ff call 23a0 <rmdot>
3a5f: 90 nop
fourteen();
3a60: e8 6b e3 ff ff call 1dd0 <fourteen>
bigfile();
3a65: e8 06 f5 ff ff call 2f70 <bigfile>
subdir();
3a6a: e8 c1 ea ff ff call 2530 <subdir>
3a6f: 90 nop
linktest();
3a70: e8 7b d9 ff ff call 13f0 <linktest>
unlinkread();
3a75: e8 56 cc ff ff call 6d0 <unlinkread>
dirfile();
3a7a: e8 e1 e6 ff ff call 2160 <dirfile>
3a7f: 90 nop
iref();
3a80: e8 bb e5 ff ff call 2040 <iref>
forktest();
3a85: e8 d6 c7 ff ff call 260 <forktest>
bigdir(); // slow
3a8a: e8 01 d7 ff ff call 1190 <bigdir>
3a8f: 90 nop
uio();
3a90: e8 3b c7 ff ff call 1d0 <uio>
exectest();
3a95: e8 f6 d5 ff ff call 1090 <exectest>
exit();
3a9a: e8 26 02 00 00 call 3cc5 <exit>
3a9f: 90 nop
00003aa0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
3aa0: 55 push %ebp
3aa1: 31 d2 xor %edx,%edx
3aa3: 89 e5 mov %esp,%ebp
3aa5: 8b 45 08 mov 0x8(%ebp),%eax
3aa8: 53 push %ebx
3aa9: 8b 5d 0c mov 0xc(%ebp),%ebx
3aac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
3ab0: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
3ab4: 88 0c 10 mov %cl,(%eax,%edx,1)
3ab7: 83 c2 01 add $0x1,%edx
3aba: 84 c9 test %cl,%cl
3abc: 75 f2 jne 3ab0 <strcpy+0x10>
;
return os;
}
3abe: 5b pop %ebx
3abf: 5d pop %ebp
3ac0: c3 ret
3ac1: eb 0d jmp 3ad0 <strcmp>
3ac3: 90 nop
3ac4: 90 nop
3ac5: 90 nop
3ac6: 90 nop
3ac7: 90 nop
3ac8: 90 nop
3ac9: 90 nop
3aca: 90 nop
3acb: 90 nop
3acc: 90 nop
3acd: 90 nop
3ace: 90 nop
3acf: 90 nop
00003ad0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3ad0: 55 push %ebp
3ad1: 89 e5 mov %esp,%ebp
3ad3: 53 push %ebx
3ad4: 8b 4d 08 mov 0x8(%ebp),%ecx
3ad7: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
3ada: 0f b6 01 movzbl (%ecx),%eax
3add: 84 c0 test %al,%al
3adf: 75 14 jne 3af5 <strcmp+0x25>
3ae1: eb 25 jmp 3b08 <strcmp+0x38>
3ae3: 90 nop
3ae4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
3ae8: 83 c1 01 add $0x1,%ecx
3aeb: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3aee: 0f b6 01 movzbl (%ecx),%eax
3af1: 84 c0 test %al,%al
3af3: 74 13 je 3b08 <strcmp+0x38>
3af5: 0f b6 1a movzbl (%edx),%ebx
3af8: 38 d8 cmp %bl,%al
3afa: 74 ec je 3ae8 <strcmp+0x18>
3afc: 0f b6 db movzbl %bl,%ebx
3aff: 0f b6 c0 movzbl %al,%eax
3b02: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3b04: 5b pop %ebx
3b05: 5d pop %ebp
3b06: c3 ret
3b07: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3b08: 0f b6 1a movzbl (%edx),%ebx
3b0b: 31 c0 xor %eax,%eax
3b0d: 0f b6 db movzbl %bl,%ebx
3b10: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3b12: 5b pop %ebx
3b13: 5d pop %ebp
3b14: c3 ret
3b15: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3b19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b20 <strlen>:
uint
strlen(char *s)
{
3b20: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
3b21: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b23: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
3b25: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3b27: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3b2a: 80 39 00 cmpb $0x0,(%ecx)
3b2d: 74 0c je 3b3b <strlen+0x1b>
3b2f: 90 nop
3b30: 83 c2 01 add $0x1,%edx
3b33: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3b37: 89 d0 mov %edx,%eax
3b39: 75 f5 jne 3b30 <strlen+0x10>
;
return n;
}
3b3b: 5d pop %ebp
3b3c: c3 ret
3b3d: 8d 76 00 lea 0x0(%esi),%esi
00003b40 <memset>:
void*
memset(void *dst, int c, uint n)
{
3b40: 55 push %ebp
3b41: 89 e5 mov %esp,%ebp
3b43: 8b 55 08 mov 0x8(%ebp),%edx
3b46: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3b47: 8b 4d 10 mov 0x10(%ebp),%ecx
3b4a: 8b 45 0c mov 0xc(%ebp),%eax
3b4d: 89 d7 mov %edx,%edi
3b4f: fc cld
3b50: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3b52: 89 d0 mov %edx,%eax
3b54: 5f pop %edi
3b55: 5d pop %ebp
3b56: c3 ret
3b57: 89 f6 mov %esi,%esi
3b59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003b60 <strchr>:
char*
strchr(const char *s, char c)
{
3b60: 55 push %ebp
3b61: 89 e5 mov %esp,%ebp
3b63: 8b 45 08 mov 0x8(%ebp),%eax
3b66: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
3b6a: 0f b6 10 movzbl (%eax),%edx
3b6d: 84 d2 test %dl,%dl
3b6f: 75 11 jne 3b82 <strchr+0x22>
3b71: eb 15 jmp 3b88 <strchr+0x28>
3b73: 90 nop
3b74: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3b78: 83 c0 01 add $0x1,%eax
3b7b: 0f b6 10 movzbl (%eax),%edx
3b7e: 84 d2 test %dl,%dl
3b80: 74 06 je 3b88 <strchr+0x28>
if(*s == c)
3b82: 38 ca cmp %cl,%dl
3b84: 75 f2 jne 3b78 <strchr+0x18>
return (char*)s;
return 0;
}
3b86: 5d pop %ebp
3b87: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
3b88: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
3b8a: 5d pop %ebp
3b8b: 90 nop
3b8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3b90: c3 ret
3b91: eb 0d jmp 3ba0 <atoi>
3b93: 90 nop
3b94: 90 nop
3b95: 90 nop
3b96: 90 nop
3b97: 90 nop
3b98: 90 nop
3b99: 90 nop
3b9a: 90 nop
3b9b: 90 nop
3b9c: 90 nop
3b9d: 90 nop
3b9e: 90 nop
3b9f: 90 nop
00003ba0 <atoi>:
return r;
}
int
atoi(const char *s)
{
3ba0: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ba1: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
3ba3: 89 e5 mov %esp,%ebp
3ba5: 8b 4d 08 mov 0x8(%ebp),%ecx
3ba8: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ba9: 0f b6 11 movzbl (%ecx),%edx
3bac: 8d 5a d0 lea -0x30(%edx),%ebx
3baf: 80 fb 09 cmp $0x9,%bl
3bb2: 77 1c ja 3bd0 <atoi+0x30>
3bb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
3bb8: 0f be d2 movsbl %dl,%edx
3bbb: 83 c1 01 add $0x1,%ecx
3bbe: 8d 04 80 lea (%eax,%eax,4),%eax
3bc1: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3bc5: 0f b6 11 movzbl (%ecx),%edx
3bc8: 8d 5a d0 lea -0x30(%edx),%ebx
3bcb: 80 fb 09 cmp $0x9,%bl
3bce: 76 e8 jbe 3bb8 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
3bd0: 5b pop %ebx
3bd1: 5d pop %ebp
3bd2: c3 ret
3bd3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003be0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
3be0: 55 push %ebp
3be1: 89 e5 mov %esp,%ebp
3be3: 56 push %esi
3be4: 8b 45 08 mov 0x8(%ebp),%eax
3be7: 53 push %ebx
3be8: 8b 5d 10 mov 0x10(%ebp),%ebx
3beb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3bee: 85 db test %ebx,%ebx
3bf0: 7e 14 jle 3c06 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
3bf2: 31 d2 xor %edx,%edx
3bf4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
3bf8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3bfc: 88 0c 10 mov %cl,(%eax,%edx,1)
3bff: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
3c02: 39 da cmp %ebx,%edx
3c04: 75 f2 jne 3bf8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
3c06: 5b pop %ebx
3c07: 5e pop %esi
3c08: 5d pop %ebp
3c09: c3 ret
3c0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00003c10 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
3c10: 55 push %ebp
3c11: 89 e5 mov %esp,%ebp
3c13: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
3c16: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
3c19: 89 5d f8 mov %ebx,-0x8(%ebp)
3c1c: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
3c1f: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
3c24: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
3c2b: 00
3c2c: 89 04 24 mov %eax,(%esp)
3c2f: e8 d1 00 00 00 call 3d05 <open>
if(fd < 0)
3c34: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
3c36: 89 c3 mov %eax,%ebx
if(fd < 0)
3c38: 78 19 js 3c53 <stat+0x43>
return -1;
r = fstat(fd, st);
3c3a: 8b 45 0c mov 0xc(%ebp),%eax
3c3d: 89 1c 24 mov %ebx,(%esp)
3c40: 89 44 24 04 mov %eax,0x4(%esp)
3c44: e8 d4 00 00 00 call 3d1d <fstat>
close(fd);
3c49: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
3c4c: 89 c6 mov %eax,%esi
close(fd);
3c4e: e8 9a 00 00 00 call 3ced <close>
return r;
}
3c53: 89 f0 mov %esi,%eax
3c55: 8b 5d f8 mov -0x8(%ebp),%ebx
3c58: 8b 75 fc mov -0x4(%ebp),%esi
3c5b: 89 ec mov %ebp,%esp
3c5d: 5d pop %ebp
3c5e: c3 ret
3c5f: 90 nop
00003c60 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
3c60: 55 push %ebp
3c61: 89 e5 mov %esp,%ebp
3c63: 57 push %edi
3c64: 56 push %esi
3c65: 31 f6 xor %esi,%esi
3c67: 53 push %ebx
3c68: 83 ec 2c sub $0x2c,%esp
3c6b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
3c6e: eb 06 jmp 3c76 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
3c70: 3c 0a cmp $0xa,%al
3c72: 74 39 je 3cad <gets+0x4d>
3c74: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
3c76: 8d 5e 01 lea 0x1(%esi),%ebx
3c79: 3b 5d 0c cmp 0xc(%ebp),%ebx
3c7c: 7d 31 jge 3caf <gets+0x4f>
cc = read(0, &c, 1);
3c7e: 8d 45 e7 lea -0x19(%ebp),%eax
3c81: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3c88: 00
3c89: 89 44 24 04 mov %eax,0x4(%esp)
3c8d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3c94: e8 44 00 00 00 call 3cdd <read>
if(cc < 1)
3c99: 85 c0 test %eax,%eax
3c9b: 7e 12 jle 3caf <gets+0x4f>
break;
buf[i++] = c;
3c9d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3ca1: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
3ca5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3ca9: 3c 0d cmp $0xd,%al
3cab: 75 c3 jne 3c70 <gets+0x10>
3cad: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
3caf: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
3cb3: 89 f8 mov %edi,%eax
3cb5: 83 c4 2c add $0x2c,%esp
3cb8: 5b pop %ebx
3cb9: 5e pop %esi
3cba: 5f pop %edi
3cbb: 5d pop %ebp
3cbc: c3 ret
00003cbd <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3cbd: b8 01 00 00 00 mov $0x1,%eax
3cc2: cd 40 int $0x40
3cc4: c3 ret
00003cc5 <exit>:
SYSCALL(exit)
3cc5: b8 02 00 00 00 mov $0x2,%eax
3cca: cd 40 int $0x40
3ccc: c3 ret
00003ccd <wait>:
SYSCALL(wait)
3ccd: b8 03 00 00 00 mov $0x3,%eax
3cd2: cd 40 int $0x40
3cd4: c3 ret
00003cd5 <pipe>:
SYSCALL(pipe)
3cd5: b8 04 00 00 00 mov $0x4,%eax
3cda: cd 40 int $0x40
3cdc: c3 ret
00003cdd <read>:
SYSCALL(read)
3cdd: b8 05 00 00 00 mov $0x5,%eax
3ce2: cd 40 int $0x40
3ce4: c3 ret
00003ce5 <write>:
SYSCALL(write)
3ce5: b8 10 00 00 00 mov $0x10,%eax
3cea: cd 40 int $0x40
3cec: c3 ret
00003ced <close>:
SYSCALL(close)
3ced: b8 15 00 00 00 mov $0x15,%eax
3cf2: cd 40 int $0x40
3cf4: c3 ret
00003cf5 <kill>:
SYSCALL(kill)
3cf5: b8 06 00 00 00 mov $0x6,%eax
3cfa: cd 40 int $0x40
3cfc: c3 ret
00003cfd <exec>:
SYSCALL(exec)
3cfd: b8 07 00 00 00 mov $0x7,%eax
3d02: cd 40 int $0x40
3d04: c3 ret
00003d05 <open>:
SYSCALL(open)
3d05: b8 0f 00 00 00 mov $0xf,%eax
3d0a: cd 40 int $0x40
3d0c: c3 ret
00003d0d <mknod>:
SYSCALL(mknod)
3d0d: b8 11 00 00 00 mov $0x11,%eax
3d12: cd 40 int $0x40
3d14: c3 ret
00003d15 <unlink>:
SYSCALL(unlink)
3d15: b8 12 00 00 00 mov $0x12,%eax
3d1a: cd 40 int $0x40
3d1c: c3 ret
00003d1d <fstat>:
SYSCALL(fstat)
3d1d: b8 08 00 00 00 mov $0x8,%eax
3d22: cd 40 int $0x40
3d24: c3 ret
00003d25 <link>:
SYSCALL(link)
3d25: b8 13 00 00 00 mov $0x13,%eax
3d2a: cd 40 int $0x40
3d2c: c3 ret
00003d2d <mkdir>:
SYSCALL(mkdir)
3d2d: b8 14 00 00 00 mov $0x14,%eax
3d32: cd 40 int $0x40
3d34: c3 ret
00003d35 <chdir>:
SYSCALL(chdir)
3d35: b8 09 00 00 00 mov $0x9,%eax
3d3a: cd 40 int $0x40
3d3c: c3 ret
00003d3d <dup>:
SYSCALL(dup)
3d3d: b8 0a 00 00 00 mov $0xa,%eax
3d42: cd 40 int $0x40
3d44: c3 ret
00003d45 <getpid>:
SYSCALL(getpid)
3d45: b8 0b 00 00 00 mov $0xb,%eax
3d4a: cd 40 int $0x40
3d4c: c3 ret
00003d4d <sbrk>:
SYSCALL(sbrk)
3d4d: b8 0c 00 00 00 mov $0xc,%eax
3d52: cd 40 int $0x40
3d54: c3 ret
00003d55 <sleep>:
SYSCALL(sleep)
3d55: b8 0d 00 00 00 mov $0xd,%eax
3d5a: cd 40 int $0x40
3d5c: c3 ret
00003d5d <uptime>:
SYSCALL(uptime)
3d5d: b8 0e 00 00 00 mov $0xe,%eax
3d62: cd 40 int $0x40
3d64: c3 ret
00003d65 <date>:
SYSCALL(date)
3d65: b8 16 00 00 00 mov $0x16,%eax
3d6a: cd 40 int $0x40
3d6c: c3 ret
00003d6d <alarm>:
SYSCALL(alarm)
3d6d: b8 17 00 00 00 mov $0x17,%eax
3d72: cd 40 int $0x40
3d74: c3 ret
3d75: 66 90 xchg %ax,%ax
3d77: 66 90 xchg %ax,%ax
3d79: 66 90 xchg %ax,%ax
3d7b: 66 90 xchg %ax,%ax
3d7d: 66 90 xchg %ax,%ax
3d7f: 90 nop
00003d80 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
3d80: 55 push %ebp
3d81: 89 e5 mov %esp,%ebp
3d83: 57 push %edi
3d84: 89 cf mov %ecx,%edi
3d86: 56 push %esi
3d87: 89 c6 mov %eax,%esi
3d89: 53 push %ebx
3d8a: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
3d8d: 8b 4d 08 mov 0x8(%ebp),%ecx
3d90: 85 c9 test %ecx,%ecx
3d92: 74 04 je 3d98 <printint+0x18>
3d94: 85 d2 test %edx,%edx
3d96: 78 70 js 3e08 <printint+0x88>
neg = 1;
x = -xx;
} else {
x = xx;
3d98: 89 d0 mov %edx,%eax
3d9a: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
3da1: 31 c9 xor %ecx,%ecx
3da3: 8d 5d d7 lea -0x29(%ebp),%ebx
3da6: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
3da8: 31 d2 xor %edx,%edx
3daa: f7 f7 div %edi
3dac: 0f b6 92 37 59 00 00 movzbl 0x5937(%edx),%edx
3db3: 88 14 0b mov %dl,(%ebx,%ecx,1)
3db6: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
3db9: 85 c0 test %eax,%eax
3dbb: 75 eb jne 3da8 <printint+0x28>
if(neg)
3dbd: 8b 45 c4 mov -0x3c(%ebp),%eax
3dc0: 85 c0 test %eax,%eax
3dc2: 74 08 je 3dcc <printint+0x4c>
buf[i++] = '-';
3dc4: c6 44 0d d7 2d movb $0x2d,-0x29(%ebp,%ecx,1)
3dc9: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
3dcc: 8d 79 ff lea -0x1(%ecx),%edi
3dcf: 01 fb add %edi,%ebx
3dd1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3dd8: 0f b6 03 movzbl (%ebx),%eax
3ddb: 83 ef 01 sub $0x1,%edi
3dde: 83 eb 01 sub $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3de1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3de8: 00
3de9: 89 34 24 mov %esi,(%esp)
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3dec: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3def: 8d 45 e7 lea -0x19(%ebp),%eax
3df2: 89 44 24 04 mov %eax,0x4(%esp)
3df6: e8 ea fe ff ff call 3ce5 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3dfb: 83 ff ff cmp $0xffffffff,%edi
3dfe: 75 d8 jne 3dd8 <printint+0x58>
putc(fd, buf[i]);
}
3e00: 83 c4 4c add $0x4c,%esp
3e03: 5b pop %ebx
3e04: 5e pop %esi
3e05: 5f pop %edi
3e06: 5d pop %ebp
3e07: c3 ret
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
3e08: 89 d0 mov %edx,%eax
3e0a: f7 d8 neg %eax
3e0c: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
3e13: eb 8c jmp 3da1 <printint+0x21>
3e15: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3e19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00003e20 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3e20: 55 push %ebp
3e21: 89 e5 mov %esp,%ebp
3e23: 57 push %edi
3e24: 56 push %esi
3e25: 53 push %ebx
3e26: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e29: 8b 45 0c mov 0xc(%ebp),%eax
3e2c: 0f b6 10 movzbl (%eax),%edx
3e2f: 84 d2 test %dl,%dl
3e31: 0f 84 c9 00 00 00 je 3f00 <printf+0xe0>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
3e37: 8d 4d 10 lea 0x10(%ebp),%ecx
3e3a: 31 ff xor %edi,%edi
3e3c: 89 4d d4 mov %ecx,-0x2c(%ebp)
3e3f: 31 db xor %ebx,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3e41: 8d 75 e7 lea -0x19(%ebp),%esi
3e44: eb 1e jmp 3e64 <printf+0x44>
3e46: 66 90 xchg %ax,%ax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
3e48: 83 fa 25 cmp $0x25,%edx
3e4b: 0f 85 b7 00 00 00 jne 3f08 <printf+0xe8>
3e51: 66 bf 25 00 mov $0x25,%di
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3e55: 83 c3 01 add $0x1,%ebx
3e58: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
3e5c: 84 d2 test %dl,%dl
3e5e: 0f 84 9c 00 00 00 je 3f00 <printf+0xe0>
c = fmt[i] & 0xff;
if(state == 0){
3e64: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
3e66: 0f b6 d2 movzbl %dl,%edx
if(state == 0){
3e69: 74 dd je 3e48 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
3e6b: 83 ff 25 cmp $0x25,%edi
3e6e: 75 e5 jne 3e55 <printf+0x35>
if(c == 'd'){
3e70: 83 fa 64 cmp $0x64,%edx
3e73: 0f 84 47 01 00 00 je 3fc0 <printf+0x1a0>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
3e79: 83 fa 70 cmp $0x70,%edx
3e7c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3e80: 0f 84 aa 00 00 00 je 3f30 <printf+0x110>
3e86: 83 fa 78 cmp $0x78,%edx
3e89: 0f 84 a1 00 00 00 je 3f30 <printf+0x110>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
3e8f: 83 fa 73 cmp $0x73,%edx
3e92: 0f 84 c0 00 00 00 je 3f58 <printf+0x138>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3e98: 83 fa 63 cmp $0x63,%edx
3e9b: 90 nop
3e9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3ea0: 0f 84 42 01 00 00 je 3fe8 <printf+0x1c8>
putc(fd, *ap);
ap++;
} else if(c == '%'){
3ea6: 83 fa 25 cmp $0x25,%edx
3ea9: 0f 84 01 01 00 00 je 3fb0 <printf+0x190>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3eaf: 8b 4d 08 mov 0x8(%ebp),%ecx
3eb2: 89 55 cc mov %edx,-0x34(%ebp)
3eb5: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3eb9: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3ec0: 00
3ec1: 89 74 24 04 mov %esi,0x4(%esp)
3ec5: 89 0c 24 mov %ecx,(%esp)
3ec8: e8 18 fe ff ff call 3ce5 <write>
3ecd: 8b 55 cc mov -0x34(%ebp),%edx
3ed0: 88 55 e7 mov %dl,-0x19(%ebp)
3ed3: 8b 45 08 mov 0x8(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3ed6: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3ed9: 31 ff xor %edi,%edi
3edb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3ee2: 00
3ee3: 89 74 24 04 mov %esi,0x4(%esp)
3ee7: 89 04 24 mov %eax,(%esp)
3eea: e8 f6 fd ff ff call 3ce5 <write>
3eef: 8b 45 0c mov 0xc(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
3ef2: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
3ef6: 84 d2 test %dl,%dl
3ef8: 0f 85 66 ff ff ff jne 3e64 <printf+0x44>
3efe: 66 90 xchg %ax,%ax
putc(fd, c);
}
state = 0;
}
}
}
3f00: 83 c4 3c add $0x3c,%esp
3f03: 5b pop %ebx
3f04: 5e pop %esi
3f05: 5f pop %edi
3f06: 5d pop %ebp
3f07: c3 ret
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3f08: 8b 45 08 mov 0x8(%ebp),%eax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
3f0b: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3f0e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3f15: 00
3f16: 89 74 24 04 mov %esi,0x4(%esp)
3f1a: 89 04 24 mov %eax,(%esp)
3f1d: e8 c3 fd ff ff call 3ce5 <write>
3f22: 8b 45 0c mov 0xc(%ebp),%eax
3f25: e9 2b ff ff ff jmp 3e55 <printf+0x35>
3f2a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
3f30: 8b 45 d4 mov -0x2c(%ebp),%eax
3f33: b9 10 00 00 00 mov $0x10,%ecx
ap++;
3f38: 31 ff xor %edi,%edi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
3f3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
3f41: 8b 10 mov (%eax),%edx
3f43: 8b 45 08 mov 0x8(%ebp),%eax
3f46: e8 35 fe ff ff call 3d80 <printint>
3f4b: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
3f4e: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
3f52: e9 fe fe ff ff jmp 3e55 <printf+0x35>
3f57: 90 nop
} else if(c == 's'){
s = (char*)*ap;
3f58: 8b 55 d4 mov -0x2c(%ebp),%edx
ap++;
if(s == 0)
3f5b: b9 30 59 00 00 mov $0x5930,%ecx
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
3f60: 8b 3a mov (%edx),%edi
ap++;
3f62: 83 c2 04 add $0x4,%edx
3f65: 89 55 d4 mov %edx,-0x2c(%ebp)
if(s == 0)
3f68: 85 ff test %edi,%edi
3f6a: 0f 44 f9 cmove %ecx,%edi
s = "(null)";
while(*s != 0){
3f6d: 0f b6 17 movzbl (%edi),%edx
3f70: 84 d2 test %dl,%dl
3f72: 74 33 je 3fa7 <printf+0x187>
3f74: 89 5d d0 mov %ebx,-0x30(%ebp)
3f77: 8b 5d 08 mov 0x8(%ebp),%ebx
3f7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
s++;
3f80: 83 c7 01 add $0x1,%edi
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
3f83: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3f86: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3f8d: 00
3f8e: 89 74 24 04 mov %esi,0x4(%esp)
3f92: 89 1c 24 mov %ebx,(%esp)
3f95: e8 4b fd ff ff call 3ce5 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
3f9a: 0f b6 17 movzbl (%edi),%edx
3f9d: 84 d2 test %dl,%dl
3f9f: 75 df jne 3f80 <printf+0x160>
3fa1: 8b 5d d0 mov -0x30(%ebp),%ebx
3fa4: 8b 45 0c mov 0xc(%ebp),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3fa7: 31 ff xor %edi,%edi
3fa9: e9 a7 fe ff ff jmp 3e55 <printf+0x35>
3fae: 66 90 xchg %ax,%ax
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
3fb0: c6 45 e7 25 movb $0x25,-0x19(%ebp)
3fb4: e9 1a ff ff ff jmp 3ed3 <printf+0xb3>
3fb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
3fc0: 8b 45 d4 mov -0x2c(%ebp),%eax
3fc3: b9 0a 00 00 00 mov $0xa,%ecx
ap++;
3fc8: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
3fcb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3fd2: 8b 10 mov (%eax),%edx
3fd4: 8b 45 08 mov 0x8(%ebp),%eax
3fd7: e8 a4 fd ff ff call 3d80 <printint>
3fdc: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
3fdf: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
3fe3: e9 6d fe ff ff jmp 3e55 <printf+0x35>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3fe8: 8b 55 d4 mov -0x2c(%ebp),%edx
putc(fd, *ap);
ap++;
3feb: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3fed: 8b 4d 08 mov 0x8(%ebp),%ecx
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
3ff0: 8b 02 mov (%edx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
3ff2: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
3ff9: 00
3ffa: 89 74 24 04 mov %esi,0x4(%esp)
3ffe: 89 0c 24 mov %ecx,(%esp)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4001: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4004: e8 dc fc ff ff call 3ce5 <write>
4009: 8b 45 0c mov 0xc(%ebp),%eax
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
400c: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
4010: e9 40 fe ff ff jmp 3e55 <printf+0x35>
4015: 66 90 xchg %ax,%ax
4017: 66 90 xchg %ax,%ax
4019: 66 90 xchg %ax,%ax
401b: 66 90 xchg %ax,%ax
401d: 66 90 xchg %ax,%ax
401f: 90 nop
00004020 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
4020: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
4021: a1 08 5a 00 00 mov 0x5a08,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
4026: 89 e5 mov %esp,%ebp
4028: 57 push %edi
4029: 56 push %esi
402a: 53 push %ebx
402b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
402e: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
4031: 39 c8 cmp %ecx,%eax
4033: 73 1d jae 4052 <free+0x32>
4035: 8d 76 00 lea 0x0(%esi),%esi
4038: 8b 10 mov (%eax),%edx
403a: 39 d1 cmp %edx,%ecx
403c: 72 1a jb 4058 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
403e: 39 d0 cmp %edx,%eax
4040: 72 08 jb 404a <free+0x2a>
4042: 39 c8 cmp %ecx,%eax
4044: 72 12 jb 4058 <free+0x38>
4046: 39 d1 cmp %edx,%ecx
4048: 72 0e jb 4058 <free+0x38>
404a: 89 d0 mov %edx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
404c: 39 c8 cmp %ecx,%eax
404e: 66 90 xchg %ax,%ax
4050: 72 e6 jb 4038 <free+0x18>
4052: 8b 10 mov (%eax),%edx
4054: eb e8 jmp 403e <free+0x1e>
4056: 66 90 xchg %ax,%ax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
4058: 8b 71 04 mov 0x4(%ecx),%esi
405b: 8d 3c f1 lea (%ecx,%esi,8),%edi
405e: 39 d7 cmp %edx,%edi
4060: 74 19 je 407b <free+0x5b>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
4062: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
4065: 8b 50 04 mov 0x4(%eax),%edx
4068: 8d 34 d0 lea (%eax,%edx,8),%esi
406b: 39 ce cmp %ecx,%esi
406d: 74 23 je 4092 <free+0x72>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
406f: 89 08 mov %ecx,(%eax)
freep = p;
4071: a3 08 5a 00 00 mov %eax,0x5a08
}
4076: 5b pop %ebx
4077: 5e pop %esi
4078: 5f pop %edi
4079: 5d pop %ebp
407a: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
407b: 03 72 04 add 0x4(%edx),%esi
407e: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
4081: 8b 10 mov (%eax),%edx
4083: 8b 12 mov (%edx),%edx
4085: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
4088: 8b 50 04 mov 0x4(%eax),%edx
408b: 8d 34 d0 lea (%eax,%edx,8),%esi
408e: 39 ce cmp %ecx,%esi
4090: 75 dd jne 406f <free+0x4f>
p->s.size += bp->s.size;
4092: 03 51 04 add 0x4(%ecx),%edx
4095: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
4098: 8b 53 f8 mov -0x8(%ebx),%edx
409b: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
409d: a3 08 5a 00 00 mov %eax,0x5a08
}
40a2: 5b pop %ebx
40a3: 5e pop %esi
40a4: 5f pop %edi
40a5: 5d pop %ebp
40a6: c3 ret
40a7: 89 f6 mov %esi,%esi
40a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000040b0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
40b0: 55 push %ebp
40b1: 89 e5 mov %esp,%ebp
40b3: 57 push %edi
40b4: 56 push %esi
40b5: 53 push %ebx
40b6: 83 ec 2c sub $0x2c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
40b9: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
40bc: 8b 0d 08 5a 00 00 mov 0x5a08,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
40c2: 83 c3 07 add $0x7,%ebx
40c5: c1 eb 03 shr $0x3,%ebx
40c8: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
40cb: 85 c9 test %ecx,%ecx
40cd: 0f 84 9b 00 00 00 je 416e <malloc+0xbe>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
40d3: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
40d5: 8b 50 04 mov 0x4(%eax),%edx
40d8: 39 d3 cmp %edx,%ebx
40da: 76 27 jbe 4103 <malloc+0x53>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
40dc: 8d 3c dd 00 00 00 00 lea 0x0(,%ebx,8),%edi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
40e3: be 00 80 00 00 mov $0x8000,%esi
40e8: 89 7d e4 mov %edi,-0x1c(%ebp)
40eb: 90 nop
40ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
40f0: 3b 05 08 5a 00 00 cmp 0x5a08,%eax
40f6: 74 30 je 4128 <malloc+0x78>
40f8: 89 c1 mov %eax,%ecx
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){
40fa: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
40fc: 8b 50 04 mov 0x4(%eax),%edx
40ff: 39 d3 cmp %edx,%ebx
4101: 77 ed ja 40f0 <malloc+0x40>
if(p->s.size == nunits)
4103: 39 d3 cmp %edx,%ebx
4105: 74 61 je 4168 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
4107: 29 da sub %ebx,%edx
4109: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
410c: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
410f: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
4112: 89 0d 08 5a 00 00 mov %ecx,0x5a08
return (void*)(p + 1);
4118: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
411b: 83 c4 2c add $0x2c,%esp
411e: 5b pop %ebx
411f: 5e pop %esi
4120: 5f pop %edi
4121: 5d pop %ebp
4122: c3 ret
4123: 90 nop
4124: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
4128: 8b 45 e4 mov -0x1c(%ebp),%eax
412b: 81 fb 00 10 00 00 cmp $0x1000,%ebx
4131: bf 00 10 00 00 mov $0x1000,%edi
4136: 0f 43 fb cmovae %ebx,%edi
4139: 0f 42 c6 cmovb %esi,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
413c: 89 04 24 mov %eax,(%esp)
413f: e8 09 fc ff ff call 3d4d <sbrk>
if(p == (char*)-1)
4144: 83 f8 ff cmp $0xffffffff,%eax
4147: 74 18 je 4161 <malloc+0xb1>
return 0;
hp = (Header*)p;
hp->s.size = nu;
4149: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
414c: 83 c0 08 add $0x8,%eax
414f: 89 04 24 mov %eax,(%esp)
4152: e8 c9 fe ff ff call 4020 <free>
return freep;
4157: 8b 0d 08 5a 00 00 mov 0x5a08,%ecx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
415d: 85 c9 test %ecx,%ecx
415f: 75 99 jne 40fa <malloc+0x4a>
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){
if(p->s.size >= nunits){
4161: 31 c0 xor %eax,%eax
4163: eb b6 jmp 411b <malloc+0x6b>
4165: 8d 76 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
4168: 8b 10 mov (%eax),%edx
416a: 89 11 mov %edx,(%ecx)
416c: eb a4 jmp 4112 <malloc+0x62>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
416e: c7 05 08 5a 00 00 00 movl $0x5a00,0x5a08
4175: 5a 00 00
base.s.size = 0;
4178: b9 00 5a 00 00 mov $0x5a00,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
417d: c7 05 00 5a 00 00 00 movl $0x5a00,0x5a00
4184: 5a 00 00
base.s.size = 0;
4187: c7 05 04 5a 00 00 00 movl $0x0,0x5a04
418e: 00 00 00
4191: e9 3d ff ff ff jmp 40d3 <malloc+0x23>
|
theorems/homotopy/JoinComm.agda | cmknapp/HoTT-Agda | 0 | 700 | <filename>theorems/homotopy/JoinComm.agda
{-# OPTIONS --without-K #-}
open import HoTT
module homotopy.JoinComm where
module _ {i j} {A : Type i} {B : Type j} where
swap : A * B → B * A
swap = Swap.f module _ where
swap-glue : (a : A) (b : B) → right a == left b
swap-glue a b = ! (glue (b , a))
module Swap = PushoutRec right left (uncurry swap-glue)
{- ∞TT:
swap : A * B → B * A
swap (left a) = right a
swap (right b) = left b
ap swap (glue (a , b)) = ! (glue (b , a))
-}
module _ {i j} {A : Type i} {B : Type j} where
swap-swap : (x : A * B) → swap (swap x) == x
swap-swap = Pushout-elim (λ a → idp) (λ b → idp) (λ c → ↓-∘=idf-in swap swap
(swap-swap-glue c)) where
swap-swap-glue : (c : A × B) → ap swap (ap swap (glue c)) == glue c
swap-swap-glue (a , b) =
ap swap (ap swap (glue (a , b))) =⟨ Swap.glue-β (a , b) |in-ctx ap swap ⟩
ap swap (! (glue (b , a))) =⟨ ap-! swap (glue (b , a)) ⟩
! (ap swap (glue (b , a))) =⟨ Swap.glue-β (b , a) |in-ctx ! ⟩
! (! (glue (a , b))) =⟨ !-! (glue (a , b)) ⟩
glue (a , b) ∎
{- ∞TT:
swap-swap : (x : A * B) → swap (swap x) == x
swap-swap (left a) = idp
swap-swap (right b) = idp
apd swap-swap (glue (a , b)) = !-! (glue (a , b))
-}
module _ {i j} {A : Type i} {B : Type j} where
swap-equiv : (A * B) ≃ (B * A)
swap-equiv = equiv swap swap swap-swap swap-swap
swap-path : (A * B) == (B * A)
swap-path = ua swap-equiv
|
tests/covered/List.agda | andrejtokarcik/agda-semantics | 3 | 111 | <reponame>andrejtokarcik/agda-semantics
module List where
data List (a : Set) : Set where
nil : List a
_::_ : a -> List a -> List a
nil2 : (\x -> x) ({a : Set} -> List a)
nil2 = nil {_}
tt : Set1 -> Set2
tt _ = Set1
map : {a b : Set} -> (a -> b) -> List a -> List b
map f nil = nil
map f (x :: xs) = f x :: map f xs
|
oeis/266/A266445.asm | neoneye/loda-programs | 11 | 168025 | ; A266445: Binary representation of the middle column of the "Rule 25" elementary cellular automaton starting with a single ON (black) cell.
; Submitted by <NAME>
; 1,10,100,1000,10001,100010,1000101,10001010,100010101,1000101011,10001010110,100010101100,1000101011000,10001010110001,100010101100010,1000101011000101,10001010110001010,100010101100010101,1000101011000101010,10001010110001010101,100010101100010101010,1000101011000101010101,10001010110001010101010,100010101100010101010101,1000101011000101010101010,10001010110001010101010101,100010101100010101010101010,1000101011000101010101010101,10001010110001010101010101010,100010101100010101010101010101
seq $0,266446 ; Decimal representation of the middle column of the "Rule 25" elementary cellular automaton starting with a single ON (black) cell.
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
|
src/stdio.asm | stephanro/hello_nasm | 0 | 246660 | ; hello_world.asm
%define _STDOUT 0x1
%define _WRITE 0x1
section .data
section .bss
section .text
global stdio
stdio:
align 16
.print_string:
; Function prologue.
push rbp
mov rbp, rsp
; Write string to standard output.
mov rax, _WRITE
mov rdi, _STDOUT
syscall
leave
ret
|
programs/oeis/008/A008794.asm | neoneye/loda | 22 | 3690 | ; A008794: Squares repeated; a(n) = floor(n/2)^2.
; 0,0,1,1,4,4,9,9,16,16,25,25,36,36,49,49,64,64,81,81,100,100,121,121,144,144,169,169,196,196,225,225,256,256,289,289,324,324,361,361,400,400,441,441,484,484,529,529,576,576,625,625,676,676,729,729,784,784,841,841,900,900,961,961,1024,1024,1089,1089,1156,1156,1225,1225,1296,1296,1369,1369,1444,1444,1521,1521,1600,1600,1681,1681,1764,1764,1849,1849,1936,1936,2025,2025,2116,2116,2209,2209,2304,2304,2401,2401
div $0,2
pow $0,2
|
projects/04/Mult.asm | jmaver-plume/nand2tetris | 0 | 172091 | // Bootstrap
@R2
M=0
(LOOP)
// If 0 jump to end
@R1
D=M
@END
D;JEQ
// Get value from R0
@R0
D=M
// Add value from R0
@R2
M=D+M
// Decrement
@R1
M=M-1
// Continue
@LOOP
0;JMP
(END)
@END
0;JMP
|
source/adam-parameter.ads | charlie5/aIDE | 3 | 1166 | <filename>source/adam-parameter.ads
with
AdaM.Any,
AdaM.a_Type,
ada.Streams;
package AdaM.Parameter
is
type Item is new Any.Item with private;
-- View
--
type View is access all Item'Class;
procedure View_write (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : in View);
procedure View_read (Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Self : out View);
for View'write use View_write;
for View'read use View_read;
-- Vector
--
package Vectors is new ada.Containers.Vectors (Positive, View);
subtype Vector is Vectors.Vector;
function to_Source (the_Parameters : in Vector) return text_Vectors.Vector;
-- Types
--
type a_Mode is (in_Mode, out_Mode, in_out_Mode, access_Mode);
-- Forge
--
function new_Parameter (Name : in String := "") return Parameter.view;
procedure free (Self : in out Parameter.view);
procedure destruct (Self : in out Item);
-- Attributes
--
overriding function Id (Self : access Item) return AdaM.Id;
function Name (Self : in Item) return String;
procedure Name_is (Self : in out Item; Now : in String);
function Mode (Self : in Item) return a_Mode;
procedure Mode_is (Self : in out Item; Now : in a_Mode);
function my_Type (Self : access Item) return access a_Type.view;
function my_Type (Self : in Item) return a_Type.view;
procedure Type_is (Self : in out Item; Now : in a_Type.view);
function Default (Self : in Item) return String;
procedure Default_is (Self : in out Item; Now : in String);
function to_Source (Self : in Item) return text_Vectors.Vector;
private
type Item is new Any.Item with
record
Name : Text;
Mode : a_Mode;
my_Type : aliased a_Type.view;
Default : Text;
end record;
end AdaM.Parameter;
|
libsrc/_DEVELOPMENT/math/float/math16/c/sdcc/cm16_sdcc___sint2h.asm | Frodevan/z88dk | 4 | 25778 | <filename>libsrc/_DEVELOPMENT/math/float/math16/c/sdcc/cm16_sdcc___sint2h.asm
SECTION code_fp_math16
PUBLIC cm16_sdcc___sint2h
EXTERN asm_f24_i16
EXTERN asm_f16_f24
.cm16_sdcc___sint2h
pop bc ;return
pop hl ;value
push hl
push bc
call asm_f24_i16
jp asm_f16_f24
|
samples/game.asm | Idorobots/asm | 2 | 20923 | ################################################################################
# A short game in ASM.
#
# > (new-game)
# You are in the living-room...
# walk China
####################
# Places to go.
(var *nodes* '{(living-room (You are in the living-room. A wizard is snoring loudly on the couch.))
(garden (You are in a beautiful garden. There is a well in front of you.))
(attic (You are in the attic. There is a giant welding a torch in the corner.))})
# Paths to take.
(var *edges* '{(living-room (garden west door)
(attic upstairs ladder))
(garden (living-room east door))
(attic (living-room downstairs ladder))})
# Items to steal.
(var *objects* '{whiskey bucket frog chain})
# Where to steal them.
(var *object-locations* '[(whiskey living-room)
(bucket living-room)
(frog garden)
(chain garden)])
# Where we at, yo.
(var *location* 'living-room)
(function describe-location [location nodes]
(second (assoc location nodes)))
(function describe-path [edge]
`(There is a $(third edge) going $(second edge) from here.))
(function describe-paths [location edges]
(apply append (map describe-path (rest (assoc location edges)))))
(function objects-at [loc objs obj-locs]
(objs [obj -> (equal? (second (assoc obj obj-locs))
loc)]))
(function describe-objects [loc objs obj-locs]
(apply append (map [obj -> `(You see a $obj on the floor.)]
(objects-at loc objs obj-locs))))
(function look []
(append (describe-location *location* *nodes*)
(describe-paths *location* *edges*)
(describe-objects *location* *objects* *object-locations*)))
(function walk [direction] {
(var next (first (select (rest (assoc *location* *edges*))
[edge -> (equal? (second edge) direction)])))
(if next {
(set! *location* (first next))
(look)
}
#else '(You can't go there.))
})
(function pickup [object]
(if (member? object
(objects-at *location* *objects* *object-locations*))
(do (push! (tuple object 'inventory) *object-locations*)
`(You are now carrying the $object))
'(You can't get that.)))
(function inventory []
(join 'inventory:
(objects-at 'inventory *objects* *object-locations*)))
## Game repl:
(function game-read []
(if (collection? (var command (read)))
(tuple (first command) `(quote $(second command)))
(tuple command)))
(function game-print [what] {
(map [arg -> (write arg \space)]
what)
(write \newline)
})
(function game-repl [] {
(var accepted-commands '{look walk pickup inventory quit})
(if (equal? (first (var command (game-read)))
'quit)
(game-print '(Bye, bye.))
#else {
(if (member? (first command) accepted-commands)
(game-print (eval command))
#else (game-print '(I don't know this command.)))
(game-repl)
})
})
(function new-game [] {
(set! *location* 'living-room)
(game-print (look))
(game-repl)
}) |
programs/oeis/141/A141351.asm | karttu/loda | 0 | 176219 | ; A141351: a(n)=C(n)+1-0^n where C(n)=A000108(n).
; 1,2,3,6,15,43,133,430,1431,4863,16797,58787,208013,742901,2674441,9694846,35357671,129644791,477638701,1767263191,6564120421,24466267021,91482563641,343059613651,1289904147325
mov $2,1
lpb $2,1
sub $2,1
add $3,1
lpb $3,1
sub $3,1
mov $4,$0
lpb $4,1
mov $1,$0
add $1,$0
bin $1,$0
sub $4,1
mov $5,$0
add $5,1
div $1,$5
lpe
lpe
lpe
add $1,1
|
src/asis/asis-extensions-iterator.ads | My-Colaborations/dynamo | 15 | 21942 | <filename>src/asis/asis-extensions-iterator.ads
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT COMPONENTS --
-- --
-- A S I S . E X T E N S I O N S . I T E R A T O R --
-- --
-- S p e c --
-- --
-- Copyright (c) 2003-2006, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY 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 ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
-- This package encapsulates the generic procedure Traverse_Unit which
-- is a generalization of the standard ASIS Asis.Iterator.Traverse_Element
-- procedure. Traverse_Unit traverses all the syntactical components of the
-- argument ASIS Compilation Unit.
package Asis.Extensions.Iterator is
generic
type State_Information is limited private;
with procedure Pre_Operation
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out State_Information) is <>;
with procedure Post_Operation
(Element : Asis.Element;
Control : in out Traverse_Control;
State : in out State_Information) is <>;
procedure Traverse_Unit
(Unit : Asis.Compilation_Unit;
Control : in out Traverse_Control;
State : in out State_Information);
-- Traverses all the syntactical structure of the argument Compilation
-- Unit. In ASIS, a Compilation Unit consists of context clause Elements
-- and of the Element representing the program unit, and these syntax
-- elements does not have a common root. Traverse_Unit instantiates
-- Asis.Iterator.Traverse_Element passing its own formal parameters as
-- actuals for Traverse_Element. Then it goes into all the
-- first-depth-level structural components of the argument Compilation
-- Unit by applying this instance of Traverse_Element to it.
--
-- If the value of traverse Control becomes Terminate_Immediately,
-- traversing of all the unit components is terminated (that is, if it
-- happens in some context clause Element, the Unit declaration Element
-- will not be traversed.
--
-- Appropriate Unit_Kinds:
-- A_Procedure
-- A_Function
-- A_Package
--
-- A_Generic_Procedure
-- A_Generic_Function
-- A_Generic_Package
--
-- A_Procedure_Instance
-- A_Function_Instance
-- A_Package_Instance
--
-- A_Procedure_Renaming
-- A_Function_Renaming
-- A_Package_Renaming
--
-- A_Generic_Procedure_Renaming
-- A_Generic_Function_Renaming
-- A_Generic_Package_Renaming
--
-- A_Procedure_Body
-- A_Procedure_Body
-- A_Function_Body
-- A_Package_Body
--
-- A_Procedure_Body_Subunit
-- A_Function_Body_Subunit
-- A_Package_Body_Subunit
-- A_Task_Body_Subunit
-- A_Protected_Body_Subunit
end Asis.Extensions.Iterator;
|
Transynther/x86/_processed/AVXALIGN/_st_4k_/i9-9900K_12_0xca.log_16241_968.asm | ljhsiun2/medusa | 9 | 99042 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x75b3, %r9
nop
nop
nop
nop
nop
add %r13, %r13
movw $0x6162, (%r9)
inc %r8
lea addresses_WC_ht+0x1ec5f, %r8
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r8)
nop
nop
dec %r13
lea addresses_WT_ht+0x1bc53, %r15
nop
nop
cmp $43379, %r10
movb $0x61, (%r15)
nop
nop
cmp %r13, %r13
lea addresses_WT_ht+0x86f3, %r10
xor $16927, %r15
movb $0x61, (%r10)
nop
nop
nop
nop
add $53161, %r13
lea addresses_A_ht+0x6c1b, %r9
nop
nop
nop
add %r13, %r13
mov (%r9), %r15
nop
nop
nop
nop
nop
and $53132, %r9
lea addresses_normal_ht+0xdcdb, %rsi
lea addresses_WT_ht+0x14af3, %rdi
nop
nop
and $13468, %r13
mov $103, %rcx
rep movsb
nop
nop
inc %rdx
lea addresses_D_ht+0x1364f, %rsi
lea addresses_A_ht+0x62f3, %rdi
clflush (%rsi)
nop
and $4887, %r8
mov $113, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %r9
lea addresses_A_ht+0x814b, %rsi
nop
nop
nop
xor $59354, %rcx
movb (%rsi), %r8b
xor %rsi, %rsi
lea addresses_D_ht+0x13df3, %rdi
nop
nop
nop
nop
nop
add $50150, %r10
mov $0x6162636465666768, %r13
movq %r13, (%rdi)
nop
nop
nop
nop
nop
xor %r13, %r13
lea addresses_WT_ht+0x3df3, %rsi
nop
xor %rdx, %rdx
movb (%rsi), %r15b
nop
nop
and $53321, %r15
lea addresses_normal_ht+0x18ef3, %r9
nop
nop
nop
nop
nop
add $52458, %r13
movw $0x6162, (%r9)
and %r8, %r8
lea addresses_normal_ht+0x19163, %r15
nop
cmp %r10, %r10
mov (%r15), %r13w
nop
nop
dec %r13
lea addresses_A_ht+0x1daf3, %rsi
nop
sub %r9, %r9
mov $0x6162636465666768, %r13
movq %r13, (%rsi)
nop
nop
nop
nop
and $2993, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %r9
push %rax
push %rcx
push %rdx
// Load
mov $0x2f3, %r9
clflush (%r9)
nop
nop
sub $5228, %rax
mov (%r9), %rdx
// Exception!!!
nop
nop
mov (0), %r15
nop
nop
xor $46276, %r9
// Store
lea addresses_WT+0x1c2f3, %r13
nop
nop
nop
nop
dec %rcx
mov $0x5152535455565758, %rdx
movq %rdx, (%r13)
nop
nop
nop
nop
nop
add %rdx, %rdx
// Load
lea addresses_RW+0x1e273, %r10
nop
nop
nop
nop
nop
add $24670, %rax
mov (%r10), %dx
nop
nop
nop
nop
nop
xor $60208, %r9
// Store
mov $0x4896690000000ff3, %r15
clflush (%r15)
nop
xor $48866, %rcx
movl $0x51525354, (%r15)
nop
cmp %r9, %r9
// Store
lea addresses_US+0x383, %rax
nop
nop
nop
add $23583, %r13
mov $0x5152535455565758, %r15
movq %r15, %xmm4
movups %xmm4, (%rax)
nop
nop
nop
xor %r10, %r10
// Faulty Load
lea addresses_WC+0x92f3, %r15
clflush (%r15)
nop
nop
nop
xor $53613, %rax
mov (%r15), %r13
lea oracles, %r15
and $0xff, %r13
shlq $12, %r13
mov (%r15,%r13,1), %r13
pop %rdx
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 2}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': True, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': True, 'type': 'addresses_normal_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'58': 16241}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
src/main/antlr/com/defano/hypertalk/parser/HyperTalk.g4 | Msimoneau/wyldcard | 0 | 593 | /*
* MIT License
*
* Copyright (c) 2017 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
grammar HyperTalk;
// Start symbol accepting only well-formed HyperTalk scripts that consist of handlers, functions, whitespace and
// comments (representing scipts that are assignable to objects like buttons, fields and cards). Disallows statements or
// expressions that are not inside of a handler or function block.
script
: handler script # handlerScript
| function script # functionScript
| NEWLINE script # newlineScript
| EOF # emptyScript
;
// Start symbol accepting any sequence of HyperTalk statements, expressions, whitespace and comments. Suitable when
// evaluating the message box or HyperTalk strings via the 'do' command and 'value of' function.
scriptlet
: statement EOF # singleScriptlet
| multilineScriptlet # mutliScriptlet
;
multilineScriptlet
: statement NEWLINE multilineScriptlet # stmntMultiScriptlet
| statement EOF # stmntScriptlet
| NEWLINE multilineScriptlet # whitespaceScriptlet
| EOF # eofScriptlet
;
handler
: 'on' handlerName NEWLINE+ statementList? 'end' handlerName # noArgHandler
| 'on' handlerName parameterList NEWLINE+ statementList? 'end' handlerName # argHandler
;
function
: 'function' ID NEWLINE+ statementList? 'end' ID # noArgFunction
| 'function' ID parameterList NEWLINE+ statementList? 'end' ID # argFunction
;
handlerName
: ID
| commandName // Handlers can take the name of a command keyword (other keywords are disallowed)
;
parameterList
: ID # singleParamList
| parameterList ',' ID # multiParamList
;
statementList
: statement NEWLINE+ statementList # multiStmntList
| statement NEWLINE+ # singleStmntList
;
statement
: commandStmnt # nonEmptyCommandStmnt
| functionCall # nonEmptyFuncStmnt
| messageStatement # nonEmptyMsgStmnt
| expression # nonEmptyExpStmnt
| ifStatement # nonEmptyIfStmnt
| repeatStatement # nonEmptyRepeatStmnt
| globalStmnt # nonEmptyGlobalStmnt
| returnStmnt # nonEmptyReturnStmnt
;
globalStmnt
: 'global' parameterList
;
returnStmnt
: 'return' expression # eprReturnStmnt
| 'return' # voidReturnStmnt
;
ifStatement
: 'if' expression thenStatement
;
thenStatement
: NEWLINE? 'then' statement # thenSingleLineStmnt
| NEWLINE? 'then' statement NEWLINE? elseStatement? # thenSingleStmnt
| NEWLINE? 'then' NEWLINE+ statementList? (elseStatement | 'end' 'if') # thenStmntList
;
elseStatement
: 'else' statement (NEWLINE+ 'end' 'if')? # elseSingleStmt
| 'else' NEWLINE+ statementList? 'end' 'if' # elseStmntList
;
repeatStatement
: 'repeat' repeatRange NEWLINE+ statementList 'end' 'repeat' # repeatStmntList
| 'repeat' repeatRange NEWLINE+ 'end' 'repeat' # repeatEmpty
;
messageStatement
: ID # noArgMsgCmdStmt
| ID listExpression # argMsgCmdStmt
;
commandStmnt
: 'add' expression 'to' expression # addCmdStmnt
| 'answer' expression 'with' factor 'or' factor 'or' factor # answerThreeButtonCmd
| 'answer' expression 'with' factor 'or' factor # answerTwoButtonCmd
| 'answer' expression 'with' factor # answerOneButtonCmd
| 'answer' expression # answerDefaultCmd
| 'ask' expression 'with' expression # askExpWithCmd
| 'ask' expression # askExpCmd
| 'ask' 'file' expression # askFileCmd
| 'ask' 'file' expression 'with' expression # askFileWithCmd
| 'beep' # beepCmdStmt
| 'beep' expression # beepMultipleStmt
| 'choose' toolExpression 'tool'? # chooseToolCmdStmt
| 'choose' 'tool' toolExpression # chooseToolNumberCmdStmt
| 'click' 'at' listExpression # clickCmdStmt
| 'click' 'at' listExpression 'with' listExpression # clickWithKeyCmdStmt
| 'close' 'file' expression # closeFileCmdStmt
| 'convert' container 'to' convertible # convertContainerToCmd
| 'convert' container 'from' convertible 'to' convertible # convertContainerFromToCmd
| 'convert' expression 'to' convertible # convertToCmd
| 'convert' expression 'from' convertible 'to' convertible # convertFromToCmd
| 'create' 'menu' expression # createMenuCmdStmt
| 'delete' expression # deleteCmdStmt
| 'dial' expression # dialCmdStmt
| 'disable' expression # disableExprStmt
| 'divide' expression 'by' expression # divideCmdStmnt
| 'do' expression # doCmdStmt
| 'domenu' expression # doMenuCmdStmt
| 'drag' 'from' listExpression 'to' listExpression # dragCmdStmt
| 'drag' 'from' listExpression 'to' listExpression 'with' listExpression # dragWithKeyCmdStmt
| 'edit' 'the'? 'script' of expression # editScriptCmdStmt
| 'enable' expression # enableExpStmnt
| 'exit' handlerName # exitCmdStmt
| 'exit' 'repeat' # exitRepeatCmdStmt
| 'exit' 'to' 'hypercard' # exitToHyperCardCmdStmt
| 'export' 'paint' 'to' 'file' expression # exportPaintCmdStmt
| 'find' expression? 'international'? expression of expression of 'marked' cards # findFieldMarkedCards
| 'find' expression? 'international'? expression of expression # findField
| 'find' expression? 'international'? expression of 'marked' cards # findMarkedCards
| 'find' expression? 'international'? expression # findAnywhere
| 'get' expression # getCmdStmnt
| 'go' 'to'? expression 'with' 'visual' expression # goVisualEffectCmdStmnd
| 'go' 'to'? expression remoteNavOption # goCmdStmnt
| 'go' 'back' # goBackCmdStmt
| 'go' 'back' 'with' 'visual' expression # goBackVisualEffectCmdStmt
| 'hide' expression # hideCmdStmnt
| 'hide' card picture # hideThisCardPictCmd
| 'hide' background picture # hideThisBkgndPictCmd
| 'hide' picture of expression # hidePictCmd
| 'hide' 'titlebar' # hideTitleBar
| 'import' 'paint' 'from' 'file' expression # importPaintCmdStmt
| 'lock' 'screen' # lockScreenCmdStmt
| 'multiply' expression 'by' expression # multiplyCmdStmnt
| 'next' 'repeat' # nextRepeatCmdStmt
| 'open' 'file' expression # openFileCmdStmt
| 'pass' handlerName # passCmdStmt
| 'play' musicExpression # playCmdStmt
| 'pop' card # popCardCmdStmt
| 'push' card # pushCardCmdStmt
| 'push' expression # pushDestCmdStmt
| 'put' listExpression # putIntoCmd
| 'put' listExpression preposition expression # putPrepositionCmd
| 'read' 'from' 'file' expression # readFileCmd
| 'read' 'from' 'file' expression 'for' expression # readFileForCmd
| 'read' 'from' 'file' expression 'at' expression 'for' expression # readFileAtCmd
| 'read' 'from' 'file' expression 'until' expression # readFileUntil
| 'reset' 'the'? 'menubar' # resetMenuCmdStmt
| 'reset' 'paint' # resetPaintCmdStmt
| 'select' 'empty' # selectEmptyCmd
| 'select' 'text' of expression # selectTextCmd
| 'select' 'before' 'text' of expression # selectBeforeCmd
| 'select' 'after' 'text' of expression # selectAfterCmd
| 'select' expression # selectChunkCmd
| 'select' 'before' expression # selectBeforeChunkCmd
| 'select' 'after' expression # selectAfterChunkCmd
| 'set' property 'to' propertyValue # setCmdStmnt
| 'send' listExpression 'to' expression # sendCmdStmnt
| 'show' expression # showCmdStmnt
| 'show' card picture # showThisCardPictCmd
| 'show' background picture # showThisBkgndPictCmd
| 'show' picture of expression # showPictCmd
| 'show' 'titlebar' # showTitleBarCmd
| 'sort' sortChunkType expression sortDirection sortStyle # sortDirectionCmd
| 'sort' sortChunkType expression sortDirection sortStyle 'by' expression # sortExpressionCmd
| 'sort' sortDirection sortStyle 'by' expression # sortStackCmd
| 'sort' 'this'? 'stack' sortDirection sortStyle 'by' expression # sortStackCmd
| 'sort' 'the'? cards (of 'this' 'stack')? sortDirection sortStyle 'by' expression # sortStackCmd
| 'sort' 'the'? 'marked' cards (of 'this' 'stack')? sortDirection sortStyle 'by' expression # sortMarkedCardsCmd
| 'sort' expression sortDirection sortStyle 'by' expression # sortBkgndCardsCmd
| 'sort' 'the'? cards of expression sortDirection sortStyle 'by' expression # sortBkgndCardsCmd
| 'sort' 'the'? 'marked' cards of expression sortDirection sortStyle 'by' expression # sortMarkedBkgndCardsCmd
| 'speak' expression # speakCmd
| 'speak' expression 'with' gender=('male'|'female'|'neuter'|'robotic') 'voice' # speakGenderCmd
| 'speak' expression 'with' 'voice' expression # speakVoiceCmd
| 'subtract' expression 'from' expression # subtractCmdStmnt
| 'type' expression # typeCmdStmt
| 'type' expression 'with' ('commandkey' | 'cmdkey') # typeWithCmdKeyCmdStmt
| 'unlock' 'screen' # unlockScreenCmdStmt
| 'unlock' 'screen' 'with' 'visual' expression # unlockScreenVisualCmdStmt
| 'visual' expression # visualEffectCmdStmt
| 'wait' expression timeUnit # waitCountCmd
| 'wait' 'for' expression timeUnit # waitForCountCmd
| 'wait' 'until' expression # waitUntilCmd
| 'wait' 'while' expression # waitWhileCmd
| 'write' expression 'to' 'file' expression # writeFileCmd
| 'write' expression 'to' 'file' expression 'at' ('eof' | 'end') # writeEndFileCmd
| 'write' expression 'to' 'file' expression 'at' expression # writeAtFileCmd
;
remoteNavOption
: 'in a' 'new' 'window' # remoteInNewWindow
| 'in a' 'new' 'window' 'without' 'dialog' # remoteInNewWindowWithoutDialog
| 'without' 'dialog' # remoteWithoutDialog
| # remoteDefault
;
convertible
: conversionFormat # singleFormatConvertible
| conversionFormat 'and' conversionFormat # dualFormatConvertible
;
conversionFormat
: seconds # secondsConvFormat
| 'dateitems' # dateItemsConvFormat
| length 'date' # dateConvFormat
| length 'time' # timeConvFormat
;
length
: ('english' | 'long') # longTimeFormat
| ('abbreviated' | 'abbrev' | 'abbr') # abbreviatedTimeFormat
| 'short' # shortTimeFormat
| # defaultTimeFormat
;
sortDirection
: 'ascending' # sortDirectionAsc
| 'descending' # sortDirectionDesc
| # sortDirectionDefault
;
sortChunkType
: 'the'? line of # sortChunkLines
| 'the'? item of # sortChunkItems
| 'the'? word of # sortChunkWords
| 'the'? character of # sortChunkChars
| # sortChunkDefault
;
sortStyle
: 'text' # sortStyleText
| 'numeric' # sortStyleNumeric
| 'international' # sortStyleInternational
| 'datetime' # sortStyleDateTime
| # sortStyleDefault
;
repeatRange
: duration # durationLoop
| count # countLoop
| 'with' ID '=' range # withLoop
| 'forever' # infiniteLoop
| # infiniteLoop
;
duration
: 'until' expression # untilDuration
| 'while' expression # whileDuration
;
count
: 'for' expression 'times'
| 'for' expression
| expression 'times'
| expression
;
range
: expression 'down' 'to' expression # rangeDownTo
| expression 'to' expression # rangeUpTo
;
chunk
: chunk chunk # compositeChunk
| ordinal character of # ordinalCharChunk
| character expression 'to' expression of # rangeCharChunk
| character expression of # charCharChunk
| ordinal word of # ordinalWordChunk
| word expression 'to' expression of # rangeWordChunk
| word expression of # wordWordChunk
| ordinal item of # ordinalItemChunk
| item expression 'to' expression of # rangeItemChunk
| item expression of # itemItemChunk
| ordinal line of # ordinalLineChunk
| line expression 'to' expression of # rangeLineChunk
| line expression of # lineLineChunk
;
menu
: 'menu' factor # expressionMenu
| ordinal 'menu' # ordinalMenu
;
menuItem
: 'menuitem' factor of menu # expressionMenuItem
| ordinal 'menuitem' of menu # ordinalMenuItem
;
property
: partProperty
| globalProperty
;
globalProperty
: 'the'? propertyName # propertySpecGlobal
;
partProperty
: 'the'? propertyName of factor # propertySpecPart
| 'the'? length propertyName of factor # lengthPropertySpecPart
;
part
: message # msgPart
| card 'part' factor # cardPartNumberPart
| background 'part' factor # bkgndPartNumberPart
| 'me' # mePart
| buttonPart # buttonPartPart
| fieldPart # fieldPartPart
| bkgndPart # bkgndPartPart
| cardPart # cardPartPart
| stackPart # stackPartPart
| windowPart # windowPartPart
;
stackPart
: 'this'? stack # thisStackPart
| stack factor # anotherStackPart
;
buttonPart
: card? button 'id' factor # cardButtonIdPart
| background button 'id' factor # bkgndButtonIdPart
| card? button factor # cardButtonPart
| background button factor # bkgndButtonPart
| ordinal card? button # cardButtonOrdinalPart
| ordinal background button # bkgndButtonOrdinalPart
| buttonPart of cardPart # buttonOfCardPart
;
fieldPart
: card field 'id' factor # cardFieldIdPart
| background? field 'id' factor # bkgndFieldIdPart
| card field factor # cardFieldPart
| background? field factor # bkgndFieldPart
| ordinal card field # cardFieldOrdinalPart
| ordinal background? field # bkgndFieldOrdinalPart
| fieldPart of cardPart # fieldOfCardPart
;
cardPart
: 'this'? card # thisCardPart
| card 'id' factor # cardIdPart
| position card # positionCardPart
| ordinal card # ordinalCardPart
| card factor # expressionCardPart
| cardPart of bkgndPart # cardOfBkgndPart
| cardPart of stackPart # cardOfStackPart
;
bkgndPart
: 'this'? background # thisBkgndPart
| background 'id' factor # bkgndIdPart
| background factor # expressionBkgndPart
| ordinal background # ordinalBkgndPart
| position background # positionBkgndPart
| bkgndPart of stackPart # bkgndOfStackPart
;
windowPart
: 'the'? card 'window' # cardWindowExpr
| 'the'? 'tool' 'window' # toolWindowExpr
| 'the'? 'pattern' 'window' # patternWindowExpr
| 'the'? 'message' 'watcher' # messageWatcherExpr
| 'the'? 'variable' 'watcher' # variableWatcherExpr
| 'window' expression # windowNameExpr
| 'window' 'id' expression # windowIdExpr
;
listExpression
: expression # singletonListExp
| expression ',' listExpression # listExp
;
expression
: factor # factorExp
| 'not' expression # notExp
| '-' expression # negateExp
| op=('there is a'|'there is an'|'there is no'|'there is not a'|'there is not an') expression # unaryOpExp
| expression '^' expression # powOpExp
| expression op=('mod'| 'div'| '/'| '*') expression # binaryOpExp
| expression op=('+'| '-') expression # binaryOpExp
| expression op=('&&'| '&') expression # binaryOpExp
| expression op=('>='|'<='|'≤'|'≥'|'<'|'>'|'contains'|'is in'|'is not in'|'is a'|'is an'|'is not a'|'is not an'|'is within'|'is not within') expression # binaryOpExp
| expression op=('='|'is not'|'is'|'<>'|'≠') expression # binaryOpExp
| expression 'and' expression # binaryAndExp
| expression 'or' expression # binaryOrExp
;
factor
: literal # literalFactor
| '-' literal # negativeLiteralFactor
| '(' expression ')' # expressionFactor
| effectExpression # visualEffectFactor
| functionCall # functionExp
| container # containerFactor
| chunk factor # chunkFactorChunk
;
container
: ID # variableDest
| 'the'? 'selection' # selectionDest
| 'target' # targetDest
| property # propertyDest
| menu # menuDest
| menuItem # menuItemDest
| part # partDest
| chunk container # chunkContainerDest
;
musicExpression
: expression expression # musicInstrumentNotes
| expression 'tempo' expression expression # musicInstrumentNotesTempo
| expression 'tempo' expression # musicInstrumentTempo
| expression # musicInstrument
;
toolExpression
: 'text' # keywordToolExpr
| 'select' # keywordToolExpr
| 'field' # keywordToolExpr
| 'button' # keywordToolExpr
| 'line' # keywordToolExpr
| ('reg' | 'regular')? ('poly' | 'polygon') # keywordToolExpr
| 'round'? ('rect' | 'rectangle') # keywordToolExpr
| 'spray' 'can'? # keywordToolExpr
| expression # toolExpr
;
effectExpression
: 'effect'? effect # effectDefault
| 'effect'? effect 'to' image # effectTo
| 'effect'? effect speed # effectSpeed
| 'effect'? effect speed 'to' image # effectSpeedTo
;
functionCall
: builtInFunc # builtInFuncCall
| ID '(' listExpression? ')' # userArgFuncCall
;
builtInFunc
: 'the' zeroArgFunc # builtinFuncNoArg
| 'the'? singleArgFunc of factor # builtinFuncOneArgs
| singleArgFunc '(' listExpression ')' # builtinFuncOneArgs
| multiArgFunc '(' listExpression ')' # builtinFuncArgList
;
zeroArgFunc
: 'mouse' # mouseFunc
| 'mouseloc' # mouseLocFunc
| 'result' # resultFunc
| ('commandkey' | 'cmdkey') # commandKeyFunc
| 'shiftkey' # shiftKeyFunc
| 'optionkey' # optionKeyFunc
| 'ticks' # ticksFunc
| seconds # secondsFunc
| length 'time' # timeFunc
| length 'date' # dateFunc
| 'tool' # toolFunc
| 'mouseclick' # mouseClickFunc
| 'number' 'of' card? 'parts' # numberOfCardParts
| 'number' 'of' background 'parts' # numberOfBkgndParts
| 'number' 'of' card? button # numberOfCardButtons
| 'number' 'of' background button # numberOfBkgndButtons
| 'number' 'of' card field # numberOfCardFields
| 'number' 'of' background? field # numberOfBkgndFields
| 'number' 'of' cards # numberOfCardsFunc
| 'number' 'of' background # numberOfBackgrounds
| 'number' 'of' 'marked' cards # numberOfMarkedCards
| 'number' 'of' 'menus' # numberOfMenusFunc
| 'number' 'of' 'windows' # numberOfWindows
| 'menus' # menusFunc
| 'diskspace' # diskSpaceNoArgFunc
| 'params' # paramsFunc
| 'paramcount' # paramCountFunc
| 'target' # targetFunc
| 'speech' # speechFunc
| 'voices' # voicesFunc
| 'windows' # windowsFunc
| 'stacks' # stacksFunc
;
singleArgFunc
: 'average' # averageFunc
| 'min' # minFunc
| 'max' # maxFunc
| 'sum' # sumFunc
| 'number' 'of' card? 'parts' # numberOfCardPartsOfExprFunc
| 'number' 'of' background 'parts' # numberOfBkgndPartsOfExprFunc
| 'number' 'of' card? button # numberOfCardButtonsOfExprFunc
| 'number' 'of' background button # numberOfBkgndButtonsOfExprFunc
| 'number' 'of' card field # numberOfCardFieldsOfExprFunc
| 'number' 'of' background? field # numberOfBkgndFieldsofExprFunc
| 'number' 'of' cards # numberOfCardsOfExprFunc
| 'number' 'of' background # numberOfBackgroundsOfExprFunc
| 'number' 'of' 'marked' cards # numberOfMarkedCardsOfExprFunc
| 'number' 'of' character # numberOfCharsFunc
| 'number' 'of' word # numberOfWordsFunc
| 'number' 'of' item # numberOfItemsFunc
| 'number' 'of' line # numberOfLinesFunc
| 'number' 'of' 'menuitems' # numberOfMenuItemsFunc
| 'number' 'of' cards # numberOfBkgndCardsFunc
| 'number' # numberOfPart
| 'random' # randomFunc
| 'sqrt' # sqrtFunc
| 'trunc' # truncFunc
| 'sin' # sinFunc
| 'cos' # cosFunc
| 'tan' # tanFunc
| 'atan' # atanFunc
| 'exp' # expFunc
| 'exp1' # exp1Func
| 'exp2' # exp2Func
| 'ln' # lnFunc
| 'ln1' # ln1Func
| 'log2' # log2Func
| 'abs' # absFunc
| 'chartonum' # charToNumFunc
| 'numtochar' # numToCharFunc
| 'value' # valueFunc
| 'length' # lengthFunc
| 'diskspace' # diskSpaceFunc
| 'param' # paramFunc
;
multiArgFunc
: singleArgFunc # oneArgArgFunc
| 'annuity' # annuityArgFunc
| 'compound' # compoundArgFunc
| 'offset' # offsetArgFunc
;
literal
: constant # constantExp
| modifierKey # literalExp
| mouseState # literalExp
| knownType # literalExp
| findType # literalExp
| LITERAL # literalExp
;
preposition
: 'before' # beforePreposition
| 'after' # afterPreposition
| 'into' # intoPreposition
;
constant
: cardinalValue # cardninalExp
| 'empty' # emptyExp
| 'pi' # piExp
| 'quote' # quoteExp
| 'return' # returnExp
| 'space' # spaceExp
| 'tab' # tabExp
| 'formfeed' # formFeedExp
| 'linefeed' # lineFeedExp
| 'comma' # commaExp
| 'colon' # colonExp
;
cardinalValue
: 'zero'
| 'one'
| 'two'
| 'three'
| 'four'
| 'five'
| 'six'
| 'seven'
| 'eight'
| 'nine'
| 'ten'
;
ordinal
: 'the'? ordinalValue # theOrdinalVal
;
ordinalValue
: 'first'
| 'second'
| 'third'
| 'fourth'
| 'fifth'
| 'sixth'
| 'seventh'
| 'eighth'
| 'ninth'
| 'tenth'
| ('mid' | 'middle')
| 'last'
| 'any'
;
mouseState
: 'up'
| 'down'
;
modifierKey
: 'commandkey'
| 'cmdkey'
| 'optionkey'
| 'shiftkey'
;
knownType
: 'number'
| 'integer'
| 'point'
| 'rect'
| 'rectangle'
| 'date'
| 'logical'
| 'boolean'
| 'bool'
;
findType
: 'word'
| 'chars'
| 'whole'
| 'string'
;
// Not all properties need to be enumerated here, only those sharing a name with another keyword.
propertyName
: 'marked'
| 'selectedtext'
| 'selectedchunk'
| 'selectedfield'
| 'selectedline'
| 'number'
| 'id'
| 'rect'
| 'rectangle'
| 'bottom'
| 'left'
| 'right'
| 'top'
| 'center'
| 'scroll'
| 'script'
| 'pattern'
| ID
;
// Not all property values need to be enumerated here, only known values sharing a name with another keyword.
propertyValue
: 'plain' # propertyValueLiteral
| 'menu' # propertyValueLiteral
| 'bottom' # propertyValueLiteral
| 'left' # propertyValueLiteral
| 'right' # propertyValueLiteral
| 'top' # propertyValueLiteral
| 'center' # propertyValueLiteral
| listExpression # propertyValueExp
;
commandName
: 'answer'
| 'ask'
| 'put'
| 'get'
| 'set'
| 'send'
| 'wait'
| 'sort'
| 'go'
| 'enable'
| 'disable'
| 'read'
| 'write'
| 'hide'
| 'show'
| 'add'
| 'subtract'
| 'multiply'
| 'divide'
| 'choose'
| 'click'
| 'drag'
| 'type'
| 'lock'
| 'unlock'
| 'pass'
| 'domenu'
| 'visual'
| 'reset'
| 'create'
| 'delete'
| 'play'
| 'dial'
| 'beep'
| 'open'
| 'close'
| 'select'
| 'find'
| 'import'
| 'export'
;
picture
: 'picture'
| 'pict'
;
seconds
: 'seconds'
| 'secs'
| 'second'
| 'sec'
;
speed
: 'fast' # fastSpeed
| ('slow' | 'slowly') # slowSpeed
| 'very' 'fast' # veryFastSpeed
| 'very' ('slow' | 'slowly') # verySlowSpeed
;
image
: 'black' # blackImage
| 'card' # cardImage
| ('gray' | 'grey') # grayImage
| 'inverse' # inverseImage
| 'white' # whiteImage
;
effect
: 'dissolve' # dissolveEffect
| 'barn' 'door' 'open' # barnDoorOpenEffect
| 'barn' 'door' 'close' # barnDoorCloseEffect
| 'checkerboard' # checkerboardEffect
| 'iris' 'open' # irisOpenEffect
| 'iris' 'close' # irisCloseEffect
| 'plain' # plainEffect
| 'push' 'up' # pushUpEffect
| 'push' 'down' # pushDownEffect
| 'push' 'left' # pushLeftEffect
| 'push' 'right' # pushRightEffect
| 'scroll' 'down' # scrollDownEffect
| 'scroll' 'up' # scrollUpEffect
| 'scroll' 'left' # scrollLeftEffect
| 'scroll' 'right' # scrollRightEffect
| 'shrink' 'to' 'top' # shrinkToTopEffect
| 'shrink' 'to' 'center' # shrinkToCenterEffect
| 'shrink' 'to' 'bottom' # shrinkToBottomEffect
| 'stretch' 'from' 'top' # stretchFromTopEffect
| 'stretch' 'from' 'center' # stretchFromCenterEffect
| 'stretch' 'from' 'bottom' # stretchFromBottomEffect
| 'venetian' 'blinds' # venitianBlindsEffect
| 'wipe' 'up' # wipeUpEffect
| 'wipe' 'down' # wipeDownEffect
| 'wipe' 'left' # wipeLeftEffect
| 'wipe' 'right' # wipeRightEffect
| 'zoom' 'in' # zoomInEffect
| 'zoom' 'out' # zoomOutEffect
| 'zoom' 'open' # zoomOpenEffect
| 'zoom' 'close' # zoomCloseEffect
;
timeUnit
: 'ticks' # ticksTimeUnit
| 'tick' # tickTimeUnit
| seconds # secondsTimeUnit
;
position
: 'the'? 'next' # nextPosition
| 'the'? ('prev' | 'previous') # prevPosition
| 'this' # thisPosition
;
message
: 'the'? ('message' | 'msg') ('box' | 'window' | )
;
cards
: 'cards'
| 'cds'
;
card
: 'card'
| 'cd'
;
background
: 'background'
| 'backgrounds'
| 'bkgnd'
| 'bkgnds'
| 'bg'
| 'bgs'
;
button
: 'button'
| 'buttons'
| 'btn'
| 'btns'
;
field
: 'field'
| 'fields'
| 'fld'
| 'flds'
;
stack
: 'stack'
;
character
: 'character'
| 'characters'
| 'char'
| 'chars'
;
word
: 'word'
| 'words'
;
line
: 'line'
| 'lines'
;
item
: 'item'
| 'items'
;
of
: 'of'
| 'from'
| 'in'
;
ID
: (ALPHA (ALPHA | DIGIT)*)
;
BREAK
: ('|' | '¬') WHITESPACE? COMMENT? WHITESPACE? NEWLINE -> skip
;
LITERAL
: STRING_LITERAL
| NUMBER_LITERAL
;
INTEGER_LITERAL
: DIGIT+
;
NUMBER_LITERAL
: INTEGER_LITERAL
| '.' INTEGER_LITERAL
| INTEGER_LITERAL '.'
| INTEGER_LITERAL '.' INTEGER_LITERAL
;
STRING_LITERAL
: '"' ~('"' | '\r' | '\n')* '"'
;
ALPHA
: ('a' .. 'z' | 'A' .. 'Z')+
;
DIGIT
: ('0' .. '9')+
;
COMMENT
: ('--' ~('\r' | '\n' | '|')*) -> channel(HIDDEN)
;
NEWLINE
: ('\n' | '\r')+
;
WHITESPACE
: (' ' | '\t')+ -> channel(HIDDEN)
;
UNLEXED_CHAR
: .
; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.