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 |
|---|---|---|---|---|
Lookup.applescript | mikegrb/p5-Misc-MacLoggerDX | 3 | 2578 | tell application "MacLoggerDX"
set qsoLogMode to system attribute "FLDIGI_MODEM"
if qsoLogMode starts with "Olivia" then
set qsoLogMode to "OLIVIA"
else if qsoLogMode ends with "HELL" then
set qsoLogMode to "HELL"
else if qsoLogMode starts with "BPSK" then
set qsoLogMode to characters 2 thru -1 of qsoLogMode as string
else if qsoLogMode starts with "DOMEX" then
set qsoLogMode to "DOMINO"
end if
lookup (system attribute "FLDIGI_LOG_CALL")
delay 1
setLogFrequency ((system attribute "FLDIGI_FREQUENCY") / 1000000)
setLogMode qsoLogMode
end tell
|
Library/Net/netMessaging.asm | steakknife/pcgeos | 504 | 162796 | <filename>Library/Net/netMessaging.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT:
MODULE:
FILE: netMessaging.asm
AUTHOR: <NAME>, Oct 21, 1992
ROUTINES:
Name Description
---- -----------
*NetMsgOpenPort Open port for send/receive (COM only)
*NetMsgClosePort Close port
*NetMsgCreateSocket Create socket for listening
*NetMsgDestroySocket Destroy socket
*NetMsgSendBuffer Send buffer to socket (broadcast?)
*NetMsgSetTimeOut Set timeout value for packets (COM only?)
NetMsgSetMainSocketStatus Set messaging on/off
NetMsgGetMainSocketStatus Get status of messaging
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial revision
DESCRIPTION:
Net Library routines to handle Messaging between hosts
$Id: netMessaging.asm,v 1.1 97/04/05 01:24:55 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetCommonCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgOpenPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Opens a port (domain) for 2-way communication. Creates a
server thread for the port if no server exists.
CALLED BY: EXTERNAL
PASS: ds:si - buffer with port information
(e.g. SerialPortInfo structure for serial ports)
cx - size of buffer
RETURN: carry set if error, ax - error code
bx - port token
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgOpenPort proc far
.enter
mov al, NMF_OPEN_PORT
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgOpenPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgClosePort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close a 2-way communication port.
CALLED BY: EXTERNAL
PASS: bx - port token
RETURN: carry set if error, ax - error code
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgClosePort proc far
.enter
mov al, NMF_CLOSE_PORT
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgClosePort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgCreateSocket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a socket for the port. Callback routine is called
when a packet is received for the socket. if 0 is passed
as offset of callback, then the incoming messages are put
into a message queue. To fetch the handle of the message
buffer, the app can P the returned semaphore
In general, a single-threaded app will rely on the callback method
(*important* the callback routine must be very fast and return
quickly, otherwise other packets coming into the port may be lost!)
and multi-threaded apps are encouraged to use the message queue
(a dedicated dispatch thread should be routinely P'ing the semaphore
and processing messages as they come in) Also note: it is not a
good idea to let messages 'sit around' in the queue, as it's limited
in size, and will overflow if too many messages are waiting in it.
One queue exists for each socket that requests it.
when the socket is being destroyed, the callback routine will be
called with cx = 0
CALLED BY: EXTERNAL
PASS: bx - port token
cx - socket ID (unique # chosen by caller)
bp - dest ID (ID # of socket to connect with)
ds:dx - callback routine (dx - 0 if using message queue)
ds shoud be a vseg for XIP'ed geodes.
si - data to pass to callback
RETURN: carry set if error, ax - error code
ax - socket token
bx - semaphore (if dx = 0)
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Callback routine:
Pass:
ds:si - buffer
cx - size
cx = 0 when socket is being destroyed.
di - data passed from NetMsgCreateSocket (si)
Return: nothing
Destroy: ax,bx,cx,dx,di,si
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgCreateSocket proc far
.enter
mov al, NMF_CREATE_SOCKET
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgCreateSocket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgDestroySocket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destroys specified socket. also calls callback with carry set
to notify destruction
CALLED BY: EXTERNAL
PASS: bx - port token
dx - socket token
RETURN: carry set if error, ax - error code
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgDestroySocket proc far
.enter
mov al, NMF_DESTROY_SOCKET
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgDestroySocket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgSendBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: send buffer across port/socket
CALLED BY: EXTERNAL
PASS: bx - port token
dx - socket token
cx - size of buffer
bp - AppID: app specific word of data passed to receiver
ds:si - buffer
RETURN: carry set if error, ax - error code
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgSendBuffer proc far
.enter
mov al, NMF_CALL_SERVICE
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgSendBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NetMsgSetTimeOut
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set Timeout value (1/60 seconds) for a socket
[Timeout value = amount of time the socket should wait for
an acknowledgement after a packet is sent to the remote
machine]
CALLED BY: EXTERNAL
PASS: bx - port token
dx - socket token
cx - timeout value
RETURN: carry set if error, ax - error code
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ISR 10/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
NetMsgSetTimeOut proc far
.enter
mov al, NMF_SET_TIMEOUT
mov di, DR_NET_MESSAGING
call NetCallDriver
.leave
ret
NetMsgSetTimeOut endp
NetCommonCode ends
|
src/courbes/courbes-droites.adb | SKNZ/BezierToSTL | 0 | 25426 | with Math; use Math;
with Courbes.Visiteurs; use Courbes.Visiteurs;
package body Courbes.Droites is
function Ctor_Droite (Debut, Fin : Point2D) return Droite is
Diff : constant Point2D := Fin - Debut;
Longueur : constant Float := Hypot(Diff);
begin
return
(Debut => Debut,
Fin => Fin,
Longueur => Longueur,
Vecteur_Directeur => Diff / Longueur);
end;
overriding function Obtenir_Point(Self : Droite; X : Coordonnee_Normalisee) return Point2D is
begin
return Self.Obtenir_Debut + Self.Longueur * X * Self.Vecteur_Directeur;
end;
overriding procedure Accepter (Self : Droite; Visiteur : Visiteur_Courbe'Class) is
begin
Visiteur.Visiter (Self);
end;
end Courbes.Droites;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_20315_1724.asm | ljhsiun2/medusa | 9 | 84253 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rdx
lea addresses_WT_ht+0x12bf4, %r9
inc %rdx
movw $0x6162, (%r9)
and %r14, %r14
pop %rdx
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r15
push %rax
push %rbp
push %rdx
push %rsi
// Store
lea addresses_WC+0x11584, %rax
clflush (%rax)
nop
cmp $31213, %r13
movl $0x51525354, (%rax)
nop
add $52515, %rax
// Faulty Load
lea addresses_A+0x4f74, %r15
nop
nop
cmp %rbp, %rbp
mov (%r15), %r13
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rsi
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'35': 20315}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
day24/src/day.ads | jwarwick/aoc_2020 | 3 | 13680 | -- AOC 2020, Day 24
package Day is
function count_tiles(filename : in String) return Natural;
function evolve_tiles(filename : in String; steps : in Natural) return Natural;
end Day;
|
agda-stdlib-0.9/src/Data/Star/List.agda | qwe2/try-agda | 1 | 10866 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Lists defined in terms of Data.Star
------------------------------------------------------------------------
module Data.Star.List where
open import Data.Star
open import Data.Unit
open import Relation.Binary.Simple
open import Data.Star.Nat
-- Lists.
List : Set → Set
List a = Star (Const a) tt tt
-- Nil and cons.
[] : ∀ {a} → List a
[] = ε
infixr 5 _∷_
_∷_ : ∀ {a} → a → List a → List a
_∷_ = _◅_
-- The sum of the elements in a list containing natural numbers.
sum : List ℕ → ℕ
sum = fold (Star Always) _+_ zero
|
Everything.agda | Taneb/agda-categories | 0 | 2287 | import Categories.2-Category
import Categories.2-Functor
import Categories.Adjoint
import Categories.Adjoint.Construction.EilenbergMoore
import Categories.Adjoint.Construction.Kleisli
import Categories.Adjoint.Equivalence
import Categories.Adjoint.Instance.0-Truncation
import Categories.Adjoint.Instance.01-Truncation
import Categories.Adjoint.Instance.Core
import Categories.Adjoint.Instance.Discrete
import Categories.Adjoint.Instance.PosetCore
import Categories.Adjoint.Instance.StrictCore
import Categories.Adjoint.Mate
import Categories.Adjoint.Properties
import Categories.Adjoint.RAPL
import Categories.Bicategory
import Categories.Bicategory.Bigroupoid
import Categories.Bicategory.Construction.1-Category
import Categories.Bicategory.Instance.Cats
import Categories.Bicategory.Instance.EnrichedCats
import Categories.Category
import Categories.Category.BicartesianClosed
import Categories.Category.Cartesian
import Categories.Category.Cartesian.Properties
import Categories.Category.CartesianClosed
import Categories.Category.CartesianClosed.Canonical
import Categories.Category.CartesianClosed.Locally
import Categories.Category.CartesianClosed.Locally.Properties
import Categories.Category.Closed
import Categories.Category.Cocartesian
import Categories.Category.Cocomplete
import Categories.Category.Cocomplete.Finitely
import Categories.Category.Complete
import Categories.Category.Complete.Finitely
import Categories.Category.Construction.0-Groupoid
import Categories.Category.Construction.Arrow
import Categories.Category.Construction.Cocones
import Categories.Category.Construction.Comma
import Categories.Category.Construction.Cones
import Categories.Category.Construction.Coproduct
import Categories.Category.Construction.Core
import Categories.Category.Construction.EilenbergMoore
import Categories.Category.Construction.Elements
import Categories.Category.Construction.EnrichedFunctors
import Categories.Category.Construction.F-Algebras
import Categories.Category.Construction.Fin
import Categories.Category.Construction.Functors
import Categories.Category.Construction.Graphs
import Categories.Category.Construction.Grothendieck
import Categories.Category.Construction.Kleisli
import Categories.Category.Construction.Path
import Categories.Category.Construction.Presheaves
import Categories.Category.Construction.Properties.Comma
import Categories.Category.Construction.Pullbacks
import Categories.Category.Construction.Thin
import Categories.Category.Core
import Categories.Category.Discrete
import Categories.Category.Equivalence
import Categories.Category.Finite
import Categories.Category.Groupoid
import Categories.Category.Groupoid.Properties
import Categories.Category.Indiscrete
import Categories.Category.Instance.Cats
import Categories.Category.Instance.EmptySet
import Categories.Category.Instance.FamilyOfSets
import Categories.Category.Instance.Globe
import Categories.Category.Instance.Groupoids
import Categories.Category.Instance.One
import Categories.Category.Instance.PointedSets
import Categories.Category.Instance.Posets
import Categories.Category.Instance.Properties.Cats
import Categories.Category.Instance.Properties.Posets
import Categories.Category.Instance.Properties.Setoids
import Categories.Category.Instance.Setoids
import Categories.Category.Instance.Sets
import Categories.Category.Instance.Simplex
import Categories.Category.Instance.SimplicialSet
import Categories.Category.Instance.SingletonSet
import Categories.Category.Instance.Span
import Categories.Category.Instance.StrictCats
import Categories.Category.Instance.StrictGroupoids
import Categories.Category.Instance.Zero
import Categories.Category.Monoidal
import Categories.Category.Monoidal.Braided
import Categories.Category.Monoidal.Braided.Properties
import Categories.Category.Monoidal.Closed
import Categories.Category.Monoidal.Closed.IsClosed
import Categories.Category.Monoidal.Closed.IsClosed.Diagonal
import Categories.Category.Monoidal.Closed.IsClosed.Dinatural
import Categories.Category.Monoidal.Closed.IsClosed.Identity
import Categories.Category.Monoidal.Closed.IsClosed.L
import Categories.Category.Monoidal.Closed.IsClosed.Pentagon
import Categories.Category.Monoidal.Construction.Minus2
import Categories.Category.Monoidal.Core
import Categories.Category.Monoidal.Instance.Cats
import Categories.Category.Monoidal.Instance.One
import Categories.Category.Monoidal.Instance.Setoids
import Categories.Category.Monoidal.Instance.Sets
import Categories.Category.Monoidal.Instance.StrictCats
import Categories.Category.Monoidal.Properties
import Categories.Category.Monoidal.Reasoning
import Categories.Category.Monoidal.Symmetric
import Categories.Category.Monoidal.Traced
import Categories.Category.Monoidal.Utilities
import Categories.Category.Product
import Categories.Category.Product.Properties
import Categories.Category.RigCategory
import Categories.Category.SetoidDiscrete
import Categories.Category.Site
import Categories.Category.Slice
import Categories.Category.Slice.Properties
import Categories.Category.SubCategory
import Categories.Category.Topos
import Categories.Category.WithFamilies
import Categories.Comonad
import Categories.Diagram.Cocone
import Categories.Diagram.Cocone.Properties
import Categories.Diagram.Coend
import Categories.Diagram.Coequalizer
import Categories.Diagram.Coequalizer.Properties
import Categories.Diagram.Colimit
import Categories.Diagram.Colimit.DualProperties
import Categories.Diagram.Colimit.Lan
import Categories.Diagram.Colimit.Properties
import Categories.Diagram.Cone
import Categories.Diagram.Cone.Properties
import Categories.Diagram.Duality
import Categories.Diagram.End
import Categories.Diagram.End.Properties
import Categories.Diagram.Equalizer
import Categories.Diagram.Finite
import Categories.Diagram.Limit
import Categories.Diagram.Limit.Properties
import Categories.Diagram.Limit.Ran
import Categories.Diagram.Pullback
import Categories.Diagram.Pullback.Limit
import Categories.Diagram.Pullback.Properties
import Categories.Diagram.Pushout
import Categories.Diagram.Pushout.Properties
import Categories.Diagram.SubobjectClassifier
import Categories.Enriched.Category
import Categories.Enriched.Functor
import Categories.Enriched.NaturalTransformation
import Categories.Enriched.NaturalTransformation.NaturalIsomorphism
import Categories.Enriched.Over.One
import Categories.Functor
import Categories.Functor.Algebra
import Categories.Functor.Bifunctor
import Categories.Functor.Bifunctor.Properties
import Categories.Functor.Coalgebra
import Categories.Functor.Cocontinuous
import Categories.Functor.Construction.Constant
import Categories.Functor.Construction.Diagonal
import Categories.Functor.Construction.LiftSetoids
import Categories.Functor.Construction.Limit
import Categories.Functor.Construction.Zero
import Categories.Functor.Continuous
import Categories.Functor.Core
import Categories.Functor.Equivalence
import Categories.Functor.Fibration
import Categories.Functor.Groupoid
import Categories.Functor.Hom
import Categories.Functor.Instance.0-Truncation
import Categories.Functor.Instance.01-Truncation
import Categories.Functor.Instance.Core
import Categories.Functor.Instance.Discrete
import Categories.Functor.Instance.SetoidDiscrete
import Categories.Functor.Instance.StrictCore
import Categories.Functor.Monoidal
import Categories.Functor.Power
import Categories.Functor.Power.Functorial
import Categories.Functor.Power.NaturalTransformation
import Categories.Functor.Presheaf
import Categories.Functor.Profunctor
import Categories.Functor.Properties
import Categories.Functor.Representable
import Categories.Functor.Slice
import Categories.GlobularSet
import Categories.Kan
import Categories.Kan.Duality
import Categories.Minus2-Category
import Categories.Minus2-Category.Construction.Indiscrete
import Categories.Minus2-Category.Instance.One
import Categories.Minus2-Category.Properties
import Categories.Monad
import Categories.Monad.Duality
import Categories.Monad.Idempotent
import Categories.Monad.Strong
import Categories.Morphism
import Categories.Morphism.Cartesian
import Categories.Morphism.Duality
import Categories.Morphism.HeterogeneousIdentity
import Categories.Morphism.HeterogeneousIdentity.Properties
import Categories.Morphism.IsoEquiv
import Categories.Morphism.Isomorphism
import Categories.Morphism.Properties
import Categories.Morphism.Reasoning
import Categories.Morphism.Reasoning.Core
import Categories.Morphism.Reasoning.Iso
import Categories.Morphism.Universal
import Categories.NaturalTransformation
import Categories.NaturalTransformation.Core
import Categories.NaturalTransformation.Dinatural
import Categories.NaturalTransformation.Equivalence
import Categories.NaturalTransformation.Hom
import Categories.NaturalTransformation.NaturalIsomorphism
import Categories.NaturalTransformation.NaturalIsomorphism.Equivalence
import Categories.NaturalTransformation.NaturalIsomorphism.Functors
import Categories.NaturalTransformation.NaturalIsomorphism.Properties
import Categories.NaturalTransformation.Properties
import Categories.Object.Coproduct
import Categories.Object.Duality
import Categories.Object.Exponential
import Categories.Object.Initial
import Categories.Object.Product
import Categories.Object.Product.Construction
import Categories.Object.Product.Core
import Categories.Object.Product.Morphisms
import Categories.Object.Terminal
import Categories.Object.Zero
import Categories.Pseudofunctor
import Categories.Pseudofunctor.Instance.EnrichedUnderlying
import Categories.Utils.EqReasoning
import Categories.Utils.Product
import Categories.Yoneda
import Categories.Yoneda.Properties
import Relation.Binary.Construct.Symmetrize
|
src/apsepp-generic_discrete_operations.ads | thierr26/ada-apsepp | 0 | 26902 | -- Copyright (C) 2019 <NAME> <<EMAIL>>
-- MIT license. Please refer to the LICENSE file.
generic
type Discrete_Type is (<>);
package Apsepp.Generic_Discrete_Operations is
-- Don't evaluate the pre-conditions in this package. Just let
-- Constraint_Error be raised in case of violation.
pragma Assertion_Policy (Pre => Ignore);
function Fi return Discrete_Type
is (Discrete_Type'First);
function La return Discrete_Type
is (Discrete_Type'Last);
function Pr (X : Discrete_Type) return Discrete_Type
is (Discrete_Type'Pred (X))
with Pre => X > Fi;
function Su (X : Discrete_Type) return Discrete_Type
is (Discrete_Type'Succ (X))
with Pre => X < La;
end Apsepp.Generic_Discrete_Operations;
|
boot.asm | OpenCoderp/MayOS | 0 | 518 | ;boot.asm:the bootloader to boot are operating system with grub
[bits 32] ;we are in 32 bit
global start ;start's the operating system:we call it in the linker script
extern _kernel_main ;this is in are .cpp file and it is the main function of are kernel
;do not modify these lines(these are needed by grub)!
section .mbHeader
align 0x4
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
;you can modify these
start:
push ebx ;this is optional and load's the grub structure
|
data/pokemon/base_stats/grimer.asm | AtmaBuster/pokeplat-gen2 | 6 | 104973 | db 0 ; species ID placeholder
db 80, 80, 50, 25, 40, 50
; hp atk def spd sat sdf
db POISON, POISON ; type
db 190 ; catch rate
db 90 ; base exp
db NO_ITEM, NUGGET ; items
db GENDER_F50 ; gender ratio
db 20 ; step cycles to hatch
INCBIN "gfx/pokemon/grimer/front.dimensions"
db GROWTH_MEDIUM_FAST ; growth rate
dn EGG_INDETERMINATE, EGG_INDETERMINATE ; egg groups
db 70 ; happiness
; tm/hm learnset
tmhm TOXIC, HIDDEN_POWER, SUNNY_DAY, TAUNT, PROTECT, RAIN_DANCE, GIGA_DRAIN, FRUSTRATION, THUNDERBOLT, THUNDERBOLT, THUNDER, RETURN, DIG, SHADOW_BALL, DOUBLE_TEAM, SHOCK_WAVE, FLAMETHROWER, SLUDGE_BOMB, FIRE_BLAST, ROCK_TOMB, TORMENT, FACADE, SECRET_POWER, REST, ATTRACT, THIEF, FLING, ENDURE, EXPLOSION, PAYBACK, CAPTIVATE, ROCK_SLIDE, SLEEP_TALK, NATURAL_GIFT, POISON_JAB, SWAGGER, SUBSTITUTE, STRENGTH, FIRE_PUNCH, GUNK_SHOT, ICE_PUNCH, MUD_SLAP, SNORE, THUNDERPUNCH
; end
|
cmake/asm_embed.asm | kiwixz/asm_embed | 1 | 26920 | section .rodata
global @prefix@_embed_@name@_begin
global @prefix@_embed_@name@_end
global @prefix@_embed_@name@_size
begin:
incbin "@file@"
end:
db 0x00 ; null terminator
@prefix@_embed_@name@_begin: dq begin
@prefix@_embed_@name@_end: dq end
@prefix@_embed_@name@_size: dq end - begin
|
oeis/131/A131113.asm | neoneye/loda-programs | 11 | 171652 | ; A131113: T(n,k) = 5*binomial(n,k) - 4*I(n,k), where I is the identity matrix; triangle T read by rows (n >= 0 and 0 <= k <= n).
; Submitted by <NAME>(s2)
; 1,5,1,5,10,1,5,15,15,1,5,20,30,20,1,5,25,50,50,25,1,5,30,75,100,75,30,1,5,35,105,175,175,105,35,1,5,40,140,280,350,280,140,40,1,5,45,180,420,630,630,420,180,45,1,5,50,225,600,1050,1260,1050,600,225,50,1,5,55,275,825,1650,2310,2310,1650,825,275,55,1,5,60,330,1100,2475,3960,4620,3960,2475,1100,330,60,1,5,65,390,1430,3575,6435,8580,8580,6435
add $0,1
seq $0,198321 ; Triangle T(n,k), read by rows, given by (0,1,0,0,0,0,0,0,0,0,0,...) DELTA (1,1,-1,1,0,0,0,0,0,0,0,...) where DELTA is the operator defined in A084938.
mul $0,20
sub $0,1
div $0,4
add $0,1
|
oeis/302/A302323.asm | neoneye/loda-programs | 11 | 10955 | <gh_stars>10-100
; A302323: Number of 2Xn 0..1 arrays with every element equal to 0, 1, 2 or 4 horizontally, diagonally or antidiagonally adjacent elements, with upper left element zero.
; Submitted by <NAME>
; 2,8,20,52,136,360,960,2576,6944,18784,50944,138432,376704,1026176,2797568,7631104,20824576,56845824,155209728,423848960,1157593088,3161835520,8636760064,23592996864,64451125248,176071467008,481011630080,1314099085312,3590087213056,9808104161280,26795845877760,73206826336256,200003196944384,546415751593984,1492829307142144,4078472937603072,11142570129752064,30442017415233536,83169037651017728,227221835254595584,620781196055412736,1696004963108388864,4633570119304347648,12659145766778961920
mov $1,5
mov $2,2
mov $4,1
lpb $0
sub $0,1
sub $1,1
add $1,$4
mul $1,2
mov $3,$4
mov $4,$2
add $2,$3
mul $2,2
lpe
mul $1,4
div $1,8
mov $0,$1
sub $0,1
mul $0,2
|
programs/oeis/168/A168570.asm | karttu/loda | 0 | 7932 | <reponame>karttu/loda<filename>programs/oeis/168/A168570.asm<gh_stars>0
; A168570: Exponent of 3 in 2^n - 1.
; 0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,4,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,4,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,5,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,4,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,3,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,1
mov $6,$0
mov $8,2
lpb $8,1
clr $0,6
mov $0,$6
sub $8,1
add $0,$8
sub $0,1
mov $1,$0
add $1,$0
mov $3,$0
lpb $1,1
div $1,4
sub $3,$1
lpb $3,1
add $4,$3
div $3,3
lpe
lpe
mov $1,$4
mov $9,$8
lpb $9,1
mov $7,$1
sub $9,1
lpe
lpe
lpb $6,1
mov $6,0
trn $7,$1
lpe
mov $1,$7
|
OutsideIn/Proof/Soundness.agda | liamoc/outside-in | 2 | 14010 | open import OutsideIn.Prelude
open import OutsideIn.X
module OutsideIn.Proof.Soundness(x : X) where
open import Data.Vec hiding (map; _>>=_)
open X(x)
import OutsideIn.Environments as EV
import OutsideIn.Expressions as E
import OutsideIn.TypeSchema as TS
import OutsideIn.TopLevel as TL
import OutsideIn.Constraints as CN
import OutsideIn.Inference as I
import OutsideIn.Inference.Separator as S
import OutsideIn.Inference.Prenexer as P
import OutsideIn.Inference.ConstraintGen as CG
import OutsideIn.Inference.Solver as SL
open EV(x)
open E(x)
open CN(x)
open TS(x)
open TL(x)
open I(x)
open CG(x)
open S(x)
open SL(x)
open P(x)
open import Relation.Binary.PropositionalEquality renaming ([_] to inspectC)
module Ax-f = Functor(axiomscheme-is-functor)
module QC-f = Functor(qconstraint-is-functor)
module Exp-f {r}{s} = Functor(expression-is-functor₂ {r}{s})
module TS-f {n} = Functor(type-schema-is-functor {n})
module pn-m {n} = Monad(PlusN-is-monad{n})
module Vec-f {n} = Functor(vec-is-functor {n})
open Monad(type-is-monad)
open Functor(is-functor)
type-substitute : ∀{a b} → (a → Type b) → Type a → Type b
type-substitute f t = (join ∘ map f) t
applyAll : ∀{tv}(n : ℕ) → Type tv → Type (tv ⨁ n)
applyAll zero x = x
applyAll (suc n) x = applyAll n (appType (map suc x) (unit zero))
constraint-substitute : ∀{a b} → (a → Type b) → QConstraint a → QConstraint b
constraint-substitute f t = constraint-types (type-substitute f) t
mutual
data _,_,_⊢_∶_ {ev tv : Set}(Q : AxiomScheme tv)(Qg : QConstraint tv)(Γ : Environment ev tv): {r : Shape} → Expression ev tv r → Type tv → Set where
TyEq : ∀ {τ₁ τ₂}{r}{e : Expression ev tv r}
→ Q , Qg , Γ ⊢ e ∶ τ₁
→ Q , Qg ⊩ (τ₁ ∼ τ₂)
→ Q , Qg , Γ ⊢ e ∶ τ₂
Abst : ∀ {τ₁ τ₂}{r}{e : Expression (Ⓢ ev) tv r}
→ Q , Qg , (⟨ ∀′ 0 · ε ⇒ τ₁ ⟩, Γ) ⊢ e ∶ τ₂
→ Q , Qg , Γ ⊢ λ′ e ∶ funType τ₁ τ₂
Appl : ∀ {τ₁ τ₂}{r₁ r₂}{e₁ : Expression ev tv r₁}{e₂ : Expression ev tv r₂}
→ Q , Qg , Γ ⊢ e₁ ∶ funType τ₁ τ₂
→ Q , Qg , Γ ⊢ e₂ ∶ τ₁
→ Q , Qg , Γ ⊢ (e₁ · e₂) ∶ τ₂
Let1 : ∀ {τ₁ τ₂}{r₁ r₂}{e₁ : Expression ev tv r₁}{e₂ : Expression (Ⓢ ev) tv r₂}
→ Q , Qg , Γ ⊢ e₁ ∶ τ₁
→ Q , Qg , (⟨ ∀′ 0 · ε ⇒ τ₁ ⟩, Γ) ⊢ e₂ ∶ τ₂
→ Q , Qg , Γ ⊢ (let₁ e₁ in′ e₂) ∶ τ₂
Let2 : ∀ {τ₁ τ₂}{r₁ r₂}{e₁ : Expression ev tv r₁}{e₂ : Expression (Ⓢ ev) tv r₂}
→ Q , Qg , Γ ⊢ e₁ ∶ τ₁
→ Q , Qg , (⟨ ∀′ 0 · ε ⇒ τ₁ ⟩, Γ) ⊢ e₂ ∶ τ₂
→ Q , Qg , Γ ⊢ (let₂ e₁ ∷ τ₁ in′ e₂) ∶ τ₂
Let3 : ∀ {n}{τ₁ τ₂}{r₁ r₂}{Qv}{e₁ : Expression ev (tv ⨁ n) r₁}{e₂ : Expression (Ⓢ ev) tv r₂}
→ Ax-f.map (pn-m.unit {n}) Q , QC-f.map (pn-m.unit {n}) Qg ∧ Qv , TS-f.map (pn-m.unit {n}) ∘ Γ ⊢ e₁ ∶ τ₁
→ Q , Qg , (⟨ ∀′ n · Qv ⇒ τ₁ ⟩, Γ) ⊢ e₂ ∶ τ₂
→ Q , Qg , Γ ⊢ (let₃ n · e₁ ∷ Qv ⇒ τ₁ in′ e₂) ∶ τ₂
VarN : ∀ {n}{v}{τ}{Qv}
→ (θ : (tv ⨁ n) → Type tv)
→ Γ v ≡ ∀′ n · Qv ⇒ τ
→ Q , Qg ⊩ constraint-substitute θ Qv
→ Q , Qg , Γ ⊢ (Var {_}{_}{Regular} v) ∶ (τ >>= θ )
DCn1 : ∀ {n}{l}{v}{K}{args}
→ (θ : (tv ⨁ n) → Type tv)
→ Γ v ≡ (DC∀ n · args ⟶ K)
→ Q , Qg , Γ ⊢ (Var {_}{_}{Datacon l} v) ∶ (applyAll n (unit K) >>= θ)
DCn2 : ∀ {a b}{l}{v}{K}{args}{Qv}
→ (θ : (tv ⨁ a) ⨁ b → Type tv)
→ Γ v ≡ (DC∀′ a , b · Qv ⇒ args ⟶ K)
→ Q , Qg ⊩ constraint-substitute θ Qv
→ Q , Qg , Γ ⊢ (Var {_}{_}{Datacon l} v) ∶ (map (pn-m.unit {b}) (applyAll a (unit K)) >>= θ)
Case : ∀ {τ}{r r′}{e : Expression ev tv r}{alts : Alternatives ev tv r′} {n : ℕ}
→ (T : tv)
→ (θ : (tv ⨁ n) → Type tv)
→ Q , Qg , Γ ⊢ e ∶ (applyAll n (unit T) >>= θ)
→ AltsType {n = n} Q Qg Γ θ T alts τ
→ Q , Qg , Γ ⊢ case e of alts ∶ τ
data AltsType {ev tv : Set}{n : ℕ}(Q : AxiomScheme tv)(Qg : QConstraint tv)(Γ : Environment ev tv)( θ : (tv ⨁ n) → Type tv)(T : tv)
: {r : Shape} → Alternatives ev tv r → Type tv → Set where
NoAlts : ∀ {τ} → AltsType Q Qg Γ θ T esac τ
OneAlt : ∀ {τ}{a}{r₁ r₂}{p : Name ev (Datacon a)}{e : Expression (ev ⨁ a) tv r₁}{as : Alternatives ev tv r₂}{vs}
→ AltsType {n = n} Q Qg Γ θ T as τ
→ Γ p ≡ DC∀ n · vs ⟶ T
→ Q , Qg , addAll (Vec-f.map (λ x → x >>= θ) vs) Γ ⊢ e ∶ τ
→ AltsType Q Qg Γ θ T ((p →′ e) ∣ as) τ
GATAlt : ∀ {x}{τ}{a}{r₁ r₂}{p : Name ev (Datacon a)}{e : Expression (ev ⨁ a) tv r₁}{as : Alternatives ev tv r₂}{vs}{Qv}
→ let θ′ : PlusN x (PlusN n tv) → Type (PlusN x tv)
θ′ v = sequence-PlusN {Type}{x} ⦃ type-is-monad ⦄ (Functor.map (pn-m.is-functor {x}) θ v)
Q′ = Ax-f.map (pn-m.unit {x}) Q
Qg′ = QC-f.map (pn-m.unit {x}) Qg
in AltsType {n = n} Q Qg Γ θ T as τ
→ Γ p ≡ DC∀′ n , x · Qv ⇒ vs ⟶ T
→ Q′ , Qg′ ∧ (constraint-substitute θ′ Qv) , addAll (Vec-f.map (λ x → x >>= θ′) vs) (TS-f.map (pn-m.unit {x}) ∘ Γ)
⊢ Exp-f.map (pn-m.unit {x}) e ∶ map (pn-m.unit {x}) τ
→ AltsType Q Qg Γ θ T ((p →′ e) ∣ as) τ
data _,_,_⊢′_ {ev tv : Set}(Q : AxiomScheme tv)(Qg : QConstraint tv)(Γ : Environment ev tv): Program ev tv → Set where
Empty : Q , Qg , Γ ⊢′ end
Bind : {r : Shape}{n : ℕ}{e : Expression ev tv r}{p : Program (Ⓢ ev) tv}{Qv Q₁ : QConstraint (tv ⨁ n)}{τ : Type (tv ⨁ n)}
→ let Q′ = Ax-f.map (pn-m.unit {n}) Q
Qg′ = QC-f.map (pn-m.unit {n}) Qg
e′ = Exp-f.map (pn-m.unit {n}) e
in Q′ , Qv ∧ Qg′ ⊩ Q₁
→ Q′ , Q₁ , (TS-f.map (pn-m.unit {n}) ∘ Γ) ⊢ e′ ∶ τ
→ Q , Qg , (⟨ ∀′ n · Qv ⇒ τ ⟩, Γ) ⊢′ p
→ Q , Qg , Γ ⊢′ bind₁ e , p
BindA : {r : Shape}{n : ℕ}{e : Expression ev (tv ⨁ n) r}{p : Program (Ⓢ ev) tv}{Qv Q₁ : QConstraint (tv ⨁ n)}{τ : Type (tv ⨁ n)}
→ let Q′ = Ax-f.map (pn-m.unit {n}) Q
Qg′ = QC-f.map (pn-m.unit {n}) Qg
in Q′ , Qv ∧ Qg′ ⊩ Q₁
→ Q′ , Q₁ , (TS-f.map (pn-m.unit {n}) ∘ Γ) ⊢ e ∶ τ
→ Q , Qg , (⟨ ∀′ n · Qv ⇒ τ ⟩, Γ) ⊢′ p
→ Q , Qg , Γ ⊢′ bind₂ n · e ∷ Qv ⇒ τ , p
open import Data.Empty
-- I know that Γ (N v) == ∀′ α · q₁ ⇒ τ₁
-- I know that gen≡
soundness-lemma : ∀{r}{n}{ev}{tv}{Γ : Environment ev tv}{e : Expression ev tv r}{r′}{τ}{C}{C′}{C′′}{n′}{Q}{Qg}{Qr}{θ}{eq : Eq (tv ⨁ n)}{Cext}
→ Γ ► e ∶ τ ↝ C → C prenex: n , C′ → C′ separate: r′ , C′′ → Q , Qg , n solv► C′′ ↝ n′ , Qr , θ
→ let Q′ = Ax-f.map (pn-m.unit {n′}) Q
Qg′ = QC-f.map (pn-m.unit {n′}) Qg
e′ = Exp-f.map (pn-m.unit {n′}) e
in ∃ (λ Qe → (Q′ , Qe , TS-f.map (pn-m.unit {n′}) ∘ Γ ⊢ e′ ∶ map (pn-m.unit {n′}) τ)
× Q′ , (Qg′ ∧ Qr) ⊩ Qe )
{- soundness-lemma (VarCon₁ Γv≡∀n·q⇒t) pnx sep sol = {!_ , VarN ? ? ? , ?!} -}
{- soundness-lemma (App {C₁ = C₁}{C₂} Pe₁ Pe₂) pnx sep sol with prenex (C₁ ∧′ C₂) | prenex (C₂ ∧′ C₁)
... | f₁ , C₁′ , p₁ | f₂ , C₂′ , p₂ with separate C₁′ | separate C₂′
... | r₁ , C₁′′ , p₁′ | r₂ , C₂′′ , p₂′ with soundness-lemma Pe₁ p₁ p₁′ {!!} | soundness-lemma Pe₂ p₂ p₂′ {!!}
... | Q₁ , P₁ , P₁′ | Q₂ , P₂ , P₂′ = Q₁ ∧ (Q₂ ∧ {!!}) , Appl P₁ P₂ , {!!} -}
soundness-lemma {n = suc (suc .(na + nb))} {e = λ′ e′} {τ = τ}
(Abs {C = Ⅎ Ⅎ (C ∧′ rest)} p)
(PN-Ext (PN-Ext (PN-∧ {._}{._}{na}{nb} p₁ p₂)))
(Separate (Simpl-∧ p₁s p₂s) (Implic-∧ p₁i p₂i)) (SOLVE simpl impls) with soundness-lemma {e = Exp-f.map (suc ∘ suc) e′} p p₁ (Separate {!p₁s!} {!!}) {!!}
... | Q₁ , t , e = {!!}
soundness-lemma (_) pnx sep sol = {!!}
{-
soundness-proof : ∀ {ev}{tv}{eq : Eq tv}{Q}{Γ : Environment ev tv}{p} → Q , Γ ► p → Q , ε , Γ ⊢′ p
soundness-proof (Empty) = Empty
soundness-proof (Bind _ _ _ _ _) = Bind {!!} {!!} {!!}
soundness-proof (BindA _ _ _ _ _) = BindA {!!} {!!} {!!}
-}
|
Nat.agda | mjhopkins/PowerOfPi | 1 | 15551 | <reponame>mjhopkins/PowerOfPi<gh_stars>1-10
module Nat where
open import Eq
data ℕ : Set where
Z : ℕ
S : ℕ → ℕ
{-# BUILTIN NATURAL ℕ #-}
infixl 6 _+_
infixl 7 _×_
_+_ : ℕ → ℕ → ℕ
Z + n = n
(S k) + n = S(k + n)
{-# BUILTIN NATPLUS _+_ #-}
_×_ : ℕ → ℕ → ℕ
Z × n = Z
S m × n = n + m × n
{-# BUILTIN NATTIMES _×_ #-}
*-right-zero : ∀ (n : ℕ) → n × Z ≡ Z
*-right-zero Z = Refl
*-right-zero (S n) = *-right-zero n
testEq : (x : ℕ) → (y : ℕ) → (p : x ≡ y) → ℕ
testEq x _ Refl = x
|
tysos/x86_64/halt.asm | jncronin/tysos | 5 | 101248 | <gh_stars>1-10
global __ty_gettype
global gcmalloc
global __halt:function
global __ty_strcpy
global _ZX15OtherOperationsM_0_4Exit_Rv_P0:function
extern __display_halt
__ty_strcpy:
jmp $
__ty_gettype:
jmp $
__halt:
call __display_halt
.halt:
xchg bx, bx
hlt
jmp .halt
_ZX15OtherOperationsM_0_4Exit_Rv_P0:
.halt:
hlt
jmp .halt
|
additionInteger.asm | ericma1999/mips-assembly | 0 | 10695 | <reponame>ericma1999/mips-assembly<filename>additionInteger.asm
.data
number1: .word 15
number2: .word 5
.text
lw $t0, number1
lw $t1, number2
add $t2, $t0, $t1 #add $a0, $t0, $t1
li $v0, 1
add $a0, $zero, $t2
syscall |
library/02_functions_batch1/unknown_10003750.asm | SamantazFox/dds140-reverse-engineering | 1 | 240665 | <reponame>SamantazFox/dds140-reverse-engineering
10003750: a1 10 52 01 10 mov eax,ds:0x10015210
10003755: 85 c0 test eax,eax
10003757: 74 06 je 0x1000375f
10003759: 50 push eax
1000375a: e8 e7 00 00 00 call 0x10003846
1000375f: b8 01 00 00 00 mov eax,0x1
10003764: c7 05 10 52 01 10 ff mov DWORD PTR ds:0x10015210,0xffffffff
1000376b: ff ff ff
1000376e: c3 ret
1000376f: cc int3
|
notes/FOT/FOTC/Program/SortList/Properties/Totality/OrdList/FlattenI.agda | asr/fotc | 11 | 10099 | <filename>notes/FOT/FOTC/Program/SortList/Properties/Totality/OrdList/FlattenI.agda
------------------------------------------------------------------------------
-- Totality properties respect to OrdList (flatten-OrdList-helper)
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- The termination checker can not determine that the function
-- flatten-OrdList-helper is defined by structural recursion because
-- we are using postulates.
module FOT.FOTC.Program.SortList.Properties.Totality.OrdList.FlattenI where
open import Common.FOL.Relation.Binary.EqReasoning
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Bool
open import FOTC.Data.Bool.PropertiesI
open import FOTC.Data.Nat.Inequalities
open import FOTC.Data.Nat.Inequalities.PropertiesI
open import FOTC.Data.Nat.Type
open import FOTC.Data.List
open import FOTC.Program.SortList.Properties.Totality.BoolI
open import FOTC.Program.SortList.Properties.Totality.ListN-I
open import FOTC.Program.SortList.Properties.Totality.OrdTreeI
open import FOTC.Program.SortList.Properties.MiscellaneousI
open import FOTC.Program.SortList.SortList
------------------------------------------------------------------------------
{-# TERMINATING #-}
flatten-OrdList-helper : ∀ {t₁ i t₂} → Tree t₁ → N i → Tree t₂ →
OrdTree (node t₁ i t₂) →
≤-Lists (flatten t₁) (flatten t₂)
flatten-OrdList-helper {t₂ = t₂} tnil Ni Tt₂ OTt =
subst (λ t → ≤-Lists t (flatten t₂))
(sym (flatten-nil))
(le-Lists-[] (flatten t₂))
flatten-OrdList-helper (ttip {i₁} Ni₁) _ tnil OTt =
le-Lists (flatten (tip i₁)) (flatten nil)
≡⟨ subst₂ (λ x₁ x₂ → le-Lists (flatten (tip i₁)) (flatten nil) ≡
le-Lists x₁ x₂)
(flatten-tip i₁)
flatten-nil
refl
⟩
le-Lists (i₁ ∷ []) []
≡⟨ le-Lists-∷ i₁ [] [] ⟩
le-ItemList i₁ [] && le-Lists [] []
≡⟨ subst₂ (λ x₁ x₂ → le-ItemList i₁ [] && le-Lists [] [] ≡ x₁ && x₂)
(le-ItemList-[] i₁)
(le-Lists-[] [])
refl
⟩
true && true
≡⟨ t&&x≡x true ⟩
true ∎
flatten-OrdList-helper {i = i} (ttip {i₁} Ni₁) Ni (ttip {i₂} Ni₂) OTt =
le-Lists (flatten (tip i₁)) (flatten (tip i₂))
≡⟨ subst₂ (λ x₁ x₂ → le-Lists (flatten (tip i₁)) (flatten (tip i₂)) ≡
le-Lists x₁ x₂)
(flatten-tip i₁)
(flatten-tip i₂)
refl
⟩
le-Lists (i₁ ∷ []) (i₂ ∷ [])
≡⟨ le-Lists-∷ i₁ [] (i₂ ∷ []) ⟩
le-ItemList i₁ (i₂ ∷ []) && le-Lists [] (i₂ ∷ [])
≡⟨ subst (λ t → le-ItemList i₁ (i₂ ∷ []) && le-Lists [] (i₂ ∷ []) ≡
t && le-Lists [] (i₂ ∷ []))
(le-ItemList-∷ i₁ i₂ [])
refl
⟩
(le i₁ i₂ && le-ItemList i₁ []) && le-Lists [] (i₂ ∷ [])
≡⟨ subst (λ t → (le i₁ i₂ && le-ItemList i₁ []) && le-Lists [] (i₂ ∷ []) ≡
(t && le-ItemList i₁ []) && le-Lists [] (i₂ ∷ []))
lemma
refl
⟩
(true && le-ItemList i₁ []) && le-Lists [] (i₂ ∷ [])
≡⟨ subst₂ (λ x₁ x₂ → (true && le-ItemList i₁ []) && le-Lists [] (i₂ ∷ []) ≡
(true && x₁) && x₂)
(le-ItemList-[] i₁)
(le-Lists-[] (i₂ ∷ []))
refl
⟩
(true && true) && true
≡⟨ &&-assoc btrue btrue btrue ⟩
true && true && true
≡⟨ &&-list₃-all-t btrue btrue btrue (refl , refl , refl) ⟩
true
∎
where
helper₁ : Bool (ordTree (tip i₁))
helper₁ = ordTree-Bool (ttip Ni₁)
helper₂ : Bool (ordTree (tip i₂))
helper₂ = ordTree-Bool (ttip Ni₂)
helper₃ : Bool (le-TreeItem (tip i₁) i)
helper₃ = le-TreeItem-Bool (ttip Ni₁) Ni
helper₄ : Bool (le-ItemTree i (tip i₂))
helper₄ = le-ItemTree-Bool Ni (ttip Ni₂)
helper₅ : ordTree (tip i₁) &&
ordTree (tip i₂) &&
le-TreeItem (tip i₁) i &&
le-ItemTree i (tip i₂) ≡ true
helper₅ = trans (sym (ordTree-node (tip i₁) i (tip i₂))) OTt
lemma : i₁ ≤ i₂
lemma = ≤-trans Ni₁ Ni Ni₂ i₁≤i i≤i₂
where
i₁≤i : i₁ ≤ i
i₁≤i = trans (sym (le-TreeItem-tip i₁ i))
(&&-list₄-t₃ helper₁ helper₂ helper₃ helper₄ helper₅)
i≤i₂ : i ≤ i₂
i≤i₂ = trans (sym (le-ItemTree-tip i i₂))
(&&-list₄-t₄ helper₁ helper₂ helper₃ helper₄ helper₅)
flatten-OrdList-helper {i = i} (ttip {i₁} Ni₁) Ni
(tnode {t₂₁} {i₂} {t₂₂} Tt₂₁ Ni₂ Tt₂₂) OTt =
le-Lists (flatten (tip i₁)) (flatten (node t₂₁ i₂ t₂₂))
≡⟨ subst (λ x → le-Lists (flatten (tip i₁)) (flatten (node t₂₁ i₂ t₂₂)) ≡
le-Lists (flatten (tip i₁)) x)
(flatten-node t₂₁ i₂ t₂₂)
refl
⟩
le-Lists (flatten (tip i₁)) (flatten t₂₁ ++ flatten t₂₂)
≡⟨ xs≤ys→xs≤zs→xs≤ys++zs (flatten-ListN (ttip Ni₁))
(flatten-ListN Tt₂₁)
(flatten-ListN Tt₂₂)
lemma₁
lemma₂
⟩
true ∎
where
-- Helper terms to get the conjuncts from OTt.
helper₁ = ordTree-Bool (ttip Ni₁)
helper₂ = ordTree-Bool (tnode Tt₂₁ Ni₂ Tt₂₂)
helper₃ = le-TreeItem-Bool (ttip Ni₁) Ni
helper₄ = le-ItemTree-Bool Ni (tnode Tt₂₁ Ni₂ Tt₂₂)
helper₅ = trans (sym (ordTree-node (tip i₁) i (node t₂₁ i₂ t₂₂))) OTt
-- Helper terms to get the conjuncts from the fourth conjunct of OTt.
helper₆ = le-ItemTree-Bool Ni Tt₂₁
helper₇ = le-ItemTree-Bool Ni Tt₂₂
helper₈ = trans (sym (le-ItemTree-node i t₂₁ i₂ t₂₂))
(&&-list₄-t₄ helper₁ helper₂ helper₃ helper₄ helper₅)
-- Common terms for the lemma₁ and lemma₂.
OrdTree-tip-i₁ : OrdTree (tip i₁)
OrdTree-tip-i₁ = &&-list₄-t₁ helper₁ helper₂ helper₃ helper₄ helper₅
≤-TreeItem-tip-i₁-i : ≤-TreeItem (tip i₁) i
≤-TreeItem-tip-i₁-i = &&-list₄-t₃ helper₁ helper₂ helper₃ helper₄ helper₅
lemma₁ : ≤-Lists (flatten (tip i₁)) (flatten t₂₁)
lemma₁ = flatten-OrdList-helper (ttip Ni₁) Ni Tt₂₁ OT
where
OrdTree-t₂₁ : OrdTree t₂₁
OrdTree-t₂₁ =
leftSubTree-OrdTree Tt₂₁ Ni₂ Tt₂₂ (&&-list₄-t₂ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-ItemTree-i-t₂₁ : ≤-ItemTree i t₂₁
≤-ItemTree-i-t₂₁ = &&-list₂-t₁ helper₆ helper₇ helper₈
OT : OrdTree (node (tip i₁) i t₂₁)
OT = ordTree (node (tip i₁) i t₂₁)
≡⟨ ordTree-node (tip i₁) i t₂₁ ⟩
ordTree (tip i₁) &&
ordTree t₂₁ &&
le-TreeItem (tip i₁) i &&
le-ItemTree i t₂₁
≡⟨ subst₄ (λ w x y z → ordTree (tip i₁) &&
ordTree t₂₁ &&
le-TreeItem (tip i₁) i &&
le-ItemTree i t₂₁ ≡
w && x && y && z)
OrdTree-tip-i₁
OrdTree-t₂₁
≤-TreeItem-tip-i₁-i
≤-ItemTree-i-t₂₁
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
lemma₂ : ≤-Lists (flatten (tip i₁)) (flatten t₂₂)
lemma₂ = flatten-OrdList-helper (ttip Ni₁) Ni Tt₂₂ OT
where
OrdTree-t₂₂ : OrdTree t₂₂
OrdTree-t₂₂ =
rightSubTree-OrdTree Tt₂₁ Ni₂ Tt₂₂ (&&-list₄-t₂ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-ItemTree-i-t₂₂ : ≤-ItemTree i t₂₂
≤-ItemTree-i-t₂₂ = &&-list₂-t₂ helper₆ helper₇ helper₈
OT : OrdTree (node (tip i₁) i t₂₂)
OT = ordTree (node (tip i₁) i t₂₂)
≡⟨ ordTree-node (tip i₁) i t₂₂ ⟩
ordTree (tip i₁) &&
ordTree t₂₂ &&
le-TreeItem (tip i₁) i &&
le-ItemTree i t₂₂
≡⟨ subst₄ (λ w x y z → ordTree (tip i₁) &&
ordTree t₂₂ &&
le-TreeItem (tip i₁) i &&
le-ItemTree i t₂₂ ≡
w && x && y && z)
OrdTree-tip-i₁
OrdTree-t₂₂
≤-TreeItem-tip-i₁-i
≤-ItemTree-i-t₂₂
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
flatten-OrdList-helper {i = i} (tnode {t₁₁} {i₁} {t₁₂} Tt₁₁ Ni₁ Tt₁₂) Ni tnil OTt =
le-Lists (flatten (node t₁₁ i₁ t₁₂)) (flatten nil)
≡⟨ subst (λ x → le-Lists (flatten (node t₁₁ i₁ t₁₂)) (flatten nil) ≡
le-Lists x (flatten nil))
(flatten-node t₁₁ i₁ t₁₂)
refl
⟩
le-Lists (flatten t₁₁ ++ flatten t₁₂) (flatten nil)
≡⟨ xs≤zs→ys≤zs→xs++ys≤zs (flatten-ListN Tt₁₁)
(flatten-ListN Tt₁₂)
(flatten-ListN tnil)
lemma₁
lemma₂
⟩
true ∎
where
-- Helper terms to get the conjuncts from OTt.
helper₁ = ordTree-Bool (tnode Tt₁₁ Ni₁ Tt₁₂)
helper₂ = ordTree-Bool tnil
helper₃ = le-TreeItem-Bool (tnode Tt₁₁ Ni₁ Tt₁₂) Ni
helper₄ = le-ItemTree-Bool Ni tnil
helper₅ = trans (sym (ordTree-node (node t₁₁ i₁ t₁₂) i nil)) OTt
-- Helper terms to get the conjuncts from the third conjunct of OTt.
helper₆ = le-TreeItem-Bool Tt₁₁ Ni
helper₇ = le-TreeItem-Bool Tt₁₂ Ni
helper₈ = trans (sym (le-TreeItem-node t₁₁ i₁ t₁₂ i))
(&&-list₄-t₃ helper₁ helper₂ helper₃ helper₄ helper₅)
-- Common terms for the lemma₁ and lemma₂.
≤-ItemTree-i-niltree : ≤-ItemTree i nil
≤-ItemTree-i-niltree = &&-list₄-t₄ helper₁ helper₂ helper₃ helper₄ helper₅
lemma₁ : ≤-Lists (flatten t₁₁) (flatten nil)
lemma₁ = flatten-OrdList-helper Tt₁₁ Ni tnil OT
where
OrdTree-t₁₁ : OrdTree t₁₁
OrdTree-t₁₁ =
leftSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₁-i : ≤-TreeItem t₁₁ i
≤-TreeItem-t₁₁-i = &&-list₂-t₁ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₁ i nil)
OT = ordTree (node t₁₁ i nil)
≡⟨ ordTree-node t₁₁ i nil ⟩
ordTree t₁₁ &&
ordTree nil &&
le-TreeItem t₁₁ i &&
le-ItemTree i nil
≡⟨ subst₄ (λ w x y z → ordTree t₁₁ &&
ordTree nil &&
le-TreeItem t₁₁ i &&
le-ItemTree i nil ≡
w && x && y && z)
OrdTree-t₁₁
ordTree-nil
≤-TreeItem-t₁₁-i
≤-ItemTree-i-niltree
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
lemma₂ : ≤-Lists (flatten t₁₂) (flatten nil)
lemma₂ = flatten-OrdList-helper Tt₁₂ Ni tnil OT
where
OrdTree-t₁₂ : OrdTree t₁₂
OrdTree-t₁₂ =
rightSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₂-i : ≤-TreeItem t₁₂ i
≤-TreeItem-t₁₂-i = &&-list₂-t₂ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₂ i nil)
OT = ordTree (node t₁₂ i nil)
≡⟨ ordTree-node t₁₂ i nil ⟩
ordTree t₁₂ &&
ordTree nil &&
le-TreeItem t₁₂ i &&
le-ItemTree i nil
≡⟨ subst₄ (λ w x y z → ordTree t₁₂ &&
ordTree nil &&
le-TreeItem t₁₂ i &&
le-ItemTree i nil ≡
w && x && y && z)
OrdTree-t₁₂
ordTree-nil
≤-TreeItem-t₁₂-i
≤-ItemTree-i-niltree
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
flatten-OrdList-helper {i = i} (tnode {t₁₁} {i₁} {t₁₂} Tt₁₁ Ni₁ Tt₁₂) Ni
(ttip {i₂} Ni₂) OTt =
le-Lists (flatten (node t₁₁ i₁ t₁₂)) (flatten (tip i₂))
≡⟨ subst (λ x → le-Lists (flatten (node t₁₁ i₁ t₁₂)) (flatten (tip i₂)) ≡
le-Lists x (flatten (tip i₂)))
(flatten-node t₁₁ i₁ t₁₂)
refl
⟩
le-Lists (flatten t₁₁ ++ flatten t₁₂) (flatten (tip i₂))
≡⟨ xs≤zs→ys≤zs→xs++ys≤zs (flatten-ListN Tt₁₁)
(flatten-ListN Tt₁₂)
(flatten-ListN (ttip Ni₂))
lemma₁
lemma₂
⟩
true ∎
where
-- Helper terms to get the conjuncts from OTt.
helper₁ = ordTree-Bool (tnode Tt₁₁ Ni₁ Tt₁₂)
helper₂ = ordTree-Bool (ttip Ni₂)
helper₃ = le-TreeItem-Bool (tnode Tt₁₁ Ni₁ Tt₁₂) Ni
helper₄ = le-ItemTree-Bool Ni (ttip Ni₂)
helper₅ = trans (sym (ordTree-node (node t₁₁ i₁ t₁₂) i (tip i₂))) OTt
-- Helper terms to get the conjuncts from the third conjunct of OTt.
helper₆ = le-TreeItem-Bool Tt₁₁ Ni
helper₇ = le-TreeItem-Bool Tt₁₂ Ni
helper₈ = trans (sym (le-TreeItem-node t₁₁ i₁ t₁₂ i))
(&&-list₄-t₃ helper₁ helper₂ helper₃ helper₄ helper₅)
-- Common terms for the lemma₁ and lemma₂.
OrdTree-tip-i₂ : OrdTree (tip i₂)
OrdTree-tip-i₂ = &&-list₄-t₂ helper₁ helper₂ helper₃ helper₄ helper₅
≤-ItemTree-i-tip-i₂ : ≤-ItemTree i (tip i₂)
≤-ItemTree-i-tip-i₂ = &&-list₄-t₄ helper₁ helper₂ helper₃ helper₄ helper₅
lemma₁ : ≤-Lists (flatten t₁₁) (flatten (tip i₂))
lemma₁ = flatten-OrdList-helper Tt₁₁ Ni (ttip Ni₂) OT
where
OrdTree-t₁₁ : OrdTree t₁₁
OrdTree-t₁₁ =
leftSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₁-i : ≤-TreeItem t₁₁ i
≤-TreeItem-t₁₁-i = &&-list₂-t₁ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₁ i (tip i₂))
OT = ordTree (node t₁₁ i (tip i₂))
≡⟨ ordTree-node t₁₁ i (tip i₂) ⟩
ordTree t₁₁ &&
ordTree (tip i₂) &&
le-TreeItem t₁₁ i &&
le-ItemTree i (tip i₂)
≡⟨ subst₄ (λ w x y z → ordTree t₁₁ &&
ordTree (tip i₂) &&
le-TreeItem t₁₁ i &&
le-ItemTree i (tip i₂) ≡
w && x && y && z)
OrdTree-t₁₁
OrdTree-tip-i₂
≤-TreeItem-t₁₁-i
≤-ItemTree-i-tip-i₂
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
lemma₂ : ≤-Lists (flatten t₁₂) (flatten (tip i₂))
lemma₂ = flatten-OrdList-helper Tt₁₂ Ni (ttip Ni₂) OT
where
OrdTree-t₁₂ : OrdTree t₁₂
OrdTree-t₁₂ =
rightSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₂-i : ≤-TreeItem t₁₂ i
≤-TreeItem-t₁₂-i = &&-list₂-t₂ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₂ i (tip i₂))
OT = ordTree (node t₁₂ i (tip i₂))
≡⟨ ordTree-node t₁₂ i (tip i₂) ⟩
ordTree t₁₂ &&
ordTree (tip i₂) &&
le-TreeItem t₁₂ i &&
le-ItemTree i (tip i₂)
≡⟨ subst₄ (λ w x y z → ordTree t₁₂ &&
ordTree (tip i₂) &&
le-TreeItem t₁₂ i &&
le-ItemTree i (tip i₂) ≡
w && x && y && z)
OrdTree-t₁₂
OrdTree-tip-i₂
≤-TreeItem-t₁₂-i
≤-ItemTree-i-tip-i₂
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
flatten-OrdList-helper {i = i} (tnode {t₁₁} {i₁} {t₁₂} Tt₁₁ Ni₁ Tt₁₂) Ni
(tnode {t₂₁} {i₂} {t₂₂} Tt₂₁ Ni₂ Tt₂₂) OTt =
le-Lists (flatten (node t₁₁ i₁ t₁₂)) (flatten (node t₂₁ i₂ t₂₂))
≡⟨ subst (λ x → le-Lists (flatten (node t₁₁ i₁ t₁₂))
(flatten (node t₂₁ i₂ t₂₂)) ≡
le-Lists x (flatten (node t₂₁ i₂ t₂₂)))
(flatten-node t₁₁ i₁ t₁₂)
refl
⟩
le-Lists (flatten t₁₁ ++ flatten t₁₂) (flatten (node t₂₁ i₂ t₂₂))
≡⟨ xs≤zs→ys≤zs→xs++ys≤zs (flatten-ListN Tt₁₁)
(flatten-ListN Tt₁₂)
(flatten-ListN (tnode Tt₂₁ Ni₂ Tt₂₂))
lemma₁
lemma₂
⟩
true ∎
where
-- Helper terms to get the conjuncts from OTt.
helper₁ = ordTree-Bool (tnode Tt₁₁ Ni₁ Tt₁₂)
helper₂ = ordTree-Bool (tnode Tt₂₁ Ni₂ Tt₂₂)
helper₃ = le-TreeItem-Bool (tnode Tt₁₁ Ni₁ Tt₁₂) Ni
helper₄ = le-ItemTree-Bool Ni (tnode Tt₂₁ Ni₂ Tt₂₂)
helper₅ = trans (sym (ordTree-node (node t₁₁ i₁ t₁₂) i (node t₂₁ i₂ t₂₂))) OTt
-- Helper terms to get the conjuncts from the third conjunct of OTt.
helper₆ = le-TreeItem-Bool Tt₁₁ Ni
helper₇ = le-TreeItem-Bool Tt₁₂ Ni
helper₈ = trans (sym (le-TreeItem-node t₁₁ i₁ t₁₂ i))
(&&-list₄-t₃ helper₁ helper₂ helper₃ helper₄ helper₅)
-- Common terms for the lemma₁ and lemma₂.
OrdTree-node-t₂₁-i₂-t₂₂ : OrdTree (node t₂₁ i₂ t₂₂)
OrdTree-node-t₂₁-i₂-t₂₂ = &&-list₄-t₂ helper₁ helper₂ helper₃ helper₄ helper₅
≤-ItemTree-i-node-t₂₁-i₂-t₂₂ : ≤-ItemTree i (node t₂₁ i₂ t₂₂)
≤-ItemTree-i-node-t₂₁-i₂-t₂₂ = &&-list₄-t₄ helper₁ helper₂ helper₃ helper₄
helper₅
lemma₁ : ≤-Lists (flatten t₁₁) (flatten (node t₂₁ i₂ t₂₂))
lemma₁ = flatten-OrdList-helper Tt₁₁ Ni (tnode Tt₂₁ Ni₂ Tt₂₂) OT
where
OrdTree-t₁₁ : OrdTree t₁₁
OrdTree-t₁₁ =
leftSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₁-i : ≤-TreeItem t₁₁ i
≤-TreeItem-t₁₁-i = &&-list₂-t₁ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₁ i (node t₂₁ i₂ t₂₂))
OT = ordTree (node t₁₁ i (node t₂₁ i₂ t₂₂))
≡⟨ ordTree-node t₁₁ i (node t₂₁ i₂ t₂₂) ⟩
ordTree t₁₁ &&
ordTree (node t₂₁ i₂ t₂₂) &&
le-TreeItem t₁₁ i &&
le-ItemTree i (node t₂₁ i₂ t₂₂)
≡⟨ subst₄ (λ w x y z → ordTree t₁₁ &&
ordTree (node t₂₁ i₂ t₂₂) &&
le-TreeItem t₁₁ i &&
le-ItemTree i (node t₂₁ i₂ t₂₂) ≡
w && x && y && z)
OrdTree-t₁₁
OrdTree-node-t₂₁-i₂-t₂₂
≤-TreeItem-t₁₁-i
≤-ItemTree-i-node-t₂₁-i₂-t₂₂
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true ∎
lemma₂ : ≤-Lists (flatten t₁₂) (flatten (node t₂₁ i₂ t₂₂))
lemma₂ = flatten-OrdList-helper Tt₁₂ Ni (tnode Tt₂₁ Ni₂ Tt₂₂) OT
where
OrdTree-t₁₂ : OrdTree t₁₂
OrdTree-t₁₂ =
rightSubTree-OrdTree Tt₁₁ Ni₁ Tt₁₂ (&&-list₄-t₁ helper₁ helper₂ helper₃
helper₄ helper₅)
≤-TreeItem-t₁₂-i : ≤-TreeItem t₁₂ i
≤-TreeItem-t₁₂-i = &&-list₂-t₂ helper₆ helper₇ helper₈
OT : OrdTree (node t₁₂ i (node t₂₁ i₂ t₂₂))
OT = ordTree (node t₁₂ i (node t₂₁ i₂ t₂₂))
≡⟨ ordTree-node t₁₂ i (node t₂₁ i₂ t₂₂) ⟩
ordTree t₁₂ &&
ordTree (node t₂₁ i₂ t₂₂) &&
le-TreeItem t₁₂ i &&
le-ItemTree i (node t₂₁ i₂ t₂₂)
≡⟨ subst₄ (λ w x y z → ordTree t₁₂ &&
ordTree (node t₂₁ i₂ t₂₂) &&
le-TreeItem t₁₂ i &&
le-ItemTree i (node t₂₁ i₂ t₂₂) ≡
w && x && y && z)
OrdTree-t₁₂
OrdTree-node-t₂₁-i₂-t₂₂
≤-TreeItem-t₁₂-i
≤-ItemTree-i-node-t₂₁-i₂-t₂₂
refl
⟩
true && true && true && true
≡⟨ &&-list₄-all-t btrue btrue btrue btrue (refl , refl , refl , refl) ⟩
true
∎
|
src/asm-x86/util-concurrent-counters.adb | Letractively/ada-util | 60 | 13342 | -----------------------------------------------------------------------
-- Util.Concurrent -- Concurrent Counters
-- Copyright (C) 2009, 2010 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
-- This implementation of atomic counters works only for Intel x86 based
-- platforms. It uses the <b>lock</b> instruction followed by an <b>incl</b>
-- or a <b>decl</b> instruction to implement the atomic operations.
-- (See GNU/Linux atomic.h headers).
with System.Machine_Code;
package body Util.Concurrent.Counters is
use System.Machine_Code;
use Interfaces;
-- ------------------------------
-- Increment the counter atomically.
-- ------------------------------
procedure Increment (C : in out Counter) is
begin
Asm (Template => "lock incl %0",
Volatile => True,
Outputs => Unsigned_32'Asm_Output ("+m", C.Value),
Clobber => "memory");
end Increment;
-- ------------------------------
-- Increment the counter atomically and return the value before increment.
-- ------------------------------
procedure Increment (C : in out Counter;
Value : out Integer) is
Val : Unsigned_32 := 1;
begin
Asm (Template => "lock xaddl %1,%0",
Volatile => True,
Outputs => (Unsigned_32'Asm_Output ("+m", C.Value),
Unsigned_32'Asm_Output ("=r", Val)),
Inputs => Unsigned_32'Asm_Input ("1", Val),
Clobber => "memory");
Value := Integer (Val);
end Increment;
-- ------------------------------
-- Decrement the counter atomically.
-- ------------------------------
procedure Decrement (C : in out Counter) is
begin
Asm (Template => "lock decl %0",
Volatile => True,
Outputs => Unsigned_32'Asm_Output ("+m", C.Value),
Clobber => "memory");
end Decrement;
-- ------------------------------
-- Decrement the counter atomically and return a status.
-- ------------------------------
procedure Decrement (C : in out Counter;
Is_Zero : out Boolean) is
Result : Unsigned_8;
begin
Asm ("lock decl %0; sete %1",
Volatile => True,
Outputs => (Unsigned_32'Asm_Output ("+m", C.Value),
Unsigned_8'Asm_Output ("=qm", Result)));
Is_Zero := Result /= 0;
end Decrement;
-- ------------------------------
-- Get the counter value
-- ------------------------------
function Value (C : in Counter) return Integer is
begin
-- On x86, reading the counter is atomic.
return Integer (C.Value);
end Value;
end Util.Concurrent.Counters;
|
programs/oeis/040/A040139.asm | jmorken/loda | 1 | 246841 | <gh_stars>1-10
; A040139: Continued fraction for sqrt(152).
; 12,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3,24,3
pow $0,4
mov $1,$0
trn $0,4
sub $0,4
gcd $1,$0
mul $1,3
|
programs/oeis/106/A106852.asm | karttu/loda | 0 | 167284 | <reponame>karttu/loda
; A106852: Expansion of 1/(1-x*(1-3*x)).
; 1,1,-2,-5,1,16,13,-35,-74,31,253,160,-599,-1079,718,3955,1801,-10064,-15467,14725,61126,16951,-166427,-217280,282001,933841,87838,-2713685,-2977199,5163856,14095453,-1396115,-43682474,-39494129,91553293,210035680,-64624199,-694731239,-500858642,1583335075,3085911001,-1664094224,-10921827227,-5929544555,26835937126,44624570791,-35883240587,-169756952960,-62107231199,447163627681,633485321278,-708005561765,-2608461525599,-484444840304,7340939736493,8794274257405,-13228544952074,-39611367724289,74267131933,118908370304800,118685568909001,-238039542005399,-594096248732402,120022377283795,1902311123481001,1542243991629616,-4164689378813387,-8791421353702235,3702646782737926
mov $1,2
mov $2,2
lpb $0,1
sub $0,1
mul $1,3
sub $2,$1
add $1,$2
lpe
sub $1,2
div $1,6
mul $1,3
add $1,1
|
compile/minsys-assembler/test/Exercise3.1.asm | lonelyhentai/workspace | 2 | 25345 | .data
a: .word 3
.text 0x0000 #;代码开始的首地址
start: lui $1,0xffff #;让$28为0FFFF0000H作为端口地址的高16位
ori $28,$1,0xF000 #;$28端口是系统的I/O地址的高20位
switled: #;测试led和拨码开关
lw $1,0xC70($28) #;从拨码开关读取数据
sw $1,0xC60($28) #;将拨码开端的数据写到led上
j switled
|
src/arch/cores/armv7-m/m4-systick.adb | PThierry/ewok-kernel | 65 | 15404 | --
-- Copyright 2018 The wookey project team <<EMAIL>>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
-- - <NAME>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
--
package body m4.systick
with spark_mode => on
is
procedure init
is
begin
SYSTICK.LOAD.RELOAD := bits_24
(MAIN_CLOCK_FREQUENCY / TICKS_PER_SECOND);
SYSTICK.VAL.CURRENT := 0;
SYSTICK.CTRL := (ENABLE => true,
TICKINT => true,
CLKSOURCE => PROCESSOR_CLOCK,
COUNTFLAG => 0);
end init;
procedure increment
is
current : constant t_tick := ticks;
begin
ticks := current + 1;
end increment;
function get_ticks return unsigned_64
is
current : constant t_tick := ticks;
begin
return unsigned_64 (current);
end get_ticks;
function to_milliseconds (t : t_tick)
return milliseconds
is
begin
return t * (1000 / TICKS_PER_SECOND);
end to_milliseconds;
function to_microseconds (t : t_tick)
return microseconds
is
begin
return t * (1000000 / TICKS_PER_SECOND);
end to_microseconds;
function to_ticks (ms : milliseconds) return t_tick
is
begin
return ms * TICKS_PER_SECOND / 1000;
end to_ticks;
function get_milliseconds return milliseconds
is
current : constant t_tick := ticks;
begin
return to_milliseconds (current);
end get_milliseconds;
function get_microseconds return microseconds
is
current : constant t_tick := ticks;
begin
return to_microseconds (current);
end get_microseconds;
end m4.systick;
|
Reactive.agda | divipp/frp_agda | 21 | 11882 | <reponame>divipp/frp_agda<gh_stars>10-100
{-# OPTIONS --type-in-type #-}
module Reactive where
open import Prelude
infixr 9 _∘ᵗ_ _∘ᵀ_ _∘ᵇ_ _∙_
infixl 9 _∘ʷ_
infix 4 _,ᵀ_ _,ᵗ_
infix 2 _×ᵀ_
-- Coinductive trees will represent protocols of interactions
record Tree : Set where
coinductive
field
Branch : Set
child : Branch → Tree
open Tree
constᵀ : Set → Tree
constᵀ A .Branch = A
constᵀ A .child _ = constᵀ A
_×ᵀ_ : Tree → Tree → Tree
(p ×ᵀ q) .Branch = p .Branch × q .Branch
(p ×ᵀ q) .child (ph , qh) = p .child ph ×ᵀ q .child qh
alter : Tree → Tree → Tree
alter p q .Branch = p .Branch
alter p q .child hp = alter q (p .child hp)
alter' = λ A B → alter (constᵀ A) (constᵀ B)
-- signals
Sig = λ A B → alter' (Maybe A) (Maybe B)
NoSig = Sig ⊥ ⊥
OutSig = λ A → Sig A ⊥
InSig = λ A → Sig ⊥ A
BiSig = λ A → Sig A A
{-
p: P₁ P₂ -> P₃ P₄ ...
| ^ | ^
v | v |
q: Q₁ -> Q₂ Q₃ -> Q₄ ...
-}
merge : Tree → Tree → Tree
merge p q .Branch = p .Branch
merge p q .child hp .Branch = q .Branch
merge p q .child hp .child hq = merge (q .child hq) (p .child hp)
union2 : Tree → Tree → Tree
union2 p q .Branch = p .Branch ⊎ q .Branch
union2 p q .child (inj₁ ph) with p .child ph
... | r = λ where .Branch → q .Branch
.child rh → union2 r (q .child rh)
union2 p q .child (inj₂ qh) with q .child qh
... | r = λ where .Branch → p .Branch
.child rh → union2 (p .child rh) r
-- TODO: express with simpler combinators?
union2mb : Tree → Tree → Tree
union2mb p q .Branch = Maybe (p .Branch ⊎ q .Branch)
union2mb p q .child (just (inj₁ ph)) with p .child ph
... | r = λ where .Branch → q .Branch
.child rh → union2mb r (q .child rh)
union2mb p q .child (just (inj₂ qh)) with q .child qh
... | r = λ where .Branch → p .Branch
.child rh → union2mb (p .child rh) r
union2mb p q .child nothing .Branch = ⊤
union2mb p q .child nothing .child _ = union2mb p q
-----------------------------
data I/O : Set where I O : I/O -- input and output phases
variable p q r s : Tree
variable i/o : I/O
opposite : I/O → I/O
opposite I = O
opposite O = I
ΠΣ : I/O → (A : Set) → (A → Set) → Set
ΠΣ I A P = (a : A) → P a
ΠΣ O A P = Σ A P
⟨_⟩ : I/O → (A → A → B) → A → A → B
⟨ I ⟩ = id
⟨ O ⟩ = flip
-- an interactive agent which communcates according to the protocol p
-- an agent can be called either in input or in output phase
record Agent (i/o : I/O) (p : Tree) : Set where
coinductive
field
step : ΠΣ i/o (p .Branch) λ a → Agent (opposite i/o) (p .child a)
open Agent
_,ᵀ_ : Agent i/o p → Agent i/o q → Agent i/o (p ×ᵀ q)
_,ᵀ_ {i/o = I} a b .step (k , l) = a .step k ,ᵀ b .step l
_,ᵀ_ {i/o = O} a b .step with a .step | b .step
... | i , j | k , l = (i , k) , (j ,ᵀ l)
_∘ᵗ_ : Agent I (alter p q) → Agent I (alter q r) → Agent I (alter p r)
(b ∘ᵗ a) .step ph .step with b .step ph .step
... | qh , bt with a .step qh .step
... | rh , at = rh , bt ∘ᵗ at
-- stream processors
SP = λ A B → Agent I (alter' A B)
-- same as Agent I (Sig A B)
SPM = λ A B → SP (Maybe A) (Maybe B)
arr : (A → B) → SP A B
arr f .step x .step = f x , arr f
accum : (A → B → B) → B → SP A B
accum f b .step a .step with f a b
... | b' = b' , accum f b'
maybefy : SP A B → SPM A B
maybefy f .step nothing .step = nothing , (maybefy f)
maybefy f .step (just a) .step with f .step a .step
... | x , y = just x , maybefy y
-- synchronous interaction transformers
IT = λ p q → Agent I (merge p q)
mapAgent : ⟨ i/o ⟩ IT q p → Agent i/o p → Agent i/o q
mapAgent {i/o = I} l i .step hq with l .step hq .step
... | a , l2 = mapAgent l2 (i .step a)
mapAgent {i/o = O} l i .step with i .step
... | a , b with l .step a .step
... | c , l2 = c , (mapAgent l2 b)
_∘ᵀ_ : IT p q → IT q r → IT p r
(b ∘ᵀ a) .step ph .step with b .step ph .step
... | qh , bt with a .step qh .step
... | rh , at = rh , at ∘ᵀ bt
_,ᵗ_ : IT p q → IT r s → IT (p ×ᵀ r) (q ×ᵀ s)
_,ᵗ_ a b .step (k , l) .step with a .step k .step | b .step l .step
... | c , d | e , f = (c , e) , (d ,ᵗ f)
idIT : IT p p
idIT .step a .step = a , idIT
swapIT : IT (p ×ᵀ q) (q ×ᵀ p)
swapIT .step (a , b) .step = (b , a) , swapIT
assocIT : ⟨ i/o ⟩ IT ((p ×ᵀ q) ×ᵀ r) (p ×ᵀ (q ×ᵀ r))
assocIT {i/o = I} .step ((a , b) , c) . step = (a , (b , c)) , assocIT {i/o = O}
assocIT {i/o = O} .step (a , (b , c)) . step = ((a , b) , c) , assocIT {i/o = I}
fstSig : IT (p ×ᵀ Sig A B) p
fstSig .step (x , y) .step = x , λ where .step x .step → (x , nothing) , fstSig
joinSig : A → B → ⟨ i/o ⟩ IT (⟨ i/o ⟩ Sig A C ×ᵀ ⟨ i/o ⟩ Sig B D) (⟨ i/o ⟩ Sig (A × B) (C × D))
joinSig {i/o = I} a b .step (nothing , nothing) .step = nothing , joinSig {i/o = O} a b
joinSig {i/o = I} a b .step (nothing , just y ) .step = just (a , y) , joinSig {i/o = O} a y
joinSig {i/o = I} a b .step (just x , nothing) .step = just (x , b) , joinSig {i/o = O} x b
joinSig {i/o = I} a b .step (just x , just y ) .step = just (x , y) , joinSig {i/o = O} x y
joinSig {i/o = O} a b .step nothing .step = (nothing , nothing) , joinSig {i/o = I} a b
joinSig {i/o = O} a b .step (just (x , y)) .step = (just x , just y ) , joinSig {i/o = I} a b
noInput : IT (Sig A B) (OutSig A)
noInput .step x .step = x , λ where .step y .step → nothing , noInput
noOutput : IT (Sig A B) (InSig B)
noOutput .step x .step = nothing , λ where .step y .step → y , noOutput
mkIT : Agent i/o p → ⟨ i/o ⟩ IT p NoSig
mkIT {i/o = I} a .step x .step = nothing , mkIT {i/o = O} (a .step x)
mkIT {i/o = O} a .step _ .step with a .step
... | b , c = b , mkIT {i/o = I} c
constIT = λ S T A B → IT (alter' S T) (alter' A B)
constITM = λ S T A B → IT (Sig S T) (Sig A B)
lensIT : Lens S T A B → constIT S T A B
lensIT k .step s .step with k s
... | a , bt = a , λ where .step b .step → bt b , lensIT k
prismIT : Prism S T A B → constITM S T A B
prismIT f = lensIT (prismToLens f)
mkIT' : SP S A → SP B T → constIT S T A B
mkIT' f g .step s .step with f .step s .step
... | a , cont = a , (mkIT' g cont)
isoIT : (S → A) → (B → T) → constIT S T A B
isoIT f g = lensIT λ x → (f x) , g
-- bidirectional connection
Bi = λ p q → Agent I (union2 p q)
_∘ᵇ_ : Bi p q → Bi q r → Bi p r
(a ∘ᵇ b) .step (inj₁ x) .step with a .step (inj₁ x) .step
... | c , d with b .step (inj₁ c) .step
... | e , f = e , d ∘ᵇ f
(a ∘ᵇ b) .step (inj₂ x) .step with b .step (inj₂ x) .step
... | c , d with a .step (inj₂ c) .step
... | e , f = e , f ∘ᵇ d
isoBi : Iso A A B B → Bi (constᵀ A) (constᵀ B)
isoBi i .step (inj₁ x) .step = (i .proj₁ x) , isoBi i
isoBi i .step (inj₂ x) .step = (i .proj₂ x) , isoBi i
mmb : Bi p q → Agent I (union2mb p q)
mmb x .step nothing .step = _ , mmb x
mmb x .step (just (inj₁ y)) .step with x .step (inj₁ y) .step
... | a , b = a , mmb b
mmb x .step (just (inj₂ y)) .step with x .step (inj₂ y) .step
... | a , b = a , mmb b
entangleBi : IT (Sig A A ×ᵀ Sig B B) (union2mb (constᵀ A) (constᵀ B))
entangleBi .step (nothing , nothing) .step = nothing , λ where .step _ .step → (nothing , nothing) , entangleBi
entangleBi .step (just x , nothing) .step = just (inj₁ x) , λ where .step z .step → (nothing , just z) , entangleBi
entangleBi .step (nothing , just x) .step = just (inj₂ x) , λ where .step z .step → (just z , nothing) , entangleBi
entangleBi .step (just x , just y) .step = nothing , λ where .step _ .step → (nothing , nothing) , entangleBi
entangle : IT (Sig A C ×ᵀ Sig C B) (Sig A B)
entangle .step (a , c) .step = a , λ where .step b .step → (c , b) , entangle
enta : SP A B → IT (Sig A C ×ᵀ Sig C B) NoSig
enta x = entangle ∘ᵀ mkIT (maybefy x)
entaBi : Bi (constᵀ A) (constᵀ B) → IT (Sig A A ×ᵀ Sig B B) NoSig
entaBi x = entangleBi ∘ᵀ mkIT (mmb x)
---------------------------------------------------------------------
data Direction : Set where horizontal vertical : Direction
data Abled : Set where enabled disabled : Abled
data Validity : Set where valid invalid : Validity
variable fin : Fin _
variable vec : Vec _ _
variable checked : Bool
variable size : ℕ
variable name str : String
variable en : Abled
variable dir : Direction
variable val : Validity
oppositeᵉ : Abled → Abled
oppositeᵉ enabled = disabled
oppositeᵉ disabled = enabled
oppositeᵛ : Validity → Validity
oppositeᵛ valid = invalid
oppositeᵛ invalid = valid
isEnabled : I/O → Abled → Set
isEnabled I enabled = ⊤
isEnabled I disabled = ⊥
isEnabled O _ = ⊤
-- abstract widget
data Widget : Set where
Button : Abled → String → Widget
CheckBox : Abled → Bool → Widget
ComboBox : Abled → Vec String n → Fin n → Widget
Entry : Abled → (size : ℕ)(name contents : String) → Validity → Widget
Label : String → Widget
Empty : Widget
Container : Direction → Widget → Widget → Widget
variable w w₁ w₂ : Widget
isInput : Widget → Maybe (Abled × Widget)
isInput (Button e x) = just (e , Button (oppositeᵉ e) x)
isInput (CheckBox e x) = just (e , CheckBox (oppositeᵉ e) x)
isInput (ComboBox e ss i) = just (e , ComboBox (oppositeᵉ e) ss i)
isInput (Entry e n s s' v) = just (e , Entry (oppositeᵉ e) n s s' v)
isInput _ = nothing
isJust : Maybe A → Set
isJust = maybe ⊥ (λ _ → ⊤)
-- possible edits of a widget (I: by the user; O: by the program)
data WidgetEdit : I/O → Widget → Set
-- ⟪_⟫ performs the edit
⟪_⟫ : {d : I/O} {a : Widget} (p : WidgetEdit d a) → Widget
data WidgetEdit where
toggle : {_ : isEnabled i/o en} → WidgetEdit i/o (CheckBox en checked)
click : WidgetEdit I (Button enabled str)
setLabel : String → WidgetEdit O (Label str)
setEntry : {_ : isEnabled i/o en} → String → WidgetEdit i/o (Entry en size name str val)
select : {vec : Vec String n}{_ : isEnabled i/o en} → Fin n → WidgetEdit i/o (ComboBox en vec fin)
toggleEnable : {_ : isJust (isInput w)} → WidgetEdit O w
toggleValidity : WidgetEdit O (Entry en size name str val)
replaceBy : Widget → WidgetEdit O w
modLeft : WidgetEdit i/o w₁ → WidgetEdit i/o (Container dir w₁ w₂)
modRight : WidgetEdit i/o w₂ → WidgetEdit i/o (Container dir w₁ w₂)
addToLeft addToRight : Direction → Widget → WidgetEdit O w
removeLeft removeRight : WidgetEdit O (Container dir w₁ w₂)
_∙_ : (p : WidgetEdit O w) → WidgetEdit O ⟪ p ⟫ → WidgetEdit O w
⟪ replaceBy x ⟫ = x
⟪ modLeft {dir = dir} {w₂ = w₂} p ⟫ = Container dir ⟪ p ⟫ w₂
⟪ modRight {dir = dir} {w₁ = w₁} p ⟫ = Container dir w₁ ⟪ p ⟫
⟪ toggle {en = en} {checked} ⟫ = CheckBox en (not checked)
⟪ select {en = en} {vec = vec} fin ⟫ = ComboBox en vec fin
⟪ setEntry {_} {en} {size} {name} {_} {val} {_} str ⟫ = Entry en size name str val
⟪ toggleValidity {en} {size} {name} {str} {val} ⟫ = Entry en size name str (oppositeᵛ val)
⟪ click {s} ⟫ = Button enabled s
⟪ setLabel l ⟫ = Label l
⟪ toggleEnable {w} {e} ⟫ with isInput w | e
... | just (_ , w') | tt = w' -- note: the JS backend cannot erase 'e', maybe because of the pattern maching on tt here
... | nothing | ()
⟪ addToLeft {r} dir w ⟫ = Container dir w r
⟪ addToRight {l} dir w ⟫ = Container dir l w
⟪ removeLeft {w₂ = w₂} ⟫ = w₂
⟪ removeRight {w₁ = w₁} ⟫ = w₁
⟪ p ∙ q ⟫ = ⟪ q ⟫
---------------------------------------
pw : I/O → Widget → Tree
pw i/o w .Branch = Maybe (WidgetEdit i/o w)
pw i/o w .child e = pw (opposite i/o) (maybe w ⟪_⟫ e)
-- GUI component (reactive widget)
WComp' = λ i/o w p → ⟨ i/o ⟩ IT (pw i/o w) p
WComp = λ i/o w A B → WComp' i/o w (⟨ i/o ⟩ Sig A B)
WC = λ p → Σ Widget λ w → WComp' I w p
processMain : WC (Sig A B) → Agent O (pw O Empty)
processMain (w , x) .step = just (replaceBy w) , mapAgent {i/o = I} (x ∘ᵀ noInput ∘ᵀ noOutput) (arr id)
-- enforcing no input ⇒ no output
ease : WComp i/o w A B → WComp i/o w A B
ease {i/o = I} b .step nothing .step = nothing , λ where .step x .step → nothing , ease {i/o = I} b
ease {i/o = I} b .step (just z) .step with b .step (just z) .step
... | x , y = x , ease {i/o = O} y
ease {i/o = O} b .step x .step with b .step x .step
... | c , d = c , ease {i/o = I} d
ease' : WC (Sig A B) → WC (Sig A B)
ease' (_ , x) = _ , ease {i/o = I} x
_∘ʷ_ : WC p → IT p q → WC q
(_ , x) ∘ʷ y = (_ , x ∘ᵀ y)
----------------------------------------------------------
button : ∀ i/o → WComp i/o (Button enabled str) ⊤ ⊥
button I .step nothing .step = nothing , button O
button I .step (just click) .step = just _ , button O
button O .step _ .step = nothing , button I
button' : String → WC (OutSig ⊤)
button' s = _ , button {s} I
checkbox : ∀ i/o → WComp i/o (CheckBox enabled checked) Bool Bool
checkbox I .step nothing .step = nothing , checkbox O
checkbox {b} I .step (just toggle) .step = just (not b) , checkbox O
checkbox O .step nothing .step = nothing , checkbox I
checkbox {b} O .step (just b') .step with b == b'
... | true = nothing , checkbox I
... | false = just toggle , checkbox I
checkbox' : Bool → WC (BiSig Bool)
checkbox' b = _ , checkbox {b} I
comboBox : ∀ {vec : Vec String n} i/o → WComp i/o (ComboBox enabled vec fin) (Fin n) (Fin n)
comboBox I .step nothing .step = nothing , comboBox O
comboBox I .step (just (select i)) .step = just i , comboBox O
comboBox O .step nothing .step = nothing , comboBox I
comboBox O .step (just i) .step = just (select i) , comboBox I
comboBox' : (vec : Vec String n)(fin : Fin n) → WC (Sig (Fin n) (Fin n))
comboBox' vec fin = _ , comboBox {fin = fin}{vec = vec} I
label : ∀ i/o → WComp i/o (Label str) ⊥ String
label I .step nothing .step = nothing , label O
label I .step (just ())
label O .step nothing .step = nothing , label I
label O .step (just m) .step = just (setLabel m) , label I
label' : String → WC (InSig String)
label' n = _ , label {n} I
label'' = λ n → label' n -- ∘ʷ discard
-- todo: refactoring (use less cases)
entry : Bool → ∀ i/o → WComp' i/o (Entry en size name str val) (⟨ i/o ⟩ Sig String (Maybe String) ×ᵀ ⟨ i/o ⟩ Sig ⊥ ⊤)
entry _ I .step nothing .step = (nothing , nothing) , entry false O
entry _ I .step (just (setEntry s)) .step = (just s , nothing) , entry true O
entry {val = v} v' O .step (ii , td) .step with td | ii | v | v'
... | nothing | nothing | invalid | true = just toggleValidity , entry false I
... | nothing | just nothing | valid | _ = just toggleValidity , entry false I
... | nothing | just (just ss) | valid | _ = just (setEntry ss) , entry false I
... | nothing | just (just ss) | invalid | _ = just (setEntry ss ∙ toggleValidity) , entry false I
... | nothing | _ | _ | _ = nothing , entry false I
... | just _ | nothing | invalid | true = just (toggleEnable ∙ toggleValidity) , entry false I
... | just _ | just nothing | valid | _ = just (toggleEnable ∙ toggleValidity) , entry false I
... | just _ | just (just ss) | valid | _ = just (toggleEnable ∙ setEntry ss) , entry false I
... | just _ | just (just ss) | invalid | _ = just (toggleEnable ∙ setEntry ss ∙ toggleValidity) , entry false I
... | just _ | _ | _ | _ = just toggleEnable , entry false I
entryF : ℕ → Abled → String → WC (Sig String (Maybe String) ×ᵀ InSig ⊤)
entryF size en name = _ , entry {en} {size} {name} {""} {valid} false I
container' : ∀ i/o → WComp' i/o (Container dir w₁ w₂) (pw i/o w₁ ×ᵀ pw i/o w₂)
container' I .step nothing .step = (nothing , nothing) , container' O
container' I .step (just (modLeft e)) .step = (just e , nothing) , container' O
container' I .step (just (modRight e)) .step = (nothing , just e) , container' O
container' O .step (nothing , nothing) .step = nothing , container' I
container' O .step (just x , nothing) .step = just (modLeft x) , container' I
container' O .step (nothing , just y) .step = just (modRight y) , container' I
container' O .step (just x , just y) .step = just (modLeft x ∙ modRight y) , container' I
container : (dir : Direction) → WComp' I w₁ r → WComp' I w₂ s → WComp' I (Container dir w₁ w₂) (r ×ᵀ s)
container _ p q = container' I ∘ᵀ (p ,ᵗ q)
fc : Direction → WC p → WC (Sig C D) → WC p
fc dir (_ , b) (_ , d) = _ , container' {dir} I ∘ᵀ ({-ease {I}-} b ,ᵗ ease {i/o = I} d) ∘ᵀ fstSig
infixr 3 _<->_
infixr 4 _<|>_
_<|>_ : WC p → WC (Sig C D) → WC p
_<|>_ = fc horizontal
_<->_ : WC p → WC (Sig C D) → WC p
_<->_ = fc vertical
infix 5 _⟦_⟧_
_⟦_⟧_ : WC p → IT (p ×ᵀ q) r → WC q → WC r
(_ , b) ⟦ t ⟧ (_ , d) = _ , container' {horizontal} I ∘ᵀ (b ,ᵗ d) ∘ᵀ t
entry'' : Abled → ℕ → String → WC (Sig String (Maybe String) ×ᵀ InSig ⊤)
entry'' en len name = entryF len en name ⟦ fstSig ⟧ label' name
entry' = λ len name → entry'' enabled len name ∘ʷ fstSig
addLabel : String → WC p → WC p
addLabel s x = x ⟦ fstSig ⟧ label'' s
---------------------------------------------------------------------------------------------------------------
counter = λ n → label' (showNat n) ⟦ swapIT ∘ᵀ enta (arr (const 1) ∘ᵗ accum _+_ n ∘ᵗ arr showNat) ⟧ button' "Count"
counter' = λ f b n → checkbox' b ∘ʷ noInput ⟦ enta (arr f ∘ᵗ accum _+_ n ∘ᵗ arr showNat) ⟧ label' (showNat n)
floatEntry = λ s → entry' 4 s ∘ʷ prismIT floatPrism
dateEntry = λ en s → entry'' en 4 s ∘ʷ (prismIT floatPrism ,ᵗ idIT)
showDates : (Float × Float) → String
showDates (a , b) = primStringAppend (primShowFloat a) (primStringAppend " -- " (primShowFloat b))
main = processMain (
label' "count clicks:"
<|> counter 0
<-> label' "count checks:"
<|> counter' (if_then 1 else 0) false 0
<-> label' "count checks and unchecks:"
<|> counter' (const 1) false 0
<-> label' "count unchecks:"
<|> counter' (if_then 0 else 1) false 0
<-> label' "copy input to label:"
<|> entry' 10 "" ∘ʷ noInput ⟦ enta (arr id) ⟧ label' ""
<-> label' "converter:"
<|> floatEntry "Celsius" ⟦ entaBi (isoBi (mulIso 1.8) ∘ᵇ isoBi (plusIso 32.0)) ⟧ floatEntry "Fahrenheit"
<-> label' "flight booker (unfinished):"
<|> ((comboBox' ("one-way" ∷ "return" ∷ []) zero
⟦ (mkIT' (arr ( maybe nothing (const (just _)) -- mapMaybe (const _) cannot be used because Agda bug #3380
)) (arr id) ,ᵗ (assocIT {i/o = O} ∘ᵀ swapIT))
∘ᵀ assocIT {i/o = O}
∘ᵀ (swapIT ∘ᵀ entangle ,ᵗ joinSig {i/o = I} 0.0 0.0) ∘ᵀ (swapIT ∘ᵀ fstSig)
⟧
(dateEntry enabled "start date" ∘ʷ fstSig ⟦ idIT ⟧ dateEntry disabled "return date")) ∘ʷ noInput)
⟦ {-(isoIT (showDates) (const nothing) ,ᵗ idIT) ∘ᵀ entangle-} enta (arr showDates)
⟧
(label' "")
)
|
oeis/038/A038544.asm | neoneye/loda-programs | 11 | 27087 | <gh_stars>10-100
; A038544: a(n) = Sum_{i=0..10^n} i^3.
; 1,3025,25502500,250500250000,2500500025000000,25000500002500000000,250000500000250000000000,2500000500000025000000000000,25000000500000002500000000000000,250000000500000000250000000000000000,2500000000500000000025000000000000000000
mov $1,1
mov $2,10
pow $2,$0
add $1,$2
mul $1,$2
pow $1,2
mov $0,$1
div $0,4
|
oeis/053/A053116.asm | neoneye/loda-programs | 11 | 15954 | ; A053116: a(n) = ((9*n+10)(!^9))/10, related to A045756 ((9*n+1)(!^9) 9-factorials).
; 1,19,532,19684,905464,49800520,3187233280,232668029440,19078778414080,1736168835681280,173616883568128000,18924240308925952000,2233060356453262336000,283598665269564316672000,38569418476660747067392000,5592565679115808324771840000,861255114583834482014863360000,140384583677165020568422727680000,24146148392472383537768709160960000,4370452859037501420336136358133760000,830386043217125269863865908045414400000,165246822600207928702909315701037465600000,34371339100843249170205137665815792844800000
add $0,1
mov $1,2
mov $2,1
lpb $0
sub $0,1
add $2,9
mul $1,$2
lpe
mov $0,$1
div $0,20
|
3rdParties/src/nasm/nasm-2.15.02/travis/test/movnti.asm | blue3k/StormForge | 1 | 104366 | bits 16
movnti [si],eax
bits 32
movnti [esi],eax
bits 64
movnti [rsi],eax
movnti [rsi],rax
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_358.asm | ljhsiun2/medusa | 9 | 169047 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x1774b, %rsi
nop
nop
nop
nop
nop
sub %rax, %rax
movups (%rsi), %xmm0
vpextrq $0, %xmm0, %r12
nop
nop
nop
nop
nop
dec %rdx
lea addresses_A_ht+0xd3cf, %rsi
lea addresses_A_ht+0x11134, %rdi
nop
nop
xor $22361, %rbx
mov $92, %rcx
rep movsw
cmp %rdx, %rdx
lea addresses_WT_ht+0x1a86f, %rdx
dec %rsi
mov $0x6162636465666768, %rcx
movq %rcx, (%rdx)
nop
nop
add $56195, %rdx
lea addresses_A_ht+0x1b70f, %r12
nop
nop
nop
nop
inc %rax
movw $0x6162, (%r12)
nop
nop
nop
nop
sub $46873, %rdi
lea addresses_WT_ht+0x11a0f, %rdx
nop
nop
nop
nop
nop
add %rbx, %rbx
movb $0x61, (%rdx)
nop
nop
mfence
lea addresses_UC_ht+0x2a8f, %r12
nop
xor $45317, %rax
movw $0x6162, (%r12)
nop
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_normal_ht+0xfd9f, %rbx
nop
and $49617, %rcx
mov (%rbx), %si
dec %rsi
lea addresses_D_ht+0xad8f, %r12
nop
nop
nop
nop
sub $4454, %rdi
movb (%r12), %al
add $62325, %rdi
lea addresses_normal_ht+0xe98f, %rbx
nop
nop
nop
nop
add %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
movups %xmm2, (%rbx)
nop
add %rdi, %rdi
lea addresses_WT_ht+0xfd8f, %rcx
and %rax, %rax
mov (%rcx), %r12
nop
nop
cmp $13452, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0x4f9f, %rsi
lea addresses_WT+0x9dcb, %rdi
nop
nop
nop
nop
nop
inc %r12
mov $26, %rcx
rep movsw
nop
nop
add $31398, %rsi
// Faulty Load
lea addresses_RW+0x1f58f, %rsi
sub $20610, %r11
mov (%rsi), %r14w
lea oracles, %r12
and $0xff, %r14
shlq $12, %r14
mov (%r12,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_RW'}, 'dst': {'same': False, 'congruent': 2, 'type': 'addresses_WT'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
Calculator.g4 | ouyi/antlr4calc | 6 | 5794 | grammar Calculator;
expr: expr op=('*'|'/') expr # MulDiv
| expr op=('+'|'-') expr # AddSub
| INT # Int
| '('expr')' # Parens
;
INT: [0-9]+ ;
MUL: '*' ;
DIV: '/' ;
ADD: '+' ;
SUB: '-' ;
WS : [ \t\r\n]+ -> skip ;
|
cp.asm | desynilaaa/FPA5 | 0 | 165830 | <gh_stars>0
_cp: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
break;
}
close(fd);
return 1;
}
int main(int argc, char *argv[]){
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 53 push %ebx
e: 51 push %ecx
if(argc < 3){
f: 83 39 02 cmpl $0x2,(%ecx)
break;
}
close(fd);
return 1;
}
int main(int argc, char *argv[]){
12: 8b 59 04 mov 0x4(%ecx),%ebx
if(argc < 3){
15: 7f 13 jg 2a <main+0x2a>
printf(2, "CP require 2 arguments [src] [destination]\n");
17: 50 push %eax
18: 50 push %eax
19: 68 0c 0d 00 00 push $0xd0c
1e: 6a 02 push $0x2
20: e8 4b 09 00 00 call 970 <printf>
exit();
25: e8 f8 07 00 00 call 822 <exit>
}
if(strcmp(argv[1],"-R")==0){
2a: 50 push %eax
2b: 50 push %eax
2c: 68 b7 0d 00 00 push $0xdb7
31: ff 73 04 pushl 0x4(%ebx)
34: e8 d7 05 00 00 call 610 <strcmp>
39: 83 c4 10 add $0x10,%esp
3c: 85 c0 test %eax,%eax
3e: 75 1a jne 5a <main+0x5a>
if(cpAll(argv[2],argv[3],1)<1){
40: 50 push %eax
41: 6a 01 push $0x1
43: ff 73 0c pushl 0xc(%ebx)
46: ff 73 08 pushl 0x8(%ebx)
49: e8 e2 02 00 00 call 330 <cpAll>
4e: 83 c4 10 add $0x10,%esp
51: 85 c0 test %eax,%eax
53: 7e 6a jle bf <main+0xbf>
}else{
if(cpFile(argv[1],argv[2])<1){
printf(2,"Error copying file!\n");
}
}
exit();
55: e8 c8 07 00 00 call 822 <exit>
}
if(strcmp(argv[1],"-R")==0){
if(cpAll(argv[2],argv[3],1)<1){
printf(2,"Error performing cp -R operation!\n");
}
}else if(strcmp(argv[1],"*")==0){
5a: 50 push %eax
5b: 50 push %eax
5c: 68 ba 0d 00 00 push $0xdba
61: ff 73 04 pushl 0x4(%ebx)
64: e8 a7 05 00 00 call 610 <strcmp>
69: 83 c4 10 add $0x10,%esp
6c: 85 c0 test %eax,%eax
6e: 75 28 jne 98 <main+0x98>
if(cpAll(argv[2],argv[3],0)<1){
70: 50 push %eax
71: 6a 00 push $0x0
73: ff 73 0c pushl 0xc(%ebx)
76: ff 73 08 pushl 0x8(%ebx)
79: e8 b2 02 00 00 call 330 <cpAll>
7e: 83 c4 10 add $0x10,%esp
81: 85 c0 test %eax,%eax
83: 7f d0 jg 55 <main+0x55>
printf(2,"Error performing cp * operation!\n");
85: 51 push %ecx
86: 51 push %ecx
87: 68 5c 0d 00 00 push $0xd5c
8c: 6a 02 push $0x2
8e: e8 dd 08 00 00 call 970 <printf>
93: 83 c4 10 add $0x10,%esp
96: eb bd jmp 55 <main+0x55>
}
}else{
if(cpFile(argv[1],argv[2])<1){
98: 52 push %edx
99: 52 push %edx
9a: ff 73 08 pushl 0x8(%ebx)
9d: ff 73 04 pushl 0x4(%ebx)
a0: e8 7b 01 00 00 call 220 <cpFile>
a5: 83 c4 10 add $0x10,%esp
a8: 85 c0 test %eax,%eax
aa: 7f a9 jg 55 <main+0x55>
printf(2,"Error copying file!\n");
ac: 50 push %eax
ad: 50 push %eax
ae: 68 bc 0d 00 00 push $0xdbc
b3: 6a 02 push $0x2
b5: e8 b6 08 00 00 call 970 <printf>
ba: 83 c4 10 add $0x10,%esp
bd: eb 96 jmp 55 <main+0x55>
printf(2, "CP require 2 arguments [src] [destination]\n");
exit();
}
if(strcmp(argv[1],"-R")==0){
if(cpAll(argv[2],argv[3],1)<1){
printf(2,"Error performing cp -R operation!\n");
bf: 50 push %eax
c0: 50 push %eax
c1: 68 38 0d 00 00 push $0xd38
c6: 6a 02 push $0x2
c8: e8 a3 08 00 00 call 970 <printf>
cd: 83 c4 10 add $0x10,%esp
d0: eb 83 jmp 55 <main+0x55>
d2: 66 90 xchg %ax,%ax
d4: 66 90 xchg %ax,%ax
d6: 66 90 xchg %ax,%ax
d8: 66 90 xchg %ax,%ax
da: 66 90 xchg %ax,%ax
dc: 66 90 xchg %ax,%ax
de: 66 90 xchg %ax,%ax
000000e0 <strcats>:
#include "stat.h"
#include "user.h"
#include "fcntl.h"
#include "fs.h"
char* strcats(char* destination, char* source){
e0: 55 push %ebp
e1: 89 e5 mov %esp,%ebp
e3: 56 push %esi
e4: 53 push %ebx
e5: 8b 75 08 mov 0x8(%ebp),%esi
e8: 8b 5d 0c mov 0xc(%ebp),%ebx
int indexs = strlen(destination);
eb: 83 ec 0c sub $0xc,%esp
ee: 56 push %esi
ef: 83 c3 01 add $0x1,%ebx
f2: e8 69 05 00 00 call 660 <strlen>
int i;
for(i=0;source[i]!=' ';indexs++,i++){
f7: 0f b6 53 ff movzbl -0x1(%ebx),%edx
fb: 83 c4 10 add $0x10,%esp
fe: 01 f0 add %esi,%eax
100: 80 fa 20 cmp $0x20,%dl
103: 74 18 je 11d <strcats+0x3d>
105: 8d 76 00 lea 0x0(%esi),%esi
destination[indexs]=source[i];
108: 88 10 mov %dl,(%eax)
destination[indexs+1]='\0';
10a: c6 40 01 00 movb $0x0,0x1(%eax)
10e: 83 c3 01 add $0x1,%ebx
#include "fs.h"
char* strcats(char* destination, char* source){
int indexs = strlen(destination);
int i;
for(i=0;source[i]!=' ';indexs++,i++){
111: 0f b6 53 ff movzbl -0x1(%ebx),%edx
115: 83 c0 01 add $0x1,%eax
118: 80 fa 20 cmp $0x20,%dl
11b: 75 eb jne 108 <strcats+0x28>
destination[indexs]=source[i];
destination[indexs+1]='\0';
}
return destination;
}
11d: 8d 65 f8 lea -0x8(%ebp),%esp
120: 89 f0 mov %esi,%eax
122: 5b pop %ebx
123: 5e pop %esi
124: 5d pop %ebp
125: c3 ret
126: 8d 76 00 lea 0x0(%esi),%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000130 <strcat>:
char* strcat(char* s1, const char* s2){
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 53 push %ebx
134: 8b 45 08 mov 0x8(%ebp),%eax
137: 8b 5d 0c mov 0xc(%ebp),%ebx
char* b = s1;
while (*s1) ++s1;
13a: 80 38 00 cmpb $0x0,(%eax)
13d: 89 c2 mov %eax,%edx
13f: 74 28 je 169 <strcat+0x39>
141: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
148: 83 c2 01 add $0x1,%edx
14b: 80 3a 00 cmpb $0x0,(%edx)
14e: 75 f8 jne 148 <strcat+0x18>
while (*s2) *s1++ = *s2++;
150: 0f b6 0b movzbl (%ebx),%ecx
153: 84 c9 test %cl,%cl
155: 74 19 je 170 <strcat+0x40>
157: 89 f6 mov %esi,%esi
159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
160: 83 c2 01 add $0x1,%edx
163: 83 c3 01 add $0x1,%ebx
166: 88 4a ff mov %cl,-0x1(%edx)
169: 0f b6 0b movzbl (%ebx),%ecx
16c: 84 c9 test %cl,%cl
16e: 75 f0 jne 160 <strcat+0x30>
*s1 = 0;
170: c6 02 00 movb $0x0,(%edx)
return b;
}
173: 5b pop %ebx
174: 5d pop %ebp
175: c3 ret
176: 8d 76 00 lea 0x0(%esi),%esi
179: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000180 <fmtname>:
char* fmtname(char *path){
180: 55 push %ebp
181: 89 e5 mov %esp,%ebp
183: 56 push %esi
184: 53 push %ebx
185: 8b 5d 08 mov 0x8(%ebp),%ebx
static char buf[DIRSIZ+1];
char *p;
for(p=path+strlen(path); p >= path && *p != '/'; p--);
188: 83 ec 0c sub $0xc,%esp
18b: 53 push %ebx
18c: e8 cf 04 00 00 call 660 <strlen>
191: 83 c4 10 add $0x10,%esp
194: 01 d8 add %ebx,%eax
196: 73 0f jae 1a7 <fmtname+0x27>
198: eb 12 jmp 1ac <fmtname+0x2c>
19a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1a0: 83 e8 01 sub $0x1,%eax
1a3: 39 c3 cmp %eax,%ebx
1a5: 77 05 ja 1ac <fmtname+0x2c>
1a7: 80 38 2f cmpb $0x2f,(%eax)
1aa: 75 f4 jne 1a0 <fmtname+0x20>
p++;
1ac: 8d 58 01 lea 0x1(%eax),%ebx
if(strlen(p) >= DIRSIZ){
1af: 83 ec 0c sub $0xc,%esp
1b2: 53 push %ebx
1b3: e8 a8 04 00 00 call 660 <strlen>
1b8: 83 c4 10 add $0x10,%esp
1bb: 83 f8 0d cmp $0xd,%eax
1be: 77 4a ja 20a <fmtname+0x8a>
return p;
}
memmove(buf, p, strlen(p));
1c0: 83 ec 0c sub $0xc,%esp
1c3: 53 push %ebx
1c4: e8 97 04 00 00 call 660 <strlen>
1c9: 83 c4 0c add $0xc,%esp
1cc: 50 push %eax
1cd: 53 push %ebx
1ce: 68 90 11 00 00 push $0x1190
1d3: e8 18 06 00 00 call 7f0 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
1d8: 89 1c 24 mov %ebx,(%esp)
1db: e8 80 04 00 00 call 660 <strlen>
1e0: 89 1c 24 mov %ebx,(%esp)
1e3: 89 c6 mov %eax,%esi
return buf;
1e5: bb 90 11 00 00 mov $0x1190,%ebx
p++;
if(strlen(p) >= DIRSIZ){
return p;
}
memmove(buf, p, strlen(p));
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
1ea: e8 71 04 00 00 call 660 <strlen>
1ef: ba 0e 00 00 00 mov $0xe,%edx
1f4: 83 c4 0c add $0xc,%esp
1f7: 05 90 11 00 00 add $0x1190,%eax
1fc: 29 f2 sub %esi,%edx
1fe: 52 push %edx
1ff: 6a 20 push $0x20
201: 50 push %eax
202: e8 89 04 00 00 call 690 <memset>
return buf;
207: 83 c4 10 add $0x10,%esp
}
20a: 8d 65 f8 lea -0x8(%ebp),%esp
20d: 89 d8 mov %ebx,%eax
20f: 5b pop %ebx
210: 5e pop %esi
211: 5d pop %ebp
212: c3 ret
213: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000220 <cpFile>:
int cpFile(char* source, char* destination){
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 57 push %edi
224: 56 push %esi
225: 53 push %ebx
226: 81 ec 24 27 00 00 sub $0x2724,%esp
char bufs[10000];
int sourceFD, destinationFD, in,out;
if ((sourceFD = open(source, O_RDONLY)) < 0) {
22c: 6a 00 push $0x0
22e: ff 75 08 pushl 0x8(%ebp)
231: e8 2c 06 00 00 call 862 <open>
236: 83 c4 10 add $0x10,%esp
239: 85 c0 test %eax,%eax
23b: 89 c6 mov %eax,%esi
23d: 78 71 js 2b0 <cpFile+0x90>
printf(2, "CP cannot open source file %s\n", sourceFD);
return 0;
}
if ((destinationFD = open(destination, O_CREATE | O_WRONLY)) < 0) {
23f: 83 ec 08 sub $0x8,%esp
242: 8d 9d d8 d8 ff ff lea -0x2728(%ebp),%ebx
248: 68 01 02 00 00 push $0x201
24d: ff 75 0c pushl 0xc(%ebp)
250: e8 0d 06 00 00 call 862 <open>
255: 83 c4 10 add $0x10,%esp
258: 85 c0 test %eax,%eax
25a: 89 c7 mov %eax,%edi
25c: 79 14 jns 272 <cpFile+0x52>
25e: eb 6d jmp 2cd <cpFile+0xad>
return 0;
}
while ((in = read(sourceFD, bufs, sizeof(bufs))) > 0) {
//printf(1,"%c",in);
out = write(destinationFD, bufs, in);
260: 83 ec 04 sub $0x4,%esp
263: 50 push %eax
264: 53 push %ebx
265: 57 push %edi
266: e8 d7 05 00 00 call 842 <write>
if (out < 0){
26b: 83 c4 10 add $0x10,%esp
26e: 85 c0 test %eax,%eax
270: 78 16 js 288 <cpFile+0x68>
if ((destinationFD = open(destination, O_CREATE | O_WRONLY)) < 0) {
printf(2, "CP cannot create destination file %s\n", destinationFD);
return 0;
}
while ((in = read(sourceFD, bufs, sizeof(bufs))) > 0) {
272: 83 ec 04 sub $0x4,%esp
275: 68 10 27 00 00 push $0x2710
27a: 53 push %ebx
27b: 56 push %esi
27c: e8 b9 05 00 00 call 83a <read>
281: 83 c4 10 add $0x10,%esp
284: 85 c0 test %eax,%eax
286: 7f d8 jg 260 <cpFile+0x40>
if (out < 0){
break;
}
}
//printf(1,"END OF CP %d\n",in);
close(sourceFD);
288: 83 ec 0c sub $0xc,%esp
28b: 56 push %esi
28c: e8 b9 05 00 00 call 84a <close>
close(destinationFD);
291: 89 3c 24 mov %edi,(%esp)
294: e8 b1 05 00 00 call 84a <close>
return 1;
299: 83 c4 10 add $0x10,%esp
29c: b8 01 00 00 00 mov $0x1,%eax
}
2a1: 8d 65 f4 lea -0xc(%ebp),%esp
2a4: 5b pop %ebx
2a5: 5e pop %esi
2a6: 5f pop %edi
2a7: 5d pop %ebp
2a8: c3 ret
2a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int sourceFD, destinationFD, in,out;
if ((sourceFD = open(source, O_RDONLY)) < 0) {
printf(2, "CP cannot open source file %s\n", sourceFD);
2b0: 83 ec 04 sub $0x4,%esp
2b3: 50 push %eax
2b4: 68 90 0c 00 00 push $0xc90
2b9: 6a 02 push $0x2
2bb: e8 b0 06 00 00 call 970 <printf>
return 0;
2c0: 83 c4 10 add $0x10,%esp
}
//printf(1,"END OF CP %d\n",in);
close(sourceFD);
close(destinationFD);
return 1;
}
2c3: 8d 65 f4 lea -0xc(%ebp),%esp
if ((sourceFD = open(source, O_RDONLY)) < 0) {
printf(2, "CP cannot open source file %s\n", sourceFD);
return 0;
2c6: 31 c0 xor %eax,%eax
}
//printf(1,"END OF CP %d\n",in);
close(sourceFD);
close(destinationFD);
return 1;
}
2c8: 5b pop %ebx
2c9: 5e pop %esi
2ca: 5f pop %edi
2cb: 5d pop %ebp
2cc: c3 ret
if ((sourceFD = open(source, O_RDONLY)) < 0) {
printf(2, "CP cannot open source file %s\n", sourceFD);
return 0;
}
if ((destinationFD = open(destination, O_CREATE | O_WRONLY)) < 0) {
printf(2, "CP cannot create destination file %s\n", destinationFD);
2cd: 83 ec 04 sub $0x4,%esp
2d0: 50 push %eax
2d1: 68 b0 0c 00 00 push $0xcb0
2d6: 6a 02 push $0x2
2d8: e8 93 06 00 00 call 970 <printf>
return 0;
2dd: 83 c4 10 add $0x10,%esp
2e0: 31 c0 xor %eax,%eax
2e2: eb bd jmp 2a1 <cpFile+0x81>
2e4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2ea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000002f0 <cpHardLink>:
//printf(1,"END OF CP %d\n",in);
close(sourceFD);
close(destinationFD);
return 1;
}
int cpHardLink (char* source, char* destination){
2f0: 55 push %ebp
2f1: 89 e5 mov %esp,%ebp
2f3: 56 push %esi
2f4: 53 push %ebx
2f5: 8b 75 0c mov 0xc(%ebp),%esi
2f8: 8b 5d 08 mov 0x8(%ebp),%ebx
if(link(source,destination)){
2fb: 83 ec 08 sub $0x8,%esp
2fe: 56 push %esi
2ff: 53 push %ebx
300: e8 7d 05 00 00 call 882 <link>
305: 83 c4 10 add $0x10,%esp
308: 85 c0 test %eax,%eax
30a: ba 01 00 00 00 mov $0x1,%edx
30f: 74 13 je 324 <cpHardLink+0x34>
printf(1,"cp failed to perform copy operation from %s to %s\n",source,destination);
311: 56 push %esi
312: 53 push %ebx
313: 68 d8 0c 00 00 push $0xcd8
318: 6a 01 push $0x1
31a: e8 51 06 00 00 call 970 <printf>
31f: 83 c4 10 add $0x10,%esp
322: 31 d2 xor %edx,%edx
return 0;
}
return 1;
}
324: 8d 65 f8 lea -0x8(%ebp),%esp
327: 89 d0 mov %edx,%eax
329: 5b pop %ebx
32a: 5e pop %esi
32b: 5d pop %ebp
32c: c3 ret
32d: 8d 76 00 lea 0x0(%esi),%esi
00000330 <cpAll>:
int cpAll(char* source, char* destination, int mode){
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 57 push %edi
334: 56 push %esi
335: 53 push %ebx
336: 81 ec 38 06 00 00 sub $0x638,%esp
char buf[512], *p,tempDes[1000];
int fd;
struct dirent de;
struct stat st;
mkdir(destination);
33c: ff 75 0c pushl 0xc(%ebp)
printf(1,"cp failed to perform copy operation from %s to %s\n",source,destination);
return 0;
}
return 1;
}
int cpAll(char* source, char* destination, int mode){
33f: 8b 75 08 mov 0x8(%ebp),%esi
char buf[512], *p,tempDes[1000];
int fd;
struct dirent de;
struct stat st;
mkdir(destination);
342: e8 43 05 00 00 call 88a <mkdir>
chdir(destination);
347: 58 pop %eax
348: ff 75 0c pushl 0xc(%ebp)
34b: e8 42 05 00 00 call 892 <chdir>
if((fd = open(source, 0)) < 0){
350: 58 pop %eax
351: 5a pop %edx
352: 6a 00 push $0x0
354: 56 push %esi
355: e8 08 05 00 00 call 862 <open>
35a: 83 c4 10 add $0x10,%esp
35d: 85 c0 test %eax,%eax
35f: 0f 88 1b 02 00 00 js 580 <cpAll+0x250>
365: 89 c3 mov %eax,%ebx
printf(2, "cp: cannot open %s\n", source);
return 0;
}
if(fstat(fd, &st) < 0){
367: 8d 85 ec f9 ff ff lea -0x614(%ebp),%eax
36d: 83 ec 08 sub $0x8,%esp
370: 50 push %eax
371: 53 push %ebx
372: e8 03 05 00 00 call 87a <fstat>
377: 83 c4 10 add $0x10,%esp
37a: 85 c0 test %eax,%eax
37c: 0f 88 1e 02 00 00 js 5a0 <cpAll+0x270>
printf(2, "cp: cannot stat %s\n", source);
close(fd);
return 0;
}
switch(st.type){
382: 0f b7 85 ec f9 ff ff movzwl -0x614(%ebp),%eax
389: 66 83 f8 01 cmp $0x1,%ax
38d: 74 31 je 3c0 <cpAll+0x90>
38f: 66 83 f8 02 cmp $0x2,%ax
393: 75 12 jne 3a7 <cpAll+0x77>
case T_FILE:
printf(2, "CP fail!\n");
395: 83 ec 08 sub $0x8,%esp
398: 68 a8 0d 00 00 push $0xda8
39d: 6a 02 push $0x2
39f: e8 cc 05 00 00 call 970 <printf>
break;
3a4: 83 c4 10 add $0x10,%esp
cpAll(buf,tempDes,mode);
}
}
break;
}
close(fd);
3a7: 83 ec 0c sub $0xc,%esp
3aa: 53 push %ebx
3ab: e8 9a 04 00 00 call 84a <close>
return 1;
3b0: 83 c4 10 add $0x10,%esp
3b3: b8 01 00 00 00 mov $0x1,%eax
}
3b8: 8d 65 f4 lea -0xc(%ebp),%esp
3bb: 5b pop %ebx
3bc: 5e pop %esi
3bd: 5f pop %edi
3be: 5d pop %ebp
3bf: c3 ret
switch(st.type){
case T_FILE:
printf(2, "CP fail!\n");
break;
case T_DIR:
strcpy(buf, source);
3c0: 8d bd 00 fa ff ff lea -0x600(%ebp),%edi
3c6: 83 ec 08 sub $0x8,%esp
3c9: 56 push %esi
3ca: 8d b5 dc f9 ff ff lea -0x624(%ebp),%esi
3d0: 57 push %edi
3d1: e8 0a 02 00 00 call 5e0 <strcpy>
p = buf+strlen(buf);
3d6: 89 3c 24 mov %edi,(%esp)
3d9: e8 82 02 00 00 call 660 <strlen>
3de: 8d 14 07 lea (%edi,%eax,1),%edx
*p++ = '/';
3e1: 8d 44 07 01 lea 0x1(%edi,%eax,1),%eax
while(read(fd, &de, sizeof(de)) == sizeof(de)){
3e5: 83 c4 10 add $0x10,%esp
case T_FILE:
printf(2, "CP fail!\n");
break;
case T_DIR:
strcpy(buf, source);
p = buf+strlen(buf);
3e8: 89 95 d0 f9 ff ff mov %edx,-0x630(%ebp)
*p++ = '/';
3ee: 89 85 cc f9 ff ff mov %eax,-0x634(%ebp)
3f4: c6 02 2f movb $0x2f,(%edx)
3f7: 89 f6 mov %esi,%esi
3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while(read(fd, &de, sizeof(de)) == sizeof(de)){
400: 83 ec 04 sub $0x4,%esp
403: 6a 10 push $0x10
405: 56 push %esi
406: 53 push %ebx
407: e8 2e 04 00 00 call 83a <read>
40c: 83 c4 10 add $0x10,%esp
40f: 83 f8 10 cmp $0x10,%eax
412: 75 93 jne 3a7 <cpAll+0x77>
if(de.inum == 0)
414: 66 83 bd dc f9 ff ff cmpw $0x0,-0x624(%ebp)
41b: 00
41c: 74 e2 je 400 <cpAll+0xd0>
continue;
memmove(p, de.name, DIRSIZ);
41e: 8d 85 de f9 ff ff lea -0x622(%ebp),%eax
424: 83 ec 04 sub $0x4,%esp
427: 6a 0e push $0xe
429: 50 push %eax
42a: ff b5 cc f9 ff ff pushl -0x634(%ebp)
430: e8 bb 03 00 00 call 7f0 <memmove>
p[DIRSIZ] = 0;
435: 8b 85 d0 f9 ff ff mov -0x630(%ebp),%eax
43b: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
43f: 59 pop %ecx
440: 58 pop %eax
441: 8d 85 ec f9 ff ff lea -0x614(%ebp),%eax
447: 50 push %eax
448: 57 push %edi
449: e8 12 03 00 00 call 760 <stat>
44e: 83 c4 10 add $0x10,%esp
451: 85 c0 test %eax,%eax
453: 0f 88 07 01 00 00 js 560 <cpAll+0x230>
printf(2, "cp: cannot stat %s\n", buf);
continue;
}
//printf(1, "%s %d %d %d %s\n", fmtname(buf), st.type, st.ino, st.size, buf);
char *temp = fmtname(buf);
459: 83 ec 0c sub $0xc,%esp
45c: 57 push %edi
45d: e8 1e fd ff ff call 180 <fmtname>
//printf(1,"%d %d %s\n",strcmp(temp,"."),strcmp(temp,".."),temp);
if(strcmp(temp,".")==32 || strcmp(temp,"..")==-14 || strcmp(temp,".")==46 || strcmp(temp,"..")==32){
462: 59 pop %ecx
463: 5a pop %edx
464: 68 b3 0d 00 00 push $0xdb3
469: 50 push %eax
46a: 89 85 d4 f9 ff ff mov %eax,-0x62c(%ebp)
470: e8 9b 01 00 00 call 610 <strcmp>
475: 83 c4 10 add $0x10,%esp
478: 83 f8 20 cmp $0x20,%eax
47b: 74 83 je 400 <cpAll+0xd0>
47d: 83 ec 08 sub $0x8,%esp
480: 68 b2 0d 00 00 push $0xdb2
485: ff b5 d4 f9 ff ff pushl -0x62c(%ebp)
48b: e8 80 01 00 00 call 610 <strcmp>
490: 83 c4 10 add $0x10,%esp
493: 83 f8 f2 cmp $0xfffffff2,%eax
496: 0f 84 64 ff ff ff je 400 <cpAll+0xd0>
49c: 83 ec 08 sub $0x8,%esp
49f: 68 b3 0d 00 00 push $0xdb3
4a4: ff b5 d4 f9 ff ff pushl -0x62c(%ebp)
4aa: e8 61 01 00 00 call 610 <strcmp>
4af: 83 c4 10 add $0x10,%esp
4b2: 83 f8 2e cmp $0x2e,%eax
4b5: 0f 84 45 ff ff ff je 400 <cpAll+0xd0>
4bb: 83 ec 08 sub $0x8,%esp
4be: 68 b2 0d 00 00 push $0xdb2
4c3: ff b5 d4 f9 ff ff pushl -0x62c(%ebp)
4c9: e8 42 01 00 00 call 610 <strcmp>
4ce: 83 c4 10 add $0x10,%esp
4d1: 83 f8 20 cmp $0x20,%eax
4d4: 0f 84 26 ff ff ff je 400 <cpAll+0xd0>
//printf(1,"Skipped %s\n",temp);
continue;
}
printf(1,"%s\n",buf);
4da: 83 ec 04 sub $0x4,%esp
4dd: 57 push %edi
4de: 68 90 0d 00 00 push $0xd90
4e3: 6a 01 push $0x1
4e5: e8 86 04 00 00 call 970 <printf>
strcpy(tempDes,destination);
4ea: 58 pop %eax
4eb: 8d 8d 00 fc ff ff lea -0x400(%ebp),%ecx
4f1: 5a pop %edx
4f2: ff 75 0c pushl 0xc(%ebp)
4f5: 51 push %ecx
4f6: e8 e5 00 00 00 call 5e0 <strcpy>
strcats(tempDes,"/");
4fb: 59 pop %ecx
4fc: 8d 8d 00 fc ff ff lea -0x400(%ebp),%ecx
502: 58 pop %eax
503: 68 b5 0d 00 00 push $0xdb5
508: 51 push %ecx
509: e8 d2 fb ff ff call e0 <strcats>
strcats(tempDes,temp);
50e: 58 pop %eax
50f: 8d 85 00 fc ff ff lea -0x400(%ebp),%eax
515: 5a pop %edx
516: ff b5 d4 f9 ff ff pushl -0x62c(%ebp)
51c: 50 push %eax
51d: e8 be fb ff ff call e0 <strcats>
//printf(1,"%s\n",tempDes);
if(st.type == T_FILE){
522: 83 c4 10 add $0x10,%esp
525: 66 83 bd ec f9 ff ff cmpw $0x2,-0x614(%ebp)
52c: 02
52d: 0f 84 8f 00 00 00 je 5c2 <cpAll+0x292>
//cpFile(buf,tempDes);
cpHardLink(buf,tempDes);
}else if(mode == 1){
533: 83 7d 10 01 cmpl $0x1,0x10(%ebp)
537: 0f 85 c3 fe ff ff jne 400 <cpAll+0xd0>
cpAll(buf,tempDes,mode);
53d: 8d 85 00 fc ff ff lea -0x400(%ebp),%eax
543: 83 ec 04 sub $0x4,%esp
546: 6a 01 push $0x1
548: 50 push %eax
549: 57 push %edi
54a: e8 e1 fd ff ff call 330 <cpAll>
54f: 83 c4 10 add $0x10,%esp
552: e9 a9 fe ff ff jmp 400 <cpAll+0xd0>
557: 89 f6 mov %esi,%esi
559: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(de.inum == 0)
continue;
memmove(p, de.name, DIRSIZ);
p[DIRSIZ] = 0;
if(stat(buf, &st) < 0){
printf(2, "cp: cannot stat %s\n", buf);
560: 83 ec 04 sub $0x4,%esp
563: 57 push %edi
564: 68 94 0d 00 00 push $0xd94
569: 6a 02 push $0x2
56b: e8 00 04 00 00 call 970 <printf>
continue;
570: 83 c4 10 add $0x10,%esp
573: e9 88 fe ff ff jmp 400 <cpAll+0xd0>
578: 90 nop
579: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
struct dirent de;
struct stat st;
mkdir(destination);
chdir(destination);
if((fd = open(source, 0)) < 0){
printf(2, "cp: cannot open %s\n", source);
580: 83 ec 04 sub $0x4,%esp
583: 56 push %esi
584: 68 80 0d 00 00 push $0xd80
589: 6a 02 push $0x2
58b: e8 e0 03 00 00 call 970 <printf>
return 0;
590: 83 c4 10 add $0x10,%esp
}
break;
}
close(fd);
return 1;
}
593: 8d 65 f4 lea -0xc(%ebp),%esp
struct stat st;
mkdir(destination);
chdir(destination);
if((fd = open(source, 0)) < 0){
printf(2, "cp: cannot open %s\n", source);
return 0;
596: 31 c0 xor %eax,%eax
}
break;
}
close(fd);
return 1;
}
598: 5b pop %ebx
599: 5e pop %esi
59a: 5f pop %edi
59b: 5d pop %ebp
59c: c3 ret
59d: 8d 76 00 lea 0x0(%esi),%esi
printf(2, "cp: cannot open %s\n", source);
return 0;
}
if(fstat(fd, &st) < 0){
printf(2, "cp: cannot stat %s\n", source);
5a0: 83 ec 04 sub $0x4,%esp
5a3: 56 push %esi
5a4: 68 94 0d 00 00 push $0xd94
5a9: 6a 02 push $0x2
5ab: e8 c0 03 00 00 call 970 <printf>
close(fd);
5b0: 89 1c 24 mov %ebx,(%esp)
5b3: e8 92 02 00 00 call 84a <close>
return 0;
5b8: 83 c4 10 add $0x10,%esp
5bb: 31 c0 xor %eax,%eax
5bd: e9 f6 fd ff ff jmp 3b8 <cpAll+0x88>
strcats(tempDes,"/");
strcats(tempDes,temp);
//printf(1,"%s\n",tempDes);
if(st.type == T_FILE){
//cpFile(buf,tempDes);
cpHardLink(buf,tempDes);
5c2: 8d 85 00 fc ff ff lea -0x400(%ebp),%eax
5c8: 83 ec 08 sub $0x8,%esp
5cb: 50 push %eax
5cc: 57 push %edi
5cd: e8 1e fd ff ff call 2f0 <cpHardLink>
5d2: 83 c4 10 add $0x10,%esp
5d5: e9 26 fe ff ff jmp 400 <cpAll+0xd0>
5da: 66 90 xchg %ax,%ax
5dc: 66 90 xchg %ax,%ax
5de: 66 90 xchg %ax,%ax
000005e0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
5e0: 55 push %ebp
5e1: 89 e5 mov %esp,%ebp
5e3: 53 push %ebx
5e4: 8b 45 08 mov 0x8(%ebp),%eax
5e7: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
5ea: 89 c2 mov %eax,%edx
5ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
5f0: 83 c1 01 add $0x1,%ecx
5f3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
5f7: 83 c2 01 add $0x1,%edx
5fa: 84 db test %bl,%bl
5fc: 88 5a ff mov %bl,-0x1(%edx)
5ff: 75 ef jne 5f0 <strcpy+0x10>
;
return os;
}
601: 5b pop %ebx
602: 5d pop %ebp
603: c3 ret
604: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
60a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000610 <strcmp>:
int
strcmp(const char *p, const char *q)
{
610: 55 push %ebp
611: 89 e5 mov %esp,%ebp
613: 56 push %esi
614: 53 push %ebx
615: 8b 55 08 mov 0x8(%ebp),%edx
618: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
61b: 0f b6 02 movzbl (%edx),%eax
61e: 0f b6 19 movzbl (%ecx),%ebx
621: 84 c0 test %al,%al
623: 75 1e jne 643 <strcmp+0x33>
625: eb 29 jmp 650 <strcmp+0x40>
627: 89 f6 mov %esi,%esi
629: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
630: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
633: 0f b6 02 movzbl (%edx),%eax
p++, q++;
636: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
639: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
63d: 84 c0 test %al,%al
63f: 74 0f je 650 <strcmp+0x40>
641: 89 f1 mov %esi,%ecx
643: 38 d8 cmp %bl,%al
645: 74 e9 je 630 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
647: 29 d8 sub %ebx,%eax
}
649: 5b pop %ebx
64a: 5e pop %esi
64b: 5d pop %ebp
64c: c3 ret
64d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
650: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
652: 29 d8 sub %ebx,%eax
}
654: 5b pop %ebx
655: 5e pop %esi
656: 5d pop %ebp
657: c3 ret
658: 90 nop
659: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000660 <strlen>:
uint
strlen(char *s)
{
660: 55 push %ebp
661: 89 e5 mov %esp,%ebp
663: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
666: 80 39 00 cmpb $0x0,(%ecx)
669: 74 12 je 67d <strlen+0x1d>
66b: 31 d2 xor %edx,%edx
66d: 8d 76 00 lea 0x0(%esi),%esi
670: 83 c2 01 add $0x1,%edx
673: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
677: 89 d0 mov %edx,%eax
679: 75 f5 jne 670 <strlen+0x10>
;
return n;
}
67b: 5d pop %ebp
67c: c3 ret
uint
strlen(char *s)
{
int n;
for(n = 0; s[n]; n++)
67d: 31 c0 xor %eax,%eax
;
return n;
}
67f: 5d pop %ebp
680: c3 ret
681: eb 0d jmp 690 <memset>
683: 90 nop
684: 90 nop
685: 90 nop
686: 90 nop
687: 90 nop
688: 90 nop
689: 90 nop
68a: 90 nop
68b: 90 nop
68c: 90 nop
68d: 90 nop
68e: 90 nop
68f: 90 nop
00000690 <memset>:
void*
memset(void *dst, int c, uint n)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
697: 8b 4d 10 mov 0x10(%ebp),%ecx
69a: 8b 45 0c mov 0xc(%ebp),%eax
69d: 89 d7 mov %edx,%edi
69f: fc cld
6a0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
6a2: 89 d0 mov %edx,%eax
6a4: 5f pop %edi
6a5: 5d pop %ebp
6a6: c3 ret
6a7: 89 f6 mov %esi,%esi
6a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000006b0 <strchr>:
char*
strchr(const char *s, char c)
{
6b0: 55 push %ebp
6b1: 89 e5 mov %esp,%ebp
6b3: 53 push %ebx
6b4: 8b 45 08 mov 0x8(%ebp),%eax
6b7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
6ba: 0f b6 10 movzbl (%eax),%edx
6bd: 84 d2 test %dl,%dl
6bf: 74 1d je 6de <strchr+0x2e>
if(*s == c)
6c1: 38 d3 cmp %dl,%bl
6c3: 89 d9 mov %ebx,%ecx
6c5: 75 0d jne 6d4 <strchr+0x24>
6c7: eb 17 jmp 6e0 <strchr+0x30>
6c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
6d0: 38 ca cmp %cl,%dl
6d2: 74 0c je 6e0 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
6d4: 83 c0 01 add $0x1,%eax
6d7: 0f b6 10 movzbl (%eax),%edx
6da: 84 d2 test %dl,%dl
6dc: 75 f2 jne 6d0 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
6de: 31 c0 xor %eax,%eax
}
6e0: 5b pop %ebx
6e1: 5d pop %ebp
6e2: c3 ret
6e3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
6e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000006f0 <gets>:
char*
gets(char *buf, int max)
{
6f0: 55 push %ebp
6f1: 89 e5 mov %esp,%ebp
6f3: 57 push %edi
6f4: 56 push %esi
6f5: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
6f6: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
6f8: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
6fb: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
6fe: eb 29 jmp 729 <gets+0x39>
cc = read(0, &c, 1);
700: 83 ec 04 sub $0x4,%esp
703: 6a 01 push $0x1
705: 57 push %edi
706: 6a 00 push $0x0
708: e8 2d 01 00 00 call 83a <read>
if(cc < 1)
70d: 83 c4 10 add $0x10,%esp
710: 85 c0 test %eax,%eax
712: 7e 1d jle 731 <gets+0x41>
break;
buf[i++] = c;
714: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
718: 8b 55 08 mov 0x8(%ebp),%edx
71b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
71d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
71f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
723: 74 1b je 740 <gets+0x50>
725: 3c 0d cmp $0xd,%al
727: 74 17 je 740 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
729: 8d 5e 01 lea 0x1(%esi),%ebx
72c: 3b 5d 0c cmp 0xc(%ebp),%ebx
72f: 7c cf jl 700 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
731: 8b 45 08 mov 0x8(%ebp),%eax
734: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
738: 8d 65 f4 lea -0xc(%ebp),%esp
73b: 5b pop %ebx
73c: 5e pop %esi
73d: 5f pop %edi
73e: 5d pop %ebp
73f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
740: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
743: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
745: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
749: 8d 65 f4 lea -0xc(%ebp),%esp
74c: 5b pop %ebx
74d: 5e pop %esi
74e: 5f pop %edi
74f: 5d pop %ebp
750: c3 ret
751: eb 0d jmp 760 <stat>
753: 90 nop
754: 90 nop
755: 90 nop
756: 90 nop
757: 90 nop
758: 90 nop
759: 90 nop
75a: 90 nop
75b: 90 nop
75c: 90 nop
75d: 90 nop
75e: 90 nop
75f: 90 nop
00000760 <stat>:
int
stat(char *n, struct stat *st)
{
760: 55 push %ebp
761: 89 e5 mov %esp,%ebp
763: 56 push %esi
764: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
765: 83 ec 08 sub $0x8,%esp
768: 6a 00 push $0x0
76a: ff 75 08 pushl 0x8(%ebp)
76d: e8 f0 00 00 00 call 862 <open>
if(fd < 0)
772: 83 c4 10 add $0x10,%esp
775: 85 c0 test %eax,%eax
777: 78 27 js 7a0 <stat+0x40>
return -1;
r = fstat(fd, st);
779: 83 ec 08 sub $0x8,%esp
77c: ff 75 0c pushl 0xc(%ebp)
77f: 89 c3 mov %eax,%ebx
781: 50 push %eax
782: e8 f3 00 00 00 call 87a <fstat>
787: 89 c6 mov %eax,%esi
close(fd);
789: 89 1c 24 mov %ebx,(%esp)
78c: e8 b9 00 00 00 call 84a <close>
return r;
791: 83 c4 10 add $0x10,%esp
794: 89 f0 mov %esi,%eax
}
796: 8d 65 f8 lea -0x8(%ebp),%esp
799: 5b pop %ebx
79a: 5e pop %esi
79b: 5d pop %ebp
79c: c3 ret
79d: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
7a0: b8 ff ff ff ff mov $0xffffffff,%eax
7a5: eb ef jmp 796 <stat+0x36>
7a7: 89 f6 mov %esi,%esi
7a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000007b0 <atoi>:
return r;
}
int
atoi(const char *s)
{
7b0: 55 push %ebp
7b1: 89 e5 mov %esp,%ebp
7b3: 53 push %ebx
7b4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
7b7: 0f be 11 movsbl (%ecx),%edx
7ba: 8d 42 d0 lea -0x30(%edx),%eax
7bd: 3c 09 cmp $0x9,%al
7bf: b8 00 00 00 00 mov $0x0,%eax
7c4: 77 1f ja 7e5 <atoi+0x35>
7c6: 8d 76 00 lea 0x0(%esi),%esi
7c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
7d0: 8d 04 80 lea (%eax,%eax,4),%eax
7d3: 83 c1 01 add $0x1,%ecx
7d6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
7da: 0f be 11 movsbl (%ecx),%edx
7dd: 8d 5a d0 lea -0x30(%edx),%ebx
7e0: 80 fb 09 cmp $0x9,%bl
7e3: 76 eb jbe 7d0 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
7e5: 5b pop %ebx
7e6: 5d pop %ebp
7e7: c3 ret
7e8: 90 nop
7e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000007f0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
7f0: 55 push %ebp
7f1: 89 e5 mov %esp,%ebp
7f3: 56 push %esi
7f4: 53 push %ebx
7f5: 8b 5d 10 mov 0x10(%ebp),%ebx
7f8: 8b 45 08 mov 0x8(%ebp),%eax
7fb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
7fe: 85 db test %ebx,%ebx
800: 7e 14 jle 816 <memmove+0x26>
802: 31 d2 xor %edx,%edx
804: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
808: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
80c: 88 0c 10 mov %cl,(%eax,%edx,1)
80f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
812: 39 da cmp %ebx,%edx
814: 75 f2 jne 808 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
816: 5b pop %ebx
817: 5e pop %esi
818: 5d pop %ebp
819: c3 ret
0000081a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
81a: b8 01 00 00 00 mov $0x1,%eax
81f: cd 40 int $0x40
821: c3 ret
00000822 <exit>:
SYSCALL(exit)
822: b8 02 00 00 00 mov $0x2,%eax
827: cd 40 int $0x40
829: c3 ret
0000082a <wait>:
SYSCALL(wait)
82a: b8 03 00 00 00 mov $0x3,%eax
82f: cd 40 int $0x40
831: c3 ret
00000832 <pipe>:
SYSCALL(pipe)
832: b8 04 00 00 00 mov $0x4,%eax
837: cd 40 int $0x40
839: c3 ret
0000083a <read>:
SYSCALL(read)
83a: b8 05 00 00 00 mov $0x5,%eax
83f: cd 40 int $0x40
841: c3 ret
00000842 <write>:
SYSCALL(write)
842: b8 10 00 00 00 mov $0x10,%eax
847: cd 40 int $0x40
849: c3 ret
0000084a <close>:
SYSCALL(close)
84a: b8 15 00 00 00 mov $0x15,%eax
84f: cd 40 int $0x40
851: c3 ret
00000852 <kill>:
SYSCALL(kill)
852: b8 06 00 00 00 mov $0x6,%eax
857: cd 40 int $0x40
859: c3 ret
0000085a <exec>:
SYSCALL(exec)
85a: b8 07 00 00 00 mov $0x7,%eax
85f: cd 40 int $0x40
861: c3 ret
00000862 <open>:
SYSCALL(open)
862: b8 0f 00 00 00 mov $0xf,%eax
867: cd 40 int $0x40
869: c3 ret
0000086a <mknod>:
SYSCALL(mknod)
86a: b8 11 00 00 00 mov $0x11,%eax
86f: cd 40 int $0x40
871: c3 ret
00000872 <unlink>:
SYSCALL(unlink)
872: b8 12 00 00 00 mov $0x12,%eax
877: cd 40 int $0x40
879: c3 ret
0000087a <fstat>:
SYSCALL(fstat)
87a: b8 08 00 00 00 mov $0x8,%eax
87f: cd 40 int $0x40
881: c3 ret
00000882 <link>:
SYSCALL(link)
882: b8 13 00 00 00 mov $0x13,%eax
887: cd 40 int $0x40
889: c3 ret
0000088a <mkdir>:
SYSCALL(mkdir)
88a: b8 14 00 00 00 mov $0x14,%eax
88f: cd 40 int $0x40
891: c3 ret
00000892 <chdir>:
SYSCALL(chdir)
892: b8 09 00 00 00 mov $0x9,%eax
897: cd 40 int $0x40
899: c3 ret
0000089a <dup>:
SYSCALL(dup)
89a: b8 0a 00 00 00 mov $0xa,%eax
89f: cd 40 int $0x40
8a1: c3 ret
000008a2 <getpid>:
SYSCALL(getpid)
8a2: b8 0b 00 00 00 mov $0xb,%eax
8a7: cd 40 int $0x40
8a9: c3 ret
000008aa <sbrk>:
SYSCALL(sbrk)
8aa: b8 0c 00 00 00 mov $0xc,%eax
8af: cd 40 int $0x40
8b1: c3 ret
000008b2 <sleep>:
SYSCALL(sleep)
8b2: b8 0d 00 00 00 mov $0xd,%eax
8b7: cd 40 int $0x40
8b9: c3 ret
000008ba <uptime>:
SYSCALL(uptime)
8ba: b8 0e 00 00 00 mov $0xe,%eax
8bf: cd 40 int $0x40
8c1: c3 ret
8c2: 66 90 xchg %ax,%ax
8c4: 66 90 xchg %ax,%ax
8c6: 66 90 xchg %ax,%ax
8c8: 66 90 xchg %ax,%ax
8ca: 66 90 xchg %ax,%ax
8cc: 66 90 xchg %ax,%ax
8ce: 66 90 xchg %ax,%ax
000008d0 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
8d0: 55 push %ebp
8d1: 89 e5 mov %esp,%ebp
8d3: 57 push %edi
8d4: 56 push %esi
8d5: 53 push %ebx
8d6: 89 c6 mov %eax,%esi
8d8: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
8db: 8b 5d 08 mov 0x8(%ebp),%ebx
8de: 85 db test %ebx,%ebx
8e0: 74 7e je 960 <printint+0x90>
8e2: 89 d0 mov %edx,%eax
8e4: c1 e8 1f shr $0x1f,%eax
8e7: 84 c0 test %al,%al
8e9: 74 75 je 960 <printint+0x90>
neg = 1;
x = -xx;
8eb: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
8ed: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
8f4: f7 d8 neg %eax
8f6: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
8f9: 31 ff xor %edi,%edi
8fb: 8d 5d d7 lea -0x29(%ebp),%ebx
8fe: 89 ce mov %ecx,%esi
900: eb 08 jmp 90a <printint+0x3a>
902: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
908: 89 cf mov %ecx,%edi
90a: 31 d2 xor %edx,%edx
90c: 8d 4f 01 lea 0x1(%edi),%ecx
90f: f7 f6 div %esi
911: 0f b6 92 d8 0d 00 00 movzbl 0xdd8(%edx),%edx
}while((x /= base) != 0);
918: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
91a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
91d: 75 e9 jne 908 <printint+0x38>
if(neg)
91f: 8b 45 c4 mov -0x3c(%ebp),%eax
922: 8b 75 c0 mov -0x40(%ebp),%esi
925: 85 c0 test %eax,%eax
927: 74 08 je 931 <printint+0x61>
buf[i++] = '-';
929: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
92e: 8d 4f 02 lea 0x2(%edi),%ecx
931: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
935: 8d 76 00 lea 0x0(%esi),%esi
938: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
93b: 83 ec 04 sub $0x4,%esp
93e: 83 ef 01 sub $0x1,%edi
941: 6a 01 push $0x1
943: 53 push %ebx
944: 56 push %esi
945: 88 45 d7 mov %al,-0x29(%ebp)
948: e8 f5 fe ff ff call 842 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
94d: 83 c4 10 add $0x10,%esp
950: 39 df cmp %ebx,%edi
952: 75 e4 jne 938 <printint+0x68>
putc(fd, buf[i]);
}
954: 8d 65 f4 lea -0xc(%ebp),%esp
957: 5b pop %ebx
958: 5e pop %esi
959: 5f pop %edi
95a: 5d pop %ebp
95b: c3 ret
95c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
960: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
962: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
969: eb 8b jmp 8f6 <printint+0x26>
96b: 90 nop
96c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000970 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
970: 55 push %ebp
971: 89 e5 mov %esp,%ebp
973: 57 push %edi
974: 56 push %esi
975: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
976: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
979: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
97c: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
97f: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
982: 89 45 d0 mov %eax,-0x30(%ebp)
985: 0f b6 1e movzbl (%esi),%ebx
988: 83 c6 01 add $0x1,%esi
98b: 84 db test %bl,%bl
98d: 0f 84 b0 00 00 00 je a43 <printf+0xd3>
993: 31 d2 xor %edx,%edx
995: eb 39 jmp 9d0 <printf+0x60>
997: 89 f6 mov %esi,%esi
999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
9a0: 83 f8 25 cmp $0x25,%eax
9a3: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
9a6: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
9ab: 74 18 je 9c5 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
9ad: 8d 45 e2 lea -0x1e(%ebp),%eax
9b0: 83 ec 04 sub $0x4,%esp
9b3: 88 5d e2 mov %bl,-0x1e(%ebp)
9b6: 6a 01 push $0x1
9b8: 50 push %eax
9b9: 57 push %edi
9ba: e8 83 fe ff ff call 842 <write>
9bf: 8b 55 d4 mov -0x2c(%ebp),%edx
9c2: 83 c4 10 add $0x10,%esp
9c5: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
9c8: 0f b6 5e ff movzbl -0x1(%esi),%ebx
9cc: 84 db test %bl,%bl
9ce: 74 73 je a43 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
9d0: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
9d2: 0f be cb movsbl %bl,%ecx
9d5: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
9d8: 74 c6 je 9a0 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
9da: 83 fa 25 cmp $0x25,%edx
9dd: 75 e6 jne 9c5 <printf+0x55>
if(c == 'd'){
9df: 83 f8 64 cmp $0x64,%eax
9e2: 0f 84 f8 00 00 00 je ae0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
9e8: 81 e1 f7 00 00 00 and $0xf7,%ecx
9ee: 83 f9 70 cmp $0x70,%ecx
9f1: 74 5d je a50 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
9f3: 83 f8 73 cmp $0x73,%eax
9f6: 0f 84 84 00 00 00 je a80 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
9fc: 83 f8 63 cmp $0x63,%eax
9ff: 0f 84 ea 00 00 00 je aef <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
a05: 83 f8 25 cmp $0x25,%eax
a08: 0f 84 c2 00 00 00 je ad0 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
a0e: 8d 45 e7 lea -0x19(%ebp),%eax
a11: 83 ec 04 sub $0x4,%esp
a14: c6 45 e7 25 movb $0x25,-0x19(%ebp)
a18: 6a 01 push $0x1
a1a: 50 push %eax
a1b: 57 push %edi
a1c: e8 21 fe ff ff call 842 <write>
a21: 83 c4 0c add $0xc,%esp
a24: 8d 45 e6 lea -0x1a(%ebp),%eax
a27: 88 5d e6 mov %bl,-0x1a(%ebp)
a2a: 6a 01 push $0x1
a2c: 50 push %eax
a2d: 57 push %edi
a2e: 83 c6 01 add $0x1,%esi
a31: e8 0c fe ff ff call 842 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
a36: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
a3a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
a3d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
a3f: 84 db test %bl,%bl
a41: 75 8d jne 9d0 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
a43: 8d 65 f4 lea -0xc(%ebp),%esp
a46: 5b pop %ebx
a47: 5e pop %esi
a48: 5f pop %edi
a49: 5d pop %ebp
a4a: c3 ret
a4b: 90 nop
a4c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
a50: 83 ec 0c sub $0xc,%esp
a53: b9 10 00 00 00 mov $0x10,%ecx
a58: 6a 00 push $0x0
a5a: 8b 5d d0 mov -0x30(%ebp),%ebx
a5d: 89 f8 mov %edi,%eax
a5f: 8b 13 mov (%ebx),%edx
a61: e8 6a fe ff ff call 8d0 <printint>
ap++;
a66: 89 d8 mov %ebx,%eax
a68: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
a6b: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
a6d: 83 c0 04 add $0x4,%eax
a70: 89 45 d0 mov %eax,-0x30(%ebp)
a73: e9 4d ff ff ff jmp 9c5 <printf+0x55>
a78: 90 nop
a79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
a80: 8b 45 d0 mov -0x30(%ebp),%eax
a83: 8b 18 mov (%eax),%ebx
ap++;
a85: 83 c0 04 add $0x4,%eax
a88: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
a8b: b8 d1 0d 00 00 mov $0xdd1,%eax
a90: 85 db test %ebx,%ebx
a92: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
a95: 0f b6 03 movzbl (%ebx),%eax
a98: 84 c0 test %al,%al
a9a: 74 23 je abf <printf+0x14f>
a9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
aa0: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
aa3: 8d 45 e3 lea -0x1d(%ebp),%eax
aa6: 83 ec 04 sub $0x4,%esp
aa9: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
aab: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
aae: 50 push %eax
aaf: 57 push %edi
ab0: e8 8d fd ff ff call 842 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
ab5: 0f b6 03 movzbl (%ebx),%eax
ab8: 83 c4 10 add $0x10,%esp
abb: 84 c0 test %al,%al
abd: 75 e1 jne aa0 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
abf: 31 d2 xor %edx,%edx
ac1: e9 ff fe ff ff jmp 9c5 <printf+0x55>
ac6: 8d 76 00 lea 0x0(%esi),%esi
ac9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
ad0: 83 ec 04 sub $0x4,%esp
ad3: 88 5d e5 mov %bl,-0x1b(%ebp)
ad6: 8d 45 e5 lea -0x1b(%ebp),%eax
ad9: 6a 01 push $0x1
adb: e9 4c ff ff ff jmp a2c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ae0: 83 ec 0c sub $0xc,%esp
ae3: b9 0a 00 00 00 mov $0xa,%ecx
ae8: 6a 01 push $0x1
aea: e9 6b ff ff ff jmp a5a <printf+0xea>
aef: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
af2: 83 ec 04 sub $0x4,%esp
af5: 8b 03 mov (%ebx),%eax
af7: 6a 01 push $0x1
af9: 88 45 e4 mov %al,-0x1c(%ebp)
afc: 8d 45 e4 lea -0x1c(%ebp),%eax
aff: 50 push %eax
b00: 57 push %edi
b01: e8 3c fd ff ff call 842 <write>
b06: e9 5b ff ff ff jmp a66 <printf+0xf6>
b0b: 66 90 xchg %ax,%ax
b0d: 66 90 xchg %ax,%ax
b0f: 90 nop
00000b10 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
b10: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
b11: a1 a0 11 00 00 mov 0x11a0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
b16: 89 e5 mov %esp,%ebp
b18: 57 push %edi
b19: 56 push %esi
b1a: 53 push %ebx
b1b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
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))
b1e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
b20: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
b23: 39 c8 cmp %ecx,%eax
b25: 73 19 jae b40 <free+0x30>
b27: 89 f6 mov %esi,%esi
b29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
b30: 39 d1 cmp %edx,%ecx
b32: 72 1c jb b50 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
b34: 39 d0 cmp %edx,%eax
b36: 73 18 jae b50 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
b38: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
b3a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
b3c: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
b3e: 72 f0 jb b30 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
b40: 39 d0 cmp %edx,%eax
b42: 72 f4 jb b38 <free+0x28>
b44: 39 d1 cmp %edx,%ecx
b46: 73 f0 jae b38 <free+0x28>
b48: 90 nop
b49: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
b50: 8b 73 fc mov -0x4(%ebx),%esi
b53: 8d 3c f1 lea (%ecx,%esi,8),%edi
b56: 39 d7 cmp %edx,%edi
b58: 74 19 je b73 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
b5a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
b5d: 8b 50 04 mov 0x4(%eax),%edx
b60: 8d 34 d0 lea (%eax,%edx,8),%esi
b63: 39 f1 cmp %esi,%ecx
b65: 74 23 je b8a <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
b67: 89 08 mov %ecx,(%eax)
freep = p;
b69: a3 a0 11 00 00 mov %eax,0x11a0
}
b6e: 5b pop %ebx
b6f: 5e pop %esi
b70: 5f pop %edi
b71: 5d pop %ebp
b72: 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;
b73: 03 72 04 add 0x4(%edx),%esi
b76: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
b79: 8b 10 mov (%eax),%edx
b7b: 8b 12 mov (%edx),%edx
b7d: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
b80: 8b 50 04 mov 0x4(%eax),%edx
b83: 8d 34 d0 lea (%eax,%edx,8),%esi
b86: 39 f1 cmp %esi,%ecx
b88: 75 dd jne b67 <free+0x57>
p->s.size += bp->s.size;
b8a: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
b8d: a3 a0 11 00 00 mov %eax,0x11a0
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
b92: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
b95: 8b 53 f8 mov -0x8(%ebx),%edx
b98: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
b9a: 5b pop %ebx
b9b: 5e pop %esi
b9c: 5f pop %edi
b9d: 5d pop %ebp
b9e: c3 ret
b9f: 90 nop
00000ba0 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
ba0: 55 push %ebp
ba1: 89 e5 mov %esp,%ebp
ba3: 57 push %edi
ba4: 56 push %esi
ba5: 53 push %ebx
ba6: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
ba9: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
bac: 8b 15 a0 11 00 00 mov 0x11a0,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
bb2: 8d 78 07 lea 0x7(%eax),%edi
bb5: c1 ef 03 shr $0x3,%edi
bb8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
bbb: 85 d2 test %edx,%edx
bbd: 0f 84 a3 00 00 00 je c66 <malloc+0xc6>
bc3: 8b 02 mov (%edx),%eax
bc5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
bc8: 39 cf cmp %ecx,%edi
bca: 76 74 jbe c40 <malloc+0xa0>
bcc: 81 ff 00 10 00 00 cmp $0x1000,%edi
bd2: be 00 10 00 00 mov $0x1000,%esi
bd7: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
bde: 0f 43 f7 cmovae %edi,%esi
be1: ba 00 80 00 00 mov $0x8000,%edx
be6: 81 ff ff 0f 00 00 cmp $0xfff,%edi
bec: 0f 46 da cmovbe %edx,%ebx
bef: eb 10 jmp c01 <malloc+0x61>
bf1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
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){
bf8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
bfa: 8b 48 04 mov 0x4(%eax),%ecx
bfd: 39 cf cmp %ecx,%edi
bff: 76 3f jbe c40 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
c01: 39 05 a0 11 00 00 cmp %eax,0x11a0
c07: 89 c2 mov %eax,%edx
c09: 75 ed jne bf8 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
c0b: 83 ec 0c sub $0xc,%esp
c0e: 53 push %ebx
c0f: e8 96 fc ff ff call 8aa <sbrk>
if(p == (char*)-1)
c14: 83 c4 10 add $0x10,%esp
c17: 83 f8 ff cmp $0xffffffff,%eax
c1a: 74 1c je c38 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
c1c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
c1f: 83 ec 0c sub $0xc,%esp
c22: 83 c0 08 add $0x8,%eax
c25: 50 push %eax
c26: e8 e5 fe ff ff call b10 <free>
return freep;
c2b: 8b 15 a0 11 00 00 mov 0x11a0,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
c31: 83 c4 10 add $0x10,%esp
c34: 85 d2 test %edx,%edx
c36: 75 c0 jne bf8 <malloc+0x58>
return 0;
c38: 31 c0 xor %eax,%eax
c3a: eb 1c jmp c58 <malloc+0xb8>
c3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
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){
if(p->s.size == nunits)
c40: 39 cf cmp %ecx,%edi
c42: 74 1c je c60 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
c44: 29 f9 sub %edi,%ecx
c46: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
c49: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
c4c: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
c4f: 89 15 a0 11 00 00 mov %edx,0x11a0
return (void*)(p + 1);
c55: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
c58: 8d 65 f4 lea -0xc(%ebp),%esp
c5b: 5b pop %ebx
c5c: 5e pop %esi
c5d: 5f pop %edi
c5e: 5d pop %ebp
c5f: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
c60: 8b 08 mov (%eax),%ecx
c62: 89 0a mov %ecx,(%edx)
c64: eb e9 jmp c4f <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
c66: c7 05 a0 11 00 00 a4 movl $0x11a4,0x11a0
c6d: 11 00 00
c70: c7 05 a4 11 00 00 a4 movl $0x11a4,0x11a4
c77: 11 00 00
base.s.size = 0;
c7a: b8 a4 11 00 00 mov $0x11a4,%eax
c7f: c7 05 a8 11 00 00 00 movl $0x0,0x11a8
c86: 00 00 00
c89: e9 3e ff ff ff jmp bcc <malloc+0x2c>
|
HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/VMM/VMMR0/HMR0A.asm | roughk/CSCI-49XX-OpenSource | 0 | 100524 | <filename>HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/VMM/VMMR0/HMR0A.asm
; $Id: HMR0A.asm 72855 2018-07-04 08:36:12Z vboxsync $
;; @file
; HM - Ring-0 VMX, SVM world-switch and helper routines
;
;
; Copyright (C) 2006-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
;*********************************************************************************************************************************
;* Header Files *
;*********************************************************************************************************************************
%include "VBox/asmdefs.mac"
%include "VBox/err.mac"
%include "VBox/vmm/hm_vmx.mac"
%include "VBox/vmm/cpum.mac"
%include "VBox/vmm/vm.mac"
%include "iprt/x86.mac"
%include "HMInternal.mac"
%ifdef RT_OS_OS2 ;; @todo fix OMF support in yasm and kick nasm out completely.
%macro vmwrite 2,
int3
%endmacro
%define vmlaunch int3
%define vmresume int3
%define vmsave int3
%define vmload int3
%define vmrun int3
%define clgi int3
%define stgi int3
%macro invlpga 2,
int3
%endmacro
%endif
;*********************************************************************************************************************************
;* Defined Constants And Macros *
;*********************************************************************************************************************************
;; The offset of the XMM registers in X86FXSTATE.
; Use define because I'm too lazy to convert the struct.
%define XMM_OFF_IN_X86FXSTATE 160
;; Spectre filler for 32-bit mode.
; Some user space address that points to a 4MB page boundrary in hope that it
; will somehow make it less useful.
%define SPECTRE_FILLER32 0x227fffff
;; Spectre filler for 64-bit mode.
; Choosen to be an invalid address (also with 5 level paging).
%define SPECTRE_FILLER64 0x02204204207fffff
;; Spectre filler for the current CPU mode.
%ifdef RT_ARCH_AMD64
%define SPECTRE_FILLER SPECTRE_FILLER64
%else
%define SPECTRE_FILLER SPECTRE_FILLER32
%endif
;;
; Determine skipping restoring of GDTR, IDTR, TR across VMX non-root operation
;
%ifdef RT_ARCH_AMD64
%define VMX_SKIP_GDTR
%define VMX_SKIP_TR
%define VBOX_SKIP_RESTORE_SEG
%ifdef RT_OS_DARWIN
; Load the NULL selector into DS, ES, FS and GS on 64-bit darwin so we don't
; risk loading a stale LDT value or something invalid.
%define HM_64_BIT_USE_NULL_SEL
; Darwin (Mavericks) uses IDTR limit to store the CPU Id so we need to restore it always.
; See @bugref{6875}.
%else
%define VMX_SKIP_IDTR
%endif
%endif
;; @def MYPUSHAD
; Macro generating an equivalent to pushad
;; @def MYPOPAD
; Macro generating an equivalent to popad
;; @def MYPUSHSEGS
; Macro saving all segment registers on the stack.
; @param 1 full width register name
; @param 2 16-bit register name for \a 1.
;; @def MYPOPSEGS
; Macro restoring all segment registers on the stack
; @param 1 full width register name
; @param 2 16-bit register name for \a 1.
%ifdef ASM_CALL64_GCC
%macro MYPUSHAD64 0
push r15
push r14
push r13
push r12
push rbx
%endmacro
%macro MYPOPAD64 0
pop rbx
pop r12
pop r13
pop r14
pop r15
%endmacro
%else ; ASM_CALL64_MSC
%macro MYPUSHAD64 0
push r15
push r14
push r13
push r12
push rbx
push rsi
push rdi
%endmacro
%macro MYPOPAD64 0
pop rdi
pop rsi
pop rbx
pop r12
pop r13
pop r14
pop r15
%endmacro
%endif
%ifdef VBOX_SKIP_RESTORE_SEG
%macro MYPUSHSEGS64 2
%endmacro
%macro MYPOPSEGS64 2
%endmacro
%else ; !VBOX_SKIP_RESTORE_SEG
; trashes, rax, rdx & rcx
%macro MYPUSHSEGS64 2
%ifndef HM_64_BIT_USE_NULL_SEL
mov %2, es
push %1
mov %2, ds
push %1
%endif
; Special case for FS; Windows and Linux either don't use it or restore it when leaving kernel mode, Solaris OTOH doesn't and we must save it.
mov ecx, MSR_K8_FS_BASE
rdmsr
push rdx
push rax
%ifndef HM_64_BIT_USE_NULL_SEL
push fs
%endif
; Special case for GS; OSes typically use swapgs to reset the hidden base register for GS on entry into the kernel. The same happens on exit
mov ecx, MSR_K8_GS_BASE
rdmsr
push rdx
push rax
%ifndef HM_64_BIT_USE_NULL_SEL
push gs
%endif
%endmacro
; trashes, rax, rdx & rcx
%macro MYPOPSEGS64 2
; Note: do not step through this code with a debugger!
%ifndef HM_64_BIT_USE_NULL_SEL
xor eax, eax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
%endif
%ifndef HM_64_BIT_USE_NULL_SEL
pop gs
%endif
pop rax
pop rdx
mov ecx, MSR_K8_GS_BASE
wrmsr
%ifndef HM_64_BIT_USE_NULL_SEL
pop fs
%endif
pop rax
pop rdx
mov ecx, MSR_K8_FS_BASE
wrmsr
; Now it's safe to step again
%ifndef HM_64_BIT_USE_NULL_SEL
pop %1
mov ds, %2
pop %1
mov es, %2
%endif
%endmacro
%endif ; VBOX_SKIP_RESTORE_SEG
%macro MYPUSHAD32 0
pushad
%endmacro
%macro MYPOPAD32 0
popad
%endmacro
%macro MYPUSHSEGS32 2
push ds
push es
push fs
push gs
%endmacro
%macro MYPOPSEGS32 2
pop gs
pop fs
pop es
pop ds
%endmacro
%ifdef RT_ARCH_AMD64
%define MYPUSHAD MYPUSHAD64
%define MYPOPAD MYPOPAD64
%define MYPUSHSEGS MYPUSHSEGS64
%define MYPOPSEGS MYPOPSEGS64
%else
%define MYPUSHAD MYPUSHAD32
%define MYPOPAD MYPOPAD32
%define MYPUSHSEGS MYPUSHSEGS32
%define MYPOPSEGS MYPOPSEGS32
%endif
;;
; Creates an indirect branch prediction barrier on CPUs that need and supports that.
; @clobbers eax, edx, ecx
; @param 1 How to address CPUMCTX.
; @param 2 Which flag to test for (CPUMCTX_WSF_IBPB_ENTRY or CPUMCTX_WSF_IBPB_EXIT)
%macro INDIRECT_BRANCH_PREDICTION_BARRIER 2
test byte [%1 + CPUMCTX.fWorldSwitcher], %2
jz %%no_indirect_branch_barrier
mov ecx, MSR_IA32_PRED_CMD
mov eax, MSR_IA32_PRED_CMD_F_IBPB
xor edx, edx
wrmsr
%%no_indirect_branch_barrier:
%endmacro
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
%ifdef VBOX_WITH_KERNEL_USING_XMM
extern NAME(CPUMIsGuestFPUStateActive)
%endif
BEGINCODE
;/**
; * Restores host-state fields.
; *
; * @returns VBox status code
; * @param f32RestoreHost x86: [ebp + 08h] msc: ecx gcc: edi RestoreHost flags.
; * @param pRestoreHost x86: [ebp + 0ch] msc: rdx gcc: rsi Pointer to the RestoreHost struct.
; */
ALIGNCODE(16)
BEGINPROC VMXRestoreHostState
%ifdef RT_ARCH_AMD64
%ifndef ASM_CALL64_GCC
; Use GCC's input registers since we'll be needing both rcx and rdx further
; down with the wrmsr instruction. Use the R10 and R11 register for saving
; RDI and RSI since MSC preserve the two latter registers.
mov r10, rdi
mov r11, rsi
mov rdi, rcx
mov rsi, rdx
%endif
test edi, VMX_RESTORE_HOST_GDTR
jz .test_idtr
lgdt [rsi + VMXRESTOREHOST.HostGdtr]
.test_idtr:
test edi, VMX_RESTORE_HOST_IDTR
jz .test_ds
lidt [rsi + VMXRESTOREHOST.HostIdtr]
.test_ds:
test edi, VMX_RESTORE_HOST_SEL_DS
jz .test_es
mov ax, [rsi + VMXRESTOREHOST.uHostSelDS]
mov ds, eax
.test_es:
test edi, VMX_RESTORE_HOST_SEL_ES
jz .test_tr
mov ax, [rsi + VMXRESTOREHOST.uHostSelES]
mov es, eax
.test_tr:
test edi, VMX_RESTORE_HOST_SEL_TR
jz .test_fs
; When restoring the TR, we must first clear the busy flag or we'll end up faulting.
mov dx, [rsi + VMXRESTOREHOST.uHostSelTR]
mov ax, dx
and eax, X86_SEL_MASK_OFF_RPL ; Mask away TI and RPL bits leaving only the descriptor offset.
test edi, VMX_RESTORE_HOST_GDT_READ_ONLY | VMX_RESTORE_HOST_GDT_NEED_WRITABLE
jnz .gdt_readonly
add rax, qword [rsi + VMXRESTOREHOST.HostGdtr + 2] ; xAX <- descriptor offset + GDTR.pGdt.
and dword [rax + 4], ~RT_BIT(9) ; Clear the busy flag in TSS desc (bits 0-7=base, bit 9=busy bit).
ltr dx
jmp short .test_fs
.gdt_readonly:
test edi, VMX_RESTORE_HOST_GDT_NEED_WRITABLE
jnz .gdt_readonly_need_writable
mov rcx, cr0
mov r9, rcx
add rax, qword [rsi + VMXRESTOREHOST.HostGdtr + 2] ; xAX <- descriptor offset + GDTR.pGdt.
and rcx, ~X86_CR0_WP
mov cr0, rcx
and dword [rax + 4], ~RT_BIT(9) ; Clear the busy flag in TSS desc (bits 0-7=base, bit 9=busy bit).
ltr dx
mov cr0, r9
jmp short .test_fs
.gdt_readonly_need_writable:
add rax, qword [rsi + VMXRESTOREHOST.HostGdtrRw + 2] ; xAX <- descriptor offset + GDTR.pGdtRw.
and dword [rax + 4], ~RT_BIT(9) ; Clear the busy flag in TSS desc (bits 0-7=base, bit 9=busy bit).
lgdt [rsi + VMXRESTOREHOST.HostGdtrRw]
ltr dx
lgdt [rsi + VMXRESTOREHOST.HostGdtr] ; Load the original GDT
.test_fs:
;
; When restoring the selector values for FS and GS, we'll temporarily trash
; the base address (at least the high 32-bit bits, but quite possibly the
; whole base address), the wrmsr will restore it correctly. (VT-x actually
; restores the base correctly when leaving guest mode, but not the selector
; value, so there is little problem with interrupts being enabled prior to
; this restore job.)
; We'll disable ints once for both FS and GS as that's probably faster.
;
test edi, VMX_RESTORE_HOST_SEL_FS | VMX_RESTORE_HOST_SEL_GS
jz .restore_success
pushfq
cli ; (see above)
test edi, VMX_RESTORE_HOST_SEL_FS
jz .test_gs
mov ax, word [rsi + VMXRESTOREHOST.uHostSelFS]
mov fs, eax
mov eax, dword [rsi + VMXRESTOREHOST.uHostFSBase] ; uHostFSBase - Lo
mov edx, dword [rsi + VMXRESTOREHOST.uHostFSBase + 4h] ; uHostFSBase - Hi
mov ecx, MSR_K8_FS_BASE
wrmsr
.test_gs:
test edi, VMX_RESTORE_HOST_SEL_GS
jz .restore_flags
mov ax, word [rsi + VMXRESTOREHOST.uHostSelGS]
mov gs, eax
mov eax, dword [rsi + VMXRESTOREHOST.uHostGSBase] ; uHostGSBase - Lo
mov edx, dword [rsi + VMXRESTOREHOST.uHostGSBase + 4h] ; uHostGSBase - Hi
mov ecx, MSR_K8_GS_BASE
wrmsr
.restore_flags:
popfq
.restore_success:
mov eax, VINF_SUCCESS
%ifndef ASM_CALL64_GCC
; Restore RDI and RSI on MSC.
mov rdi, r10
mov rsi, r11
%endif
%else ; RT_ARCH_X86
mov eax, VERR_NOT_IMPLEMENTED
%endif
ret
ENDPROC VMXRestoreHostState
;/**
; * Dispatches an NMI to the host.
; */
ALIGNCODE(16)
BEGINPROC VMXDispatchHostNmi
int 2 ; NMI is always vector 2. The IDT[2] IRQ handler cannot be anything else. See Intel spec. 6.3.1 "External Interrupts".
ret
ENDPROC VMXDispatchHostNmi
;/**
; * Executes VMWRITE, 64-bit value.
; *
; * @returns VBox status code.
; * @param idxField x86: [ebp + 08h] msc: rcx gcc: rdi VMCS index.
; * @param u64Data x86: [ebp + 0ch] msc: rdx gcc: rsi VM field value.
; */
ALIGNCODE(16)
BEGINPROC VMXWriteVmcs64
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
xor rax, rax
vmwrite rdi, rsi
%else
and ecx, 0ffffffffh
xor rax, rax
vmwrite rcx, rdx
%endif
%else ; RT_ARCH_X86
mov ecx, [esp + 4] ; idxField
lea edx, [esp + 8] ; &u64Data
vmwrite ecx, [edx] ; low dword
jz .done
jc .done
inc ecx
xor eax, eax
vmwrite ecx, [edx + 4] ; high dword
.done:
%endif ; RT_ARCH_X86
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_VMX_INVALID_VMCS_FIELD
.the_end:
ret
ENDPROC VMXWriteVmcs64
;/**
; * Executes VMREAD, 64-bit value.
; *
; * @returns VBox status code.
; * @param idxField VMCS index.
; * @param pData Where to store VM field value.
; */
;DECLASM(int) VMXReadVmcs64(uint32_t idxField, uint64_t *pData);
ALIGNCODE(16)
BEGINPROC VMXReadVmcs64
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
xor rax, rax
vmread [rsi], rdi
%else
and ecx, 0ffffffffh
xor rax, rax
vmread [rdx], rcx
%endif
%else ; RT_ARCH_X86
mov ecx, [esp + 4] ; idxField
mov edx, [esp + 8] ; pData
vmread [edx], ecx ; low dword
jz .done
jc .done
inc ecx
xor eax, eax
vmread [edx + 4], ecx ; high dword
.done:
%endif ; RT_ARCH_X86
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_VMX_INVALID_VMCS_FIELD
.the_end:
ret
ENDPROC VMXReadVmcs64
;/**
; * Executes VMREAD, 32-bit value.
; *
; * @returns VBox status code.
; * @param idxField VMCS index.
; * @param pu32Data Where to store VM field value.
; */
;DECLASM(int) VMXReadVmcs32(uint32_t idxField, uint32_t *pu32Data);
ALIGNCODE(16)
BEGINPROC VMXReadVmcs32
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
xor rax, rax
vmread r10, rdi
mov [rsi], r10d
%else
and ecx, 0ffffffffh
xor rax, rax
vmread r10, rcx
mov [rdx], r10d
%endif
%else ; RT_ARCH_X86
mov ecx, [esp + 4] ; idxField
mov edx, [esp + 8] ; pu32Data
xor eax, eax
vmread [edx], ecx
%endif ; RT_ARCH_X86
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_VMX_INVALID_VMCS_FIELD
.the_end:
ret
ENDPROC VMXReadVmcs32
;/**
; * Executes VMWRITE, 32-bit value.
; *
; * @returns VBox status code.
; * @param idxField VMCS index.
; * @param u32Data Where to store VM field value.
; */
;DECLASM(int) VMXWriteVmcs32(uint32_t idxField, uint32_t u32Data);
ALIGNCODE(16)
BEGINPROC VMXWriteVmcs32
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
and esi, 0ffffffffh
xor rax, rax
vmwrite rdi, rsi
%else
and ecx, 0ffffffffh
and edx, 0ffffffffh
xor rax, rax
vmwrite rcx, rdx
%endif
%else ; RT_ARCH_X86
mov ecx, [esp + 4] ; idxField
mov edx, [esp + 8] ; u32Data
xor eax, eax
vmwrite ecx, edx
%endif ; RT_ARCH_X86
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_VMX_INVALID_VMCS_FIELD
.the_end:
ret
ENDPROC VMXWriteVmcs32
;/**
; * Executes VMXON.
; *
; * @returns VBox status code.
; * @param HCPhysVMXOn Physical address of VMXON structure.
; */
;DECLASM(int) VMXEnable(RTHCPHYS HCPhysVMXOn);
BEGINPROC VMXEnable
%ifdef RT_ARCH_AMD64
xor rax, rax
%ifdef ASM_CALL64_GCC
push rdi
%else
push rcx
%endif
vmxon [rsp]
%else ; RT_ARCH_X86
xor eax, eax
vmxon [esp + 4]
%endif ; RT_ARCH_X86
jnc .good
mov eax, VERR_VMX_INVALID_VMXON_PTR
jmp .the_end
.good:
jnz .the_end
mov eax, VERR_VMX_VMXON_FAILED
.the_end:
%ifdef RT_ARCH_AMD64
add rsp, 8
%endif
ret
ENDPROC VMXEnable
;/**
; * Executes VMXOFF.
; */
;DECLASM(void) VMXDisable(void);
BEGINPROC VMXDisable
vmxoff
.the_end:
ret
ENDPROC VMXDisable
;/**
; * Executes VMCLEAR.
; *
; * @returns VBox status code.
; * @param HCPhysVmcs Physical address of VM control structure.
; */
;DECLASM(int) VMXClearVmcs(RTHCPHYS HCPhysVmcs);
ALIGNCODE(16)
BEGINPROC VMXClearVmcs
%ifdef RT_ARCH_AMD64
xor rax, rax
%ifdef ASM_CALL64_GCC
push rdi
%else
push rcx
%endif
vmclear [rsp]
%else ; RT_ARCH_X86
xor eax, eax
vmclear [esp + 4]
%endif ; RT_ARCH_X86
jnc .the_end
mov eax, VERR_VMX_INVALID_VMCS_PTR
.the_end:
%ifdef RT_ARCH_AMD64
add rsp, 8
%endif
ret
ENDPROC VMXClearVmcs
;/**
; * Executes VMPTRLD.
; *
; * @returns VBox status code.
; * @param HCPhysVmcs Physical address of VMCS structure.
; */
;DECLASM(int) VMXActivateVmcs(RTHCPHYS HCPhysVmcs);
ALIGNCODE(16)
BEGINPROC VMXActivateVmcs
%ifdef RT_ARCH_AMD64
xor rax, rax
%ifdef ASM_CALL64_GCC
push rdi
%else
push rcx
%endif
vmptrld [rsp]
%else
xor eax, eax
vmptrld [esp + 4]
%endif
jnc .the_end
mov eax, VERR_VMX_INVALID_VMCS_PTR
.the_end:
%ifdef RT_ARCH_AMD64
add rsp, 8
%endif
ret
ENDPROC VMXActivateVmcs
;/**
; * Executes VMPTRST.
; *
; * @returns VBox status code.
; * @param [esp + 04h] gcc:rdi msc:rcx Param 1 - First parameter - Address that will receive the current pointer.
; */
;DECLASM(int) VMXGetActivatedVmcs(RTHCPHYS *pVMCS);
BEGINPROC VMXGetActivatedVmcs
%ifdef RT_OS_OS2
mov eax, VERR_NOT_SUPPORTED
ret
%else
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
vmptrst qword [rdi]
%else
vmptrst qword [rcx]
%endif
%else
vmptrst qword [esp+04h]
%endif
xor eax, eax
.the_end:
ret
%endif
ENDPROC VMXGetActivatedVmcs
;/**
; * Invalidate a page using INVEPT.
; @param enmTlbFlush msc:ecx gcc:edi x86:[esp+04] Type of flush.
; @param pDescriptor msc:edx gcc:esi x86:[esp+08] Descriptor pointer.
; */
;DECLASM(int) VMXR0InvEPT(VMXTLBFLUSHEPT enmTlbFlush, uint64_t *pDescriptor);
BEGINPROC VMXR0InvEPT
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
xor rax, rax
; invept rdi, qword [rsi]
DB 0x66, 0x0F, 0x38, 0x80, 0x3E
%else
and ecx, 0ffffffffh
xor rax, rax
; invept rcx, qword [rdx]
DB 0x66, 0x0F, 0x38, 0x80, 0xA
%endif
%else
mov ecx, [esp + 4]
mov edx, [esp + 8]
xor eax, eax
; invept ecx, qword [edx]
DB 0x66, 0x0F, 0x38, 0x80, 0xA
%endif
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_INVALID_PARAMETER
.the_end:
ret
ENDPROC VMXR0InvEPT
;/**
; * Invalidate a page using invvpid
; @param enmTlbFlush msc:ecx gcc:edi x86:[esp+04] Type of flush
; @param pDescriptor msc:edx gcc:esi x86:[esp+08] Descriptor pointer
; */
;DECLASM(int) VMXR0InvVPID(VMXTLBFLUSHVPID enmTlbFlush, uint64_t *pDescriptor);
BEGINPROC VMXR0InvVPID
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
and edi, 0ffffffffh
xor rax, rax
; invvpid rdi, qword [rsi]
DB 0x66, 0x0F, 0x38, 0x81, 0x3E
%else
and ecx, 0ffffffffh
xor rax, rax
; invvpid rcx, qword [rdx]
DB 0x66, 0x0F, 0x38, 0x81, 0xA
%endif
%else
mov ecx, [esp + 4]
mov edx, [esp + 8]
xor eax, eax
; invvpid ecx, qword [edx]
DB 0x66, 0x0F, 0x38, 0x81, 0xA
%endif
jnc .valid_vmcs
mov eax, VERR_VMX_INVALID_VMCS_PTR
ret
.valid_vmcs:
jnz .the_end
mov eax, VERR_INVALID_PARAMETER
.the_end:
ret
ENDPROC VMXR0InvVPID
%if GC_ARCH_BITS == 64
;;
; Executes INVLPGA
;
; @param pPageGC msc:rcx gcc:rdi x86:[esp+04] Virtual page to invalidate
; @param uASID msc:rdx gcc:rsi x86:[esp+0C] Tagged TLB id
;
;DECLASM(void) SVMR0InvlpgA(RTGCPTR pPageGC, uint32_t uASID);
BEGINPROC SVMR0InvlpgA
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
mov rax, rdi
mov rcx, rsi
%else
mov rax, rcx
mov rcx, rdx
%endif
%else
mov eax, [esp + 4]
mov ecx, [esp + 0Ch]
%endif
invlpga [xAX], ecx
ret
ENDPROC SVMR0InvlpgA
%else ; GC_ARCH_BITS != 64
;;
; Executes INVLPGA
;
; @param pPageGC msc:ecx gcc:edi x86:[esp+04] Virtual page to invalidate
; @param uASID msc:edx gcc:esi x86:[esp+08] Tagged TLB id
;
;DECLASM(void) SVMR0InvlpgA(RTGCPTR pPageGC, uint32_t uASID);
BEGINPROC SVMR0InvlpgA
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
movzx rax, edi
mov ecx, esi
%else
; from http://www.cs.cmu.edu/~fp/courses/15213-s06/misc/asm64-handout.pdf:
; ``Perhaps unexpectedly, instructions that move or generate 32-bit register
; values also set the upper 32 bits of the register to zero. Consequently
; there is no need for an instruction movzlq.''
mov eax, ecx
mov ecx, edx
%endif
%else
mov eax, [esp + 4]
mov ecx, [esp + 8]
%endif
invlpga [xAX], ecx
ret
ENDPROC SVMR0InvlpgA
%endif ; GC_ARCH_BITS != 64
%ifdef VBOX_WITH_KERNEL_USING_XMM
;;
; Wrapper around vmx.pfnStartVM that preserves host XMM registers and
; load the guest ones when necessary.
;
; @cproto DECLASM(int) HMR0VMXStartVMhmR0DumpDescriptorM(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM,
; PVMCPU pVCpu, PFNHMVMXSTARTVM pfnStartVM);
;
; @returns eax
;
; @param fResumeVM msc:rcx
; @param pCtx msc:rdx
; @param pVMCSCache msc:r8
; @param pVM msc:r9
; @param pVCpu msc:[rbp+30h] The cross context virtual CPU structure of the calling EMT.
; @param pfnStartVM msc:[rbp+38h]
;
; @remarks This is essentially the same code as hmR0SVMRunWrapXMM, only the parameters differ a little bit.
;
; @remarks Drivers shouldn't use AVX registers without saving+loading:
; https://msdn.microsoft.com/en-us/library/windows/hardware/ff545910%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
; However the compiler docs have different idea:
; https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx
; We'll go with the former for now.
;
; ASSUMING 64-bit and windows for now.
;
ALIGNCODE(16)
BEGINPROC hmR0VMXStartVMWrapXMM
push xBP
mov xBP, xSP
sub xSP, 0b0h + 040h ; Don't bother optimizing the frame size.
; spill input parameters.
mov [xBP + 010h], rcx ; fResumeVM
mov [xBP + 018h], rdx ; pCtx
mov [xBP + 020h], r8 ; pVMCSCache
mov [xBP + 028h], r9 ; pVM
; Ask CPUM whether we've started using the FPU yet.
mov rcx, [xBP + 30h] ; pVCpu
call NAME(CPUMIsGuestFPUStateActive)
test al, al
jnz .guest_fpu_state_active
; No need to mess with XMM registers just call the start routine and return.
mov r11, [xBP + 38h] ; pfnStartVM
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; fResumeVM
mov rdx, [xBP + 018h] ; pCtx
mov r8, [xBP + 020h] ; pVMCSCache
mov r9, [xBP + 028h] ; pVM
call r11
leave
ret
ALIGNCODE(8)
.guest_fpu_state_active:
; Save the non-volatile host XMM registers.
movdqa [rsp + 040h + 000h], xmm6
movdqa [rsp + 040h + 010h], xmm7
movdqa [rsp + 040h + 020h], xmm8
movdqa [rsp + 040h + 030h], xmm9
movdqa [rsp + 040h + 040h], xmm10
movdqa [rsp + 040h + 050h], xmm11
movdqa [rsp + 040h + 060h], xmm12
movdqa [rsp + 040h + 070h], xmm13
movdqa [rsp + 040h + 080h], xmm14
movdqa [rsp + 040h + 090h], xmm15
stmxcsr [rsp + 040h + 0a0h]
mov r10, [xBP + 018h] ; pCtx
mov eax, [r10 + CPUMCTX.fXStateMask]
test eax, eax
jz .guest_fpu_state_manually
;
; Using XSAVE to load the guest XMM, YMM and ZMM registers.
;
and eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
xor edx, edx
mov r10, [r10 + CPUMCTX.pXStateR0]
xrstor [r10]
; Make the call (same as in the other case ).
mov r11, [xBP + 38h] ; pfnStartVM
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; fResumeVM
mov rdx, [xBP + 018h] ; pCtx
mov r8, [xBP + 020h] ; pVMCSCache
mov r9, [xBP + 028h] ; pVM
call r11
mov r11d, eax ; save return value (xsave below uses eax)
; Save the guest XMM registers.
mov r10, [xBP + 018h] ; pCtx
mov eax, [r10 + CPUMCTX.fXStateMask]
and eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
xor edx, edx
mov r10, [r10 + CPUMCTX.pXStateR0]
xsave [r10]
mov eax, r11d ; restore return value.
.restore_non_volatile_host_xmm_regs:
; Load the non-volatile host XMM registers.
movdqa xmm6, [rsp + 040h + 000h]
movdqa xmm7, [rsp + 040h + 010h]
movdqa xmm8, [rsp + 040h + 020h]
movdqa xmm9, [rsp + 040h + 030h]
movdqa xmm10, [rsp + 040h + 040h]
movdqa xmm11, [rsp + 040h + 050h]
movdqa xmm12, [rsp + 040h + 060h]
movdqa xmm13, [rsp + 040h + 070h]
movdqa xmm14, [rsp + 040h + 080h]
movdqa xmm15, [rsp + 040h + 090h]
ldmxcsr [rsp + 040h + 0a0h]
leave
ret
;
; No XSAVE, load and save the guest XMM registers manually.
;
.guest_fpu_state_manually:
; Load the full guest XMM register state.
mov r10, [r10 + CPUMCTX.pXStateR0]
movdqa xmm0, [r10 + XMM_OFF_IN_X86FXSTATE + 000h]
movdqa xmm1, [r10 + XMM_OFF_IN_X86FXSTATE + 010h]
movdqa xmm2, [r10 + XMM_OFF_IN_X86FXSTATE + 020h]
movdqa xmm3, [r10 + XMM_OFF_IN_X86FXSTATE + 030h]
movdqa xmm4, [r10 + XMM_OFF_IN_X86FXSTATE + 040h]
movdqa xmm5, [r10 + XMM_OFF_IN_X86FXSTATE + 050h]
movdqa xmm6, [r10 + XMM_OFF_IN_X86FXSTATE + 060h]
movdqa xmm7, [r10 + XMM_OFF_IN_X86FXSTATE + 070h]
movdqa xmm8, [r10 + XMM_OFF_IN_X86FXSTATE + 080h]
movdqa xmm9, [r10 + XMM_OFF_IN_X86FXSTATE + 090h]
movdqa xmm10, [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h]
movdqa xmm11, [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h]
movdqa xmm12, [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h]
movdqa xmm13, [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h]
movdqa xmm14, [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h]
movdqa xmm15, [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h]
ldmxcsr [r10 + X86FXSTATE.MXCSR]
; Make the call (same as in the other case ).
mov r11, [xBP + 38h] ; pfnStartVM
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; fResumeVM
mov rdx, [xBP + 018h] ; pCtx
mov r8, [xBP + 020h] ; pVMCSCache
mov r9, [xBP + 028h] ; pVM
call r11
; Save the guest XMM registers.
mov r10, [xBP + 018h] ; pCtx
mov r10, [r10 + CPUMCTX.pXStateR0]
stmxcsr [r10 + X86FXSTATE.MXCSR]
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 000h], xmm0
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 010h], xmm1
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 020h], xmm2
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 030h], xmm3
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 040h], xmm4
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 050h], xmm5
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 060h], xmm6
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 070h], xmm7
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 080h], xmm8
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 090h], xmm9
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h], xmm10
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h], xmm11
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h], xmm12
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h], xmm13
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h], xmm14
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h], xmm15
jmp .restore_non_volatile_host_xmm_regs
ENDPROC hmR0VMXStartVMWrapXMM
;;
; Wrapper around svm.pfnVMRun that preserves host XMM registers and
; load the guest ones when necessary.
;
; @cproto DECLASM(int) hmR0SVMRunWrapXMM(RTHCPHYS HCPhysVmcbHost, RTHCPHYS HCPhysVmcb, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu,
; PFNHMSVMVMRUN pfnVMRun);
;
; @returns eax
;
; @param HCPhysVmcbHost msc:rcx
; @param HCPhysVmcb msc:rdx
; @param pCtx msc:r8
; @param pVM msc:r9
; @param pVCpu msc:[rbp+30h] The cross context virtual CPU structure of the calling EMT.
; @param pfnVMRun msc:[rbp+38h]
;
; @remarks This is essentially the same code as hmR0VMXStartVMWrapXMM, only the parameters differ a little bit.
;
; @remarks Drivers shouldn't use AVX registers without saving+loading:
; https://msdn.microsoft.com/en-us/library/windows/hardware/ff545910%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
; However the compiler docs have different idea:
; https://msdn.microsoft.com/en-us/library/9z1stfyw.aspx
; We'll go with the former for now.
;
; ASSUMING 64-bit and windows for now.
ALIGNCODE(16)
BEGINPROC hmR0SVMRunWrapXMM
push xBP
mov xBP, xSP
sub xSP, 0b0h + 040h ; Don't bother optimizing the frame size.
; spill input parameters.
mov [xBP + 010h], rcx ; HCPhysVmcbHost
mov [xBP + 018h], rdx ; HCPhysVmcb
mov [xBP + 020h], r8 ; pCtx
mov [xBP + 028h], r9 ; pVM
; Ask CPUM whether we've started using the FPU yet.
mov rcx, [xBP + 30h] ; pVCpu
call NAME(CPUMIsGuestFPUStateActive)
test al, al
jnz .guest_fpu_state_active
; No need to mess with XMM registers just call the start routine and return.
mov r11, [xBP + 38h] ; pfnVMRun
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; HCPhysVmcbHost
mov rdx, [xBP + 018h] ; HCPhysVmcb
mov r8, [xBP + 020h] ; pCtx
mov r9, [xBP + 028h] ; pVM
call r11
leave
ret
ALIGNCODE(8)
.guest_fpu_state_active:
; Save the non-volatile host XMM registers.
movdqa [rsp + 040h + 000h], xmm6
movdqa [rsp + 040h + 010h], xmm7
movdqa [rsp + 040h + 020h], xmm8
movdqa [rsp + 040h + 030h], xmm9
movdqa [rsp + 040h + 040h], xmm10
movdqa [rsp + 040h + 050h], xmm11
movdqa [rsp + 040h + 060h], xmm12
movdqa [rsp + 040h + 070h], xmm13
movdqa [rsp + 040h + 080h], xmm14
movdqa [rsp + 040h + 090h], xmm15
stmxcsr [rsp + 040h + 0a0h]
mov r10, [xBP + 020h] ; pCtx
mov eax, [r10 + CPUMCTX.fXStateMask]
test eax, eax
jz .guest_fpu_state_manually
;
; Using XSAVE.
;
and eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
xor edx, edx
mov r10, [r10 + CPUMCTX.pXStateR0]
xrstor [r10]
; Make the call (same as in the other case ).
mov r11, [xBP + 38h] ; pfnVMRun
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; HCPhysVmcbHost
mov rdx, [xBP + 018h] ; HCPhysVmcb
mov r8, [xBP + 020h] ; pCtx
mov r9, [xBP + 028h] ; pVM
call r11
mov r11d, eax ; save return value (xsave below uses eax)
; Save the guest XMM registers.
mov r10, [xBP + 020h] ; pCtx
mov eax, [r10 + CPUMCTX.fXStateMask]
and eax, CPUM_VOLATILE_XSAVE_GUEST_COMPONENTS
xor edx, edx
mov r10, [r10 + CPUMCTX.pXStateR0]
xsave [r10]
mov eax, r11d ; restore return value.
.restore_non_volatile_host_xmm_regs:
; Load the non-volatile host XMM registers.
movdqa xmm6, [rsp + 040h + 000h]
movdqa xmm7, [rsp + 040h + 010h]
movdqa xmm8, [rsp + 040h + 020h]
movdqa xmm9, [rsp + 040h + 030h]
movdqa xmm10, [rsp + 040h + 040h]
movdqa xmm11, [rsp + 040h + 050h]
movdqa xmm12, [rsp + 040h + 060h]
movdqa xmm13, [rsp + 040h + 070h]
movdqa xmm14, [rsp + 040h + 080h]
movdqa xmm15, [rsp + 040h + 090h]
ldmxcsr [rsp + 040h + 0a0h]
leave
ret
;
; No XSAVE, load and save the guest XMM registers manually.
;
.guest_fpu_state_manually:
; Load the full guest XMM register state.
mov r10, [r10 + CPUMCTX.pXStateR0]
movdqa xmm0, [r10 + XMM_OFF_IN_X86FXSTATE + 000h]
movdqa xmm1, [r10 + XMM_OFF_IN_X86FXSTATE + 010h]
movdqa xmm2, [r10 + XMM_OFF_IN_X86FXSTATE + 020h]
movdqa xmm3, [r10 + XMM_OFF_IN_X86FXSTATE + 030h]
movdqa xmm4, [r10 + XMM_OFF_IN_X86FXSTATE + 040h]
movdqa xmm5, [r10 + XMM_OFF_IN_X86FXSTATE + 050h]
movdqa xmm6, [r10 + XMM_OFF_IN_X86FXSTATE + 060h]
movdqa xmm7, [r10 + XMM_OFF_IN_X86FXSTATE + 070h]
movdqa xmm8, [r10 + XMM_OFF_IN_X86FXSTATE + 080h]
movdqa xmm9, [r10 + XMM_OFF_IN_X86FXSTATE + 090h]
movdqa xmm10, [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h]
movdqa xmm11, [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h]
movdqa xmm12, [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h]
movdqa xmm13, [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h]
movdqa xmm14, [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h]
movdqa xmm15, [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h]
ldmxcsr [r10 + X86FXSTATE.MXCSR]
; Make the call (same as in the other case ).
mov r11, [xBP + 38h] ; pfnVMRun
mov r10, [xBP + 30h] ; pVCpu
mov [xSP + 020h], r10
mov rcx, [xBP + 010h] ; HCPhysVmcbHost
mov rdx, [xBP + 018h] ; HCPhysVmcb
mov r8, [xBP + 020h] ; pCtx
mov r9, [xBP + 028h] ; pVM
call r11
; Save the guest XMM registers.
mov r10, [xBP + 020h] ; pCtx
mov r10, [r10 + CPUMCTX.pXStateR0]
stmxcsr [r10 + X86FXSTATE.MXCSR]
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 000h], xmm0
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 010h], xmm1
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 020h], xmm2
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 030h], xmm3
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 040h], xmm4
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 050h], xmm5
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 060h], xmm6
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 070h], xmm7
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 080h], xmm8
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 090h], xmm9
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0a0h], xmm10
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0b0h], xmm11
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0c0h], xmm12
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0d0h], xmm13
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0e0h], xmm14
movdqa [r10 + XMM_OFF_IN_X86FXSTATE + 0f0h], xmm15
jmp .restore_non_volatile_host_xmm_regs
ENDPROC hmR0SVMRunWrapXMM
%endif ; VBOX_WITH_KERNEL_USING_XMM
;; @def RESTORE_STATE_VM32
; Macro restoring essential host state and updating guest state
; for common host, 32-bit guest for VT-x.
%macro RESTORE_STATE_VM32 0
; Restore base and limit of the IDTR & GDTR.
%ifndef VMX_SKIP_IDTR
lidt [xSP]
add xSP, xCB * 2
%endif
%ifndef VMX_SKIP_GDTR
lgdt [xSP]
add xSP, xCB * 2
%endif
push xDI
%ifndef VMX_SKIP_TR
mov xDI, [xSP + xCB * 3] ; pCtx (*3 to skip the saved xDI, TR, LDTR).
%else
mov xDI, [xSP + xCB * 2] ; pCtx (*2 to skip the saved xDI, LDTR).
%endif
mov [ss:xDI + CPUMCTX.eax], eax
mov xAX, SPECTRE_FILLER
mov [ss:xDI + CPUMCTX.ebx], ebx
mov xBX, xAX
mov [ss:xDI + CPUMCTX.ecx], ecx
mov xCX, xAX
mov [ss:xDI + CPUMCTX.edx], edx
mov xDX, xAX
mov [ss:xDI + CPUMCTX.esi], esi
mov xSI, xAX
mov [ss:xDI + CPUMCTX.ebp], ebp
mov xBP, xAX
mov xAX, cr2
mov [ss:xDI + CPUMCTX.cr2], xAX
%ifdef RT_ARCH_AMD64
pop xAX ; The guest edi we pushed above.
mov dword [ss:xDI + CPUMCTX.edi], eax
%else
pop dword [ss:xDI + CPUMCTX.edi] ; The guest edi we pushed above.
%endif
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER ss:xDI, CPUMCTX_WSF_IBPB_EXIT
%ifndef VMX_SKIP_TR
; Restore TSS selector; must mark it as not busy before using ltr (!)
; ASSUME that this is supposed to be 'BUSY'. (saves 20-30 ticks on the T42p)
; @todo get rid of sgdt
pop xBX ; Saved TR
sub xSP, xCB * 2
sgdt [xSP]
mov xAX, xBX
and eax, X86_SEL_MASK_OFF_RPL ; Mask away TI and RPL bits leaving only the descriptor offset.
add xAX, [xSP + 2] ; eax <- GDTR.address + descriptor offset.
and dword [ss:xAX + 4], ~RT_BIT(9) ; Clear the busy flag in TSS desc (bits 0-7=base, bit 9=busy bit).
ltr bx
add xSP, xCB * 2
%endif
pop xAX ; Saved LDTR
%ifdef RT_ARCH_AMD64
cmp eax, 0
je %%skip_ldt_write32
%endif
lldt ax
%%skip_ldt_write32:
add xSP, xCB ; pCtx
%ifdef VMX_USE_CACHED_VMCS_ACCESSES
pop xDX ; Saved pCache
; Note! If we get here as a result of invalid VMCS pointer, all the following
; vmread's will fail (only eflags.cf=1 will be set) but that shouldn't cause any
; trouble only just less efficient.
mov ecx, [ss:xDX + VMCSCACHE.Read.cValidEntries]
cmp ecx, 0 ; Can't happen
je %%no_cached_read32
jmp %%cached_read32
ALIGN(16)
%%cached_read32:
dec xCX
mov eax, [ss:xDX + VMCSCACHE.Read.aField + xCX * 4]
; Note! This leaves the high 32 bits of the cache entry unmodified!!
vmread [ss:xDX + VMCSCACHE.Read.aFieldVal + xCX * 8], xAX
cmp xCX, 0
jnz %%cached_read32
%%no_cached_read32:
%endif
; Restore segment registers.
MYPOPSEGS xAX, ax
; Restore the host XCR0 if necessary.
pop xCX
test ecx, ecx
jnz %%xcr0_after_skip
pop xAX
pop xDX
xsetbv ; ecx is already zero.
%%xcr0_after_skip:
; Restore general purpose registers.
MYPOPAD
%endmacro
;;
; Prepares for and executes VMLAUNCH/VMRESUME (32 bits guest mode)
;
; @returns VBox status code
; @param fResume x86:[ebp+8], msc:rcx,gcc:rdi Whether to use vmlauch/vmresume.
; @param pCtx x86:[ebp+c], msc:rdx,gcc:rsi Pointer to the guest-CPU context.
; @param pCache x86:[ebp+10],msc:r8, gcc:rdx Pointer to the VMCS cache.
; @param pVM x86:[ebp+14],msc:r9, gcc:rcx The cross context VM structure.
; @param pVCpu x86:[ebp+18],msc:[ebp+30],gcc:r8 The cross context virtual CPU structure of the calling EMT.
;
ALIGNCODE(16)
BEGINPROC VMXR0StartVM32
push xBP
mov xBP, xSP
pushf
cli
;
; Save all general purpose host registers.
;
MYPUSHAD
;
; First we have to write some final guest CPU context registers.
;
mov eax, VMX_VMCS_HOST_RIP
%ifdef RT_ARCH_AMD64
lea r10, [.vmlaunch_done wrt rip]
vmwrite rax, r10
%else
mov ecx, .vmlaunch_done
vmwrite eax, ecx
%endif
; Note: assumes success!
;
; Unify input parameter registers.
;
%ifdef RT_ARCH_AMD64
%ifdef ASM_CALL64_GCC
; fResume already in rdi
; pCtx already in rsi
mov rbx, rdx ; pCache
%else
mov rdi, rcx ; fResume
mov rsi, rdx ; pCtx
mov rbx, r8 ; pCache
%endif
%else
mov edi, [ebp + 8] ; fResume
mov esi, [ebp + 12] ; pCtx
mov ebx, [ebp + 16] ; pCache
%endif
;
; Save the host XCR0 and load the guest one if necessary.
; Note! Trashes rdx and rcx.
;
%ifdef ASM_CALL64_MSC
mov rax, [xBP + 30h] ; pVCpu
%elifdef ASM_CALL64_GCC
mov rax, r8 ; pVCpu
%else
mov eax, [xBP + 18h] ; pVCpu
%endif
test byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
jz .xcr0_before_skip
xor ecx, ecx
xgetbv ; Save the host one on the stack.
push xDX
push xAX
mov eax, [xSI + CPUMCTX.aXcr] ; Load the guest one.
mov edx, [xSI + CPUMCTX.aXcr + 4]
xor ecx, ecx ; paranoia
xsetbv
push 0 ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
jmp .xcr0_before_done
.xcr0_before_skip:
push 3fh ; indicate that we need not.
.xcr0_before_done:
;
; Save segment registers.
; Note! Trashes rdx & rcx, so we moved it here (amd64 case).
;
MYPUSHSEGS xAX, ax
%ifdef VMX_USE_CACHED_VMCS_ACCESSES
mov ecx, [xBX + VMCSCACHE.Write.cValidEntries]
cmp ecx, 0
je .no_cached_writes
mov edx, ecx
mov ecx, 0
jmp .cached_write
ALIGN(16)
.cached_write:
mov eax, [xBX + VMCSCACHE.Write.aField + xCX * 4]
vmwrite xAX, [xBX + VMCSCACHE.Write.aFieldVal + xCX * 8]
inc xCX
cmp xCX, xDX
jl .cached_write
mov dword [xBX + VMCSCACHE.Write.cValidEntries], 0
.no_cached_writes:
; Save the pCache pointer.
push xBX
%endif
; Save the pCtx pointer.
push xSI
; Save host LDTR.
xor eax, eax
sldt ax
push xAX
%ifndef VMX_SKIP_TR
; The host TR limit is reset to 0x67; save & restore it manually.
str eax
push xAX
%endif
%ifndef VMX_SKIP_GDTR
; VT-x only saves the base of the GDTR & IDTR and resets the limit to 0xffff; we must restore the limit correctly!
sub xSP, xCB * 2
sgdt [xSP]
%endif
%ifndef VMX_SKIP_IDTR
sub xSP, xCB * 2
sidt [xSP]
%endif
; Load CR2 if necessary (may be expensive as writing CR2 is a synchronizing instruction).
mov xBX, [xSI + CPUMCTX.cr2]
mov xDX, cr2
cmp xBX, xDX
je .skip_cr2_write32
mov cr2, xBX
.skip_cr2_write32:
mov eax, VMX_VMCS_HOST_RSP
vmwrite xAX, xSP
; Note: assumes success!
; Don't mess with ESP anymore!!!
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER xSI, CPUMCTX_WSF_IBPB_ENTRY
; Load guest general purpose registers.
mov eax, [xSI + CPUMCTX.eax]
mov ebx, [xSI + CPUMCTX.ebx]
mov ecx, [xSI + CPUMCTX.ecx]
mov edx, [xSI + CPUMCTX.edx]
mov ebp, [xSI + CPUMCTX.ebp]
; Resume or start VM?
cmp xDI, 0 ; fResume
; Load guest edi & esi.
mov edi, [xSI + CPUMCTX.edi]
mov esi, [xSI + CPUMCTX.esi]
je .vmlaunch_launch
vmresume
jc near .vmxstart_invalid_vmcs_ptr
jz near .vmxstart_start_failed
jmp .vmlaunch_done; ; Here if vmresume detected a failure.
.vmlaunch_launch:
vmlaunch
jc near .vmxstart_invalid_vmcs_ptr
jz near .vmxstart_start_failed
jmp .vmlaunch_done; ; Here if vmlaunch detected a failure.
ALIGNCODE(16) ;; @todo YASM BUG - this alignment is wrong on darwin, it's 1 byte off.
.vmlaunch_done:
RESTORE_STATE_VM32
mov eax, VINF_SUCCESS
.vmstart_end:
popf
pop xBP
ret
.vmxstart_invalid_vmcs_ptr:
RESTORE_STATE_VM32
mov eax, VERR_VMX_INVALID_VMCS_PTR_TO_START_VM
jmp .vmstart_end
.vmxstart_start_failed:
RESTORE_STATE_VM32
mov eax, VERR_VMX_UNABLE_TO_START_VM
jmp .vmstart_end
ENDPROC VMXR0StartVM32
%ifdef RT_ARCH_AMD64
;; @def RESTORE_STATE_VM64
; Macro restoring essential host state and updating guest state
; for 64-bit host, 64-bit guest for VT-x.
;
%macro RESTORE_STATE_VM64 0
; Restore base and limit of the IDTR & GDTR
%ifndef VMX_SKIP_IDTR
lidt [xSP]
add xSP, xCB * 2
%endif
%ifndef VMX_SKIP_GDTR
lgdt [xSP]
add xSP, xCB * 2
%endif
push xDI
%ifndef VMX_SKIP_TR
mov xDI, [xSP + xCB * 3] ; pCtx (*3 to skip the saved xDI, TR, LDTR)
%else
mov xDI, [xSP + xCB * 2] ; pCtx (*2 to skip the saved xDI, LDTR)
%endif
mov qword [xDI + CPUMCTX.eax], rax
mov rax, SPECTRE_FILLER64
mov qword [xDI + CPUMCTX.ebx], rbx
mov rbx, rax
mov qword [xDI + CPUMCTX.ecx], rcx
mov rcx, rax
mov qword [xDI + CPUMCTX.edx], rdx
mov rdx, rax
mov qword [xDI + CPUMCTX.esi], rsi
mov rsi, rax
mov qword [xDI + CPUMCTX.ebp], rbp
mov rbp, rax
mov qword [xDI + CPUMCTX.r8], r8
mov r8, rax
mov qword [xDI + CPUMCTX.r9], r9
mov r9, rax
mov qword [xDI + CPUMCTX.r10], r10
mov r10, rax
mov qword [xDI + CPUMCTX.r11], r11
mov r11, rax
mov qword [xDI + CPUMCTX.r12], r12
mov r12, rax
mov qword [xDI + CPUMCTX.r13], r13
mov r13, rax
mov qword [xDI + CPUMCTX.r14], r14
mov r14, rax
mov qword [xDI + CPUMCTX.r15], r15
mov r15, rax
mov rax, cr2
mov qword [xDI + CPUMCTX.cr2], rax
pop xAX ; The guest rdi we pushed above
mov qword [xDI + CPUMCTX.edi], rax
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER xDI, CPUMCTX_WSF_IBPB_EXIT
%ifndef VMX_SKIP_TR
; Restore TSS selector; must mark it as not busy before using ltr (!)
; ASSUME that this is supposed to be 'BUSY'. (saves 20-30 ticks on the T42p).
; @todo get rid of sgdt
pop xBX ; Saved TR
sub xSP, xCB * 2
sgdt [xSP]
mov xAX, xBX
and eax, X86_SEL_MASK_OFF_RPL ; Mask away TI and RPL bits leaving only the descriptor offset.
add xAX, [xSP + 2] ; eax <- GDTR.address + descriptor offset.
and dword [xAX + 4], ~RT_BIT(9) ; Clear the busy flag in TSS desc (bits 0-7=base, bit 9=busy bit).
ltr bx
add xSP, xCB * 2
%endif
pop xAX ; Saved LDTR
cmp eax, 0
je %%skip_ldt_write64
lldt ax
%%skip_ldt_write64:
pop xSI ; pCtx (needed in rsi by the macros below)
%ifdef VMX_USE_CACHED_VMCS_ACCESSES
pop xDX ; Saved pCache
; Note! If we get here as a result of invalid VMCS pointer, all the following
; vmread's will fail (only eflags.cf=1 will be set) but that shouldn't cause any
; trouble only just less efficient.
mov ecx, [xDX + VMCSCACHE.Read.cValidEntries]
cmp ecx, 0 ; Can't happen
je %%no_cached_read64
jmp %%cached_read64
ALIGN(16)
%%cached_read64:
dec xCX
mov eax, [xDX + VMCSCACHE.Read.aField + xCX * 4]
vmread [xDX + VMCSCACHE.Read.aFieldVal + xCX * 8], xAX
cmp xCX, 0
jnz %%cached_read64
%%no_cached_read64:
%endif
; Restore segment registers.
MYPOPSEGS xAX, ax
; Restore the host XCR0 if necessary.
pop xCX
test ecx, ecx
jnz %%xcr0_after_skip
pop xAX
pop xDX
xsetbv ; ecx is already zero.
%%xcr0_after_skip:
; Restore general purpose registers.
MYPOPAD
%endmacro
;;
; Prepares for and executes VMLAUNCH/VMRESUME (64 bits guest mode)
;
; @returns VBox status code
; @param fResume msc:rcx, gcc:rdi Whether to use vmlauch/vmresume.
; @param pCtx msc:rdx, gcc:rsi Pointer to the guest-CPU context.
; @param pCache msc:r8, gcc:rdx Pointer to the VMCS cache.
; @param pVM msc:r9, gcc:rcx The cross context VM structure.
; @param pVCpu msc:[ebp+30], gcc:r8 The cross context virtual CPU structure of the calling EMT.
;
ALIGNCODE(16)
BEGINPROC VMXR0StartVM64
push xBP
mov xBP, xSP
pushf
cli
; Save all general purpose host registers.
MYPUSHAD
; First we have to save some final CPU context registers.
lea r10, [.vmlaunch64_done wrt rip]
mov rax, VMX_VMCS_HOST_RIP ; Return address (too difficult to continue after VMLAUNCH?).
vmwrite rax, r10
; Note: assumes success!
;
; Unify the input parameter registers.
;
%ifdef ASM_CALL64_GCC
; fResume already in rdi
; pCtx already in rsi
mov rbx, rdx ; pCache
%else
mov rdi, rcx ; fResume
mov rsi, rdx ; pCtx
mov rbx, r8 ; pCache
%endif
;
; Save the host XCR0 and load the guest one if necessary.
; Note! Trashes rdx and rcx.
;
%ifdef ASM_CALL64_MSC
mov rax, [xBP + 30h] ; pVCpu
%else
mov rax, r8 ; pVCpu
%endif
test byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
jz .xcr0_before_skip
xor ecx, ecx
xgetbv ; Save the host one on the stack.
push xDX
push xAX
mov eax, [xSI + CPUMCTX.aXcr] ; Load the guest one.
mov edx, [xSI + CPUMCTX.aXcr + 4]
xor ecx, ecx ; paranoia
xsetbv
push 0 ; Indicate that we must restore XCR0 (popped into ecx, thus 0).
jmp .xcr0_before_done
.xcr0_before_skip:
push 3fh ; indicate that we need not.
.xcr0_before_done:
;
; Save segment registers.
; Note! Trashes rdx & rcx, so we moved it here (amd64 case).
;
MYPUSHSEGS xAX, ax
%ifdef VMX_USE_CACHED_VMCS_ACCESSES
mov ecx, [xBX + VMCSCACHE.Write.cValidEntries]
cmp ecx, 0
je .no_cached_writes
mov edx, ecx
mov ecx, 0
jmp .cached_write
ALIGN(16)
.cached_write:
mov eax, [xBX + VMCSCACHE.Write.aField + xCX * 4]
vmwrite xAX, [xBX + VMCSCACHE.Write.aFieldVal + xCX * 8]
inc xCX
cmp xCX, xDX
jl .cached_write
mov dword [xBX + VMCSCACHE.Write.cValidEntries], 0
.no_cached_writes:
; Save the pCache pointer.
push xBX
%endif
; Save the pCtx pointer.
push xSI
; Save host LDTR.
xor eax, eax
sldt ax
push xAX
%ifndef VMX_SKIP_TR
; The host TR limit is reset to 0x67; save & restore it manually.
str eax
push xAX
%endif
%ifndef VMX_SKIP_GDTR
; VT-x only saves the base of the GDTR & IDTR and resets the limit to 0xffff; we must restore the limit correctly!
sub xSP, xCB * 2
sgdt [xSP]
%endif
%ifndef VMX_SKIP_IDTR
sub xSP, xCB * 2
sidt [xSP]
%endif
; Load CR2 if necessary (may be expensive as writing CR2 is a synchronizing instruction).
mov rbx, qword [xSI + CPUMCTX.cr2]
mov rdx, cr2
cmp rbx, rdx
je .skip_cr2_write
mov cr2, rbx
.skip_cr2_write:
mov eax, VMX_VMCS_HOST_RSP
vmwrite xAX, xSP
; Note: assumes success!
; Don't mess with ESP anymore!!!
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER xSI, CPUMCTX_WSF_IBPB_ENTRY
; Load guest general purpose registers.
mov rax, qword [xSI + CPUMCTX.eax]
mov rbx, qword [xSI + CPUMCTX.ebx]
mov rcx, qword [xSI + CPUMCTX.ecx]
mov rdx, qword [xSI + CPUMCTX.edx]
mov rbp, qword [xSI + CPUMCTX.ebp]
mov r8, qword [xSI + CPUMCTX.r8]
mov r9, qword [xSI + CPUMCTX.r9]
mov r10, qword [xSI + CPUMCTX.r10]
mov r11, qword [xSI + CPUMCTX.r11]
mov r12, qword [xSI + CPUMCTX.r12]
mov r13, qword [xSI + CPUMCTX.r13]
mov r14, qword [xSI + CPUMCTX.r14]
mov r15, qword [xSI + CPUMCTX.r15]
; Resume or start VM?
cmp xDI, 0 ; fResume
; Load guest rdi & rsi.
mov rdi, qword [xSI + CPUMCTX.edi]
mov rsi, qword [xSI + CPUMCTX.esi]
je .vmlaunch64_launch
vmresume
jc near .vmxstart64_invalid_vmcs_ptr
jz near .vmxstart64_start_failed
jmp .vmlaunch64_done; ; Here if vmresume detected a failure.
.vmlaunch64_launch:
vmlaunch
jc near .vmxstart64_invalid_vmcs_ptr
jz near .vmxstart64_start_failed
jmp .vmlaunch64_done; ; Here if vmlaunch detected a failure.
ALIGNCODE(16)
.vmlaunch64_done:
RESTORE_STATE_VM64
mov eax, VINF_SUCCESS
.vmstart64_end:
popf
pop xBP
ret
.vmxstart64_invalid_vmcs_ptr:
RESTORE_STATE_VM64
mov eax, VERR_VMX_INVALID_VMCS_PTR_TO_START_VM
jmp .vmstart64_end
.vmxstart64_start_failed:
RESTORE_STATE_VM64
mov eax, VERR_VMX_UNABLE_TO_START_VM
jmp .vmstart64_end
ENDPROC VMXR0StartVM64
%endif ; RT_ARCH_AMD64
;;
; Prepares for and executes VMRUN (32 bits guests)
;
; @returns VBox status code
; @param HCPhysVmcbHost msc:rcx,gcc:rdi Physical address of host VMCB.
; @param HCPhysVmcb msc:rdx,gcc:rsi Physical address of guest VMCB.
; @param pCtx msc:r8,gcc:rdx Pointer to the guest CPU-context.
; @param pVM msc:r9,gcc:rcx The cross context VM structure.
; @param pVCpu msc:[rsp+28],gcc:r8 The cross context virtual CPU structure of the calling EMT.
;
ALIGNCODE(16)
BEGINPROC SVMR0VMRun
%ifdef RT_ARCH_AMD64 ; fake a cdecl stack frame
%ifdef ASM_CALL64_GCC
push r8 ; pVCpu
push rcx ; pVM
push rdx ; pCtx
push rsi ; HCPhysVmcb
push rdi ; HCPhysVmcbHost
%else
mov rax, [rsp + 28h]
push rax ; pVCpu
push r9 ; pVM
push r8 ; pCtx
push rdx ; HCPhysVmcb
push rcx ; HCPhysVmcbHost
%endif
push 0
%endif
push xBP
mov xBP, xSP
pushf
; Save all general purpose host registers.
MYPUSHAD
; Load pCtx into xSI.
mov xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2] ; pCtx
; Save the host XCR0 and load the guest one if necessary.
mov xAX, [xBP + xCB * 2 + RTHCPHYS_CB * 2 + xCB * 2] ; pVCpu
test byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
jz .xcr0_before_skip
xor ecx, ecx
xgetbv ; Save the host XCR0 on the stack
push xDX
push xAX
mov xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2] ; pCtx
mov eax, [xSI + CPUMCTX.aXcr] ; load the guest XCR0
mov edx, [xSI + CPUMCTX.aXcr + 4]
xor ecx, ecx ; paranoia
xsetbv
push 0 ; indicate that we must restore XCR0 (popped into ecx, thus 0)
jmp .xcr0_before_done
.xcr0_before_skip:
push 3fh ; indicate that we need not restore XCR0
.xcr0_before_done:
; Save guest CPU-context pointer for simplifying saving of the GPRs afterwards.
push xSI
; Save host fs, gs, sysenter msr etc.
mov xAX, [xBP + xCB * 2] ; HCPhysVmcbHost (64 bits physical address; x86: take low dword only)
push xAX ; save for the vmload after vmrun
vmsave
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER xSI, CPUMCTX_WSF_IBPB_ENTRY
; Setup xAX for VMLOAD.
mov xAX, [xBP + xCB * 2 + RTHCPHYS_CB] ; HCPhysVmcb (64 bits physical address; x86: take low dword only)
; Load guest general purpose registers.
; eax is loaded from the VMCB by VMRUN.
mov ebx, [xSI + CPUMCTX.ebx]
mov ecx, [xSI + CPUMCTX.ecx]
mov edx, [xSI + CPUMCTX.edx]
mov edi, [xSI + CPUMCTX.edi]
mov ebp, [xSI + CPUMCTX.ebp]
mov esi, [xSI + CPUMCTX.esi]
; Clear the global interrupt flag & execute sti to make sure external interrupts cause a world switch.
clgi
sti
; Load guest fs, gs, sysenter msr etc.
vmload
; Run the VM.
vmrun
; Save guest fs, gs, sysenter msr etc.
vmsave
; Load host fs, gs, sysenter msr etc.
pop xAX ; load HCPhysVmcbHost (pushed above)
vmload
; Set the global interrupt flag again, but execute cli to make sure IF=0.
cli
stgi
; Pop the context pointer (pushed above) and save the guest GPRs (sans RSP and RAX).
pop xAX
mov [ss:xAX + CPUMCTX.ebx], ebx
mov xBX, SPECTRE_FILLER
mov [ss:xAX + CPUMCTX.ecx], ecx
mov xCX, xBX
mov [ss:xAX + CPUMCTX.edx], edx
mov xDX, xBX
mov [ss:xAX + CPUMCTX.esi], esi
mov xSI, xBX
mov [ss:xAX + CPUMCTX.edi], edi
mov xDI, xBX
mov [ss:xAX + CPUMCTX.ebp], ebp
mov xBP, xBX
; Fight spectre. Note! Trashes xAX!
INDIRECT_BRANCH_PREDICTION_BARRIER ss:xAX, CPUMCTX_WSF_IBPB_EXIT
; Restore the host xcr0 if necessary.
pop xCX
test ecx, ecx
jnz .xcr0_after_skip
pop xAX
pop xDX
xsetbv ; ecx is already zero
.xcr0_after_skip:
; Restore host general purpose registers.
MYPOPAD
mov eax, VINF_SUCCESS
popf
pop xBP
%ifdef RT_ARCH_AMD64
add xSP, 6*xCB
%endif
ret
ENDPROC SVMR0VMRun
%ifdef RT_ARCH_AMD64
;;
; Prepares for and executes VMRUN (64 bits guests)
;
; @returns VBox status code
; @param HCPhysVmcbHost msc:rcx,gcc:rdi Physical address of host VMCB.
; @param HCPhysVmcb msc:rdx,gcc:rsi Physical address of guest VMCB.
; @param pCtx msc:r8,gcc:rdx Pointer to the guest-CPU context.
; @param pVM msc:r9,gcc:rcx The cross context VM structure.
; @param pVCpu msc:[rsp+28],gcc:r8 The cross context virtual CPU structure of the calling EMT.
;
ALIGNCODE(16)
BEGINPROC SVMR0VMRun64
; Fake a cdecl stack frame
%ifdef ASM_CALL64_GCC
push r8 ;pVCpu
push rcx ;pVM
push rdx ;pCtx
push rsi ;HCPhysVmcb
push rdi ;HCPhysVmcbHost
%else
mov rax, [rsp + 28h]
push rax ; rbp + 30h pVCpu
push r9 ; rbp + 28h pVM
push r8 ; rbp + 20h pCtx
push rdx ; rbp + 18h HCPhysVmcb
push rcx ; rbp + 10h HCPhysVmcbHost
%endif
push 0 ; rbp + 08h "fake ret addr"
push rbp ; rbp + 00h
mov rbp, rsp
pushf
; Manual save and restore:
; - General purpose registers except RIP, RSP, RAX
;
; Trashed:
; - CR2 (we don't care)
; - LDTR (reset to 0)
; - DRx (presumably not changed at all)
; - DR7 (reset to 0x400)
; Save all general purpose host registers.
MYPUSHAD
; Load pCtx into xSI.
mov xSI, [rbp + xCB * 2 + RTHCPHYS_CB * 2]
; Save the host XCR0 and load the guest one if necessary.
mov rax, [xBP + 30h] ; pVCpu
test byte [xAX + VMCPU.hm + HMCPU.fLoadSaveGuestXcr0], 1
jz .xcr0_before_skip
xor ecx, ecx
xgetbv ; save the host XCR0 on the stack.
push xDX
push xAX
mov xSI, [xBP + xCB * 2 + RTHCPHYS_CB * 2] ; pCtx
mov eax, [xSI + CPUMCTX.aXcr] ; load the guest XCR0
mov edx, [xSI + CPUMCTX.aXcr + 4]
xor ecx, ecx ; paranoia
xsetbv
push 0 ; indicate that we must restore XCR0 (popped into ecx, thus 0)
jmp .xcr0_before_done
.xcr0_before_skip:
push 3fh ; indicate that we need not restore XCR0
.xcr0_before_done:
; Save guest CPU-context pointer for simplifying saving of the GPRs afterwards.
push rsi
; Save host fs, gs, sysenter msr etc.
mov rax, [rbp + xCB * 2] ; HCPhysVmcbHost (64 bits physical address; x86: take low dword only)
push rax ; save for the vmload after vmrun
vmsave
; Fight spectre.
INDIRECT_BRANCH_PREDICTION_BARRIER xSI, CPUMCTX_WSF_IBPB_ENTRY
; Setup rax for VMLOAD.
mov rax, [rbp + xCB * 2 + RTHCPHYS_CB] ; HCPhysVmcb (64 bits physical address; take low dword only)
; Load guest general purpose registers (rax is loaded from the VMCB by VMRUN).
mov rbx, qword [xSI + CPUMCTX.ebx]
mov rcx, qword [xSI + CPUMCTX.ecx]
mov rdx, qword [xSI + CPUMCTX.edx]
mov rdi, qword [xSI + CPUMCTX.edi]
mov rbp, qword [xSI + CPUMCTX.ebp]
mov r8, qword [xSI + CPUMCTX.r8]
mov r9, qword [xSI + CPUMCTX.r9]
mov r10, qword [xSI + CPUMCTX.r10]
mov r11, qword [xSI + CPUMCTX.r11]
mov r12, qword [xSI + CPUMCTX.r12]
mov r13, qword [xSI + CPUMCTX.r13]
mov r14, qword [xSI + CPUMCTX.r14]
mov r15, qword [xSI + CPUMCTX.r15]
mov rsi, qword [xSI + CPUMCTX.esi]
; Clear the global interrupt flag & execute sti to make sure external interrupts cause a world switch.
clgi
sti
; Load guest FS, GS, Sysenter MSRs etc.
vmload
; Run the VM.
vmrun
; Save guest fs, gs, sysenter msr etc.
vmsave
; Load host fs, gs, sysenter msr etc.
pop rax ; load HCPhysVmcbHost (pushed above)
vmload
; Set the global interrupt flag again, but execute cli to make sure IF=0.
cli
stgi
; Pop the context pointer (pushed above) and save the guest GPRs (sans RSP and RAX).
pop rax
mov qword [rax + CPUMCTX.ebx], rbx
mov rbx, SPECTRE_FILLER64
mov qword [rax + CPUMCTX.ecx], rcx
mov rcx, rbx
mov qword [rax + CPUMCTX.edx], rdx
mov rdx, rbx
mov qword [rax + CPUMCTX.esi], rsi
mov rsi, rbx
mov qword [rax + CPUMCTX.edi], rdi
mov rdi, rbx
mov qword [rax + CPUMCTX.ebp], rbp
mov rbp, rbx
mov qword [rax + CPUMCTX.r8], r8
mov r8, rbx
mov qword [rax + CPUMCTX.r9], r9
mov r9, rbx
mov qword [rax + CPUMCTX.r10], r10
mov r10, rbx
mov qword [rax + CPUMCTX.r11], r11
mov r11, rbx
mov qword [rax + CPUMCTX.r12], r12
mov r12, rbx
mov qword [rax + CPUMCTX.r13], r13
mov r13, rbx
mov qword [rax + CPUMCTX.r14], r14
mov r14, rbx
mov qword [rax + CPUMCTX.r15], r15
mov r15, rbx
; Fight spectre. Note! Trashes rax!
INDIRECT_BRANCH_PREDICTION_BARRIER rax, CPUMCTX_WSF_IBPB_EXIT
; Restore the host xcr0 if necessary.
pop xCX
test ecx, ecx
jnz .xcr0_after_skip
pop xAX
pop xDX
xsetbv ; ecx is already zero
.xcr0_after_skip:
; Restore host general purpose registers.
MYPOPAD
mov eax, VINF_SUCCESS
popf
pop rbp
add rsp, 6 * xCB
ret
ENDPROC SVMR0VMRun64
%endif ; RT_ARCH_AMD64
|
source/s-unwhan.adb | ytomino/drake | 33 | 19953 | <reponame>ytomino/drake
pragma Check_Policy (Trace => Ignore);
with Ada; -- assertions
with System.Unwind.Mapping;
with System.Unwind.Occurrences;
package body System.Unwind.Handling is
pragma Suppress (All_Checks);
use type Unwind.Representation.Machine_Occurrence_Access;
use type Unwind.Representation.Unwind_Exception_Class;
-- force to link System.Unwind.Mapping
-- to convert signals or SEH exceptions to standard exceptions.
Force_Use : Address := Mapping.Install_Exception_Handler'Address
with Export,
Convention => Ada,
External_Name => "__drake_use_install_exception_handler";
-- implementation
procedure Begin_Handler (
Machine_Occurrence : Representation.Machine_Occurrence_Access) is
begin
pragma Check (Trace, Ada.Debug.Put ("enter"));
Occurrences.Set_Current_Machine_Occurrence (Machine_Occurrence);
pragma Check (Trace, Ada.Debug.Put ("leave"));
end Begin_Handler;
procedure End_Handler (
Machine_Occurrence : Representation.Machine_Occurrence_Access) is
begin
pragma Check (Trace, Ada.Debug.Put ("enter"));
pragma Check (Trace,
Check =>
Machine_Occurrence = null
or else Ada.Debug.Put ("Machine_Occurrence = null, reraised"));
if Machine_Occurrence /= null then
Occurrences.Free (Machine_Occurrence);
Occurrences.Set_Current_Machine_Occurrence (null);
-- in Win32 SEH, the chain may be rollback, so restore it
Mapping.Reinstall_Exception_Handler;
end if;
pragma Check (Trace, Ada.Debug.Put ("leave"));
end End_Handler;
procedure Set_Exception_Parameter (
X : not null Exception_Occurrence_Access;
Machine_Occurrence :
not null Representation.Machine_Occurrence_Access) is
begin
if Machine_Occurrence.Header.exception_class =
Representation.GNAT_Exception_Class
then
Occurrences.Save_Occurrence (X.all, Machine_Occurrence.Occurrence);
else
Occurrences.Set_Foreign_Occurrence (X.all, Machine_Occurrence);
end if;
end Set_Exception_Parameter;
end System.Unwind.Handling;
|
tools-src/gnu/gcc/gcc/ada/5qosinte.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 6467 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod
------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . O S _ I N T E R F A C E --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1991-2001 Florida State University --
-- --
-- GNARL 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. GNARL 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 GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. It is --
-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
-- State University (http://www.gnat.com). --
-- --
------------------------------------------------------------------------------
-- RT GNU/Linux version.
-- This package encapsulates all direct interfaces to OS services
-- that are needed by children of System.
-- PLEASE DO NOT add any with-clauses to this package
-- or remove the pragma Elaborate_Body.
-- It is designed to be a bottom-level (leaf) package.
with Interfaces.C;
package System.OS_Interface is
pragma Preelaborate;
subtype int is Interfaces.C.int;
subtype unsigned_long is Interfaces.C.unsigned_long;
-- RT GNU/Linux kernel threads should not use the
-- OS signal interfaces.
Max_Interrupt : constant := 2;
type Signal is new int range 0 .. Max_Interrupt;
type sigset_t is new Integer;
----------
-- Time --
----------
RT_TICKS_PER_SEC : constant := 1193180;
-- the amount of time units in one second.
RT_TIME_END : constant := 16#7fffFfffFfffFfff#;
type RTIME is range -2 ** 63 .. 2 ** 63 - 1;
-- the introduction of type RTIME is due to the fact that RT-GNU/Linux
-- uses this type to represent time. In RT-GNU/Linux, it's a long long
-- integer that takes 64 bits for storage
-------------------------
-- Priority Scheduling --
-------------------------
RT_LOWEST_PRIORITY : constant System.Any_Priority :=
System.Any_Priority'First;
-- for the lowest priority task in RT-GNU/Linux. By the design, this
-- task is the regular GNU/Linux kernel.
RT_TASK_MAGIC : constant := 16#754d2774#;
-- a special constant used as a label for a task that has been created
----------------------------
-- RT constants and types --
----------------------------
SFIF : Integer;
pragma Import (C, SFIF, "SFIF");
-- Interrupt emulation flag used by RT-GNU/Linux. If it's 0, the regular
-- GNU/Linux kernel is preempted. Otherwise, the regular Linux kernel is
-- running
GFP_ATOMIC : constant := 16#1#;
GFP_KERNEL : constant := 16#3#;
-- constants to indicate the priority of a call to kmalloc.
-- GFP_KERNEL is used in the current implementation to allocate
-- stack space for a task. Since GFP_ATOMIC has higher priority,
-- if necessary, replace GFP_KERNEL with GFP_ATOMIC
type Rt_Task_States is (RT_TASK_READY, RT_TASK_DELAYED, RT_TASK_DORMANT);
-------------
-- Threads --
-------------
type Thread_Body is access
function (arg : System.Address) return System.Address;
-- ??? need to define a type for references to (IDs of)
-- RT GNU/Linux lock objects, and implement the lock objects.
subtype Thread_Id is System.Address;
-------------------------------
-- Useful imported functions --
-------------------------------
-------------------------------------
-- Functions from GNU/Linux kernel --
-------------------------------------
function Kmalloc (size : Integer; Priority : Integer) return System.Address;
pragma Import (C, Kmalloc, "kmalloc");
procedure Kfree (Ptr : System.Address);
pragma Import (C, Kfree, "kfree");
procedure Printk (Msg : String);
pragma Import (C, Printk, "printk");
---------------------
-- RT time related --
---------------------
function Rt_Get_Time return RTIME;
pragma Import (C, Rt_Get_Time, "rt_get_time");
function Rt_Request_Timer (Fn : System.Address) return Integer;
procedure Rt_Request_Timer (Fn : System.Address);
pragma Import (C, Rt_Request_Timer, "rt_request_timer");
procedure Rt_Free_Timer;
pragma Import (C, Rt_Free_Timer, "rt_free_timer");
procedure Rt_Set_Timer (T : RTIME);
pragma Import (C, Rt_Set_Timer, "rt_set_timer");
procedure Rt_No_Timer;
pragma Import (C, Rt_No_Timer, "rt_no_timer");
---------------------
-- RT FIFO related --
---------------------
function Rtf_Create (Fifo : Integer; Size : Integer) return Integer;
pragma Import (C, Rtf_Create, "rtf_create");
function Rtf_Destroy (Fifo : Integer) return Integer;
pragma Import (C, Rtf_Destroy, "rtf_destroy");
function Rtf_Resize (Minor : Integer; Size : Integer) return Integer;
pragma Import (C, Rtf_Resize, "rtf_resize");
function Rtf_Put
(Fifo : Integer;
Buf : System.Address;
Count : Integer) return Integer;
pragma Import (C, Rtf_Put, "rtf_put");
function Rtf_Get
(Fifo : Integer;
Buf : System.Address;
Count : Integer) return Integer;
pragma Import (C, Rtf_Get, "rtf_get");
function Rtf_Create_Handler
(Fifo : Integer;
Handler : System.Address) return Integer;
pragma Import (C, Rtf_Create_Handler, "rtf_create_handler");
private
type Require_Body;
end System.OS_Interface;
|
lib/cpm_crt0.asm | meesokim/z88dk | 0 | 163810 | ;
; Startup for CP/M
;
; <NAME> - Apr. 2000
; Apr. 2001: Added MS-DOS protection
;
; <NAME> - Jan. 2001: Added argc/argv support
; - Jan. 2001: Added in malloc routines
; - Jan. 2001: File support added
;
; $Id: cpm_crt0.asm,v 1.23 2015/01/21 07:05:00 stefano Exp $
;
; There are a couple of #pragma commands which affect
; this file:
;
; #pragma output nostreams - No stdio disc files
; #pragma output nofileio - No fileio at all
; #pragma output noprotectmsdos - strip the MS-DOS protection header
; #pragma output noredir - do not insert the file redirection option while parsing the
; command line arguments (useless if "nostreams" is set)
;
; These can cut down the size of the resultant executable
MODULE cpm_crt0
;-------------------------------------------------
; Include zcc_opt.def to find out some information
;-------------------------------------------------
INCLUDE "zcc_opt.def"
;-----------------------
; Some scope definitions
;-----------------------
EXTERN _main ;main() is always external to crt0
PUBLIC cleanup ;jp'd to by exit()
PUBLIC l_dcal ;jp(hl)
PUBLIC _vfprintf ;jp to printf core routine
PUBLIC exitsp ;atexit() variables
PUBLIC exitcount
PUBLIC heaplast ;Near malloc heap variables
PUBLIC heapblocks ;
PUBLIC __sgoioblk ;std* control block
PUBLIC __fcb ;file control block
;-----------------------
; Target specific labels
;-----------------------
PUBLIC _vdcDispMem ; pointer to disp. memory for C128
PUBLIC snd_tick ; for sound code, if any
PUBLIC bit_irqstatus ; current irq status when DI is necessary
PUBLIC RG0SAV ; keeping track of VDP register values (Einstein)
PUBLIC pixelbyte ; VDP gfx driver, byte temp storage
PUBLIC coords
org $100
;----------------------
; Execution starts here
;----------------------
start:
IF !DEFINED_noprotectmsdos
defb $eb,$04 ;DOS protection... JMPS LABE
ex de,hl
jp begin
defb $b4,$09 ;DOS protection... MOV AH,9
defb $ba
defw dosmessage ;DOS protection... MOV DX,OFFSET dosmessage
defb $cd,$21 ;DOS protection... INT 21h.
defb $cd,$20 ;DOS protection... INT 20h.
dosmessage:
defm "This program is for a CP/M system."
defb 13,10,'$'
begin:
ENDIF
ld (start1+1),sp ;Save entry stack
ld a,($80) ;byte count of length of args
inc a ;we can use this since args are space separated
neg
ld l,a
ld h,-1 ;negative number
ld de,-64 ;Add on space for atexit() stack
add hl,de
add hl,sp
ld sp,hl
ld (exitsp),sp
; 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
ld c,25 ;Set the default disc
call 5
ld (defltdsk),a
; Push pointers to argv[n] onto the stack now
; We must start from the end
ld hl,0 ;NULL pointer at end, just in case
push hl
ld hl,$80
ld a,(hl)
ld b,0
and a
jr z,argv_done
ld c,a
add hl,bc ;now points to the end
; Try to find the end of the arguments
argv_loop_1:
ld a,(hl)
cp ' '
jr nz,argv_loop_2
ld (hl),0
dec hl
dec c
jr nz,argv_loop_1
; We've located the end of the last argument, try to find the start
argv_loop_2:
ld a,(hl)
cp ' '
jr nz,argv_loop_3
;ld (hl),0
inc hl
IF !DEFINED_noredir
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
EXTERN freopen
xor a
add b
jr nz,no_redir_stdout
ld a,(hl)
cp '>'
jr nz,no_redir_stdout
push hl
inc hl
cp (hl)
dec hl
ld de,redir_fopen_flag ; "a" or "w"
jr nz,noappendb
ld a,'a'
ld (de),a
inc hl
noappendb:
inc hl
push bc
push hl ; file name ptr
push de
ld de,__sgoioblk+4 ; file struct for stdout
push de
call freopen
pop de
pop de
pop hl
pop bc
pop hl
dec hl
jr argv_zloop
no_redir_stdout:
ld a,(hl)
cp '<'
jr nz,no_redir_stdin
push hl
inc hl
ld de,redir_fopen_flagr
push bc
push hl ; file name ptr
push de
ld de,__sgoioblk ; file struct for stdin
push de
call freopen
pop de
pop de
pop hl
pop bc
pop hl
dec hl
jr argv_zloop
no_redir_stdin:
ENDIF
ENDIF
ENDIF
push hl
inc b
dec hl
; skip extra blanks
argv_zloop:
ld (hl),0
dec c
jr z,argv_done
dec hl
ld a,(hl)
cp ' '
jr z,argv_zloop
inc c
inc hl
argv_loop_3:
dec hl
dec c
jr nz,argv_loop_2
argv_done:
ld hl,end ;name of program (NULL)
push hl
inc b
ld hl,0
add hl,sp ;address of argv
ld c,b
ld b,0
push bc ;argc
push hl ;argv
call _main ;Call user code
pop bc ;kill argv
pop bc ;kill argc
ld a,(defltdsk) ;Restore default disc
ld e,a
ld c,14
call 5
cleanup:
push hl ;Save return value
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
EXTERN closeall ;Close any opened files
call closeall
ENDIF
ENDIF
pop bc ;Get exit() value into bc
start1: ld sp,0 ;Pick up entry sp
jp 0
l_dcal: jp (hl) ;Used for call by function ptr
;------------------------
; The stdio control block
;------------------------
__sgoioblk:
IF DEFINED_ANSIstdio
INCLUDE "stdio_fp.asm"
ELSE
defw -11,-12,-10 ;Dummy values (unused by CPM port?)
ENDIF
;----------------------------------------
; Work out which vfprintf routine we need
;----------------------------------------
_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
;-----------------------
; Some startup variables
;-----------------------
defltdsk: defb 0 ;Default disc
exitsp: defw 0 ;Address of atexit() stack
exitcount: defb 0 ;Number of atexit() routinens
heaplast: defw 0 ;Pointer to last free heap block
heapblocks: defw 0 ;Number of heap blocks available
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_nofileio
__fcb: defs 420,0 ;file control block (10 files) (MAXFILE)
ENDIF
IF !DEFINED_HAVESEED
PUBLIC _std_seed ;Integer rand() seed
_std_seed: defw 0 ; Seed for integer rand() routines
ENDIF
IF DEFINED_NEED1bitsound
snd_tick: defb 0 ; Sound variable
bit_irqstatus: defw 0
ENDIF
;-----------------------------------------------------
; Unneccessary file signature + target specific stuff
;-----------------------------------------------------
_vdcDispMem: ; Label used by "c128cpm.lib" only
base_graphics: ; various gfx drivers
defm "Small C+ CP/M"
end: defb 0 ; null file name
RG0SAV: defb 0 ; VDP graphics driver (Einstein)
pixelbyte: defb 0 ; temp byte storage for VDP driver
coords: defw 0 ; Current graphics xy coordinates
;----------------------------------------------
; Floating point support routines and variables
;----------------------------------------------
IF NEED_floatpack
INCLUDE "float.asm"
fp_seed: defb $80,$80,0,0,0,0 ; FP seed (unused ATM)
extra: defs 6 ; FP spare register
fa: defs 6 ; FP accumulator
fasign: defb 0 ; FP variable
ENDIF
IF !DEFINED_noredir
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
redir_fopen_flag:
defb 'w'
defb 0
redir_fopen_flagr:
defb 'r'
defb 0
ENDIF
ENDIF
ENDIF
|
Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2_notsx.log_8_1792.asm | ljhsiun2/medusa | 9 | 29657 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/US/_zr_/i7-8650U_0xd2_notsx.log_8_1792.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xe180, %rsi
lea addresses_A_ht+0xaf52, %rdi
nop
nop
nop
sub $7854, %rax
mov $43, %rcx
rep movsl
nop
nop
nop
nop
nop
and $25601, %rax
lea addresses_UC_ht+0xeb52, %r10
nop
nop
nop
nop
xor %rax, %rax
vmovups (%r10), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r15
nop
nop
nop
nop
nop
xor $6610, %r10
lea addresses_WT_ht+0x8f52, %rdi
nop
nop
and $15663, %rsi
movups (%rdi), %xmm7
vpextrq $0, %xmm7, %r15
nop
nop
nop
nop
xor $40776, %r15
lea addresses_WT_ht+0x18f52, %rsi
lea addresses_A_ht+0x10752, %rdi
nop
nop
nop
nop
sub %r9, %r9
mov $27, %rcx
rep movsb
xor %rax, %rax
lea addresses_WC_ht+0x14602, %rdi
nop
and %rcx, %rcx
movb $0x61, (%rdi)
nop
nop
nop
nop
and %r15, %r15
lea addresses_WC_ht+0x15352, %r10
nop
sub $29393, %rcx
mov $0x6162636465666768, %r15
movq %r15, (%r10)
nop
nop
nop
nop
sub $49454, %rdi
lea addresses_D_ht+0x7352, %rsi
lea addresses_normal_ht+0x9752, %rdi
nop
nop
nop
nop
nop
xor %r14, %r14
mov $1, %rcx
rep movsl
nop
nop
nop
nop
nop
inc %r10
lea addresses_normal_ht+0xef52, %rsi
lea addresses_WT_ht+0x14b52, %rdi
xor %r10, %r10
mov $115, %rcx
rep movsl
inc %rdi
lea addresses_A_ht+0xc252, %rcx
nop
inc %r9
mov $0x6162636465666768, %r15
movq %r15, (%rcx)
nop
nop
inc %r15
lea addresses_WC_ht+0xcf52, %rsi
lea addresses_WC_ht+0x43ca, %rdi
nop
nop
nop
nop
add $49225, %r15
mov $112, %rcx
rep movsw
nop
nop
nop
nop
and $21802, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %r9
push %rbx
push %rcx
push %rdi
// Store
lea addresses_US+0x1df52, %r8
nop
nop
nop
nop
nop
xor $36795, %rbx
mov $0x5152535455565758, %r10
movq %r10, %xmm2
movaps %xmm2, (%r8)
nop
nop
nop
sub $20218, %rcx
// Store
lea addresses_normal+0xb208, %r14
nop
nop
sub $48710, %r9
mov $0x5152535455565758, %r10
movq %r10, %xmm1
vmovups %ymm1, (%r14)
nop
and %rbx, %rbx
// Store
lea addresses_RW+0x7f52, %r8
nop
nop
dec %rbx
movw $0x5152, (%r8)
sub %rbx, %rbx
// Store
lea addresses_PSE+0x1abd2, %r9
nop
nop
and $8507, %r10
movw $0x5152, (%r9)
sub %r9, %r9
// Store
lea addresses_normal+0xe452, %r10
and $8657, %r8
movl $0x51525354, (%r10)
nop
nop
nop
cmp %r9, %r9
// Faulty Load
lea addresses_US+0x1df52, %r10
nop
nop
nop
inc %rdi
vmovups (%r10), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r8
lea oracles, %r10
and $0xff, %r8
shlq $12, %r8
mov (%r10,%r8,1), %r8
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'00': 8}
00 00 00 00 00 00 00 00
*/
|
oeis/105/A105531.asm | neoneye/loda-programs | 11 | 2060 | <filename>oeis/105/A105531.asm
; A105531: Decimal expansion of arctan 1/3.
; Submitted by <NAME>
; 3,2,1,7,5,0,5,5,4,3,9,6,6,4,2,1,9,3,4,0,1,4,0,4,6,1,4,3,5,8,6,6,1,3,1,9,0,2,0,7,5,5,2,9,5,5,5,7,6,5,6,1,9,1,4,3,2,8,0,3,0,5,9,3,5,6,7,5,6,2,3,7,4,0,5,8,1,0,5,4,4,3,5,6,4,0,8,4,2,2,3,5,0,6,4,1,3,7,4,4
mov $1,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
mul $1,$3
mov $5,$3
mul $5,2
add $5,1
mul $2,$5
mul $2,5
add $1,$2
div $1,$5
div $2,$5
sub $3,1
lpe
mul $1,3
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
Cubical/Homotopy/Group/Base.agda | rnarkk/cubical | 0 | 2895 | <reponame>rnarkk/cubical<gh_stars>0
{-# OPTIONS --safe --experimental-lossy-unification #-}
module Cubical.Homotopy.Group.Base where
open import Cubical.Homotopy.Loopspace
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Pointed
open import Cubical.Foundations.Pointed.Homogeneous
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.GroupoidLaws renaming (assoc to ∙assoc)
open import Cubical.Foundations.Path
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Function
open import Cubical.Foundations.Transport
open import Cubical.Functions.Morphism
open import Cubical.HITs.SetTruncation
renaming (rec to sRec ; rec2 to sRec2
; elim to sElim ; elim2 to sElim2 ; elim3 to sElim3
; map to sMap)
open import Cubical.HITs.Truncation
renaming (rec to trRec ; elim to trElim ; elim2 to trElim2)
open import Cubical.HITs.Sn
open import Cubical.HITs.Susp renaming (toSusp to σ)
open import Cubical.HITs.S1
open import Cubical.Data.Sigma
open import Cubical.Data.Nat
open import Cubical.Data.Bool
open import Cubical.Data.Unit
open import Cubical.Algebra.Group
open import Cubical.Algebra.Semigroup
open import Cubical.Algebra.Monoid
open Iso
open IsGroup
open IsSemigroup
open IsMonoid
open GroupStr
{- Homotopy group -}
π : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → Type ℓ
π n A = ∥ typ ((Ω^ n) A) ∥₂
{- Alternative formulation. This will be given a group structure in
the Properties file -}
π' : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → Type ℓ
π' n A = ∥ S₊∙ n →∙ A ∥₂
{- π as a group -}
1π : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π n A
1π zero {A = A} = ∣ pt A ∣₂
1π (suc n) = ∣ refl ∣₂
·π : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π (suc n) A → π (suc n) A → π (suc n) A
·π n = sRec2 squash₂ λ p q → ∣ p ∙ q ∣₂
-π : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π (suc n) A → π (suc n) A
-π n = sMap sym
π-rUnit : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π (suc n) A)
→ (·π n x (1π (suc n))) ≡ x
π-rUnit n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ rUnit p (~ i) ∣₂
π-lUnit : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π (suc n) A)
→ (·π n (1π (suc n)) x) ≡ x
π-lUnit n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ lUnit p (~ i) ∣₂
π-rCancel : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π (suc n) A)
→ (·π n x (-π n x)) ≡ 1π (suc n)
π-rCancel n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ rCancel p i ∣₂
π-lCancel : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π (suc n) A)
→ (·π n (-π n x) x) ≡ 1π (suc n)
π-lCancel n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ lCancel p i ∣₂
π-assoc : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x y z : π (suc n) A)
→ ·π n x (·π n y z) ≡ ·π n (·π n x y) z
π-assoc n = sElim3 (λ _ _ _ → isSetPathImplicit) λ p q r i → ∣ ∙assoc p q r i ∣₂
π-comm : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x y : π (suc (suc n)) A)
→ ·π (suc n) x y ≡ ·π (suc n) y x
π-comm n = sElim2 (λ _ _ → isSetPathImplicit) λ p q i → ∣ EH n p q i ∣₂
-- πₙ₊₁
πGr : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → Group ℓ
fst (πGr n A) = π (suc n) A
1g (snd (πGr n A)) = 1π (suc n)
GroupStr._·_ (snd (πGr n A)) = ·π n
inv (snd (πGr n A)) = -π n
is-set (isSemigroup (isMonoid (isGroup (snd (πGr n A))))) = squash₂
assoc (isSemigroup (isMonoid (isGroup (snd (πGr n A))))) = π-assoc n
identity (isMonoid (isGroup (snd (πGr n A)))) x = (π-rUnit n x) , (π-lUnit n x)
inverse (isGroup (snd (πGr n A))) x = (π-rCancel n x) , (π-lCancel n x)
-- Group operations on π'.
-- We define the corresponding structure on the untruncated
-- (S₊∙ n →∙ A).
∙Π : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (S₊∙ n →∙ A)
→ (S₊∙ n →∙ A)
→ (S₊∙ n →∙ A)
∙Π {A = A} {n = zero} p q = (λ _ → pt A) , refl
fst (∙Π {A = A} {n = suc zero} (f , p) (g , q)) base = pt A
fst (∙Π {A = A} {n = suc zero} (f , p) (g , q)) (loop j) =
((sym p ∙∙ cong f loop ∙∙ p) ∙ (sym q ∙∙ cong g loop ∙∙ q)) j
snd (∙Π {A = A} {n = suc zero} (f , p) (g , q)) = refl
fst (∙Π {A = A} {n = suc (suc n)} (f , p) (g , q)) north = pt A
fst (∙Π {A = A} {n = suc (suc n)} (f , p) (g , q)) south = pt A
fst (∙Π {A = A} {n = suc (suc n)} (f , p) (g , q)) (merid a j) =
((sym p ∙∙ cong f (merid a ∙ sym (merid (ptSn (suc n)))) ∙∙ p)
∙ (sym q ∙∙ cong g (merid a ∙ sym (merid (ptSn (suc n)))) ∙∙ q)) j
snd (∙Π {A = A} {n = suc (suc n)} (f , p) (g , q)) = refl
-Π : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (S₊∙ n →∙ A)
→ (S₊∙ n →∙ A)
-Π {n = zero} f = f
fst (-Π {A = A} {n = suc zero} f) base = fst f base
fst (-Π {A = A} {n = suc zero} f) (loop j) = fst f (loop (~ j))
snd (-Π {A = A} {n = suc zero} f) = snd f
fst (-Π {A = A} {n = suc (suc n)} f) north = fst f north
fst (-Π {A = A} {n = suc (suc n)} f) south = fst f north
fst (-Π {A = A} {n = suc (suc n)} f) (merid a j) =
fst f ((merid a ∙ sym (merid (ptSn _))) (~ j))
snd (-Π {A = A} {n = suc (suc n)} f) = snd f
-- to prove that this gives a group structure on π', we first
-- prove that Ωⁿ A ≃ (Sⁿ →∙ A).
-- We use the following map
mutual
Ω→SphereMap : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ}
→ typ ((Ω^ n) A) → (S₊∙ n →∙ A)
fst (Ω→SphereMap zero a) false = a
fst (Ω→SphereMap zero {A = A} a) true = pt A
snd (Ω→SphereMap zero a) = refl
fst (Ω→SphereMap (suc zero) {A = A} p) base = pt A
fst (Ω→SphereMap (suc zero) p) (loop i) = p i
snd (Ω→SphereMap (suc zero) p) = refl
fst (Ω→SphereMap (suc (suc n)) {A = A} p) north = pt A
fst (Ω→SphereMap (suc (suc n)) {A = A} p) south = pt A
fst (Ω→SphereMap (suc (suc n)) p) (merid a i) =
(sym (Ω→SphereMapId (suc n) a)
∙∙ (λ i → Ω→SphereMap (suc n) (p i) .fst a)
∙∙ Ω→SphereMapId (suc n) a) i
snd (Ω→SphereMap (suc (suc n)) p) = refl
Ω→SphereMapId : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (a : _)
→ Ω→SphereMap n {A = A} (pt ((Ω^ n) A)) .fst a ≡ pt A
Ω→SphereMapId zero false = refl
Ω→SphereMapId zero true = refl
Ω→SphereMapId (suc zero) base = refl
Ω→SphereMapId (suc zero) (loop i) = refl
Ω→SphereMapId (suc (suc n)) north = refl
Ω→SphereMapId (suc (suc n)) south = refl
Ω→SphereMapId (suc (suc n)) {A = A} (merid a i) j =
∙∙lCancel (Ω→SphereMapId (suc n) {A = A} a) j i
Ω→SphereMapId2 : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ}
→ Ω→SphereMap n {A = A} (pt ((Ω^ n) A)) ≡ ((λ _ → pt A) , refl)
fst (Ω→SphereMapId2 n {A = A} i) a = funExt (Ω→SphereMapId n {A = A}) i a
snd (Ω→SphereMapId2 zero {A = A} i) = refl
snd (Ω→SphereMapId2 (suc zero) {A = A} i) = refl
snd (Ω→SphereMapId2 (suc (suc n)) {A = A} i) = refl
-- Pointed version
Ω→SphereMap∙ : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ}
→ ((Ω^ n) A) →∙ (S₊∙ n →∙ A ∙)
Ω→SphereMap∙ n .fst = Ω→SphereMap n
Ω→SphereMap∙ n .snd = Ω→SphereMapId2 n
-- We define the following maps which will be used to
-- show that Ω→SphereMap is an equivalence
Ω→SphereMapSplit₁ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ typ ((Ω^ (suc n)) A)
→ typ (Ω (S₊∙ n →∙ A ∙))
Ω→SphereMapSplit₁ n = Ω→ (Ω→SphereMap∙ n) .fst
ΩSphereMap : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ typ (Ω (S₊∙ n →∙ A ∙))
→ (S₊∙ (suc n) →∙ A)
fst (ΩSphereMap {A = A} zero p) base = p i0 .fst false
fst (ΩSphereMap {A = A} zero p) (loop i) = p i .fst false
snd (ΩSphereMap {A = A} zero p) = refl
ΩSphereMap {A = A} (suc n) = fun IsoΩFunSuspFun
-- Functoriality
-- The homogeneity assumption is not necessary but simplifying
isNaturalΩSphereMap : ∀ {ℓ ℓ'} (A : Pointed ℓ) (B : Pointed ℓ')
(homogB : isHomogeneous B) (f : A →∙ B) (n : ℕ)
→ ∀ g → f ∘∙ ΩSphereMap n g ≡ ΩSphereMap n (Ω→ (post∘∙ (S₊∙ n) f) .fst g)
isNaturalΩSphereMap A B homogB f 0 g =
→∙Homogeneous≡ homogB (funExt lem)
where
lem : ∀ x → f .fst (ΩSphereMap 0 g .fst x)
≡ ΩSphereMap 0 (Ω→ (post∘∙ (S₊∙ 0) f) .fst g) .fst x
lem base = f .snd
lem (loop i) j =
hfill
(λ j → λ
{ (i = i0) → post∘∙ _ f .snd j
; (i = i1) → post∘∙ _ f .snd j
})
(inS (f ∘∙ g i))
j .fst false
isNaturalΩSphereMap A B homogB f (n@(suc _)) g =
→∙Homogeneous≡ homogB (funExt lem)
where
lem : ∀ x → f .fst (ΩSphereMap n g .fst x)
≡ ΩSphereMap n (Ω→ (post∘∙ (S₊∙ n) f) .fst g) .fst x
lem north = f .snd
lem south = f .snd
lem (merid a i) j =
hfill
(λ j → λ
{ (i = i0) → post∘∙ _ f .snd j
; (i = i1) → post∘∙ _ f .snd j
})
(inS (f ∘∙ g i))
j .fst a
SphereMapΩ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (S₊∙ (suc n) →∙ A)
→ typ (Ω (S₊∙ n →∙ A ∙))
SphereMapΩ {A = A} zero (f , p) =
ΣPathP ((funExt λ { false → sym p ∙∙ cong f loop ∙∙ p
; true → refl})
, refl)
SphereMapΩ {A = A} (suc n) = inv IsoΩFunSuspFun
SphereMapΩIso : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (S₊∙ (suc n) →∙ A)
(typ (Ω (S₊∙ n →∙ A ∙)))
fun (SphereMapΩIso n) = SphereMapΩ n
inv (SphereMapΩIso n) = ΩSphereMap n
fst (rightInv (SphereMapΩIso zero) f i j) false = rUnit (λ j → fst (f j) false) (~ i) j
fst (rightInv (SphereMapΩIso {A = A} zero) f i j) true = snd (f j) (~ i)
snd (rightInv (SphereMapΩIso {A = A} zero) f i j) k = snd (f j) (~ i ∨ k)
rightInv (SphereMapΩIso (suc n)) = leftInv IsoΩFunSuspFun
leftInv (SphereMapΩIso zero) f =
ΣPathP ((funExt (λ { base → sym (snd f)
; (loop i) j → doubleCompPath-filler
(sym (snd f))
(cong (fst f) loop)
(snd f) (~ j) i}))
, λ i j → snd f (~ i ∨ j))
leftInv (SphereMapΩIso (suc n)) = rightInv IsoΩFunSuspFun
{-
In order to show that Ω→SphereMap is an equivalence, we show that it factors
Ω→SphereMapSplit₁ ΩSphereMap
Ωⁿ⁺¹(Sⁿ →∙ A) ----------------> Ω (Sⁿ →∙ A) -----------> (Sⁿ⁺¹ →∙ A)
-}
Ω→SphereMap-split : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (p : typ ((Ω^ (suc n)) A))
→ Ω→SphereMap (suc n) p ≡ ΩSphereMap n (Ω→SphereMapSplit₁ n p)
Ω→SphereMap-split {A = A} zero p =
ΣPathP ((funExt (λ { base → refl
; (loop i) j → lem (~ j) i}))
, refl)
where
lem : funExt⁻ (cong fst (Ω→SphereMapSplit₁ zero p)) false ≡ p
lem = (λ i → funExt⁻ (cong-∙∙ fst (sym (Ω→SphereMapId2 zero))
(cong (Ω→SphereMap zero) p)
(Ω→SphereMapId2 zero) i) false)
∙ sym (rUnit _)
Ω→SphereMap-split {A = A} (suc n) p =
ΣPathP ((funExt (λ { north → refl
; south → refl
; (merid a i) j → lem₂ a j i}))
, refl)
where
lem : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (a : S₊ (suc n))
→ Ω→SphereMapId (suc n) {A = A} a
≡ (λ i → fst (Ω→SphereMapId2 (suc n) {A = A} i) a)
lem zero base = refl
lem zero (loop i) = refl
lem (suc n) north = refl
lem (suc n) south = refl
lem (suc n) (merid a i) = refl
lem₂ : (a : S₊ (suc n))
→ ((λ i₁ → Ω→SphereMapId (suc n) {A = A} a (~ i₁))
∙∙ (λ i₁ → Ω→SphereMap (suc n) (p i₁) .fst a)
∙∙ Ω→SphereMapId (suc n) a)
≡ (λ i → Ω→SphereMapSplit₁ (suc n) p i .fst a)
lem₂ a = cong (λ x → sym x
∙∙ funExt⁻ (cong fst (λ i → Ω→SphereMap (suc n) (p i))) a
∙∙ x)
(lem n a)
∙∙ sym (cong-∙∙ (λ x → x a)
(cong fst (λ i → Ω→SphereMapId2 (suc n) (~ i)))
(cong fst (λ i → Ω→SphereMap (suc n) (p i)))
(cong fst (Ω→SphereMapId2 (suc n))))
∙∙ (λ i → funExt⁻ (cong-∙∙ fst (sym (Ω→SphereMapId2 (suc n)))
(cong (Ω→SphereMap (suc n)) p)
(Ω→SphereMapId2 (suc n)) (~ i)) a)
isEquiv-Ω→SphereMap₀ : ∀ {ℓ} {A : Pointed ℓ}
→ isEquiv (Ω→SphereMap 0 {A = A})
isEquiv-Ω→SphereMap₀ {A = A} =
isoToIsEquiv
(iso _ (λ f → fst f false)
(λ f → ΣPathP ((funExt (λ { false → refl ; true → sym (snd f)}))
, λ i j → snd f (~ i ∨ j)))
λ p → refl)
isEquiv-Ω→SphereMap : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ}
→ isEquiv (Ω→SphereMap n {A = A})
isEquiv-Ω→SphereMap zero {A = A} =
(isoToIsEquiv
(iso _ (λ f → fst f false)
(λ f → ΣPathP ((funExt (λ { false → refl
; true → sym (snd f)}))
, λ i j → snd f (~ i ∨ j)))
λ _ → refl))
isEquiv-Ω→SphereMap (suc zero) {A = A} =
isoToIsEquiv (iso _ invFun sec λ p → sym (rUnit p))
where
invFun : S₊∙ 1 →∙ A → typ (Ω A)
invFun (f , p) = sym p ∙∙ cong f loop ∙∙ p
sec : section (Ω→SphereMap 1) invFun
sec (f , p) =
ΣPathP ((funExt (λ { base → sym p
; (loop i) j → doubleCompPath-filler
(sym p) (cong f loop) p (~ j) i}))
, λ i j → p (~ i ∨ j))
isEquiv-Ω→SphereMap (suc (suc n)) =
subst isEquiv (sym (funExt (Ω→SphereMap-split (suc n))))
(snd (compEquiv
((Ω→SphereMapSplit₁ (suc n)) ,
(isEquivΩ→ (Ω→SphereMap (suc n) , Ω→SphereMapId2 (suc n))
(isEquiv-Ω→SphereMap (suc n))))
(invEquiv (isoToEquiv (SphereMapΩIso (suc n))))))
IsoΩSphereMap : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (typ ((Ω^ n) A)) (S₊∙ n →∙ A)
IsoΩSphereMap n = equivToIso (_ , isEquiv-Ω→SphereMap n)
IsoSphereMapΩ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (S₊∙ n →∙ A) (fst ((Ω^ n) A))
IsoSphereMapΩ {A = A} n =
invIso (IsoΩSphereMap n)
SphereMap→Ω : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ S₊∙ n →∙ A → fst ((Ω^ n) A)
SphereMap→Ω n = fun (IsoSphereMapΩ n)
isHom-Ω→SphereMap : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (p q : _)
→ Ω→SphereMap (suc n) {A = A} (p ∙ q)
≡ ∙Π (Ω→SphereMap (suc n) {A = A} p)
(Ω→SphereMap (suc n) {A = A} q)
isHom-Ω→SphereMap zero {A = A} p q =
ΣPathP ((funExt (λ { base → refl
; (loop i) j → (rUnit p j ∙ rUnit q j) i}))
, refl)
isHom-Ω→SphereMap (suc n) {A = A} p q =
ΣPathP ((funExt (λ { north → refl
; south → refl
; (merid a i) j → main a j i}))
, refl)
where
doubleComp-lem : ∀ {ℓ} {A : Type ℓ} {x y : A} (p : x ≡ y) (q r : y ≡ y)
→ (p ∙∙ q ∙∙ sym p) ∙ (p ∙∙ r ∙∙ sym p)
≡ (p ∙∙ (q ∙ r) ∙∙ sym p)
doubleComp-lem p q r i j =
hcomp (λ k → λ { (i = i0) → (doubleCompPath-filler p q (sym p) k
∙ doubleCompPath-filler p r (sym p) k) j
; (i = i1) → doubleCompPath-filler p (q ∙ r) (sym p) k j
; (j = i0) → p (~ k)
; (j = i1) → p (~ k)})
((q ∙ r) j)
lem : (p : typ ((Ω^ (suc (suc n))) A))
→ cong (fst (Ω→SphereMap (suc (suc n)) p)) (merid (ptSn _)) ≡ refl
lem p =
cong (sym (Ω→SphereMapId (suc n) (ptSn _)) ∙∙_∙∙ Ω→SphereMapId (suc n) (ptSn _))
(rUnit _ ∙ (λ j → (λ i → Ω→SphereMap (suc n) {A = A} refl .snd (i ∧ j))
∙∙ (λ i → Ω→SphereMap (suc n) {A = A} (p i) .snd j)
∙∙ λ i → Ω→SphereMap (suc n) {A = A} refl .snd (~ i ∧ j))
∙ ∙∙lCancel _)
∙ ∙∙lCancel _
main : (a : S₊ (suc n))
→ sym (Ω→SphereMapId (suc n) a)
∙∙ funExt⁻ (cong fst (cong (Ω→SphereMap (suc n)) (p ∙ q))) a
∙∙ Ω→SphereMapId (suc n) a
≡ cong (fst (∙Π (Ω→SphereMap (suc (suc n)) p) (Ω→SphereMap (suc (suc n)) q))) (merid a)
main a = (cong (sym (Ω→SphereMapId (suc n) a) ∙∙_∙∙ (Ω→SphereMapId (suc n) a))
(cong-∙ (λ x → Ω→SphereMap (suc n) x .fst a) p q)
∙ sym (doubleComp-lem (sym (Ω→SphereMapId (suc n) a)) _ _))
∙∙ cong₂ _∙_ (sym (cong (cong (fst (Ω→SphereMap (suc (suc n)) p)) (merid a) ∙_)
(cong sym (lem p)) ∙ sym (rUnit _)))
(sym (cong (cong (fst (Ω→SphereMap (suc (suc n)) q)) (merid a) ∙_)
(cong sym (lem q)) ∙ sym (rUnit _)))
∙∙ λ i → (rUnit (cong-∙ (fst (Ω→SphereMap (suc (suc n)) p))
(merid a) (sym (merid (ptSn _))) (~ i)) i)
∙ (rUnit (cong-∙ (fst (Ω→SphereMap (suc (suc n)) q))
(merid a) (sym (merid (ptSn _)))(~ i)) i)
-- The iso is structure preserving
IsoSphereMapΩ-pres∙Π : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ) (f g : S₊∙ (suc n) →∙ A)
→ SphereMap→Ω (suc n) (∙Π f g)
≡ SphereMap→Ω (suc n) f ∙ SphereMap→Ω (suc n) g
IsoSphereMapΩ-pres∙Π n =
morphLemmas.isMorphInv _∙_ ∙Π (Ω→SphereMap (suc n))
(isHom-Ω→SphereMap n)
(SphereMap→Ω (suc n))
(leftInv (IsoSphereMapΩ (suc n)))
(rightInv (IsoSphereMapΩ (suc n)))
-- It is useful to define the ``Group Structure'' on (S₊∙ n →∙ A)
-- before doing it on π'. These will be the equivalents of the
-- usual groupoid laws on Ω A.
1Π : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ} → (S₊∙ n →∙ A)
fst (1Π {A = A}) _ = pt A
snd (1Π {A = A}) = refl
∙Π-rUnit : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f : S₊∙ (suc n) →∙ A)
→ ∙Π f 1Π ≡ f
fst (∙Π-rUnit {A = A} {n = zero} f i) base = snd f (~ i)
fst (∙Π-rUnit {A = A} {n = zero} f i) (loop j) = help i j
where
help : PathP (λ i → snd f (~ i) ≡ snd f (~ i))
(((sym (snd f)) ∙∙ (cong (fst f) loop) ∙∙ snd f)
∙ (refl ∙ refl))
(cong (fst f) loop)
help = (cong ((sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f) ∙_)
(sym (rUnit refl)) ∙ sym (rUnit _))
◁ λ i j → doubleCompPath-filler (sym (snd f))
(cong (fst f) loop) (snd f) (~ i) j
snd (∙Π-rUnit {A = A} {n = zero} f i) j = snd f (~ i ∨ j)
fst (∙Π-rUnit {A = A} {n = suc n} f i) north = snd f (~ i)
fst (∙Π-rUnit {A = A} {n = suc n} f i) south =
(sym (snd f) ∙ cong (fst f) (merid (ptSn (suc n)))) i
fst (∙Π-rUnit {A = A} {n = suc n} f i) (merid a j) = help i j
where
help : PathP (λ i → snd f (~ i)
≡ (sym (snd f) ∙ cong (fst f) (merid (ptSn (suc n)))) i)
(((sym (snd f))
∙∙ (cong (fst f) (merid a ∙ sym (merid (ptSn (suc n)))))
∙∙ snd f)
∙ (refl ∙ refl))
(cong (fst f) (merid a))
help = (cong (((sym (snd f))
∙∙ (cong (fst f) (merid a ∙ sym (merid (ptSn (suc n)))))
∙∙ snd f) ∙_)
(sym (rUnit refl))
∙ sym (rUnit _))
◁ λ i j → hcomp (λ k →
λ { (j = i0) → snd f (~ i ∧ k)
; (j = i1) → compPath-filler' (sym (snd f))
(cong (fst f) (merid (ptSn (suc n)))) k i
; (i = i0) → doubleCompPath-filler (sym (snd f))
(cong (fst f)
(merid a ∙ sym (merid (ptSn (suc n)))))
(snd f) k j
; (i = i1) → fst f (merid a j)})
(fst f (compPath-filler (merid a)
(sym (merid (ptSn _))) (~ i) j))
snd (∙Π-rUnit {A = A} {n = suc n} f i) j = snd f (~ i ∨ j)
∙Π-lUnit : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f : S₊∙ (suc n) →∙ A)
→ ∙Π 1Π f ≡ f
fst (∙Π-lUnit {n = zero} f i) base = snd f (~ i)
fst (∙Π-lUnit {n = zero} f i) (loop j) = s i j
where
s : PathP (λ i → snd f (~ i) ≡ snd f (~ i))
((refl ∙ refl) ∙ (sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f))
(cong (fst f) loop)
s = (cong (_∙ (sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f))
(sym (rUnit refl)) ∙ sym (lUnit _))
◁ λ i j → doubleCompPath-filler (sym (snd f))
(cong (fst f) loop) (snd f) (~ i) j
snd (∙Π-lUnit {n = zero} f i) j = snd f (~ i ∨ j)
fst (∙Π-lUnit {n = suc n} f i) north = snd f (~ i)
fst (∙Π-lUnit {n = suc n} f i) south =
(sym (snd f) ∙ cong (fst f) (merid (ptSn _))) i
fst (∙Π-lUnit {n = suc n} f i) (merid a j) = help i j
where
help : PathP (λ i → snd f (~ i)
≡ (sym (snd f) ∙ cong (fst f) (merid (ptSn (suc n)))) i)
((refl ∙ refl) ∙ ((sym (snd f))
∙∙ (cong (fst f) (merid a ∙ sym (merid (ptSn (suc n)))))
∙∙ snd f))
(cong (fst f) (merid a))
help =
(cong (_∙ ((sym (snd f))
∙∙ (cong (fst f) (merid a ∙ sym (merid (ptSn (suc n)))))
∙∙ snd f))
(sym (rUnit refl))
∙ sym (lUnit _))
◁ λ i j → hcomp (λ k →
λ { (j = i0) → snd f (~ i ∧ k)
; (j = i1) → compPath-filler' (sym (snd f))
(cong (fst f) (merid (ptSn (suc n)))) k i
; (i = i0) → doubleCompPath-filler (sym (snd f))
(cong (fst f) (merid a ∙ sym (merid (ptSn (suc n)))))
(snd f) k j
; (i = i1) → fst f (merid a j)})
(fst f (compPath-filler (merid a) (sym (merid (ptSn _))) (~ i) j))
snd (∙Π-lUnit {n = suc n} f i) j = snd f (~ i ∨ j)
∙Π-rCancel : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f : S₊∙ (suc n) →∙ A)
→ ∙Π f (-Π f) ≡ 1Π
fst (∙Π-rCancel {A = A} {n = zero} f i) base = pt A
fst (∙Π-rCancel {A = A} {n = zero} f i) (loop j) =
rCancel (sym (snd f) ∙∙ cong (fst f) loop ∙∙ snd f) i j
snd (∙Π-rCancel {A = A} {n = zero} f i) = refl
fst (∙Π-rCancel {A = A} {n = suc n} f i) north = pt A
fst (∙Π-rCancel {A = A} {n = suc n} f i) south = pt A
fst (∙Π-rCancel {A = A} {n = suc n} f i) (merid a i₁) = lem i i₁
where
pl = (sym (snd f)
∙∙ cong (fst f) (merid a ∙ sym (merid (ptSn _)))
∙∙ snd f)
lem : pl
∙ ((sym (snd f)
∙∙ cong (fst (-Π f)) (merid a ∙ sym (merid (ptSn _)))
∙∙ snd f)) ≡ refl
lem = cong (pl ∙_) (cong (sym (snd f) ∙∙_∙∙ (snd f))
(cong-∙ (fst (-Π f)) (merid a) (sym (merid (ptSn _)))
∙∙ cong₂ _∙_ refl
(cong (cong (fst f)) (rCancel (merid (ptSn _))))
∙∙ sym (rUnit _)))
∙ rCancel pl
snd (∙Π-rCancel {A = A} {n = suc n} f i) = refl
∙Π-lCancel : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f : S₊∙ (suc n) →∙ A)
→ ∙Π (-Π f) f ≡ 1Π
fst (∙Π-lCancel {A = A} {n = zero} f i) base = pt A
fst (∙Π-lCancel {A = A} {n = zero} f i) (loop j) =
rCancel (sym (snd f) ∙∙ cong (fst f) (sym loop) ∙∙ snd f) i j
fst (∙Π-lCancel {A = A} {n = suc n} f i) north = pt A
fst (∙Π-lCancel {A = A} {n = suc n} f i) south = pt A
fst (∙Π-lCancel {A = A} {n = suc n} f i) (merid a j) = lem i j
where
pl = (sym (snd f)
∙∙ cong (fst f) (merid a ∙ sym (merid (ptSn _)))
∙∙ snd f)
lem : (sym (snd f)
∙∙ cong (fst (-Π f)) (merid a ∙ sym (merid (ptSn _)))
∙∙ snd f) ∙ pl
≡ refl
lem = cong (_∙ pl) (cong (sym (snd f) ∙∙_∙∙ (snd f))
(cong-∙ (fst (-Π f)) (merid a) (sym (merid (ptSn _)))
∙∙ cong₂ _∙_ refl (cong (cong (fst f)) (rCancel (merid (ptSn _))))
∙∙ sym (rUnit _)))
∙ lCancel pl
snd (∙Π-lCancel {A = A} {n = zero} f i) = refl
snd (∙Π-lCancel {A = A} {n = suc n} f i) = refl
∙Π-assoc : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f g h : S₊∙ (suc n) →∙ A)
→ ∙Π f (∙Π g h) ≡ ∙Π (∙Π f g) h
∙Π-assoc {n = n} f g h =
sym (leftInv (IsoSphereMapΩ (suc n)) (∙Π f (∙Π g h)))
∙∙ cong (Ω→SphereMap (suc n)) (IsoSphereMapΩ-pres∙Π n f (∙Π g h)
∙∙ cong (SphereMap→Ω (suc n) f ∙_) (IsoSphereMapΩ-pres∙Π n g h)
∙∙ ∙assoc (SphereMap→Ω (suc n) f) (SphereMap→Ω (suc n) g) (SphereMap→Ω (suc n) h)
∙∙ cong (_∙ SphereMap→Ω (suc n) h) (sym (IsoSphereMapΩ-pres∙Π n f g))
∙∙ sym (IsoSphereMapΩ-pres∙Π n (∙Π f g) h))
∙∙ leftInv (IsoSphereMapΩ (suc n)) (∙Π (∙Π f g) h)
∙Π-comm : ∀ {ℓ} {A : Pointed ℓ} {n : ℕ}
→ (f g : S₊∙ (suc (suc n)) →∙ A)
→ ∙Π f g ≡ ∙Π g f
∙Π-comm {A = A} {n = n} f g =
sym (leftInv (IsoSphereMapΩ (suc (suc n))) (∙Π f g))
∙∙ cong (Ω→SphereMap (suc (suc n))) (IsoSphereMapΩ-pres∙Π (suc n) f g
∙∙ EH _ _ _
∙∙ sym (IsoSphereMapΩ-pres∙Π (suc n) g f))
∙∙ leftInv (IsoSphereMapΩ (suc (suc n))) (∙Π g f)
{- π'' as a group -}
1π' : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π' n A
1π' n {A = A} = ∣ 1Π ∣₂
·π' : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π' (suc n) A → π' (suc n) A → π' (suc n) A
·π' n = sRec2 squash₂ λ p q → ∣ ∙Π p q ∣₂
-π' : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} → π' (suc n) A → π' (suc n) A
-π' n = sMap -Π
π'-rUnit : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π' (suc n) A)
→ (·π' n x (1π' (suc n))) ≡ x
π'-rUnit n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ ∙Π-rUnit p i ∣₂
π'-lUnit : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π' (suc n) A)
→ (·π' n (1π' (suc n)) x) ≡ x
π'-lUnit n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ ∙Π-lUnit p i ∣₂
π'-rCancel : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π' (suc n) A)
→ (·π' n x (-π' n x)) ≡ 1π' (suc n)
π'-rCancel n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ ∙Π-rCancel p i ∣₂
π'-lCancel : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x : π' (suc n) A)
→ (·π' n (-π' n x) x) ≡ 1π' (suc n)
π'-lCancel n = sElim (λ _ → isSetPathImplicit) λ p i → ∣ ∙Π-lCancel p i ∣₂
π'-assoc : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x y z : π' (suc n) A)
→ ·π' n x (·π' n y z) ≡ ·π' n (·π' n x y) z
π'-assoc n = sElim3 (λ _ _ _ → isSetPathImplicit) λ p q r i → ∣ ∙Π-assoc p q r i ∣₂
π'-comm : ∀ {ℓ} (n : ℕ) {A : Pointed ℓ} (x y : π' (suc (suc n)) A)
→ ·π' (suc n) x y ≡ ·π' (suc n) y x
π'-comm n = sElim2 (λ _ _ → isSetPathImplicit) λ p q i → ∣ ∙Π-comm p q i ∣₂
-- We finally get the group definition
π'Gr : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → Group ℓ
fst (π'Gr n A) = π' (suc n) A
1g (snd (π'Gr n A)) = 1π' (suc n)
GroupStr._·_ (snd (π'Gr n A)) = ·π' n
inv (snd (π'Gr n A)) = -π' n
is-set (isSemigroup (isMonoid (isGroup (snd (π'Gr n A))))) = squash₂
assoc (isSemigroup (isMonoid (isGroup (snd (π'Gr n A))))) = π'-assoc n
identity (isMonoid (isGroup (snd (π'Gr n A)))) x = (π'-rUnit n x) , (π'-lUnit n x)
inverse (isGroup (snd (π'Gr n A))) x = (π'-rCancel n x) , (π'-lCancel n x)
-- and finally, the Iso
π'Gr≅πGr : ∀ {ℓ} (n : ℕ) (A : Pointed ℓ) → GroupIso (π'Gr n A) (πGr n A)
fst (π'Gr≅πGr n A) = setTruncIso (IsoSphereMapΩ (suc n))
snd (π'Gr≅πGr n A) =
makeIsGroupHom (sElim2 (λ _ _ → isSetPathImplicit)
λ p q i → ∣ IsoSphereMapΩ-pres∙Π n p q i ∣₂)
{- Proof of πₙ(ΩA) = πₙ₊₁(A) -}
Iso-πΩ-π : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (π n (Ω A)) (π (suc n) A)
Iso-πΩ-π {A = A} n = setTruncIso (invIso (flipΩIso n))
GrIso-πΩ-π : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ GroupIso (πGr n (Ω A)) (πGr (suc n) A)
fst (GrIso-πΩ-π n) = Iso-πΩ-π _
snd (GrIso-πΩ-π n) =
makeIsGroupHom
(sElim2 (λ _ _ → isSetPathImplicit)
λ p q → cong ∣_∣₂ (flipΩIso⁻pres· n p q))
{- Proof that πₙ(A) ≅ πₙ(∥ A ∥ₙ) -}
isContrΩTrunc : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ isContr (typ ((Ω^ n) (hLevelTrunc∙ n A)))
isContrΩTrunc {A = A} zero = isContrUnit*
isContrΩTrunc {A = A} (suc n) =
subst isContr main (isContrΩTrunc {A = Ω A} n)
where
lem₁ : (n : ℕ) → fun (PathIdTruncIso n) (λ _ → ∣ pt A ∣)
≡ snd (hLevelTrunc∙ n (Ω A))
lem₁ zero = refl
lem₁ (suc n) = transportRefl ∣ refl ∣
lem₂ : hLevelTrunc∙ n (Ω A) ≡ (Ω (hLevelTrunc∙ (suc n) A))
lem₂ = sym (ua∙ (isoToEquiv (PathIdTruncIso n))
(lem₁ n))
main : (typ ((Ω^ n) (hLevelTrunc∙ n (Ω A))))
≡ (typ ((Ω^ suc n) (hLevelTrunc∙ (suc n) A)))
main = (λ i → typ ((Ω^ n) (lem₂ i)))
∙ sym (isoToPath (flipΩIso n))
mutual
ΩTruncSwitchFun : ∀ {ℓ} {A : Pointed ℓ} (n m : ℕ) →
(hLevelTrunc∙ (suc (suc m)) ((Ω^ n) A))
→∙ ((Ω^ n) (hLevelTrunc∙ (suc n + suc m) A))
ΩTruncSwitchFun {A = A} n m =
((λ x → transport
(λ i → fst ((Ω^ n) (hLevelTrunc∙ (+-suc n (suc m) i) A)))
(Iso.fun (ΩTruncSwitch {A = A} n (suc (suc m))) x))
, cong (transport
(λ i → fst ((Ω^ n) (hLevelTrunc∙ (+-suc n (suc m) i) A))))
(ΩTruncSwitch∙ n (suc (suc m)))
∙ λ j → transp
(λ i → fst ((Ω^ n) (hLevelTrunc∙ (+-suc n (suc m) (i ∨ j)) A)))
j (snd ((Ω^ n) (hLevelTrunc∙ (+-suc n (suc m) j) A))))
ΩTruncSwitchLem :
∀ {ℓ} {A : Pointed ℓ} (n m : ℕ)
→ Iso
(typ (Ω (hLevelTrunc∙ (suc (suc m)) ((Ω^ n) A))))
(typ ((Ω^ suc n) (hLevelTrunc∙ (suc n + suc m) A)))
ΩTruncSwitchLem {A = A} n m =
(equivToIso
(Ω→ (ΩTruncSwitchFun n m) .fst
, isEquivΩ→ _ (compEquiv (isoToEquiv (ΩTruncSwitch {A = A} n (suc (suc m))))
(transportEquiv
(λ i → typ ((Ω^ n) (hLevelTrunc∙ (+-suc n (suc m) i) A)))) .snd)))
ΩTruncSwitch : ∀ {ℓ} {A : Pointed ℓ} (n m : ℕ)
→ Iso (hLevelTrunc m (fst ((Ω^ n) A)))
(typ ((Ω^ n) (hLevelTrunc∙ (n + m) A)))
ΩTruncSwitch {A = A} n zero =
equivToIso
(invEquiv
(isContr→≃Unit*
(subst isContr
(λ i → (typ ((Ω^ n) (hLevelTrunc∙ (+-comm zero n i) A))))
(isContrΩTrunc n))))
ΩTruncSwitch {A = A} zero (suc m) = idIso
ΩTruncSwitch {A = A} (suc n) (suc m) =
compIso (invIso (PathIdTruncIso _))
(ΩTruncSwitchLem n m)
ΩTruncSwitch∙ : ∀ {ℓ} {A : Pointed ℓ} (n m : ℕ)
→ Iso.fun (ΩTruncSwitch {A = A} n m) (snd (hLevelTrunc∙ m ((Ω^ n) A)))
≡ pt ((Ω^ n) (hLevelTrunc∙ (n + m) A))
ΩTruncSwitch∙ {A = A} n zero =
isContr→isProp
((subst isContr
(λ i → (typ ((Ω^ n) (hLevelTrunc∙ (+-comm zero n i) A))))
(isContrΩTrunc n))) _ _
ΩTruncSwitch∙ {A = A} zero (suc m) = refl
ΩTruncSwitch∙ {A = A} (suc n) (suc m) = ∙∙lCancel _
ΩTruncSwitch-hom : ∀ {ℓ} {A : Pointed ℓ} (n m : ℕ) (p q : _)
→ Iso.fun (ΩTruncSwitch {A = A} (suc n) (suc m)) ∣ p ∙ q ∣
≡ Iso.fun (ΩTruncSwitch {A = A} (suc n) (suc m)) ∣ p ∣
∙ Iso.fun (ΩTruncSwitch {A = A} (suc n) (suc m)) ∣ q ∣
ΩTruncSwitch-hom {A = A} n m p q =
cong (Iso.fun (ΩTruncSwitchLem {A = A} n m))
(cong-∙ ∣_∣ₕ p q)
∙ Ω→pres∙ (ΩTruncSwitchFun n m) (cong ∣_∣ₕ p) (cong ∣_∣ₕ q)
2TruncΩIso : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (hLevelTrunc 2 (fst ((Ω^ n) A)))
(typ ((Ω^ n) (hLevelTrunc∙ (2 + n) A)))
2TruncΩIso zero = idIso
2TruncΩIso {A = A} (suc n) =
compIso
(ΩTruncSwitch (suc n) 2)
(pathToIso λ i → typ ((Ω^ suc n) (hLevelTrunc∙ (+-comm (suc n) 2 i) A)))
hLevΩ+ : ∀ {ℓ} {A : Pointed ℓ} (n m : ℕ)
→ isOfHLevel (m + n) (typ A) → isOfHLevel n (typ ((Ω^ m) A))
hLevΩ+ n zero p = p
hLevΩ+ {A = A} zero (suc zero) p = refl , λ _ → isProp→isSet p _ _ _ _
hLevΩ+ {A = A} zero (suc (suc zero)) p =
refl , λ y → isOfHLevelSuc 2 p _ _ _ _ refl y
hLevΩ+ {A = A} zero (suc (suc (suc m))) p =
transport
(λ i → isContr (typ (Ω (ua∙
(isoToEquiv (flipΩIso {A = A} (suc m))) (flipΩrefl m) (~ i)))))
(hLevΩ+ {A = Ω A} zero (suc (suc m))
(subst (λ x → isOfHLevel x (typ (Ω A)))
(+-comm zero (suc (suc m)))
(lem (pt A) (pt A))))
where
lem : isOfHLevel (3 + m) (typ A)
lem = subst (λ x → isOfHLevel x (typ A))
(λ i → suc (+-comm (2 + m) zero i)) p
hLevΩ+ {A = A} (suc n) (suc m) p =
subst (isOfHLevel (suc n))
(sym (ua (isoToEquiv (flipΩIso {A = A} m))))
(hLevΩ+ {A = Ω A} (suc n) m
(isOfHLevelPath' (m + suc n) p _ _))
private
isSetΩ : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ (isSet (typ (Ω ((Ω^ n) (hLevelTrunc∙ (suc (suc (suc n))) A)))))
isSetΩ {A = A} zero = isOfHLevelTrunc 3 _ _
isSetΩ {A = A} (suc n) =
hLevΩ+ 2 (suc (suc n))
(transport
(λ i → isOfHLevel (+-comm 2 (2 + n) i) (hLevelTrunc (4 + n) (typ A)))
(isOfHLevelTrunc (suc (suc (suc (suc n))))))
πTruncIso : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ Iso (π n A) (π n (hLevelTrunc∙ (2 + n) A))
πTruncIso {A = A} zero =
compIso (invIso (setTruncIdempotentIso squash₂))
(setTruncIso setTruncTrunc2Iso)
πTruncIso {A = A} (suc n) =
compIso setTruncTrunc2Iso
(compIso
(2TruncΩIso (suc n))
(invIso (setTruncIdempotentIso (isSetΩ n))))
πTruncGroupIso : ∀ {ℓ} {A : Pointed ℓ} (n : ℕ)
→ GroupIso (πGr n A) (πGr n (hLevelTrunc∙ (3 + n) A))
fst (πTruncGroupIso n) = πTruncIso (suc n)
snd (πTruncGroupIso {A = A} n) =
makeIsGroupHom
(sElim2 (λ _ _ → isSetPathImplicit)
λ a b
→ cong (inv (setTruncIdempotentIso (isSetΩ n)))
(cong
(transport
(λ i → typ ((Ω^ suc n) (hLevelTrunc∙ (+-comm (suc n) 2 i) A))))
(ΩTruncSwitch-hom n 1 a b)
∙ transpΩTruncSwitch
(λ w → ((Ω^ n) (hLevelTrunc∙ w A))) (+-comm (suc n) 2) _ _))
where
transpΩTruncSwitch : ∀ {ℓ} (A : ℕ → Pointed ℓ) {n m : ℕ}
(r : n ≡ m) (p q : typ (Ω (A n)))
→ subst (λ n → typ (Ω (A n))) r (p ∙ q)
≡ subst (λ n → typ (Ω (A n))) r p
∙ subst (λ n → typ (Ω (A n))) r q
transpΩTruncSwitch A {n = n} =
J (λ m r → (p q : typ (Ω (A n)))
→ subst (λ n → typ (Ω (A n))) r (p ∙ q)
≡ subst (λ n → typ (Ω (A n))) r p
∙ subst (λ n → typ (Ω (A n))) r q)
λ p q → transportRefl _ ∙ cong₂ _∙_
(sym (transportRefl p)) (sym (transportRefl q))
|
oeis/159/A159511.asm | neoneye/loda-programs | 11 | 96391 | ; A159511: Numerator of Hermite(n, 11/14).
; Submitted by <NAME>
; 1,11,23,-1903,-27695,441331,18425191,-56825527,-13264761823,-101361166885,10584547092151,215763961560961,-9036738188168207,-353142538865540413,7628236524205351175,568422165089780309561,-4960863874594282822079,-945855457481312636434517,-2139610817220363819196073,1644953308007611488659331185,22078441729748043806595730961,-2981245624667690035899736082029,-78231134951166064548871111220057,5567023082320713007362248769433897,237570232085456152574140221153781345,-10480365736678299315000466673016930949
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,11
mul $3,-196
mul $3,$0
div $3,2
lpe
mov $0,$1
|
source/containers/a-colili.ads | ytomino/drake | 33 | 14789 | pragma License (Unrestricted);
-- implementation unit
with System;
private package Ada.Containers.Linked_Lists is
pragma Preelaborate;
-- traversing
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
procedure Reverse_Iterate (
Last : Node_Access;
Process : not null access procedure (Position : not null Node_Access));
-- liner search
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
function Reverse_Find (
Last : Node_Access;
Params : System.Address;
Equivalent : not null access function (
Right : not null Node_Access;
Params : System.Address)
return Boolean)
return Node_Access;
-- comparison
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
function Equivalent (
Left_Last, Right_Last : Node_Access;
Equivalent : not null access function (
Left, Right : not null Node_Access)
return Boolean)
return Boolean;
-- management
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
procedure Free (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Free : not null access procedure (Object : in out Node_Access));
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
with procedure Insert (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Before : Node_Access;
New_Item : not null Node_Access) is <>;
procedure Copy (
Target_First : out Node_Access;
Target_Last : out Node_Access;
Length : out Count_Type;
Source_Last : Node_Access;
Copy : not null access procedure (
Target : out Node_Access;
Source : not null Node_Access));
generic
type Node is limited private;
type Node_Access is access Node;
with procedure Insert (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Before : Node_Access;
New_Item : not null Node_Access) is <>;
with procedure Remove (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Position : not null Node_Access;
Next : Node_Access) is <>;
procedure Reverse_Elements (
Target_First : in out Node_Access;
Target_Last : in out Node_Access;
Length : in out Count_Type);
-- sorting
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
function Is_Sorted (
Last : Node_Access;
LT : not null access function (
Left, Right : not null Node_Access)
return Boolean)
return Boolean;
generic
type Node is limited private;
type Node_Access is access Node;
with function Previous (Position : Node_Access) return Node_Access is <>;
with procedure Insert (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Before : Node_Access;
New_Item : not null Node_Access) is <>;
with procedure Remove (
First : in out Node_Access;
Last : in out Node_Access;
Length : in out Count_Type;
Position : not null Node_Access;
Next : Node_Access) is <>;
procedure Merge (
Target_First : in out Node_Access;
Target_Last : in out Node_Access;
Length : in out Count_Type;
Source_First : in out Node_Access;
Source_Last : in out Node_Access;
Source_Length : in out Count_Type;
LT : not null access function (
Left, Right : not null Node_Access)
return Boolean);
generic
type Node is limited private;
type Node_Access is access Node;
with procedure Split (
Target_First : out Node_Access;
Target_Last : out Node_Access;
Length : out Count_Type;
Source_First : in out Node_Access;
Source_Last : in out Node_Access;
Source_Length : in out Count_Type;
Count : Count_Type) is <>;
with procedure Merge (
Target_First : in out Node_Access;
Target_Last : in out Node_Access;
Length : in out Count_Type;
Source_First : in out Node_Access;
Source_Last : in out Node_Access;
Source_Length : in out Count_Type;
LT : not null access function (
Left, Right : not null Node_Access)
return Boolean) is <>;
procedure Merge_Sort (
Target_First : in out Node_Access;
Target_Last : in out Node_Access;
Length : in out Count_Type;
LT : not null access function (
Left, Right : not null Node_Access)
return Boolean);
end Ada.Containers.Linked_Lists;
|
BraveBrowser/toggleBtwnScrptsBlockdAndAllowdAtBraveShield/preBraveVersion0.64_testedw0.61/enable.applescript | dm4rnde/FewScriptsForUIAutomateInMacOS | 0 | 4358 | # Author: dm4rnde (<EMAIL>; https://github.com/dm4rnde)
# MIT License
# Copyright (c) 2019 dm4rnde (<EMAIL>)
# https://github.com/dm4rnde/FewScriptsForUIAutomateInMacOS
# 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.
# This script will:
# change related UI element (from 'Scripts blocked') to 'All scripts allowed'
# Precondition to run:
# - must have 'Brave Browser' opened AND
# - must have tab opened showing web page AND
# - must have 'script blocking' on ('Brave Shields ...' shows 'Scripts blocked') on that web page AND
# - there shouldn't be any other popups, search boxes (or similar) taking over the focus
# within 'Brave Browser'
# Getting path to main script, for the purpose of calling subroutine from that script
tell application "Finder"
set currPathStr to container of (path to me) as string
end tell
set currPathWScrptAsStr to currPathStr & "toggle.scpt"
# Having correct path, load the script
set mainScript to load script (alias (currPathWScrptAsStr))
# Call the subroutine
mainScript's toBlocked(false)
|
src/smk-assertions.adb | LionelDraghi/smk | 10 | 7429 | <filename>src/smk-assertions.adb
-- -----------------------------------------------------------------------------
-- smk, the smart make (http://lionel.draghi.free.fr/smk/)
-- © 2018, 2019 <NAME> <<EMAIL>>
-- SPDX-License-Identifier: APSL-2.0
-- -----------------------------------------------------------------------------
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
with Smk.Settings;
package body Smk.Assertions is
-- --------------------------------------------------------------------------
function Image (A : Condition;
Prefix : String := "") return String is
begin
if Settings.Long_Listing_Format then
return (Prefix & "[" & Trigger_Image (A.Trigger) & "] ");
else
return (Prefix);
end if;
end Image;
-- --------------------------------------------------------------------------
function Count (Cond_List : Condition_Lists.List;
Count_Sources : Boolean := False;
Count_Targets : Boolean := False;
With_System_Files : Boolean := False)
return File_Count is
C : File_Count := 0;
begin
for A of Cond_List loop
if With_System_Files or else not Is_System (A.File)
then
if (Count_Sources and then Is_Source (A.File))
or else (Count_Targets and then Is_Target (A.File))
then
C := C + 1;
end if;
end if;
end loop;
return C;
end Count;
-- --------------------------------------------------------------------------
function Count_Image (Count : File_Count) return String is
Raw : constant String := File_Count'Image (Count);
begin
return Raw (2 .. Raw'Last);
end Count_Image;
end Smk.Assertions;
|
alloy4fun_models/trashltl/models/3/Jr8Tf5w27xPjsaiaa.als | Kaixi26/org.alloytools.alloy | 0 | 4760 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idJr8Tf5w27xPjsaiaa_prop4 {
eventually File in Trash
}
pred __repair { idJr8Tf5w27xPjsaiaa_prop4 }
check __repair { idJr8Tf5w27xPjsaiaa_prop4 <=> prop4o } |
test/Succeed/PartialityMonad.agda | alhassy/agda | 3 | 1784 | <gh_stars>1-10
{-# OPTIONS --show-implicit #-}
-- {-# OPTIONS -v tc.def.fun:10 -v tc.def.where:100 #-}
module PartialityMonad where
open import Common.Level
open import Common.Coinduction
record RawMonad {f} (M : Set f → Set f) : Set (lsuc f) where
infixl 1 _>>=_
field
return : ∀ {A} → A → M A
_>>=_ : ∀ {A B} → M A → (A → M B) → M B
------------------------------------------------------------------------
-- The partiality monad
data _⊥ {a} (A : Set a) : Set a where
now : (x : A) → A ⊥
later : (x : ∞ (A ⊥)) → A ⊥
-- Fails if hidden pattern {f} is removed
monad : ∀ {f} → RawMonad {f = f} _⊥
-- monad {f} = record
monad = record
{ return = now
; _>>=_ = _>>=_
}
where
_>>=_ : ∀ {A B} → A ⊥ → (A → B ⊥) → B ⊥
now x >>= f = f x
later x >>= f = later (♯ (♭ x >>= f))
|
ArmPkg/Library/ArmSmcPsciResetSystemLib/Arm/Reset.asm | GlovePuppet/edk2 | 2,757 | 167494 | ;/** @file
; ResetSystemLib implementation using PSCI calls
;
; Copyright (c) 2018, Linaro Ltd. All rights reserved.<BR>
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
;**/
INCLUDE AsmMacroExport.inc
PRESERVE8
IMPORT ArmDisableMmu
RVCT_ASM_EXPORT DisableMmuAndReenterPei
push {lr}
bl ArmDisableMmu
; no memory accesses after MMU and caches have been disabled
mov32 r0, FixedPcdGet64 (PcdFvBaseAddress)
blx r0
; never returns
nop
END
|
books/nand2tetris/ch07/PointerTest.asm | luksamuk/study | 3 | 247521 | <filename>books/nand2tetris/ch07/PointerTest.asm
@256
D=A
@SP
M=D
@300
D=A
@LCL
M=D
@400
D=A
@ARG
M=D
@3000
D=A
@THIS
M=D
@3010
D=A
@THAT
M=D
@3030
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@3
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@3040
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@3
D=A
@1
A=D+A
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@32
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@THIS
D=M
@2
A=D+A
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@46
D=A
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@THAT
D=M
@6
A=D+A
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@3
D=M
@SP
A=M
M=D
@SP
M=M+1
@3
D=A
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
D=D+A
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@2
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
D=D-A
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@6
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
D=D+A
@SP
A=M
M=D
@SP
M=M+1
(-INTERNAL.HACKVM.HALT)
@-INTERNAL.HACKVM.HALT
0;JMP
0
|
SOURCE/base/Imported/Bartok/runtime/shared/native/arch/arm/gc.asm | pmache/singularityrdk | 3 | 17954 | <reponame>pmache/singularityrdk
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
AREA |.text|, CODE, READONLY
PAGE_BITS EQU 12
MASK_OWNER EQU 0x3
INCLUDE core.inc
;;;;
;; Placeholder stubs to satisfy the linker
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; pushStackMark: If a function may be called by C, push a pointer to its
; frame on to a stack at the beginning of the function.
;
; Transition record layout:
;
; (lower addresses)
; --------------------------
; |Old stack marker record |
; --------------------------
; |Addr of call instr |
; --------------------------
; |Bottom of stack frame |
; --------------------------
; |r4 |
; --------------------------
; |r5 |
; --------------------------
; |r6 |
; --------------------------
; |r7 |
; --------------------------
; |r8 |
; --------------------------
; |r9 |
; --------------------------
; |r10 |
; --------------------------
; |r11 |
; --------------------------
; (higher addresses);
;
EXPORT __pushStackMark
NESTED_ENTRY __pushStackMark
PROLOG_END
;; Save the callee-save registers in the transition record.
;; Since the transition record is located immediately below the FP,
;; we index off the FP rather than the pointer to the struct itself.
stmdb fp, {r4-r11} ; Store callee-save registers in record
;; From this point forward, we use r8, r9, and r10 as temps.
;; R12 may hold the address of the call
;; TransitionRecord *newRecord(r9) = FP - sizeof(TransitionRecord);
sub r9, fp, #|Struct_System_GCs_CallStack_TransitionRecord___SIZE|
;; link new stack marker into chain starting at CurrentThread
;; Thread *currentThread(r10) = Thread.CurrentThread()
CurrentThread r10, r8
;; TransitionRecord *oldRecord(r8) = currentThread(r10)->asmStackMarker
ldr r8, [r10, #|Class_System_Threading_Thread___asmStackMarker|]
;; newRecord(r9)->oldTransitionRecord = oldRecord(r8)
str r8, [r9, #|Struct_System_GCs_CallStack_TransitionRecord___oldTransitionRecord|]
;; currentThread(r10)->asmStackMarker = newRecord(r9)
str r9, [r10, #|Class_System_Threading_Thread___asmStackMarker|]
;; newRecord(r9)->callAddr = return address of this call (lr).
str lr, [r10, #|Struct_System_GCs_CallStack_TransitionRecord___callAddr|]
;; newRecord(r9)->stackBottom = bottom of stack frame (sp)
str sp, [r10, #|Struct_System_GCs_CallStack_TransitionRecord___stackBottom|]
;; Restore registers r9 and r10 (and the ummodified r11)
ldmdb fp, {r8-r11}
;; return
mov pc, lr
ENTRY_END
EXPORT __popStackMark
NESTED_ENTRY __popStackMark
PROLOG_END
;; From this point forward, we use r8, r9, and r10 as temps.
;; R12 may hold the address of the call
;; TransitionRecord *newRecord(r9) = FP - sizeof(TransitionRecord);
sub r9, fp, #|Struct_System_GCs_CallStack_TransitionRecord___SIZE|
;; Thread *currentThread(r10) = Thread.CurrentThread()
CurrentThread r10, r8
;; TransitionRecord *oldRecord(r8) = newRecord(r9)->oldTransitionRecord
ldr r8, [r9, #|Struct_System_GCs_CallStack_TransitionRecord___oldTransitionRecord|]
;; currentThread(r10) = oldRecord(r8)
str r8, [r10, #|Class_System_Threading_Thread___asmStackMarker|]
;; Restore callee-save registers from the transition record.
;; Since the transition record is located immediately below the FP,
;; we index off the FP rather than the pointer to the struct itself.
ldmdb fp, {r4-r11}
;; return
mov pc, lr
ENTRY_END
EXPORT |?g_CollectBodyTransition@Class_System_GC@@SAXPAUClass_System_Threading_Thread@@H@Z|
NESTED_ENTRY "?g_CollectBodyTransition@Class_System_GC@@SAXPAUClass_System_Threading_Thread@@H@Z"
mov r12, sp
;; Save the two words of the arguments (only two are in use)
stmdb sp!, {r0-r1}
;; Save the FP, SP, and the LR
stmdb sp!, {r4-r11, r12, lr}
;; Establish the new FP
sub fp, r12, #8
;; TransitionRecord transitionRecord = new TransitionRecord()
;; TransitionRecord *newRecord(sp) = &transitionRecord
;; The transition record includes the saves. Sub an extra 8 for the sp and lr
sub sp, fp, #|Struct_System_GCs_CallStack_TransitionRecord___SIZE|
sub sp, sp, #8
PROLOG_END
;; TransitionRecord *oldRecord(r9) = currentThread(r10)->asmStackMarker
ldr r9, [r0, #|Class_System_Threading_Thread___asmStackMarker|]
;; newRecord(sp)->oldTransitionRecord = oldRecord(r9)
str r9, [sp, #|Struct_System_GCs_CallStack_TransitionRecord___oldTransitionRecord|]
;; currentThread(r10)->asmStackMarker = newRecord(sp)
str sp, [r0, #|Class_System_Threading_Thread___asmStackMarker|]
;; newRecord(sp)->callAddr = return address of this call (lr).
str lr, [sp, #|Struct_System_GCs_CallStack_TransitionRecord___callAddr|]
;; newRecord(sp)->stackBottom = bottom of stack frame (r12)
str r12, [sp, #|Struct_System_GCs_CallStack_TransitionRecord___stackBottom|]
;; Thread *currentThread(r0) = System.GC.CollectBody(r0, r1)
bl |?g_CollectBody@Class_System_GC@@SAPAUClass_System_Threading_Thread@@PAU2@H@Z|
;; TransitionRecord *newRecord(sp) = &transitionRecord
;; TransitionRecord *oldRecord(r9) = newRecord(sp)->oldTransitionRecord
ldr r9, [sp, #|Struct_System_GCs_CallStack_TransitionRecord___oldTransitionRecord|]
;; currentThread(r0)->asmStackMarker = oldRecord(r9)
str r9, [r0, #|Class_System_Threading_Thread___asmStackMarker|]
;; Restore permanents, FP, SP, and return
ldmdb fp, {r4-r11, sp, pc}
ENTRY_END
|?g_ZeroMemoryMM0@Class_System_Buffer@@SAXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z|
EXPORT |?g_ZeroMemoryMM0@Class_System_Buffer@@SAXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z|
mov r0, #0xde
mov r0, r0 LSL #8
orr r0, r0, #0xad
mov r0, r0 LSL #16
mov pc, lr
LTORG
END
;;;;;;;;;;;;;;;;;;;;;;;
;;;;; TODO ;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;
;; Let's define some shorter names for commonly used structures
ifdef SINGULARITY
ThreadContext TYPEDEF Struct_Microsoft_Singularity_X86_ThreadContext
endif
Thread TYPEDEF Class_System_Threading_Thread
TransitionRecord TYPEDEF Struct_System_GCs_CallStack_TransitionRecord
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; void CollectBodyTransition(Thread thread, int generation):
; Save the callee-save registers in a transition record and then call
; System.GC.CollectBody(thread, generation)
;
align 16
?g_CollectBodyTransition@Class_System_GC@@SIXPAUClass_System_Threading_Thread@@H@Z proc
; static void __fastcall GC.CollectBodyTransition(Thread, int)
push ebp
mov ebp, esp
sub esp, (SIZE TransitionRecord)
push edx
lea edx, [ebp-(SIZE TransitionRecord)]
ifdef SINGULARITY
mov eax, [ecx].Thread._context._stackMarkers
else
mov eax, [ecx].Thread._asmStackMarker ; get old marker address
endif
mov [edx].TransitionRecord._oldTransitionRecord, eax ; link from current record
mov eax, dword ptr [ebp+4] ; load return address
mov [edx].TransitionRecord._callAddr, eax
lea eax, [ebp+8] ; skip pushed PC and SP
mov [edx].TransitionRecord._stackBottom, eax ; (bottom of stack frame)
mov [edx].TransitionRecord._calleeSaveRegisters._EBX, ebx ; save callee-save registers
mov [edx].TransitionRecord._calleeSaveRegisters._EDI, edi
mov [edx].TransitionRecord._calleeSaveRegisters._ESI, esi
mov eax, dword ptr [ebp]
mov [edx].TransitionRecord._calleeSaveRegisters._EBP, eax ; save old ebp value
ifdef SINGULARITY
mov [ecx].Thread._context._stackMarkers, edx ; update thread field
else
mov [ecx].Thread._asmStackMarker, edx ; update thread field
endif
pop edx
call ?g_CollectBody@Class_System_GC@@SIPAUClass_System_Threading_Thread@@PAU2@H@Z
; static void __fastcall GC.CollectBody(Thread,int)
lea edi, [ebp-(SIZE TransitionRecord)]
mov esi, [edi].TransitionRecord._oldTransitionRecord ; get old marker address
ifdef SINGULARITY
mov [eax].Thread._context._stackMarkers, esi ; restore thread field
else
mov [eax].Thread._asmStackMarker, esi ; restore thread field
endif
mov ebx, [edi].TransitionRecord._calleeSaveRegisters._EBX ; restore callee-save regs
mov esi, [edi].TransitionRecord._calleeSaveRegisters._ESI
mov ebp, [edi].TransitionRecord._calleeSaveRegisters._EBP
mov edi, [edi].TransitionRecord._calleeSaveRegisters._EDI
add esp, (SIZE TransitionRecord)+4 ; skip FP
ret
?g_CollectBodyTransition@Class_System_GC@@SIXPAUClass_System_Threading_Thread@@H@Z endp
ifdef NYI
ifdef SINGULARITY
;; __throwDispatcherUnwind depends on this only modifying eax
?g_ReturnToUnlinkStackMethod@Class_System_GCs_CallStack@@SI_NPAUuintPtr@@@Z proc
mov eax, _UnlinkStackBegin
cmp ecx, eax
jl return_false
mov eax, _UnlinkStackLimit
cmp ecx, eax
jg return_false
mov eax, 1
ret 0
return_false:
mov eax, 0
ret
?g_ReturnToUnlinkStackMethod@Class_System_GCs_CallStack@@SI_NPAUuintPtr@@@Z endp
endif
endif
; The assembly versions of Buffer.ZeroMemory have not been implemented for x86
align 16
?g_ZeroMemoryXMM@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z proc
int 3
?g_ZeroMemoryXMM@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z endp
align 16
?g_ZeroMemoryMM0@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z proc
int 3
?g_ZeroMemoryMM0@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z endp
align 16
?g_ZeroMemorySTOS@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z proc
int 3
?g_ZeroMemorySTOS@Class_System_Buffer@@SIXPAUUntracedPtr_uint8@@PAUuintPtr@@@Z endp
end
|
_maps/Collapsing Ledge.asm | kodishmediacenter/msu-md-sonic | 9 | 240730 | ; ---------------------------------------------------------------------------
; Sprite mappings - GHZ collapsing ledge
; ---------------------------------------------------------------------------
Map_Ledge_internal:
dc.w @left-Map_Ledge_internal
dc.w @right-Map_Ledge_internal
dc.w @leftsmash-Map_Ledge_internal
dc.w @rightsmash-Map_Ledge_internal
@left: dc.b $10
dc.b $C8, $E, 0, $57, $10 ; ledge facing left
dc.b $D0, $D, 0, $63, $F0
dc.b $E0, $D, 0, $6B, $10
dc.b $E0, $D, 0, $73, $F0
dc.b $D8, 6, 0, $7B, $E0
dc.b $D8, 6, 0, $81, $D0
dc.b $F0, $D, 0, $87, $10
dc.b $F0, $D, 0, $8F, $F0
dc.b $F0, 5, 0, $97, $E0
dc.b $F0, 5, 0, $9B, $D0
dc.b 0, $D, 0, $9F, $10
dc.b 0, 5, 0, $A7, 0
dc.b 0, $D, 0, $AB, $E0
dc.b 0, 5, 0, $B3, $D0
dc.b $10, $D, 0, $AB, $10
dc.b $10, 5, 0, $B7, 0
@right: dc.b $10
dc.b $C8, $E, 0, $57, $10 ; ledge facing right
dc.b $D0, $D, 0, $63, $F0
dc.b $E0, $D, 0, $6B, $10
dc.b $E0, $D, 0, $73, $F0
dc.b $D8, 6, 0, $7B, $E0
dc.b $D8, 6, 0, $BB, $D0
dc.b $F0, $D, 0, $87, $10
dc.b $F0, $D, 0, $8F, $F0
dc.b $F0, 5, 0, $97, $E0
dc.b $F0, 5, 0, $C1, $D0
dc.b 0, $D, 0, $9F, $10
dc.b 0, 5, 0, $A7, 0
dc.b 0, $D, 0, $AB, $E0
dc.b 0, 5, 0, $B7, $D0
dc.b $10, $D, 0, $AB, $10
dc.b $10, 5, 0, $B7, 0
@leftsmash: dc.b $19
dc.b $C8, 6, 0, $5D, $20 ; ledge facing left in pieces
dc.b $C8, 6, 0, $57, $10
dc.b $D0, 5, 0, $67, 0
dc.b $D0, 5, 0, $63, $F0
dc.b $E0, 5, 0, $6F, $20
dc.b $E0, 5, 0, $6B, $10
dc.b $E0, 5, 0, $77, 0
dc.b $E0, 5, 0, $73, $F0
dc.b $D8, 6, 0, $7B, $E0
dc.b $D8, 6, 0, $81, $D0
dc.b $F0, 5, 0, $8B, $20
dc.b $F0, 5, 0, $87, $10
dc.b $F0, 5, 0, $93, 0
dc.b $F0, 5, 0, $8F, $F0
dc.b $F0, 5, 0, $97, $E0
dc.b $F0, 5, 0, $9B, $D0
dc.b 0, 5, 0, $8B, $20
dc.b 0, 5, 0, $8B, $10
dc.b 0, 5, 0, $A7, 0
dc.b 0, 5, 0, $AB, $F0
dc.b 0, 5, 0, $AB, $E0
dc.b 0, 5, 0, $B3, $D0
dc.b $10, 5, 0, $AB, $20
dc.b $10, 5, 0, $AB, $10
dc.b $10, 5, 0, $B7, 0
@rightsmash: dc.b $19
dc.b $C8, 6, 0, $5D, $20 ; ledge facing right in pieces
dc.b $C8, 6, 0, $57, $10
dc.b $D0, 5, 0, $67, 0
dc.b $D0, 5, 0, $63, $F0
dc.b $E0, 5, 0, $6F, $20
dc.b $E0, 5, 0, $6B, $10
dc.b $E0, 5, 0, $77, 0
dc.b $E0, 5, 0, $73, $F0
dc.b $D8, 6, 0, $7B, $E0
dc.b $D8, 6, 0, $BB, $D0
dc.b $F0, 5, 0, $8B, $20
dc.b $F0, 5, 0, $87, $10
dc.b $F0, 5, 0, $93, 0
dc.b $F0, 5, 0, $8F, $F0
dc.b $F0, 5, 0, $97, $E0
dc.b $F0, 5, 0, $C1, $D0
dc.b 0, 5, 0, $8B, $20
dc.b 0, 5, 0, $8B, $10
dc.b 0, 5, 0, $A7, 0
dc.b 0, 5, 0, $AB, $F0
dc.b 0, 5, 0, $AB, $E0
dc.b 0, 5, 0, $B7, $D0
dc.b $10, 5, 0, $AB, $20
dc.b $10, 5, 0, $AB, $10
dc.b $10, 5, 0, $B7, 0
even |
src/firmware-tests/Platform/Adc/EnableDisable/EnableAdcCalledTwiceTest.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 95782 | <gh_stars>1-10
#include "Platform.inc"
#include "FarCalls.inc"
#include "Adc.inc"
#include "TestFixture.inc"
radix decimal
EnableAdcCalledTwiceTest code
global testArrange
testArrange:
fcall initialiseAdc
testAct:
fcall enableAdc
waitUntilConversionHasCompleted:
banksel ADCON0
btfsc ADCON0, GO
goto waitUntilConversionHasCompleted
callEnableForTheSecondTime:
fcall enableAdc
testAssert:
banksel ADCON0
movf ADCON0, W
andlw (1 << GO)
.assert "W == 0, 'Second enableAdc() call should not have started a conversion.'"
return
end
|
oeis/228/A228406.asm | neoneye/loda-programs | 11 | 240354 | ; A228406: Sequences from the quartic oscillator.
; Submitted by <NAME>
; 0,24,384,2064,7104,18984,43008,86688,160128,276408,451968,706992,1065792,1557192,2214912,3077952,4190976,5604696,7376256,9569616,12255936,15513960,19430400,24100320,29627520,36124920,43714944,52529904,62712384,74415624,87803904
mul $0,2
lpb $0
mov $2,$0
sub $0,2
add $2,2
bin $2,4
add $1,$2
lpe
mov $0,$1
mul $0,24
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_724.asm | ljhsiun2/medusa | 9 | 9985 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_724.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x16a85, %r13
nop
nop
nop
dec %rbx
mov (%r13), %r11d
nop
nop
nop
nop
nop
cmp $25728, %r11
lea addresses_D_ht+0x8aad, %rcx
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, %xmm2
and $0xffffffffffffffc0, %rcx
movntdq %xmm2, (%rcx)
nop
nop
nop
nop
nop
sub %r11, %r11
lea addresses_WC_ht+0x885, %r13
clflush (%r13)
nop
and %r14, %r14
mov (%r13), %r11w
nop
add %rbx, %rbx
lea addresses_D_ht+0x117cf, %r14
nop
nop
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
movups %xmm5, (%r14)
nop
nop
nop
nop
nop
dec %rdi
lea addresses_WC_ht+0x229, %rdi
nop
nop
nop
xor %r14, %r14
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
vmovups %ymm0, (%rdi)
xor %rcx, %rcx
lea addresses_WT_ht+0xc685, %rsi
lea addresses_D_ht+0xc685, %rdi
nop
nop
cmp %r15, %r15
mov $113, %rcx
rep movsw
nop
nop
nop
nop
nop
dec %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_A+0xadad, %r12
nop
and $43897, %rsi
movl $0x51525354, (%r12)
nop
nop
nop
nop
sub %r12, %r12
// REPMOV
lea addresses_A+0xbe85, %rsi
lea addresses_A+0x1540d, %rdi
nop
add $28464, %rbp
mov $84, %rcx
rep movsw
nop
nop
nop
nop
add %rdi, %rdi
// Load
lea addresses_PSE+0x16d85, %rdi
cmp %rsi, %rsi
mov (%rdi), %ebp
nop
nop
nop
nop
add $29429, %rsi
// Store
mov $0xa85, %r12
nop
nop
nop
nop
add %rbp, %rbp
movb $0x51, (%r12)
nop
nop
nop
nop
nop
and %rsi, %rsi
// Store
lea addresses_A+0x8865, %r12
nop
and $6646, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm6
movups %xmm6, (%r12)
nop
nop
nop
nop
inc %r10
// Store
lea addresses_US+0x685, %r12
nop
nop
nop
nop
nop
and $63838, %r14
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
vmovups %ymm4, (%r12)
add $6871, %rsi
// Store
lea addresses_WC+0xd96d, %rdi
nop
nop
nop
sub $22089, %rsi
mov $0x5152535455565758, %rbp
movq %rbp, %xmm7
movups %xmm7, (%rdi)
nop
nop
nop
nop
nop
sub %r14, %r14
// Faulty Load
lea addresses_A+0xbe85, %r14
clflush (%r14)
nop
inc %rdi
movb (%r14), %r12b
lea oracles, %r10
and $0xff, %r12
shlq $12, %r12
mov (%r10,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'src': {'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 9, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 3, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sccz80/sqr.asm | ahjelm/z88dk | 640 | 164359 |
SECTION code_fp_am9511
PUBLIC sqr
EXTERN cam32_sccz80_sqr
defc sqr = cam32_sccz80_sqr
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _sqr
EXTERN cam32_sdcc_sqr
defc _sqr = cam32_sdcc_sqr
ENDIF
|
src/TemporalOps/Delay.agda | DimaSamoz/temporal-type-systems | 4 | 15683 | <reponame>DimaSamoz/temporal-type-systems
{- Delay operator. -}
module TemporalOps.Delay where
open import CategoryTheory.Categories
open import CategoryTheory.Instances.Reactive
open import CategoryTheory.Functor
open import CategoryTheory.CartesianStrength
open import TemporalOps.Common
open import TemporalOps.Next
open import Data.Nat.Properties using (+-identityʳ ; +-comm ; +-assoc ; +-suc)
open import Relation.Binary.HeterogeneousEquality as ≅ using (_≅_ ; ≅-to-≡)
import Relation.Binary.PropositionalEquality as ≡
open import Data.Product
open import Data.Sum
-- General iteration
-- iter f n v = fⁿ(v)
iter : (τ -> τ) -> ℕ -> τ -> τ
iter F zero A = A
iter F (suc n) A = F (iter F n A)
-- Multi-step delay
delay_by_ : τ -> ℕ -> τ
delay A by zero = A
delay A by suc n = ▹ (delay A by n)
infix 67 delay_by_
-- || Lemmas for the delay operator
-- Extra delay is cancelled out by extra waiting.
delay-+ : ∀{A} -> (n l k : ℕ)
-> delay A by (n + l) at (n + k) ≡ delay A by l at k
delay-+ zero l k = refl
delay-+ (suc n) = delay-+ n
-- || Derived lemmas - they can all be expressed in terms of delay-+,
-- || but they are given explicitly for simplicity.
-- Delay by n is cancelled out by waiting n extra steps.
delay-+-left0 : ∀{A} -> (n k : ℕ)
-> delay A by n at (n + k) ≡ A at k
delay-+-left0 zero k = refl
delay-+-left0 (suc n) k = delay-+-left0 n k
-- delay-+-left0 can be converted to delay-+ (heterogeneously).
delay-+-left0-eq : ∀{A : τ} -> (n l : ℕ)
-> Proof-≡ (delay-+-left0 {A} n l) (delay-+ {A} n 0 l)
delay-+-left0-eq zero l v v′ pf = ≅-to-≡ pf
delay-+-left0-eq (suc n) l = delay-+-left0-eq n l
-- Extra delay by n steps is cancelled out by waiting for n steps.
delay-+-right0 : ∀{A} -> (n l : ℕ)
-> delay A by (n + l) at n ≡ delay A by l at 0
delay-+-right0 zero l = refl
delay-+-right0 (suc n) l = delay-+-right0 n l
-- Delaying by n is the same as delaying by (n + 0)
delay-+0-left : ∀{A} -> (k n : ℕ)
-> delay A by k at n ≡ delay A by (k + 0) at n
delay-+0-left {A} k n rewrite +-identityʳ k = refl
-- If the delay is greater than the wait amount, we get unit
delay-⊤ : ∀{A} -> (n k : ℕ)
-> ⊤ at n ≡ delay A by (n + suc k) at n
delay-⊤ {A} n k = sym (delay-+-right0 n (suc k))
-- Associativity of arguments in the delay lemma
delay-assoc-sym : ∀{A} (n k l j : ℕ)
-> Proof-≅ (sym (delay-+ {A} n (k + l) (k + j)))
(sym (delay-+ {A} (n + k) l j))
delay-assoc-sym zero zero l j v v′ pr = pr
delay-assoc-sym zero (suc k) l j = delay-assoc-sym zero k l j
delay-assoc-sym (suc n) k l j = delay-assoc-sym n k l j
-- Functor instance for delay
F-delay : ℕ -> Endofunctor ℝeactive
F-delay k = record
{ omap = delay_by k
; fmap = fmap-delay k
; fmap-id = λ {_ n a} -> fmap-delay-id k {_} {n} {a}
; fmap-∘ = fmap-delay-∘ k
; fmap-cong = fmap-delay-cong k
}
where
-- Lifting of delay
fmap-delay : {A B : τ} -> (k : ℕ) -> A ⇴ B -> delay A by k ⇴ delay B by k
fmap-delay zero f = f
fmap-delay (suc k) f = Functor.fmap F-▹ (fmap-delay k f)
-- Delay preserves identities
fmap-delay-id : ∀ (k : ℕ) {A : τ} {n : ℕ} {a : (delay A by k) n}
-> (fmap-delay k id at n) a ≡ a
fmap-delay-id zero = refl
fmap-delay-id (suc k) {A} {zero} = refl
fmap-delay-id (suc k) {A} {suc n} = fmap-delay-id k {A} {n}
-- Delay preserves composition
fmap-delay-∘ : ∀ (k : ℕ) {A B C : τ} {g : B ⇴ C} {f : A ⇴ B} {n : ℕ} {a : (delay A by k) n}
-> (fmap-delay k (g ∘ f) at n) a ≡ (fmap-delay k g ∘ fmap-delay k f at n) a
fmap-delay-∘ zero = refl
fmap-delay-∘ (suc k) {n = zero} = refl
fmap-delay-∘ (suc k) {n = suc n} = fmap-delay-∘ k {n = n}
-- Delay is congruent
fmap-delay-cong : ∀ (k : ℕ) {A B : τ} {f f′ : A ⇴ B}
-> ({n : ℕ} {a : A at n} -> f n a ≡ f′ n a)
-> ({n : ℕ} {a : delay A by k at n}
-> (fmap-delay k f at n) a
≡ (fmap-delay k f′ at n) a)
fmap-delay-cong zero e = e
fmap-delay-cong (suc k) e {zero} = refl
fmap-delay-cong (suc k) e {suc n} = fmap-delay-cong k e
-- || Lemmas for the interaction of fmap and delay-+
-- Lifted version of the delay-+ lemma
-- Arguments have different types, so we need heterogeneous equality
fmap-delay-+ : ∀ {A B : τ} {f : A ⇴ B} (n k l : ℕ)
-> Fun-≅ (Functor.fmap (F-delay (n + k)) f at (n + l))
(Functor.fmap (F-delay k) f at l)
fmap-delay-+ zero k l v .v ≅.refl = ≅.refl
fmap-delay-+ (suc n) k l v v′ pf = fmap-delay-+ n k l v v′ pf
-- Specialised version with v of type delay A by (n + k) at (n + l)
-- Uses explicit rewrites and homogeneous equality
fmap-delay-+-n+k : ∀ {A B : τ} {f : A ⇴ B} (n k l : ℕ)
-> (v : delay A by (n + k) at (n + l))
-> rew (delay-+ n k l) ((Functor.fmap (F-delay (n + k)) f at (n + l)) v)
≡ (Functor.fmap (F-delay k) f at l) (rew (delay-+ n k l) v)
fmap-delay-+-n+k {A} n k l v =
≅-to-rew-≡ (fmap-delay-+ n k l v v′ v≅v′) (delay-+ n k l)
where
v′ : delay A by k at l
v′ = rew (delay-+ n k l) v
v≅v′ : v ≅ v′
v≅v′ = rew-to-≅ (delay-+ n k l)
-- Lifted delay lemma with delay-+-left0
fmap-delay-+-n+0 : ∀ {A B : τ} {f : A ⇴ B} (n l : ℕ)
-> {v : delay A by n at (n + l)}
-> rew (delay-+-left0 n l) ((Functor.fmap (F-delay n) f at (n + l)) v)
≡ f l (rew (delay-+-left0 n l) v)
fmap-delay-+-n+0 {A} zero l = refl
fmap-delay-+-n+0 {A} (suc n) l = fmap-delay-+-n+0 n l
-- Specialised version with v of type delay A by k at l
-- Uses explicit rewrites and homogeneous equality
fmap-delay-+-k : ∀ {A B : τ} {f : A ⇴ B} (n k l : ℕ)
->(v : delay A by k at l)
-> Functor.fmap (F-delay (n + k)) f (n + l) (rew (sym (delay-+ n k l)) v)
≡ rew (sym (delay-+ n k l)) (Functor.fmap (F-delay k) f l v)
fmap-delay-+-k {A} {B} {f} n k l v =
sym (≅-to-rew-≡ (≅.sym (fmap-delay-+ n k l v′ v v≅v′)) (sym (delay-+ n k l)))
where
v′ : delay A by (n + k) at (n + l)
v′ = rew (sym (delay-+ n k l)) v
v≅v′ : v′ ≅ v
v≅v′ = ≅.sym (rew-to-≅ (sym (delay-+ n k l)))
-- Delay is a Cartesian functor
F-cart-delay : ∀ k -> CartesianFunctor (F-delay k) ℝeactive-cart ℝeactive-cart
F-cart-delay k = record
{ u = u-delay k
; m = m-delay k
; m-nat₁ = m-nat₁-delay k
; m-nat₂ = m-nat₂-delay k
; associative = assoc-delay k
; unital-right = unit-right-delay k
; unital-left = λ {B} {n} {a} -> unit-left-delay k {B} {n} {a}
}
where
open CartesianFunctor F-cart-▹
u-delay : ∀ k -> ⊤ ⇴ delay ⊤ by k
u-delay zero = λ n _ → top.tt
u-delay (suc k) zero top.tt = top.tt
u-delay (suc k) (suc n) top.tt = u-delay k n top.tt
m-delay : ∀ k (A B : τ) -> (delay A by k ⊗ delay B by k) ⇴ delay (A ⊗ B) by k
m-delay zero A B = λ n x → x
m-delay (suc k) A B = Functor.fmap F-▹ (m-delay k A B) ∘ m (delay A by k) (delay B by k)
m-nat₁-delay : ∀ k {A B C : τ} (f : A ⇴ B)
-> Functor.fmap (F-delay k) (f * id) ∘ m-delay k A C
≈ m-delay k B C ∘ Functor.fmap (F-delay k) f * id
m-nat₁-delay zero f = refl
m-nat₁-delay (suc k) f {zero} = refl
m-nat₁-delay (suc k) f {suc n} = m-nat₁-delay k f
m-nat₂-delay : ∀ k {A B C : τ} (f : A ⇴ B)
-> Functor.fmap (F-delay k) (id * f) ∘ m-delay k C A
≈ m-delay k C B ∘ id * Functor.fmap (F-delay k) f
m-nat₂-delay zero f = refl
m-nat₂-delay (suc k) f {zero} = refl
m-nat₂-delay (suc k) f {suc n} = m-nat₂-delay k f
assoc-delay : ∀ k {A B C : τ}
-> m-delay k A (B ⊗ C) ∘ id * m-delay k B C ∘ assoc-right
≈ Functor.fmap (F-delay k) assoc-right ∘ m-delay k (A ⊗ B) C ∘ m-delay k A B * id
assoc-delay zero = refl
assoc-delay (suc k) {A} {B} {C} {zero} = refl
assoc-delay (suc k) {A} {B} {C} {suc n} = assoc-delay k
unit-right-delay : ∀ k {A : τ} ->
Functor.fmap (F-delay k) unit-right ∘ m-delay k A ⊤ ∘ (id * u-delay k) ≈ unit-right
unit-right-delay zero {A} {n} = refl
unit-right-delay (suc k) {A} {zero} = refl
unit-right-delay (suc k) {A} {suc n} = unit-right-delay k
unit-left-delay : ∀ k {B : τ} ->
Functor.fmap (F-delay k) unit-left ∘ m-delay k ⊤ B ∘ (u-delay k * id) ≈ unit-left
unit-left-delay zero = refl
unit-left-delay (suc k) {B} {zero} = refl
unit-left-delay (suc k) {B} {suc n} = unit-left-delay k
m-delay-+-n+0 : ∀ {A B} k l {a b}
-> (rew (delay-+-left0 k l)
(CartesianFunctor.m (F-cart-delay k) A B (k + l) (a , b)))
≡ (rew (delay-+-left0 k l) a , rew (delay-+-left0 k l) b)
m-delay-+-n+0 zero l = refl
m-delay-+-n+0 (suc k) l = m-delay-+-n+0 k l
m-delay-+-sym : ∀ {A B} k l m{a b}
-> rew (sym (delay-+ k m l))
(CartesianFunctor.m (F-cart-delay m) A B l (a , b))
≡ CartesianFunctor.m (F-cart-delay (k + m)) A B (k + l)
((rew (sym (delay-+ k m l)) a) , (rew (sym (delay-+ k m l)) b))
m-delay-+-sym zero l m = refl
m-delay-+-sym (suc k) l m = m-delay-+-sym k l m
|
programs/oeis/205/A205794.asm | neoneye/loda | 22 | 170005 | <reponame>neoneye/loda<filename>programs/oeis/205/A205794.asm<gh_stars>10-100
; A205794: Least positive integer j such that n divides C(k)-C(j) , where k, as in A205793, is the least number for which there is such a j, and C=A002808 (composite numbers).
; 1,1,2,1,1,1,3,1,2,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,3,1,2,1,1,1,1,1,2,1,1,1,3,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,3,1,2,1,1,1,1,1,2,1,1,1,3,1,2,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,2,1,1,1,3,1,2
trn $0,1
add $0,2
seq $0,155874 ; Smallest positive composite number such that a(n)+n is also composite.
div $0,2
sub $0,1
|
tests/devices/save3dos/save3dos_3.asm | NEO-SPECTRUMAN/sjasmplus | 0 | 103893 | <reponame>NEO-SPECTRUMAN/sjasmplus<gh_stars>0
DEVICE ZXSPECTRUM48
ORG $8765
code:
DB "Code"
.sz EQU $-code
; the default type is CODE block, taking two arguments: address, size
SAVE3DOS "save3dos_3.bin", code, code.sz
SAVE3DOS "save3dos_3.raw", code, code.sz, 3, $ABCD ; w2 = non-default load address
|
HdGfxLib/libgfxinit/common/hw-gfx-gma-config.ads | jam3st/edk2 | 1 | 21575 | --
-- Copyright (C) 2015-2018 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
private package HW.GFX.GMA.Config
with
Initializes => (Valid_Port_GPU, Raw_Clock)
is
CPU : constant CPU_Type := Haswell;
CPU_Var : constant CPU_Variant := Normal;
Internal_Display : constant Internal_Type := DP;
Analog_I2C_Port : constant PCH_Port := PCH_DAC;
EDP_Low_Voltage_Swing : constant Boolean := False;
DDI_HDMI_Buffer_Translation : constant Integer := -1;
Default_MMIO_Base : constant := 0 ;
LVDS_Dual_Threshold : constant := 95_000_000;
----------------------------------------------------------------------------
Default_MMIO_Base_Set : constant Boolean := Default_MMIO_Base /= 0;
Has_Internal_Display : constant Boolean := Internal_Display /= None;
Internal_Is_EDP : constant Boolean := Internal_Display = DP;
Have_DVI_I : constant Boolean := Analog_I2C_Port /= PCH_DAC;
Has_Presence_Straps : constant Boolean := CPU /= Broxton;
----- CPU pipe: --------
Disable_Trickle_Feed : constant Boolean := not
(CPU in Haswell .. Broadwell);
Pipe_Enabled_Workaround : constant Boolean := CPU = Broadwell;
Has_EDP_Transcoder : constant Boolean := CPU >= Haswell;
Use_PDW_For_EDP_Scaling : constant Boolean := CPU = Haswell;
Has_Pipe_DDI_Func : constant Boolean := CPU >= Haswell;
Has_Trans_Clk_Sel : constant Boolean := CPU >= Haswell;
Has_Pipe_MSA_Misc : constant Boolean := CPU >= Haswell;
Has_Pipeconf_Misc : constant Boolean := CPU >= Broadwell;
Has_Pipeconf_BPC : constant Boolean := CPU /= Haswell;
Has_Plane_Control : constant Boolean := CPU >= Broxton;
Has_DSP_Linoff : constant Boolean := CPU <= Ivybridge;
Has_PF_Pipe_Select : constant Boolean := CPU in Ivybridge .. Haswell;
Has_Cursor_FBC_Control : constant Boolean := CPU >= Ivybridge;
VGA_Plane_Workaround : constant Boolean := CPU = Ivybridge;
Has_GMCH_DP_Transcoder : constant Boolean := CPU = G45;
Has_GMCH_VGACNTRL : constant Boolean := CPU = G45;
Has_GMCH_PFIT_CONTROL : constant Boolean := CPU = G45;
----- Panel power: -----
Has_PP_Write_Protection : constant Boolean := CPU <= Ivybridge;
Has_PP_Port_Select : constant Boolean := CPU <= Ivybridge;
Use_PP_VDD_Override : constant Boolean := CPU <= Ivybridge;
Has_PCH_Panel_Power : constant Boolean := CPU >= Ironlake;
----- PCH/FDI: ---------
Has_PCH : constant Boolean := CPU /= Broxton and CPU /= G45;
Has_PCH_DAC : constant Boolean := CPU in Ironlake .. Ivybridge or
(CPU in Broadwell .. Haswell
and CPU_Var = Normal);
Has_PCH_Aux_Channels : constant Boolean := CPU in Ironlake .. Broadwell;
VGA_Has_Sync_Disable : constant Boolean := CPU <= Ivybridge;
Has_Trans_Timing_Ovrrde : constant Boolean := CPU >= Sandybridge;
Has_DPLL_SEL : constant Boolean := CPU in Ironlake .. Ivybridge;
Has_FDI_BPC : constant Boolean := CPU in Ironlake .. Ivybridge;
Has_FDI_Composite_Sel : constant Boolean := CPU = Ivybridge;
Has_Trans_DP_Ctl : constant Boolean := CPU in
Sandybridge .. Ivybridge;
Has_FDI_C : constant Boolean := CPU = Ivybridge;
Has_FDI_RX_Power_Down : constant Boolean := CPU in Haswell .. Broadwell;
Has_GMCH_RawClk : constant Boolean := CPU = G45;
----- DDI: -------------
End_EDP_Training_Late : constant Boolean := CPU in Haswell .. Broadwell;
Has_Per_DDI_Clock_Sel : constant Boolean := CPU in Haswell .. Broadwell;
Has_HOTPLUG_CTL : constant Boolean := CPU in Haswell .. Broadwell;
Has_SHOTPLUG_CTL_A : constant Boolean := (CPU in Haswell .. Broadwell
and CPU_Var = ULT) or
CPU >= Skylake;
Has_DDI_PHYs : constant Boolean := CPU = Broxton;
Has_DDI_D : constant Boolean := CPU >= Haswell and
CPU_Var = Normal and
not Has_DDI_PHYs;
Has_DDI_E : constant Boolean := -- might be disabled by x4 eDP
Has_DDI_D;
Has_DDI_Buffer_Trans : constant Boolean := CPU >= Haswell and
CPU /= Broxton;
Has_Low_Voltage_Swing : constant Boolean := CPU >= Broxton;
Has_Iboost_Config : constant Boolean := CPU >= Skylake;
Need_DP_Aux_Mutex : constant Boolean := False; -- Skylake & (PSR | GTC)
----- GMBUS: -----------
Ungate_GMBUS_Unit_Level : constant Boolean := CPU >= Skylake;
GMBUS_Alternative_Pins : constant Boolean := CPU = Broxton;
Has_PCH_GMBUS : constant Boolean := CPU >= Ironlake;
----- Power: -----------
Has_IPS : constant Boolean := (CPU = Haswell and
CPU_Var = ULT) or
CPU = Broadwell;
Has_IPS_CTL_Mailbox : constant Boolean := CPU = Broadwell;
Has_Per_Pipe_SRD : constant Boolean := CPU >= Broadwell;
----- GTT: -------------
Fold_39Bit_GTT_PTE : constant Boolean := CPU <= Haswell;
----------------------------------------------------------------------------
Max_Pipe : constant Pipe_Index :=
(if CPU <= Sandybridge
then Secondary
else Tertiary);
type Supported_Pipe_Array is array (Pipe_Index) of Boolean;
Supported_Pipe : constant Supported_Pipe_Array :=
(Primary => Primary <= Max_Pipe,
Secondary => Secondary <= Max_Pipe,
Tertiary => Tertiary <= Max_Pipe);
type Valid_Per_Port is array (Port_Type) of Boolean;
type Valid_Per_GPU is array (CPU_Type) of Valid_Per_Port;
Valid_Port_GPU : Valid_Per_GPU :=
(G45 =>
(Disabled => False,
Internal => Config.Internal_Display = LVDS,
HDMI3 => False,
others => True),
Ironlake =>
(Disabled => False,
Internal => Config.Internal_Display = LVDS,
others => True),
Sandybridge =>
(Disabled => False,
Internal => Config.Internal_Display = LVDS,
others => True),
Ivybridge =>
(Disabled => False,
Internal => Config.Internal_Display /= None,
others => True),
Haswell =>
(Disabled => False,
Internal => Config.Internal_Display = DP,
HDMI3 => CPU_Var = Normal,
DP3 => CPU_Var = Normal,
Analog => CPU_Var = Normal,
others => True),
Broadwell =>
(Disabled => False,
Internal => Config.Internal_Display = DP,
HDMI3 => CPU_Var = Normal,
DP3 => CPU_Var = Normal,
Analog => CPU_Var = Normal,
others => True),
Broxton =>
(Internal => Config.Internal_Display = DP,
DP1 => True,
DP2 => True,
HDMI1 => True,
HDMI2 => True,
others => False),
Skylake =>
(Disabled => False,
Internal => Config.Internal_Display = DP,
Analog => False,
others => True))
with
Part_Of => GMA.Config_State;
Valid_Port : Valid_Per_Port renames Valid_Port_GPU (CPU);
Last_Digital_Port : constant Digital_Port :=
(if Has_DDI_E then DIGI_E else DIGI_C);
----------------------------------------------------------------------------
type FDI_Per_Port is array (Port_Type) of Boolean;
Is_FDI_Port : constant FDI_Per_Port :=
(case CPU is
when Ironlake .. Ivybridge => FDI_Per_Port'
(Internal => Internal_Display = LVDS,
others => True),
when Haswell .. Broadwell => FDI_Per_Port'
(Analog => Has_PCH_DAC,
others => False),
when others => FDI_Per_Port'
(others => False));
type FDI_Lanes_Per_Port is array (GPU_Port) of DP_Lane_Count;
FDI_Lane_Count : constant FDI_Lanes_Per_Port :=
(DIGI_D => DP_Lane_Count_2,
others =>
(if CPU in Ironlake .. Ivybridge then
DP_Lane_Count_4
else
DP_Lane_Count_2));
FDI_Training : constant FDI_Training_Type :=
(case CPU is
when Ironlake => Simple_Training,
when Sandybridge => Full_Training,
when others => Auto_Training);
----------------------------------------------------------------------------
Default_DDI_HDMI_Buffer_Translation : constant DDI_HDMI_Buf_Trans_Range :=
(case CPU is
when Haswell => 6,
when Broadwell => 7,
when Broxton => 8,
when Skylake => 8,
when others => 0);
----------------------------------------------------------------------------
Default_CDClk_Freq : constant Frequency_Type :=
(case CPU is
when G45 => 320_000_000, -- unused
when Ironlake |
Haswell |
Broadwell => 450_000_000,
when Sandybridge |
Ivybridge => 400_000_000,
when Broxton => 288_000_000,
when Skylake => 337_500_000);
Default_RawClk_Freq : constant Frequency_Type :=
(case CPU is
when G45 => 100_000_000, -- unused, depends on FSB
when Ironlake |
Sandybridge |
Ivybridge => 125_000_000,
when Haswell |
Broadwell => (if CPU_Var = Normal then
125_000_000
else
24_000_000),
when Broxton => Frequency_Type'First, -- none needed
when Skylake => 24_000_000);
Raw_Clock : Frequency_Type := Default_RawClk_Freq
with Part_Of => GMA.Config_State;
----------------------------------------------------------------------------
-- Maximum source width with enabled scaler. This only accounts
-- for simple 1:1 pipe:scaler mappings.
type Width_Per_Pipe is array (Pipe_Index) of Pos16;
Maximum_Scalable_Width : constant Width_Per_Pipe :=
(case CPU is
when G45 => -- TODO: Is this true?
(Primary => 4096,
Secondary => 2048,
Tertiary => Pos16'First),
when Ironlake..Haswell =>
(Primary => 4096,
Secondary => 2048,
Tertiary => 2048),
when Broadwell..Skylake =>
(Primary => 4096,
Secondary => 4096,
Tertiary => 4096));
-- Maximum X position of hardware cursors
Maximum_Cursor_X : constant := (case CPU is
when G45 .. Ivybridge => 4095,
when Haswell .. Skylake => 8191);
Maximum_Cursor_Y : constant := 4095;
----------------------------------------------------------------------------
-- FIXME: Unknown for Broxton, Linux' i915 contains a fixme too :-D
HDMI_Max_Clock_24bpp : constant Frequency_Type :=
(if CPU >= Haswell then 300_000_000 else 225_000_000);
----------------------------------------------------------------------------
GTT_Offset : constant := (case CPU is
when G45 .. Haswell => 16#0020_0000#,
when Broadwell .. Skylake => 16#0080_0000#);
GTT_Size : constant := (case CPU is
when G45 .. Haswell => 16#0020_0000#,
-- Limit Broadwell to 4MiB to have a stable
-- interface (i.e. same number of entries):
when Broadwell .. Skylake => 16#0040_0000#);
GTT_PTE_Size : constant := (case CPU is
when G45 .. Haswell => 4,
when Broadwell .. Skylake => 8);
Fence_Base : constant := (case CPU is
when G45 .. Ironlake => 16#0000_3000#,
when Sandybridge .. Skylake => 16#0010_0000#);
Fence_Count : constant := (case CPU is
when G45 .. Sandybridge => 16,
when Ivybridge .. Skylake => 32);
----------------------------------------------------------------------------
use type HW.Word16;
function Is_Broadwell_H (Device_Id : Word16) return Boolean is
(Device_Id = 16#1612# or Device_Id = 16#1622# or Device_Id = 16#162a#);
function Is_Skylake_U (Device_Id : Word16) return Boolean is
(Device_Id = 16#1906# or Device_Id = 16#1916# or Device_Id = 16#1923# or
Device_Id = 16#1926# or Device_Id = 16#1927#);
-- Rather catch too much here than too little,
-- it's only used to distinguish generations.
function Is_GPU (Device_Id : Word16; CPU : CPU_Type; CPU_Var : CPU_Variant)
return Boolean is
(case CPU is
when G45 => (Device_Id and 16#ff02#) = 16#2e02# or
(Device_Id and 16#fffe#) = 16#2a42#,
when Ironlake => (Device_Id and 16#fff3#) = 16#0042#,
when Sandybridge => (Device_Id and 16#ffc2#) = 16#0102#,
when Ivybridge => (Device_Id and 16#ffc3#) = 16#0142#,
when Haswell =>
(case CPU_Var is
when Normal => (Device_Id and 16#ffc3#) = 16#0402# or
(Device_Id and 16#ffc3#) = 16#0d02#,
when ULT => (Device_Id and 16#ffc3#) = 16#0a02#),
when Broadwell => ((Device_Id and 16#ffc3#) = 16#1602# or
(Device_Id and 16#ffcf#) = 16#160b# or
(Device_Id and 16#ffcf#) = 16#160d#) and
(case CPU_Var is
when Normal => Is_Broadwell_H (Device_Id),
when ULT => not Is_Broadwell_H (Device_Id)),
when Broxton => (Device_Id and 16#fffe#) = 16#5a84#,
when Skylake => ((Device_Id and 16#ffc3#) = 16#1902# or
(Device_Id and 16#ffcf#) = 16#190b# or
(Device_Id and 16#ffcf#) = 16#190d# or
(Device_Id and 16#fff9#) = 16#1921#) and
(case CPU_Var is
when Normal => not Is_Skylake_U (Device_Id),
when ULT => Is_Skylake_U (Device_Id)));
function Compatible_GPU (Device_Id : Word16) return Boolean is
(Is_GPU (Device_Id, CPU, CPU_Var));
end HW.GFX.GMA.Config;
|
AppleScript/airpods_pro_toggle.applescript | iml885203/helper_scripts | 1 | 3668 | <filename>AppleScript/airpods_pro_toggle.applescript<gh_stars>1-10
# need use NoiseBuddy v1.2
# https://github.com/insidegui/NoiseBuddy/releases/tag/1.2
tell application "System Events" to tell process "NoiseBuddy"
tell menu bar item 1 of menu bar 2
click
end tell
end tell
using terms from application "Spotify"
if player state of application "Spotify" is paused then
tell application "Spotify" to play
else
tell application "Spotify" to pause
end if
end using terms from
|
theorems/homotopy/Pi2HSusp.agda | cmknapp/HoTT-Agda | 0 | 12636 | <reponame>cmknapp/HoTT-Agda
{-# OPTIONS --without-K #-}
open import HoTT
open import homotopy.HSpace renaming (HSpaceStructure to HSS)
open import homotopy.WedgeExtension
module homotopy.Pi2HSusp where
module Pi2HSusp {i} (A : Type i) (gA : has-level 1 A)
(cA : is-connected 0 A) (A-H : HSS A)
where
{- TODO this belongs somewhere else, but where? -}
private
Type=-ext : ∀ {i} {A B : Type i} (p q : A == B)
→ ((x : A) → coe p x == coe q x) → p == q
Type=-ext p q α =
! (ua-η p)
∙ ap ua (pair= (λ= α) (prop-has-all-paths-↓ (is-equiv-is-prop (coe q))))
∙ ua-η q
open HSS A-H
open ConnectedHSpace A cA A-H
P : Suspension A → Type i
P x = Trunc 1 (north == x)
module Codes = SuspensionRec A A (λ a → ua (μ-e-r-equiv a))
Codes : Suspension A → Type i
Codes = Codes.f
Codes-level : (x : Suspension A) → has-level 1 (Codes x)
Codes-level = Suspension-elim gA gA
(λ _ → prop-has-all-paths-↓ has-level-is-prop)
encode₀ : {x : Suspension A} → (north == x) → Codes x
encode₀ α = transport Codes α e
encode : {x : Suspension A} → P x → Codes x
encode {x} = Trunc-rec (Codes-level x) encode₀
decode' : A → P north
decode' a = [ (merid a ∙ ! (merid e)) ]
abstract
transport-Codes-mer : (a a' : A)
→ transport Codes (merid a) a' == μ a a'
transport-Codes-mer a a' =
coe (ap Codes (merid a)) a'
=⟨ Codes.merid-β a |in-ctx (λ w → coe w a') ⟩
coe (ua (μ-e-r-equiv a)) a'
=⟨ coe-β (μ-e-r-equiv a) a' ⟩
μ a a' ∎
transport-Codes-mer-e-! : (a : A)
→ transport Codes (! (merid e)) a == a
transport-Codes-mer-e-! a =
coe (ap Codes (! (merid e))) a
=⟨ ap-! Codes (merid e) |in-ctx (λ w → coe w a) ⟩
coe (! (ap Codes (merid e))) a
=⟨ Codes.merid-β e |in-ctx (λ w → coe (! w) a) ⟩
coe (! (ua (μ-e-r-equiv e))) a
=⟨ Type=-ext (ua (μ-e-r-equiv e)) idp (λ x → coe-β _ x ∙ μ-e-l x)
|in-ctx (λ w → coe (! w) a) ⟩
coe (! idp) a ∎
abstract
encode-decode' : (a : A) → encode (decode' a) == a
encode-decode' a =
transport Codes (merid a ∙ ! (merid e)) e
=⟨ trans-∙ {B = Codes} (merid a) (! (merid e)) e ⟩
transport Codes (! (merid e)) (transport Codes (merid a) e)
=⟨ transport-Codes-mer a e ∙ μ-e-r a
|in-ctx (λ w → transport Codes (! (merid e)) w) ⟩
transport Codes (! (merid e)) a
=⟨ transport-Codes-mer-e-! a ⟩
a ∎
abstract
homomorphism : (a a' : A)
→ Path {A = Trunc 1 (north == south)}
[ merid (μ a a' ) ] [ merid a' ∙ ! (merid e) ∙ merid a ]
homomorphism = WedgeExt.ext args
where
args : WedgeExt.args {a₀ = e} {b₀ = e}
args = record {m = -2; n = -2; cA = cA; cB = cA;
P = λ a a' → (_ , Trunc-level {n = 1} _ _);
f = λ a → ap [_] $
merid (μ a e)
=⟨ ap merid (μ-e-r a) ⟩
merid a
=⟨ ap (λ w → w ∙ merid a) (! (!-inv-r (merid e)))
∙ ∙-assoc (merid e) (! (merid e)) (merid a) ⟩
merid e ∙ ! (merid e) ∙ merid a ∎;
g = λ a' → ap [_] $
merid (μ e a')
=⟨ ap merid (μ-e-l a') ⟩
merid a'
=⟨ ! (∙-unit-r (merid a'))
∙ ap (λ w → merid a' ∙ w) (! (!-inv-l (merid e))) ⟩
merid a' ∙ ! (merid e) ∙ merid e ∎ ;
p = ap (λ {(p₁ , p₂) → ap [_] $
merid (μ e e) =⟨ p₁ ⟩
merid e =⟨ p₂ ⟩
merid e ∙ ! (merid e) ∙ merid e ∎})
(pair×= (ap (λ x → ap merid x) (! μ-coh)) (coh (merid e)))}
where coh : {B : Type i} {b b' : B} (p : b == b')
→ ap (λ w → w ∙ p) (! (!-inv-r p)) ∙ ∙-assoc p (! p) p
== ! (∙-unit-r p) ∙ ap (λ w → p ∙ w) (! (!-inv-l p))
coh idp = idp
decode : {x : Suspension A} → Codes x → P x
decode {x} = Suspension-elim {P = λ x → Codes x → P x}
decode'
(λ a → [ merid a ])
(λ a → ↓-→-from-transp (λ= $ STS a))
x
where
abstract
STS : (a a' : A) → transport P (merid a) (decode' a')
== [ merid (transport Codes (merid a) a') ]
STS a a' =
transport P (merid a) [ merid a' ∙ ! (merid e) ]
=⟨ transport-Trunc (north ==_) (merid a) _ ⟩
[ transport (north ==_) (merid a) (merid a' ∙ ! (merid e)) ]
=⟨ ap [_] (trans-pathfrom {A = Suspension A} (merid a) _) ⟩
[ (merid a' ∙ ! (merid e)) ∙ merid a ]
=⟨ ap [_] (∙-assoc (merid a') (! (merid e)) (merid a)) ⟩
[ merid a' ∙ ! (merid e) ∙ merid a ]
=⟨ ! (homomorphism a a') ⟩
[ merid (μ a a') ]
=⟨ ap ([_] ∘ merid) (! (transport-Codes-mer a a')) ⟩
[ merid (transport Codes (merid a) a') ] ∎
abstract
decode-encode : {x : Suspension A} (tα : P x)
→ decode {x} (encode {x} tα) == tα
decode-encode {x} = Trunc-elim
{P = λ tα → decode {x} (encode {x} tα) == tα}
(λ _ → =-preserves-level 1 Trunc-level)
(J (λ y p → decode {y} (encode {y} [ p ]) == [ p ])
(ap [_] (!-inv-r (merid e))))
main-lemma-eq : Trunc 1 (north' A == north) ≃ A
main-lemma-eq = equiv encode decode' encode-decode' decode-encode
⊙main-lemma : ⊙Trunc 1 (⊙Ω (⊙Susp (A , e))) == (A , e)
⊙main-lemma = ⊙ua (⊙≃-in main-lemma-eq idp)
abstract
main-lemma-iso : Ω^S-group 0 (⊙Trunc 1 (⊙Ω (⊙Susp (A , e)))) Trunc-level
≃ᴳ Ω^S-group 0 (⊙Trunc 1 (A , e)) Trunc-level
main-lemma-iso = (record {f = f; pres-comp = pres-comp} , ie)
where
h : fst (⊙Trunc 1 (⊙Ω (⊙Susp (A , e)))
⊙→ ⊙Trunc 1 (A , e))
h = (λ x → [ encode x ]) , idp
f : Ω (⊙Trunc 1 (⊙Ω (⊙Susp (A , e)))) → Ω (⊙Trunc 1 (A , e))
f = fst (ap^ 1 h)
pres-comp : (p q : Ω^ 1 (⊙Trunc 1 (⊙Ω (⊙Susp (A , e)))))
→ f (conc^S 0 p q) == conc^S 0 (f p) (f q)
pres-comp = ap^S-conc^S 0 h
ie : is-equiv f
ie = is-equiv-ap^ 1 h (snd $ ((unTrunc-equiv A gA)⁻¹ ∘e main-lemma-eq))
abstract
π₂-Suspension : πS 1 (⊙Susp (A , e)) == πS 0 (A , e)
π₂-Suspension =
πS 1 (⊙Susp (A , e))
=⟨ πS-inner-iso 0 (⊙Susp (A , e)) ⟩
πS 0 (⊙Ω (⊙Susp (A , e)))
=⟨ ! (πS-Trunc-shift-iso 0 (⊙Ω (⊙Susp (A , e)))) ⟩
Ω^S-group 0 (⊙Trunc 1 (⊙Ω (⊙Susp (A , e)))) Trunc-level
=⟨ group-ua main-lemma-iso ⟩
Ω^S-group 0 (⊙Trunc 1 (A , e)) Trunc-level
=⟨ πS-Trunc-shift-iso 0 (A , e) ⟩
πS 0 (A , e) ∎
|
programs/oeis/246/A246260.asm | neoneye/loda | 22 | 179280 | <reponame>neoneye/loda
; A246260: Characteristic function of A246261: a(n) = A000035(A048673(n)).
; 1,0,1,1,0,0,0,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,1,1,0,1,1,1,1,1,1,1,1,0,1,0,1,0,0,1,1,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,1,1,0,0,1,1,0,1,1,0,1,0,1,0,1,1
seq $0,3961 ; Completely multiplicative with a(prime(k)) = prime(k+1).
mod $0,4
div $0,2
pow $1,$0
mov $0,$1
|
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco/Cisco_hsrp.g4 | sskausik08/Wilco | 1 | 3571 | <reponame>sskausik08/Wilco<gh_stars>1-10
parser grammar Cisco_hsrp;
import Cisco_common;
options {
tokenVocab = CiscoLexer;
}
router_hsrp_stanza
:
ROUTER HSRP NEWLINE router_hsrp_if+
;
router_hsrp_if
:
INTERFACE interface_name NEWLINE router_hsrp_if_af+
;
router_hsrp_if_af
:
ADDRESS_FAMILY
(
IPV4
| IPV6
) NEWLINE HSRP DEC? NEWLINE router_hsrp_if_af_tail+
;
router_hsrp_if_af_tail
:
(
AUTHENTICATION
| ADDRESS
| PREEMPT
| PRIORITY
| TIMERS
| TRACK OBJECT
| VERSION DEC
) ~NEWLINE* NEWLINE
;
|
libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/___fs2uint_callee.asm | ahjelm/z88dk | 640 | 177860 |
SECTION code_fp_am9511
PUBLIC ___fs2uint_callee
EXTERN cam32_sdcc___fs2uint_callee
defc ___fs2uint_callee = cam32_sdcc___fs2uint_callee
|
ada-exceptions.ads | mgrojo/adalib | 15 | 24082 | -- Standard Ada library specification
-- Copyright (c) 2003-2018 <NAME> <<EMAIL>>
-- Copyright (c) 2004-2016 AXE Consultants
-- Copyright (c) 2004, 2005, 2006 Ada-Europe
-- Copyright (c) 2000 The MITRE Corporation, Inc.
-- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
-- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
---------------------------------------------------------------------------
with Ada.Streams;
package Ada.Exceptions is
pragma Preelaborate (Exceptions);
type Exception_Id is private;
pragma Preelaborable_Initialization (Exception_Id);
Null_Id : constant Exception_Id;
function Exception_Name (Id : in Exception_Id) return String;
function Wide_Exception_Name (Id : in Exception_Id) return Wide_String;
function Wide_Wide_Exception_Name (Id : in Exception_Id)
return Wide_Wide_String;
type Exception_Occurrence is limited private;
pragma Preelaborable_Initialization (Exception_Occurrence);
type Exception_Occurrence_Access is access all Exception_Occurrence;
Null_Occurrence : constant Exception_Occurrence;
procedure Raise_Exception (E : in Exception_Id;
Message : in String := "");
pragma No_Return (Raise_Exception);
function Exception_Message (X : in Exception_Occurrence) return String;
procedure Reraise_Occurrence (X : in Exception_Occurrence);
function Exception_Identity (X : in Exception_Occurrence)
return Exception_Id;
function Exception_Name (X : in Exception_Occurrence) return String;
-- Same as Exception_Name(Exception_Identity(X)).
function Wide_Exception_Name (X : in Exception_Occurrence)
return Wide_String;
-- Same as Wide_Exception_Name(Exception_Identity(X)).
function Wide_Wide_Exception_Name (X : in Exception_Occurrence)
return Wide_Wide_String;
-- Same as Wide_Wide_Exception_Name(Exception_Identity(X)).
function Exception_Information (X : in Exception_Occurrence) return String;
procedure Save_Occurrence (Target : out Exception_Occurrence;
Source : in Exception_Occurrence);
function Save_Occurrence (Source : in Exception_Occurrence)
return Exception_Occurrence_Access;
procedure Read_Exception_Occurrence
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : out Exception_Occurrence);
procedure Write_Exception_Occurrence
(Stream : not null access Ada.Streams.Root_Stream_Type'Class;
Item : in Exception_Occurrence);
for Exception_Occurrence'Read use Read_Exception_Occurrence;
for Exception_Occurrence'Write use Write_Exception_Occurrence;
private
pragma Import (Ada, Exception_Id);
pragma Import (Ada, Exception_Occurrence);
pragma Import (Ada, Null_Id);
pragma Import (Ada, Null_Occurrence);
end Ada.Exceptions;
|
oeis/101/A101376.asm | neoneye/loda-programs | 11 | 86434 | ; A101376: a(n) = n^2*(n^3 - n^2 + n + 1)/2.
; 0,1,14,99,424,1325,3366,7399,14624,26649,45550,73931,114984,172549,251174,356175,493696,670769,895374,1176499,1524200,1949661,2465254,3084599,3822624,4695625,5721326,6918939,8309224,9914549,11758950,13868191,16269824,18993249,22069774,25532675,29417256,33760909,38603174,43985799,49952800,56550521,63827694,71835499,80627624,90260325,100792486,112285679,124804224,138415249,153188750,169197651,186517864,205228349,225411174,247151575,270538016,295662249,322619374,351507899,382429800,415490581
mov $1,$0
add $0,1
pow $1,2
mov $2,$0
sub $0,2
mul $0,$1
add $0,$2
mul $1,$0
mov $0,$1
div $0,2
|
test/Succeed/Issue3972.agda | shlevy/agda | 1,989 | 12954 | <gh_stars>1000+
-- Andreas, 2019-08-08, issue #3972 (and #3967)
-- In the presence of an unreachable clause, the serializer crashed on a unsolve meta.
-- It seems this issue was fixed along #3966: only the ranges of unreachable clauses
-- are now serialized.
open import Agda.Builtin.Equality public
postulate
List : Set → Set
data Coo {A} (xs : List A) : Set where
coo : Coo xs → Coo xs
test : {A : Set} (xs : List A) (z : Coo xs) → Set₁
test xs z = cs xs z refl
where
cs : (xs : List _) -- filling this meta _=A removes the internal error
(z : Coo xs)
(eq : xs ≡ xs)
→ Set₁
cs xs (coo z) refl = Set
cs xs (coo z) eq = Set -- unreachable
|
CaTT/CaTT.agda | thibautbenjamin/catt-formalization | 0 | 15447 | <filename>CaTT/CaTT.agda
{-# OPTIONS --without-K #-}
open import Prelude
import GSeTT.Syntax
import GSeTT.Rules
open import CaTT.Ps-contexts
open import CaTT.Relation
open import CaTT.Uniqueness-Derivations-Ps
open import CaTT.Decidability-ps
open import CaTT.Fullness
import GSeTT.Typed-Syntax
module CaTT.CaTT where
J : Set₁
J = Σ (ps-ctx × Ty) λ {(Γ , A) → A is-full-in Γ }
open import Globular-TT.Syntax J
Ty→Pre-Ty : Ty → Pre-Ty
Tm→Pre-Tm : Tm → Pre-Tm
Sub→Pre-Sub : Sub → Pre-Sub
Ty→Pre-Ty ∗ = ∗
Ty→Pre-Ty (⇒ A t u) = ⇒ (Ty→Pre-Ty A) (Tm→Pre-Tm t) (Tm→Pre-Tm u)
Tm→Pre-Tm (v x) = Var x
Tm→Pre-Tm (coh Γ A Afull γ) = Tm-constructor (((Γ , A)) , Afull) (Sub→Pre-Sub γ)
Sub→Pre-Sub <> = <>
Sub→Pre-Sub < γ , x ↦ t > = < Sub→Pre-Sub γ , x ↦ Tm→Pre-Tm t >
_[_]Ty : Ty → Sub → Ty
_[_]Tm : Tm → Sub → Tm
_∘ₛ_ : Sub → Sub → Sub
∗ [ σ ]Ty = ∗
⇒ A t u [ σ ]Ty = ⇒ (A [ σ ]Ty) (t [ σ ]Tm) (u [ σ ]Tm)
v x [ <> ]Tm = v x
v x [ < σ , y ↦ t > ]Tm = if x ≡ y then t else ((v x) [ σ ]Tm)
coh Γ A full γ [ σ ]Tm = coh Γ A full (γ ∘ₛ σ)
<> ∘ₛ γ = <>
< γ , x ↦ t > ∘ₛ δ = < γ ∘ₛ δ , x ↦ t [ δ ]Tm >
GPre-Ty→Ty : GSeTT.Syntax.Pre-Ty → Ty
GPre-Ty→Ty GSeTT.Syntax.∗ = ∗
GPre-Ty→Ty (GSeTT.Syntax.⇒ A (GSeTT.Syntax.Var x) (GSeTT.Syntax.Var y)) = ⇒ (GPre-Ty→Ty A) (v x) (v y)
Ty→Pre-Ty[] : ∀ {A γ} → ((GPre-Ty A) [ Sub→Pre-Sub γ ]Pre-Ty) == Ty→Pre-Ty ((GPre-Ty→Ty A) [ γ ]Ty)
Tm→Pre-Tm[] : ∀ {x γ} → ((Var x) [ Sub→Pre-Sub γ ]Pre-Tm) == Tm→Pre-Tm ((v x) [ γ ]Tm)
Ty→Pre-Ty[] {GSeTT.Syntax.∗} {γ} = idp
Ty→Pre-Ty[] {GSeTT.Syntax.⇒ A (GSeTT.Syntax.Var x) (GSeTT.Syntax.Var y)} {γ} = ap³ ⇒ Ty→Pre-Ty[] (Tm→Pre-Tm[] {x} {γ}) (Tm→Pre-Tm[] {y} {γ})
Tm→Pre-Tm[] {x} {<>} = idp
Tm→Pre-Tm[] {x} {< γ , y ↦ t >} with eqdecℕ x y
... | inl idp = idp
... | inr _ = Tm→Pre-Tm[] {x} {γ}
dim-Pre-Ty[] : ∀ {A γ} → dim (Ty→Pre-Ty ((GPre-Ty→Ty A) [ γ ]Ty)) == dim (GPre-Ty A)
dim-Pre-Ty[] {GSeTT.Syntax.∗} {γ} = idp
dim-Pre-Ty[] {GSeTT.Syntax.⇒ A (GSeTT.Syntax.Var _) (GSeTT.Syntax.Var _)} {γ} = ap S dim-Pre-Ty[]
rule : J → GSeTT.Typed-Syntax.Ctx × Pre-Ty
rule ((Γ , A) , _) = (fst Γ , Γ⊢ps→Γ⊢ (snd Γ)) , Ty→Pre-Ty A
open GSeTT.Typed-Syntax
open import Sets ℕ eqdecℕ
open import Globular-TT.Rules J rule
open import Globular-TT.CwF-Structure J rule
eqdecJ : eqdec J
eqdecJ ((Γ , A) , Afull) ((Γ' , A') , A'full) with eqdec-ps Γ Γ' | CaTT.Fullness.eqdec-Ty A A'
... | inl idp | inl idp = inl (ap (λ X → ((Γ , A) , X)) (is-prop-has-all-paths (is-prop-full Γ A) Afull A'full))
... | inr Γ≠Γ' | _ = inr λ{idp → Γ≠Γ' idp}
... | inl idp | inr A≠A' = inr λ{A=A' → A≠A' (snd (=, (fst-is-inj A=A')))}
open import Globular-TT.Uniqueness-Derivations J rule eqdecJ
open import Globular-TT.Disks J rule eqdecJ
dim-tm : ∀ {Γ x A} → Γ ⊢t Var x # A → ℕ
dim-tm {Γ} {x} {A} _ = dim A
GdimT : ∀ {A} → GSeTT.Syntax.dim A == dim (GPre-Ty A)
GdimT {GSeTT.Syntax.∗} = idp
GdimT {GSeTT.Syntax.⇒ A _ _} = ap S GdimT
GdimC : ∀ {Γ} → GSeTT.Syntax.dimC Γ == dimC (GPre-Ctx Γ)
GdimC {nil} = idp
GdimC {Γ :: (x , A)} = ap² max (GdimC {Γ}) GdimT
G#∈ : ∀ {Γ x A} → x GSeTT.Syntax.# A ∈ Γ → x # (GPre-Ty A) ∈ (GPre-Ctx Γ)
G#∈ {Γ :: a} (inl x∈Γ) = inl (G#∈ x∈Γ)
G#∈ {Γ :: a} (inr (idp , idp)) = inr (idp , idp)
G∈ : ∀ {Γ x} → x GSeTT.Syntax.∈ Γ → x ∈-set (varC Γ)
G∈ {Γ :: (a , _)} (inl x∈Γ) = ∈-∪₁ {A = varC Γ} {B = singleton a} (G∈ x∈Γ)
G∈ {Γ :: (x , _)} (inr idp) = ∈-∪₂ {A = varC Γ} {B = singleton x} (∈-singleton x)
private
every-term-has-variables : ∀ {Γ t A} → Γ ⊢t (Tm→Pre-Tm t) # A → Σ ℕ λ x → x ∈-set vart t
every-term-has-variables {Γ} {v x} {A} Γ⊢t = x , ∈-singleton x
every-term-has-variables {Γ} {coh (nil , (ps Δ⊢ps)) _ _ γ} {A} (tm _ Γ⊢γ idp) = ⊥-elim (∅-is-not-ps _ _ Δ⊢ps)
every-term-has-variables {Γ} {coh ((_ :: _) , Δ⊢ps) _ _ <>} {A} (tm _ () idp)
every-term-has-variables {Γ} {coh ((_ :: _) , Δ⊢ps) _ _ < γ , _ ↦ u >} {A} (tm _ (sc _ _ Γ⊢u _) idp) with every-term-has-variables Γ⊢u
... | (x , x∈) = x , ∈-∪₂ {A = varS γ} {B = vart u} x∈
side-cond₁-not𝔻0 : ∀ Γ Γ⊢ps A t → (GPre-Ctx Γ) ⊢t (Tm→Pre-Tm t) # (Ty→Pre-Ty A) → ((varT A) ∪-set (vart t)) ⊂ (src-var (Γ , Γ⊢ps)) → Γ ≠ (nil :: (0 , GSeTT.Syntax.∗))
side-cond₁-not𝔻0 .(nil :: (0 , GSeTT.Syntax.∗)) (ps pss) A t Γ⊢t incl idp with every-term-has-variables Γ⊢t | dec-≤ 0 0
... | x , x∈A | inl _ = incl _ (∈-∪₂ {A = varT A} {B = vart t} x∈A)
... | x , x∈A | inr _ = incl _ (∈-∪₂ {A = varT A} {B = vart t} x∈A)
side-cond₁-not𝔻0 .(nil :: (0 , GSeTT.Syntax.∗)) (ps (psd Γ⊢psf)) A t Γ⊢t incl idp = ⇒≠∗ (𝔻0-type _ _ (psvar Γ⊢psf))
max-srcᵢ-var-def : ∀ {Γ x A i} → (Γ⊢psx : Γ ⊢ps x # A) → 0 < i → ℕ × Pre-Ty
max-srcᵢ-var-def pss _ = 0 , ∗
max-srcᵢ-var-def (psd Γ⊢psx) 0<i = max-srcᵢ-var-def Γ⊢psx 0<i
max-srcᵢ-var-def {_} {x} {A} {i} (pse Γ⊢psx idp idp idp idp idp) 0<i with dec-≤ i (GSeTT.Syntax.dim A)
... | inl i≤dA = max-srcᵢ-var-def Γ⊢psx 0<i
... | inr dA<i with dec-≤ (GSeTT.Syntax.dim A) (dim (snd (max-srcᵢ-var-def Γ⊢psx 0<i)))
... | inl _ = max-srcᵢ-var-def Γ⊢psx 0<i
... | inr _ = x , GPre-Ty A
max-srcᵢ-var-∈ : ∀ {Γ x A i} → (Γ⊢psx : Γ ⊢ps x # A) → (0<i : 0 < i) → fst (max-srcᵢ-var-def Γ⊢psx 0<i) ∈-list (srcᵢ-var i Γ⊢psx)
max-srcᵢ-var-∈ pss 0<i = transport {B = 0 ∈-list_} (simplify-if 0<i ^) (inr idp)
max-srcᵢ-var-∈ (psd Γ⊢psx) 0<i = max-srcᵢ-var-∈ Γ⊢psx 0<i
max-srcᵢ-var-∈ {Γ} {x} {A} {i} (pse Γ⊢psx idp idp idp idp idp) 0<i with dec-≤ i (GSeTT.Syntax.dim A)
... | inl _ = max-srcᵢ-var-∈ Γ⊢psx 0<i
... | inr _ with dec-≤ (GSeTT.Syntax.dim A) (dim (snd (max-srcᵢ-var-def Γ⊢psx 0<i)))
... | inl _ = inl (inl (max-srcᵢ-var-∈ Γ⊢psx 0<i))
... | inr _ = inr idp
max-srcᵢ-var-⊢ : ∀ {Γ x A i} → (Γ⊢psx : Γ ⊢ps x # A) → (0<i : 0 < i) → GPre-Ctx Γ ⊢t Var (fst (max-srcᵢ-var-def Γ⊢psx 0<i)) # snd (max-srcᵢ-var-def Γ⊢psx 0<i)
max-srcᵢ-var-⊢ pss 0<i = var (cc ec (ob ec) idp) (inr (idp , idp))
max-srcᵢ-var-⊢ (psd Γ⊢psx) 0<i = max-srcᵢ-var-⊢ Γ⊢psx 0<i
max-srcᵢ-var-⊢ {Γ} {x} {A} {i} Γ+⊢ps@(pse Γ⊢psx idp idp idp idp idp) 0<i with dec-≤ i (GSeTT.Syntax.dim A)
... | inl _ = wkt (wkt (max-srcᵢ-var-⊢ Γ⊢psx 0<i) ((GCtx _ (GSeTT.Rules.Γ,x:A⊢→Γ⊢ (psv Γ+⊢ps))))) (GCtx _ (psv Γ+⊢ps))
... | inr _ with dec-≤ (GSeTT.Syntax.dim A) (dim (snd (max-srcᵢ-var-def Γ⊢psx 0<i)))
... | inl _ = wkt (wkt (max-srcᵢ-var-⊢ Γ⊢psx 0<i) ((GCtx _ (GSeTT.Rules.Γ,x:A⊢→Γ⊢ (psv Γ+⊢ps))))) (GCtx _ (psv Γ+⊢ps))
... | inr _ = var (GCtx _ (psv Γ+⊢ps)) (inr (idp , idp))
max-srcᵢ-var-dim : ∀ {Γ x A i} → (Γ⊢psx : Γ ⊢ps x # A) → (0<i : 0 < i) → min i (S (dimC (GPre-Ctx Γ))) == S (dim (snd (max-srcᵢ-var-def Γ⊢psx 0<i)))
max-srcᵢ-var-dim pss 0<i = simplify-min-r 0<i
max-srcᵢ-var-dim (psd Γ⊢psx) 0<i = max-srcᵢ-var-dim Γ⊢psx 0<i
max-srcᵢ-var-dim {Γ} {x} {A} {i} (pse {Γ = Δ} Γ⊢psx idp idp idp idp idp) 0<i with dec-≤ i (GSeTT.Syntax.dim A)
... | inl i≤dA = simplify-min-l (n≤m→n≤Sm (≤T (≤-= i≤dA (GdimT {A})) (m≤max (max (dimC (GPre-Ctx Δ)) _) (dim (GPre-Ty A))) )) >> (simplify-min-l (≤T i≤dA (≤-= (S≤ (dim-dangling Γ⊢psx)) (ap S (GdimC {Δ})))) ^) >> max-srcᵢ-var-dim Γ⊢psx 0<i
max-srcᵢ-var-dim {Γ} {x} {A} {i} (pse {Γ = Δ} Γ⊢psx idp idp idp idp idp) 0<i | inr dA<i with dec-≤ (GSeTT.Syntax.dim A) (dim (snd (max-srcᵢ-var-def Γ⊢psx 0<i)))
... | inl dA≤m = let dA<dΔ = (S≤S (≤T (=-≤-= (ap S (GdimT {A} ^)) (S≤ dA≤m) (max-srcᵢ-var-dim Γ⊢psx 0<i ^)) (min≤m i (S (dimC (GPre-Ctx Δ)))))) in
ap (min i)
(ap S (simplify-max-l {max (dimC (GPre-Ctx Δ)) _} {dim (GPre-Ty A)} (≤T dA<dΔ (n≤max _ _))
>> simplify-max-l {dimC (GPre-Ctx Δ)} {_} (Sn≤m→n≤m dA<dΔ)))
>> max-srcᵢ-var-dim Γ⊢psx 0<i
... | inr m<dA = simplify-min-r {i} {S (max (max (dimC (GPre-Ctx Δ)) _) (dim (GPre-Ty A)))}
(up-maxS {max (dimC (GPre-Ctx Δ)) _} {dim (GPre-Ty A)}
(up-maxS {dimC (GPre-Ctx Δ)} {_}
(min<l (=-≤ (ap S (max-srcᵢ-var-dim Γ⊢psx 0<i)) (≤T (S≤ (≰ m<dA)) (≰ dA<i))))
(=-≤ (GdimT {A} ^) (≤T (n≤Sn _) (≰ dA<i))))
(=-≤ (ap S (GdimT {A}) ^) (≰ dA<i)))
>> ap S (simplify-max-r {max (dimC (GPre-Ctx Δ)) _} {dim (GPre-Ty A)}
(up-max {dimC (GPre-Ctx Δ)} {_} (≤-= (Sn≤m→n≤m (greater-than-min-r (≰ dA<i) (=-≤ (max-srcᵢ-var-dim Γ⊢psx 0<i) (≰ m<dA)))) (ap S GdimT)) (n≤Sn _)))
max-srcᵢ-var : ∀ {Γ x A i} → (Γ⊢psx : Γ ⊢ps x # A) → 0 < i → Σ (Σ (ℕ × Pre-Ty) (λ {(x , B) → GPre-Ctx Γ ⊢t Var x # B})) (λ {((x , B) , Γ⊢x) → (x ∈-list (srcᵢ-var i Γ⊢psx)) × (min i (S (dimC (GPre-Ctx Γ))) == S (dim-tm Γ⊢x))})
max-srcᵢ-var Γ⊢psx 0<i = (max-srcᵢ-var-def Γ⊢psx 0<i , max-srcᵢ-var-⊢ Γ⊢psx 0<i) , (max-srcᵢ-var-∈ Γ⊢psx 0<i , max-srcᵢ-var-dim Γ⊢psx 0<i)
max-src-var : ∀ Γ → (Γ⊢ps : Γ ⊢ps) → (Γ ≠ (nil :: (0 , GSeTT.Syntax.∗))) → Σ (Σ (ℕ × Pre-Ty) (λ {(x , B) → GPre-Ctx Γ ⊢t Var x # B})) (λ {((x , B) , Γ⊢x) → (x ∈-set (src-var (Γ , Γ⊢ps))) × (dimC (GPre-Ctx Γ) == S (dim-tm Γ⊢x))})
max-src-var Γ Γ⊢ps@(ps Γ⊢psx) Γ≠𝔻0 with max-srcᵢ-var {i = GSeTT.Syntax.dimC Γ} Γ⊢psx (dim-ps-not-𝔻0 Γ⊢ps Γ≠𝔻0)
... | ((x , B) , (x∈ , p)) = (x , B) , (∈-list-∈-set _ _ x∈ , (ap (λ n → min n (S (dimC (GPre-Ctx Γ)))) (GdimC {Γ}) >> simplify-min-l (n≤Sn _) ^ >> p) )
full-term-have-max-variables : ∀ {Γ A Γ⊢ps} → GPre-Ctx Γ ⊢T (Ty→Pre-Ty A) → A is-full-in ((Γ , Γ⊢ps)) →
Σ (Σ (ℕ × Pre-Ty) (λ {(x , B) → GPre-Ctx Γ ⊢t Var x # B})) (λ {((x , B) , Γ⊢x) → (x ∈-set varT A) × (dimC (GPre-Ctx Γ) ≤ S (dim-tm Γ⊢x))})
full-term-have-max-variables {Γ} {_} {Γ⊢ps} Γ⊢A (side-cond₁ .(_ , _) A t u (incl , incl₂) _) with max-src-var Γ Γ⊢ps (side-cond₁-not𝔻0 _ Γ⊢ps A t (Γ⊢src Γ⊢A) incl₂)
... | ((x , B) , Γ⊢x) , (x∈src , dimΓ=Sdimx) = ((x , B) , Γ⊢x) , (A∪B⊂A∪B∪C (varT A) (vart t) (vart u) _ (incl _ x∈src) , transport {B = λ x → (dimC (GPre-Ctx Γ)) ≤ x} dimΓ=Sdimx (n≤n _))
full-term-have-max-variables {Γ} {_} {Γ⊢ps@(ps Γ⊢psx)} _ (side-cond₂ .(_ , _) _ (incl , _)) with max-var {Γ} Γ⊢ps
... | (x , B) , (x∈Γ , dimx) = ((x , (GPre-Ty B)) , var (GCtx Γ (psv Γ⊢psx)) (G#∈ x∈Γ)) , (incl _ (G∈ (x#A∈Γ→x∈Γ x∈Γ)) , ≤-= (=-≤ ((GdimC {Γ} ^) >> dimx) (n≤Sn _)) (ap S GdimT))
dim-∈-var : ∀ {Γ A x B} → Γ ⊢t Var x # B → Γ ⊢T (Ty→Pre-Ty A) → x ∈-set varT A → dim B < dim (Ty→Pre-Ty A)
dim-∈-var-t : ∀ {Γ t A x B} → Γ ⊢t Var x # B → Γ ⊢t (Tm→Pre-Tm t) # (Ty→Pre-Ty A) → x ∈-set vart t → dim B ≤ dim (Ty→Pre-Ty A)
dim-∈-var-S : ∀ {Δ γ Γ x B} → Δ ⊢t Var x # B → Δ ⊢S (Sub→Pre-Sub γ) > (GPre-Ctx Γ) → x ∈-set varS γ → dim B ≤ dimC (GPre-Ctx Γ)
dim-full-ty : ∀ {Γ A} → (Γ⊢ps : Γ ⊢ps) → (GPre-Ctx Γ) ⊢T (Ty→Pre-Ty A) → A is-full-in (Γ , Γ⊢ps) → dimC (GPre-Ctx Γ) ≤ dim (Ty→Pre-Ty A)
dim-∈-var {Γ} {A⇒@(⇒ A t u)} {x} {B} Γ⊢x (ar Γ⊢A Γ⊢t Γ⊢u) x∈A⇒ with ∈-∪ {varT A} {vart t ∪-set vart u} x∈A⇒
... | inl x∈A = n≤m→n≤Sm (dim-∈-var Γ⊢x Γ⊢A x∈A)
... | inr x∈t∪u with ∈-∪ {vart t} {vart u} x∈t∪u
... | inl x∈t = S≤ (dim-∈-var-t Γ⊢x Γ⊢t x∈t)
... | inr x∈u = S≤ (dim-∈-var-t Γ⊢x Γ⊢u x∈u)
dim-∈-var-t {t = v x} Γ⊢x Γ⊢t (inr idp) with unique-type Γ⊢x Γ⊢t (ap Var idp)
... | idp = n≤n _
dim-∈-var-t {t = coh Γ A Afull γ} Γ⊢x (tm Γ⊢A Δ⊢γ:Γ p) x∈t = ≤-= (≤T (dim-∈-var-S Γ⊢x Δ⊢γ:Γ x∈t) (dim-full-ty (snd Γ) Γ⊢A Afull) ) ((dim[] _ _ ^) >> ap dim (p ^))
dim-∈-var-S {Δ} {< γ , y ↦ t >} {Γ :: (_ , A)} {x} {B} Δ⊢x (sc Δ⊢γ:Γ Γ+⊢ Δ⊢t idp) x∈γ+ with ∈-∪ {varS γ} {vart t} x∈γ+
... | inl x∈γ = ≤T (dim-∈-var-S Δ⊢x Δ⊢γ:Γ x∈γ) (n≤max _ _)
... | inr x∈t = ≤T (dim-∈-var-t Δ⊢x (transport {B = Δ ⊢t (Tm→Pre-Tm t) #_} Ty→Pre-Ty[] Δ⊢t) x∈t) (=-≤ (dim-Pre-Ty[]) (m≤max (dimC (GPre-Ctx Γ)) (dim (GPre-Ty A))))
dim-full-ty Γ⊢ps Γ⊢A Afull with full-term-have-max-variables Γ⊢A Afull
... | ((x , B) , Γ⊢x) , (x∈A , dimx) = ≤T dimx (dim-∈-var Γ⊢x Γ⊢A x∈A)
well-foundedness : well-founded
well-foundedness ((Γ , A) , Afull) Γ⊢A with full-term-have-max-variables Γ⊢A Afull
... |((x , B) , Γ⊢x) , (x∈Γ , dimΓ≤Sdimx) = ≤T dimΓ≤Sdimx (dim-∈-var Γ⊢x Γ⊢A x∈Γ)
open import Globular-TT.Dec-Type-Checking J rule well-foundedness eqdecJ
|
tools/SPARK2005/preprocessor/src/unit_processing.adb | michalkonecny/polypaver | 1 | 26482 | <filename>tools/SPARK2005/preprocessor/src/unit_processing.adb<gh_stars>1-10
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Strings;
with Ada.Strings.Maps;
with Ada.Strings.Fixed;
with Ada.Wide_Text_IO; use Ada.Wide_Text_IO;
with Ada.Calendar;
with Ada.Calendar.Formatting;
with Ada.IO_Exceptions;
with Asis.Compilation_Units;
with Asis.Elements;
with Asis.Text;
with Asis.Extensions.Iterator;
with FP_Translation; use FP_Translation;
package body Unit_Processing is
procedure Recursive_Construct_Processing is new
Asis.Extensions.Iterator.Traverse_Unit
(State_Information => FP_Translation.Traversal_State,
Pre_Operation => FP_Translation.Pre_Op,
Post_Operation => FP_Translation.Post_Op);
------------------
-- Process_Unit --
------------------
procedure Process_Unit
(The_Unit : Asis.Compilation_Unit;
Trace : Boolean := False;
Output_Path : String)
is
Example_Element : Asis.Element := Asis.Elements.Unit_Declaration (The_Unit);
-- The top-level ctructural element of the library item or subunit
-- contained in The_Unit. Only needed as an example element from the
-- compilation unit so that we can obtain the span of the unit.
Unit_Span : Asis.Text.Span := Asis.Text.Compilation_Span(Example_Element);
-- Span is used to indicate a portion of the program text. Here we need
-- to span the whole text of the unit as that is the full scope of the translation.
Unit_Text_Name : String := To_String(Asis.Compilation_Units.Text_Name(The_Unit));
-- We assume that the text name is the full path of the .adb file
-- in which the unit is stored.
Last_Segment_Ix : Integer :=
Ada.Strings.Fixed.Index
(Source => Unit_Text_Name,
Set => Ada.Strings.Maps.To_Set("\\\\/"),
Going => Ada.Strings.Backward);
Output_File_Name : String :=
Output_Path &
Unit_Text_Name(Last_Segment_Ix..Unit_Text_Name'Last);
Process_Control : Asis.Traverse_Control := Asis.Continue;
Process_State : Traversal_State;
-- initialised later because it contains a file handle
begin
if Trace then
Put("Source text name: ");
Put(To_Wide_String(Unit_Text_Name));
New_Line;
end if;
-- Initialise the transversal state variable,
-- and open the appropriate output file:
Process_State.Span := Unit_Span;
Process_State.Trace := Trace;
declare
begin
Open(Process_State.Output_File, Out_File, Output_File_Name);
exception
when Ada.IO_Exceptions.Name_Error =>
Create(Process_State.Output_File, Out_File, Output_File_Name);
end;
if Trace then
Put("Target file name: ");
Put(To_Wide_String(Output_File_Name));
New_Line;
end if;
-- Write a header to the new file:
Put(Process_State.Output_File,
"-- This file has been modified by pp_fpops for floating-point verification.");
New_Line(Process_State.Output_File);
Put(Process_State.Output_File,
"-- pp_fpops is part of PolyPaver (https://github.com/michalkonecny/polypaver).");
New_Line(Process_State.Output_File);
Put(Process_State.Output_File,
"-- Generated on ");
Put(Process_State.Output_File,
To_Wide_String(Ada.Calendar.Formatting.Image(Ada.Calendar.Clock)));
Put(Process_State.Output_File,
" from the file:");
New_Line(Process_State.Output_File);
Put(Process_State.Output_File,
"-- ");
Put(Process_State.Output_File,
To_Wide_String(Unit_Text_Name));
New_Line(Process_State.Output_File);
Put(Process_State.Output_File,
"-- pp_fpops converted any floating-point operators to calls in the following packages:");
New_Line(Process_State.Output_File);
Put(Process_State.Output_File,
"with PP_SF_Rounded; with PP_F_Rounded; with PP_LF_Rounded;");
New_Line(Process_State.Output_File);
-- Put(Process_State.Output_File,
-- "--# inherit PP_SF_Rounded, PP_F_Rounded, PP_LF_Rounded;");
-- New_Line(Process_State.Output_File);
-- Recurse through the unit constructs.
-- When coming across an FP operator expression,
-- put all that precedes it and has not been printed yet,
-- and then put a translation of the FP operator expression.
Recursive_Construct_Processing
(Unit => The_Unit,
Control => Process_Control,
State => Process_State);
-- Put the remainder of the unit body.
-- If there are no FP operators in the body,
-- the span is the whole unit body text at the point
-- and the unit remains unchanged.
FP_Translation.Put_Current_Span(Example_Element, Process_State);
-- Close the output file:
Close(Process_State.Output_File);
end Process_Unit;
end Unit_Processing;
|
programs/oeis/038/A038349.asm | neoneye/loda | 22 | 82248 | ; A038349: Partial sums of primes congruent to 1 mod 6.
; 7,20,39,70,107,150,211,278,351,430,527,630,739,866,1005,1156,1313,1476,1657,1850,2049,2260,2483,2712,2953,3224,3501,3784,4091,4404,4735,5072,5421,5788,6161,6540,6937,7346,7767,8200,8639,9096,9559
lpb $0
mov $2,$0
sub $0,1
seq $2,112772 ; Semiprimes of the form 6n+2.
add $1,$2
lpe
div $1,2
add $1,7
mov $0,$1
|
SimpleDialog/dialog.asm | Korkmatik/Assemby | 0 | 90188 | <gh_stars>0
section .data
textNameQuestion db "Hello! What is your name? "
textHello db "Hello, "
textAgeQuestion db "How old are you? "
textAgeStart db "So you are "
textAgeEnd db " years old."
section .bss
name resb 20
age resb 4
section .text
global _start
_start:
call _askName
call _printHello
call _askAge
call _printAge
mov rax, 60
mov rdi, 0
syscall
_askName:
; print the question
mov rax, 1
mov rdi, 1
mov rsi, textNameQuestion
mov rdx, 26
syscall
; get user input
mov rax, 0
mov rdi, 0
mov rsi, name
mov rdx, 20
syscall
ret
_printHello:
; print first part
mov rax, 1
mov rdi, 1
mov rsi, textHello
mov rdx, 7
syscall
; print name
mov rax, 1
mov rdi, 1
mov rsi, name
mov rdx, 20
syscall
ret
_askAge:
; print question
mov rax, 1
mov rdi, 1
mov rsi, textAgeQuestion
mov rdx, 17
syscall
; get user input
mov rax, 0
mov rdi, 0
mov rsi, age
syscall
ret
_printAge:
; print first part of text
mov rax, 1
mov rdi, 1
mov rsi, textAgeStart
mov rdx, 11
syscall
; print age
mov rax, 1
mov rdi, 1
mov rsi, age
mov rdx, 4
syscall
; print last part of text
mov rax, 1
mov rdi, 1
mov rsi, textAgeEnd
mov rdx, 11
syscall
ret
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_1294.asm | ljhsiun2/medusa | 9 | 27134 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0xe03, %rsi
lea addresses_normal_ht+0x19faf, %rdi
nop
nop
nop
cmp $61614, %r15
mov $31, %rcx
rep movsq
nop
cmp $55107, %r14
lea addresses_UC_ht+0x149e9, %rsi
lea addresses_WC_ht+0x18929, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
xor $1402, %r10
mov $6, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $22061, %rcx
lea addresses_D_ht+0xd249, %rdi
dec %r15
mov (%rdi), %si
nop
nop
add %r10, %r10
lea addresses_UC_ht+0xe6a9, %rdi
nop
nop
nop
cmp $14483, %rcx
mov $0x6162636465666768, %r15
movq %r15, (%rdi)
nop
nop
add $42316, %r15
lea addresses_normal_ht+0x1b169, %r14
clflush (%r14)
nop
and $19444, %r13
mov (%r14), %r10w
nop
nop
nop
nop
sub %r15, %r15
lea addresses_D_ht+0x9ea9, %r10
sub $44891, %r13
movb $0x61, (%r10)
nop
nop
nop
nop
cmp $47209, %r14
lea addresses_WT_ht+0x135f9, %r14
nop
nop
nop
xor $52215, %r15
mov $0x6162636465666768, %rsi
movq %rsi, %xmm3
movups %xmm3, (%r14)
nop
nop
nop
nop
sub %r13, %r13
lea addresses_UC_ht+0x6aa9, %r14
nop
nop
nop
xor %rdi, %rdi
movups (%r14), %xmm0
vpextrq $1, %xmm0, %r13
cmp %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %rax
push %rdi
push %rdx
// Store
mov $0x99d, %r11
nop
nop
nop
nop
nop
and %rdx, %rdx
movl $0x51525354, (%r11)
nop
nop
nop
nop
add %r14, %r14
// Faulty Load
mov $0x4a5c8b0000000ea9, %rax
xor %rdi, %rdi
mov (%rax), %r13w
lea oracles, %r14
and $0xff, %r13
shlq $12, %r13
mov (%r14,%r13,1), %r13
pop %rdx
pop %rdi
pop %rax
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': True, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': True, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/004/A004166.asm | neoneye/loda-programs | 11 | 162696 | ; A004166: Sum of digits of 3^n.
; Submitted by <NAME>(s3.)
; 1,3,9,9,9,9,18,18,18,27,27,27,18,27,45,36,27,27,45,36,45,27,45,54,54,63,63,81,72,72,63,81,63,72,99,81,81,90,90,81,90,99,90,108,90,99,108,126,117,108,144,117,117,135,108,90,90,108,126,117,99,135,153,153,144,135,117,162,153,153,144,180,162,153,171,180,153,162,153,189,153,189,198,198,162,162,171,189,198,189,216,171,171,198,198,180,198,216,225,207
mov $4,$0
mov $0,3
pow $0,$4
lpb $0
mov $2,$0
div $0,10
mod $2,10
add $3,$2
lpe
mov $0,$3
|
src/dnscatcher/dns/dnscatcher-dns.adb | DNSCatcher/DNSCatcher | 4 | 13022 | <filename>src/dnscatcher/dns/dnscatcher-dns.adb
-- Copyright 2019 <NAME> <<EMAIL>>
--
-- 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.
package body DNSCatcher.DNS is
function To_String
(RR_Type : RR_Types)
return String
is
begin
-- This **** is required because 'in' is a keyword and Ada is case
-- insensitive
case RR_Type is
when WILDCARD =>
return "*";
when others =>
return RR_Types'Image (RR_Type);
end case;
end To_String;
function To_String
(DNS_Class : Classes)
return String
is
begin
-- This **** is required because 'in' is a keyword and Ada is case
-- insensitive
case DNS_Class is
when INternet =>
return "IN";
when others =>
return Classes'Image (DNS_Class);
end case;
end To_String;
end DNSCatcher.DNS;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1030.asm | ljhsiun2/medusa | 9 | 240504 | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xd2c0, %rbp
nop
nop
add %r12, %r12
movb $0x61, (%rbp)
nop
nop
sub $24681, %rdx
lea addresses_WC_ht+0x19230, %rsi
lea addresses_WC_ht+0x15db0, %rdi
nop
sub %rbp, %rbp
mov $23, %rcx
rep movsq
xor %rdx, %rdx
lea addresses_WC_ht+0x8b0, %rcx
nop
nop
cmp $8099, %r12
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
movups %xmm5, (%rcx)
add %rsi, %rsi
lea addresses_D_ht+0xc3a0, %rbp
nop
nop
xor $26583, %rsi
movl $0x61626364, (%rbp)
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x1a4b0, %rcx
nop
nop
nop
nop
add %rsi, %rsi
movl $0x61626364, (%rcx)
nop
nop
add $20616, %rdi
lea addresses_WC_ht+0x14fb0, %rsi
lea addresses_WT_ht+0xd370, %rdi
clflush (%rsi)
sub %r15, %r15
mov $0, %rcx
rep movsw
nop
nop
nop
cmp $57726, %rdi
lea addresses_D_ht+0xf0b0, %rbp
nop
nop
nop
add $53625, %rdx
mov (%rbp), %rbx
nop
nop
nop
nop
nop
cmp %r12, %r12
lea addresses_A_ht+0x1e0b0, %r12
nop
nop
and %rbx, %rbx
mov (%r12), %rdi
xor %rsi, %rsi
lea addresses_UC_ht+0x1b38, %rsi
lea addresses_UC_ht+0xa6b0, %rdi
nop
sub %rdx, %rdx
mov $61, %rcx
rep movsw
nop
add %rbp, %rbp
lea addresses_D_ht+0x26b0, %rbx
nop
inc %rdi
movl $0x61626364, (%rbx)
nop
dec %rdx
lea addresses_D_ht+0x11618, %r15
nop
nop
nop
nop
and %rbp, %rbp
movb (%r15), %bl
cmp $29955, %rdi
lea addresses_WT_ht+0x158b0, %rdx
nop
nop
nop
nop
nop
and %r15, %r15
mov $0x6162636465666768, %rbx
movq %rbx, %xmm1
and $0xffffffffffffffc0, %rdx
vmovntdq %ymm1, (%rdx)
nop
nop
nop
nop
and %rdi, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r15
push %rdx
// Faulty Load
lea addresses_RW+0x158b0, %rdx
nop
nop
nop
cmp %r10, %r10
mov (%rdx), %r15d
lea oracles, %r14
and $0xff, %r15
shlq $12, %r15
mov (%r14,%r15,1), %r15
pop %rdx
pop %r15
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_RW', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_RW', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 4}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_WC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 10}}
{'dst': {'same': True, 'congruent': 6, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D_ht', 'congruent': 7}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 2}}
{'dst': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
src/boot/GDT.asm | Psychoticpotato/OScelot | 0 | 179742 | ; GDT
gdt_start:
gdt_null: ;Mandatory null descriptor
dd 0x0 ; 'dd' means define double word (4 bytes)
dd 0x0
gdt_code: ; Code segment descriptor
; base=0x0, limit=0xfffff,
; 1st flags: (present)1 (priviledge) 00 (descriptor type)1 ->1001b
;Type flags: (code)1 (conforming)0 (readable)1 (accessed)0 ->1010b
; 2nd flags: (granularity)1 (32-bit default)1 (64-bit seg)0 (AVL)0 ->1100b
dw 0xffff ; limit (bits 0-15)
dw 0x0 ; Base (bits 0-15)
db 0x0 ; Base (bits 16-23);
db 10011010b ; 1st flags, type flags
db 11001111b ; 2nd flags, limit (bits 16-19)
db 0x0 ; Base (bits 24-31)
gdt_data: ; the data segment descriptor
; Same as code segment except for the type flags:
; Type Flags: (code)0 (expand_down)0 (writable)1 (accessed)0 -> 0010b
dw 0xffff ; limit (bits 0-15)
dw 0x0 ; Base (bits 0-15)
db 0x0 ; Base (bits 16-23);
db 10010010b ; 1st flags, type flags
db 11001111b ; 2nd flags, limit (bits 16-19)
db 0x0 ; Base (bits 24-31)
gdt_end: ; The assembler can now calculate the size of the GDT for the descriptor.
; GDT descriptor
gdt_descriptor:
dw gdt_end - gdt_start - 1 ;Size of the GDT, always minus one of the true Size
dd gdt_start ;Start address of the GDT
[GLOBAL idt_flush] ;Allows the C to call idt_flush()
idt_flush:
mov eax, [esp+4] ;Get pointer to the IDT as a parameter.
lidt [eax] ;Load the IDT pointer
ret
;Define handy constants for the GDT segment descriptor offsets.
;THese are what segment registers must contain when in protected mode.
;Example: when we set DS = 0x10 in PM, the cpu knows that we mean to use
;the segment described at offset 0x10 (16 bytes) in our GDT, which in
;our case is the DATA segment (0x0 0> NULL; 0x08 -> CODE; 0x10 -> DATA
CODE_SEG equ gdt_code - gdt_start
DATA_SEG equ gdt_data - gdt_start
|
src/Prelude/Variables.agda | jespercockx/agda-prelude | 0 | 11398 |
module Prelude.Variables where
open import Agda.Primitive
open import Agda.Builtin.Nat
variable
ℓ ℓ₁ ℓ₂ ℓ₃ : Level
A B : Set ℓ
x y : A
n m : Nat
|
src/latin_utils/latin_utils-general.adb | spr93/whitakers-words | 204 | 15530 | -- WORDS, a Latin dictionary, by <NAME> (USAF, Retired)
--
-- Copyright <NAME> (1936–2010)
--
-- This is a free program, which means it is proper to copy it and pass
-- it on to your friends. Consider it a developmental item for which
-- there is no charge. However, just for form, it is Copyrighted
-- (c). Permission is hereby freely given for any and all use of program
-- and data. You can sell it as your own, but at least tell me.
--
-- This version is distributed without obligation, but the developer
-- would appreciate comments and suggestions.
--
-- All parts of the WORDS system, source code and data files, are made freely
-- available to anyone who wishes to use them, for whatever purpose.
with Ada.Text_IO;
with Latin_Utils.Strings_Package;
package body Latin_Utils.General is
---------------------------------------------------------------------------
procedure Load_Dictionary
(Line : in out String;
Last : in out Integer;
D_K : out Latin_Utils.Dictionary_Package.Dictionary_Kind
)
is
use Latin_Utils.Strings_Package;
begin
Ada.Text_IO.Put
("What dictionary to use, GENERAL or SPECIAL (Reply G or S) =>");
Ada.Text_IO.Get_Line (Line, Last);
if Last > 0 then
if Trim (Line (Line'First .. Last))(1) = 'G' or else
Trim (Line (Line'First .. Last))(1) = 'g'
then
D_K := Latin_Utils.Dictionary_Package.General;
elsif Trim (Line (Line'First .. Last))(1) = 'S' or else
Trim (Line (Line'First .. Last))(1) = 's'
then
D_K := Latin_Utils.Dictionary_Package.Special;
else
Ada.Text_IO.Put_Line ("No such dictionary");
raise Ada.Text_IO.Data_Error;
end if;
end if;
end Load_Dictionary;
---------------------------------------------------------------------------
end Latin_Utils.General;
|
.build/ada/asis-gela-elements-stmt.ads | faelys/gela-asis | 4 | 23904 |
------------------------------------------------------------------------------
-- Copyright (c) 2006-2013, <NAME>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of the Maxim Reznik, IE nor the names of its
-- contributors may be used to endorse or promote products derived from
-- this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
package Asis.Gela.Elements.Stmt is
------------------------------
-- Base_Path_Statement_Node --
------------------------------
type Base_Path_Statement_Node is abstract
new Statement_Node with private;
type Base_Path_Statement_Ptr is
access all Base_Path_Statement_Node;
for Base_Path_Statement_Ptr'Storage_Pool use Lists.Pool;
function Statement_Paths
(Element : Base_Path_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Statement_Paths
(Element : in out Base_Path_Statement_Node;
Value : in Asis.Element);
function Statement_Paths_List
(Element : Base_Path_Statement_Node) return Asis.Element;
function Children (Element : access Base_Path_Statement_Node)
return Traverse_List;
-----------------------
-- If_Statement_Node --
-----------------------
type If_Statement_Node is
new Base_Path_Statement_Node with private;
type If_Statement_Ptr is
access all If_Statement_Node;
for If_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_If_Statement_Node
(The_Context : ASIS.Context)
return If_Statement_Ptr;
function Statement_Kind (Element : If_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : If_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access If_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Case_Statement_Node --
-------------------------
type Case_Statement_Node is
new Base_Path_Statement_Node with private;
type Case_Statement_Ptr is
access all Case_Statement_Node;
for Case_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Case_Statement_Node
(The_Context : ASIS.Context)
return Case_Statement_Ptr;
function Case_Expression
(Element : Case_Statement_Node) return Asis.Expression;
procedure Set_Case_Expression
(Element : in out Case_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Case_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Case_Statement_Node)
return Traverse_List;
function Clone
(Element : Case_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Case_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------------
-- Selective_Accept_Statement_Node --
-------------------------------------
type Selective_Accept_Statement_Node is
new Base_Path_Statement_Node with private;
type Selective_Accept_Statement_Ptr is
access all Selective_Accept_Statement_Node;
for Selective_Accept_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Selective_Accept_Statement_Node
(The_Context : ASIS.Context)
return Selective_Accept_Statement_Ptr;
function Statement_Kind (Element : Selective_Accept_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Selective_Accept_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Selective_Accept_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------------
-- Timed_Entry_Call_Statement_Node --
-------------------------------------
type Timed_Entry_Call_Statement_Node is
new Base_Path_Statement_Node with private;
type Timed_Entry_Call_Statement_Ptr is
access all Timed_Entry_Call_Statement_Node;
for Timed_Entry_Call_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Timed_Entry_Call_Statement_Node
(The_Context : ASIS.Context)
return Timed_Entry_Call_Statement_Ptr;
function Statement_Kind (Element : Timed_Entry_Call_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Timed_Entry_Call_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Timed_Entry_Call_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------------------
-- Conditional_Entry_Call_Statement_Node --
-------------------------------------------
type Conditional_Entry_Call_Statement_Node is
new Base_Path_Statement_Node with private;
type Conditional_Entry_Call_Statement_Ptr is
access all Conditional_Entry_Call_Statement_Node;
for Conditional_Entry_Call_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Conditional_Entry_Call_Statement_Node
(The_Context : ASIS.Context)
return Conditional_Entry_Call_Statement_Ptr;
function Statement_Kind (Element : Conditional_Entry_Call_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Conditional_Entry_Call_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Conditional_Entry_Call_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
----------------------------------------
-- Asynchronous_Select_Statement_Node --
----------------------------------------
type Asynchronous_Select_Statement_Node is
new Base_Path_Statement_Node with private;
type Asynchronous_Select_Statement_Ptr is
access all Asynchronous_Select_Statement_Node;
for Asynchronous_Select_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Asynchronous_Select_Statement_Node
(The_Context : ASIS.Context)
return Asynchronous_Select_Statement_Ptr;
function Statement_Kind (Element : Asynchronous_Select_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Asynchronous_Select_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Asynchronous_Select_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Null_Statement_Node --
-------------------------
type Null_Statement_Node is
new Statement_Node with private;
type Null_Statement_Ptr is
access all Null_Statement_Node;
for Null_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Null_Statement_Node
(The_Context : ASIS.Context)
return Null_Statement_Ptr;
function Statement_Kind (Element : Null_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Null_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Null_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------
-- Assignment_Statement_Node --
-------------------------------
type Assignment_Statement_Node is
new Statement_Node with private;
type Assignment_Statement_Ptr is
access all Assignment_Statement_Node;
for Assignment_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Assignment_Statement_Node
(The_Context : ASIS.Context)
return Assignment_Statement_Ptr;
function Assignment_Variable_Name
(Element : Assignment_Statement_Node) return Asis.Expression;
procedure Set_Assignment_Variable_Name
(Element : in out Assignment_Statement_Node;
Value : in Asis.Expression);
function Assignment_Expression
(Element : Assignment_Statement_Node) return Asis.Expression;
procedure Set_Assignment_Expression
(Element : in out Assignment_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Assignment_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Assignment_Statement_Node)
return Traverse_List;
function Clone
(Element : Assignment_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Assignment_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Loop_Statement_Node --
-------------------------
type Loop_Statement_Node is
new Statement_Node with private;
type Loop_Statement_Ptr is
access all Loop_Statement_Node;
for Loop_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Loop_Statement_Node
(The_Context : ASIS.Context)
return Loop_Statement_Ptr;
function Statement_Identifier
(Element : Loop_Statement_Node) return Asis.Defining_Name;
procedure Set_Statement_Identifier
(Element : in out Loop_Statement_Node;
Value : in Asis.Defining_Name);
function Back_Identifier
(Element : Loop_Statement_Node) return Asis.Identifier;
procedure Set_Back_Identifier
(Element : in out Loop_Statement_Node;
Value : in Asis.Identifier);
function Is_Name_Repeated
(Element : Loop_Statement_Node) return Boolean;
procedure Set_Is_Name_Repeated
(Element : in out Loop_Statement_Node;
Value : in Boolean);
function Loop_Statements
(Element : Loop_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Loop_Statements
(Element : in out Loop_Statement_Node;
Value : in Asis.Element);
function Loop_Statements_List
(Element : Loop_Statement_Node) return Asis.Element;
function Statement_Kind (Element : Loop_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Loop_Statement_Node)
return Traverse_List;
function Clone
(Element : Loop_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Loop_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------
-- While_Loop_Statement_Node --
-------------------------------
type While_Loop_Statement_Node is
new Loop_Statement_Node with private;
type While_Loop_Statement_Ptr is
access all While_Loop_Statement_Node;
for While_Loop_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_While_Loop_Statement_Node
(The_Context : ASIS.Context)
return While_Loop_Statement_Ptr;
function While_Condition
(Element : While_Loop_Statement_Node) return Asis.Expression;
procedure Set_While_Condition
(Element : in out While_Loop_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : While_Loop_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access While_Loop_Statement_Node)
return Traverse_List;
function Clone
(Element : While_Loop_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access While_Loop_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-----------------------------
-- For_Loop_Statement_Node --
-----------------------------
type For_Loop_Statement_Node is
new Loop_Statement_Node with private;
type For_Loop_Statement_Ptr is
access all For_Loop_Statement_Node;
for For_Loop_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_For_Loop_Statement_Node
(The_Context : ASIS.Context)
return For_Loop_Statement_Ptr;
function Loop_Parameter_Specification
(Element : For_Loop_Statement_Node) return Asis.Declaration;
procedure Set_Loop_Parameter_Specification
(Element : in out For_Loop_Statement_Node;
Value : in Asis.Declaration);
function Statement_Kind (Element : For_Loop_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access For_Loop_Statement_Node)
return Traverse_List;
function Clone
(Element : For_Loop_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access For_Loop_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
--------------------------
-- Block_Statement_Node --
--------------------------
type Block_Statement_Node is
new Statement_Node with private;
type Block_Statement_Ptr is
access all Block_Statement_Node;
for Block_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Block_Statement_Node
(The_Context : ASIS.Context)
return Block_Statement_Ptr;
function Is_Name_Repeated
(Element : Block_Statement_Node) return Boolean;
procedure Set_Is_Name_Repeated
(Element : in out Block_Statement_Node;
Value : in Boolean);
function Is_Declare_Block
(Element : Block_Statement_Node) return Boolean;
procedure Set_Is_Declare_Block
(Element : in out Block_Statement_Node;
Value : in Boolean);
function Block_Declarative_Items
(Element : Block_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Block_Declarative_Items
(Element : in out Block_Statement_Node;
Value : in Asis.Element);
function Block_Declarative_Items_List
(Element : Block_Statement_Node) return Asis.Element;
function Block_Statements
(Element : Block_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Block_Statements
(Element : in out Block_Statement_Node;
Value : in Asis.Element);
function Block_Statements_List
(Element : Block_Statement_Node) return Asis.Element;
function Block_Exception_Handlers
(Element : Block_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Block_Exception_Handlers
(Element : in out Block_Statement_Node;
Value : in Asis.Element);
function Block_Exception_Handlers_List
(Element : Block_Statement_Node) return Asis.Element;
function Statement_Identifier
(Element : Block_Statement_Node) return Asis.Defining_Name;
procedure Set_Statement_Identifier
(Element : in out Block_Statement_Node;
Value : in Asis.Defining_Name);
function Back_Identifier
(Element : Block_Statement_Node) return Asis.Identifier;
procedure Set_Back_Identifier
(Element : in out Block_Statement_Node;
Value : in Asis.Identifier);
function Handled_Statements
(Element : Block_Statement_Node) return Asis.Element;
procedure Set_Handled_Statements
(Element : in out Block_Statement_Node;
Value : in Asis.Element);
function Statement_Kind (Element : Block_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Block_Statement_Node)
return Traverse_List;
function Clone
(Element : Block_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Block_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Exit_Statement_Node --
-------------------------
type Exit_Statement_Node is
new Statement_Node with private;
type Exit_Statement_Ptr is
access all Exit_Statement_Node;
for Exit_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Exit_Statement_Node
(The_Context : ASIS.Context)
return Exit_Statement_Ptr;
function Exit_Loop_Name
(Element : Exit_Statement_Node) return Asis.Expression;
procedure Set_Exit_Loop_Name
(Element : in out Exit_Statement_Node;
Value : in Asis.Expression);
function Corresponding_Loop_Exited
(Element : Exit_Statement_Node) return Asis.Statement;
procedure Set_Corresponding_Loop_Exited
(Element : in out Exit_Statement_Node;
Value : in Asis.Statement);
function Exit_Condition
(Element : Exit_Statement_Node) return Asis.Expression;
procedure Set_Exit_Condition
(Element : in out Exit_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Exit_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Exit_Statement_Node)
return Traverse_List;
function Clone
(Element : Exit_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Exit_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Goto_Statement_Node --
-------------------------
type Goto_Statement_Node is
new Statement_Node with private;
type Goto_Statement_Ptr is
access all Goto_Statement_Node;
for Goto_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Goto_Statement_Node
(The_Context : ASIS.Context)
return Goto_Statement_Ptr;
function Goto_Label
(Element : Goto_Statement_Node) return Asis.Expression;
procedure Set_Goto_Label
(Element : in out Goto_Statement_Node;
Value : in Asis.Expression);
function Corresponding_Destination_Statement
(Element : Goto_Statement_Node) return Asis.Statement;
procedure Set_Corresponding_Destination_Statement
(Element : in out Goto_Statement_Node;
Value : in Asis.Statement);
function Statement_Kind (Element : Goto_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Goto_Statement_Node)
return Traverse_List;
function Clone
(Element : Goto_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Goto_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
------------------------------
-- Base_Call_Statement_Node --
------------------------------
type Base_Call_Statement_Node is abstract
new Statement_Node with private;
type Base_Call_Statement_Ptr is
access all Base_Call_Statement_Node;
for Base_Call_Statement_Ptr'Storage_Pool use Lists.Pool;
function Called_Name
(Element : Base_Call_Statement_Node) return Asis.Expression;
procedure Set_Called_Name
(Element : in out Base_Call_Statement_Node;
Value : in Asis.Expression);
function Corresponding_Called_Entity
(Element : Base_Call_Statement_Node) return Asis.Declaration;
procedure Set_Corresponding_Called_Entity
(Element : in out Base_Call_Statement_Node;
Value : in Asis.Declaration);
function Call_Statement_Parameters
(Element : Base_Call_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Call_Statement_Parameters
(Element : in out Base_Call_Statement_Node;
Value : in Asis.Element);
function Call_Statement_Parameters_List
(Element : Base_Call_Statement_Node) return Asis.Element;
function Normalized_Call_Statement_Parameters
(Element : Base_Call_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Add_To_Normalized_Call_Statement_Parameters
(Element : in out Base_Call_Statement_Node;
Item : in Asis.Element);
function Children (Element : access Base_Call_Statement_Node)
return Traverse_List;
-----------------------------------
-- Procedure_Call_Statement_Node --
-----------------------------------
type Procedure_Call_Statement_Node is
new Base_Call_Statement_Node with private;
type Procedure_Call_Statement_Ptr is
access all Procedure_Call_Statement_Node;
for Procedure_Call_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Procedure_Call_Statement_Node
(The_Context : ASIS.Context)
return Procedure_Call_Statement_Ptr;
function Is_Call_On_Dispatching_Operation
(Element : Procedure_Call_Statement_Node) return Boolean;
procedure Set_Is_Call_On_Dispatching_Operation
(Element : in out Procedure_Call_Statement_Node;
Value : in Boolean);
function Is_Dispatching_Call
(Element : Procedure_Call_Statement_Node) return Boolean;
procedure Set_Is_Dispatching_Call
(Element : in out Procedure_Call_Statement_Node;
Value : in Boolean);
function Statement_Kind (Element : Procedure_Call_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Procedure_Call_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Procedure_Call_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------------
-- Entry_Call_Statement_Node --
-------------------------------
type Entry_Call_Statement_Node is
new Base_Call_Statement_Node with private;
type Entry_Call_Statement_Ptr is
access all Entry_Call_Statement_Node;
for Entry_Call_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Entry_Call_Statement_Node
(The_Context : ASIS.Context)
return Entry_Call_Statement_Ptr;
function Statement_Kind (Element : Entry_Call_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Entry_Call_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Entry_Call_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
----------------------------------
-- Simple_Return_Statement_Node --
----------------------------------
type Simple_Return_Statement_Node is
new Statement_Node with private;
type Simple_Return_Statement_Ptr is
access all Simple_Return_Statement_Node;
for Simple_Return_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Simple_Return_Statement_Node
(The_Context : ASIS.Context)
return Simple_Return_Statement_Ptr;
function Return_Expression
(Element : Simple_Return_Statement_Node) return Asis.Expression;
procedure Set_Return_Expression
(Element : in out Simple_Return_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Simple_Return_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Simple_Return_Statement_Node)
return Traverse_List;
function Clone
(Element : Simple_Return_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Simple_Return_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
------------------------------------
-- Extended_Return_Statement_Node --
------------------------------------
type Extended_Return_Statement_Node is
new Statement_Node with private;
type Extended_Return_Statement_Ptr is
access all Extended_Return_Statement_Node;
for Extended_Return_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Extended_Return_Statement_Node
(The_Context : ASIS.Context)
return Extended_Return_Statement_Ptr;
function Return_Object_Specification
(Element : Extended_Return_Statement_Node) return Asis.Declaration;
procedure Set_Return_Object_Specification
(Element : in out Extended_Return_Statement_Node;
Value : in Asis.Declaration);
function Extended_Return_Statements
(Element : Extended_Return_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Extended_Return_Statements
(Element : in out Extended_Return_Statement_Node;
Value : in Asis.Element);
function Extended_Return_Statements_List
(Element : Extended_Return_Statement_Node) return Asis.Element;
function Extended_Return_Exception_Handlers
(Element : Extended_Return_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Extended_Return_Exception_Handlers
(Element : in out Extended_Return_Statement_Node;
Value : in Asis.Element);
function Extended_Return_Exception_Handlers_List
(Element : Extended_Return_Statement_Node) return Asis.Element;
function Handled_Statements
(Element : Extended_Return_Statement_Node) return Asis.Element;
procedure Set_Handled_Statements
(Element : in out Extended_Return_Statement_Node;
Value : in Asis.Element);
function Statement_Kind (Element : Extended_Return_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Extended_Return_Statement_Node)
return Traverse_List;
function Clone
(Element : Extended_Return_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Extended_Return_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
---------------------------
-- Accept_Statement_Node --
---------------------------
type Accept_Statement_Node is
new Statement_Node with private;
type Accept_Statement_Ptr is
access all Accept_Statement_Node;
for Accept_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Accept_Statement_Node
(The_Context : ASIS.Context)
return Accept_Statement_Ptr;
function Accept_Entry_Index
(Element : Accept_Statement_Node) return Asis.Expression;
procedure Set_Accept_Entry_Index
(Element : in out Accept_Statement_Node;
Value : in Asis.Expression);
function Accept_Entry_Direct_Name
(Element : Accept_Statement_Node) return Asis.Name;
procedure Set_Accept_Entry_Direct_Name
(Element : in out Accept_Statement_Node;
Value : in Asis.Name);
function Accept_Parameters
(Element : Accept_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Accept_Parameters
(Element : in out Accept_Statement_Node;
Value : in Asis.Element);
function Accept_Parameters_List
(Element : Accept_Statement_Node) return Asis.Element;
function Accept_Body_Statements
(Element : Accept_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Accept_Body_Statements
(Element : in out Accept_Statement_Node;
Value : in Asis.Element);
function Accept_Body_Statements_List
(Element : Accept_Statement_Node) return Asis.Element;
function Accept_Body_Exception_Handlers
(Element : Accept_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Accept_Body_Exception_Handlers
(Element : in out Accept_Statement_Node;
Value : in Asis.Element);
function Accept_Body_Exception_Handlers_List
(Element : Accept_Statement_Node) return Asis.Element;
function Corresponding_Entry
(Element : Accept_Statement_Node) return Asis.Declaration;
procedure Set_Corresponding_Entry
(Element : in out Accept_Statement_Node;
Value : in Asis.Declaration);
function Is_Name_Repeated
(Element : Accept_Statement_Node) return Boolean;
procedure Set_Is_Name_Repeated
(Element : in out Accept_Statement_Node;
Value : in Boolean);
function Handled_Statements
(Element : Accept_Statement_Node) return Asis.Element;
procedure Set_Handled_Statements
(Element : in out Accept_Statement_Node;
Value : in Asis.Element);
function Statement_Kind (Element : Accept_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Accept_Statement_Node)
return Traverse_List;
function Clone
(Element : Accept_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Accept_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
----------------------------
-- Requeue_Statement_Node --
----------------------------
type Requeue_Statement_Node is
new Statement_Node with private;
type Requeue_Statement_Ptr is
access all Requeue_Statement_Node;
for Requeue_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Requeue_Statement_Node
(The_Context : ASIS.Context)
return Requeue_Statement_Ptr;
function Requeue_Entry_Name
(Element : Requeue_Statement_Node) return Asis.Name;
procedure Set_Requeue_Entry_Name
(Element : in out Requeue_Statement_Node;
Value : in Asis.Name);
function Statement_Kind (Element : Requeue_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Requeue_Statement_Node)
return Traverse_List;
function Clone
(Element : Requeue_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Requeue_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
---------------------------------------
-- Requeue_Statement_With_Abort_Node --
---------------------------------------
type Requeue_Statement_With_Abort_Node is
new Requeue_Statement_Node with private;
type Requeue_Statement_With_Abort_Ptr is
access all Requeue_Statement_With_Abort_Node;
for Requeue_Statement_With_Abort_Ptr'Storage_Pool use Lists.Pool;
function New_Requeue_Statement_With_Abort_Node
(The_Context : ASIS.Context)
return Requeue_Statement_With_Abort_Ptr;
function Statement_Kind (Element : Requeue_Statement_With_Abort_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Requeue_Statement_With_Abort_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Requeue_Statement_With_Abort_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
--------------------------------
-- Delay_Until_Statement_Node --
--------------------------------
type Delay_Until_Statement_Node is
new Statement_Node with private;
type Delay_Until_Statement_Ptr is
access all Delay_Until_Statement_Node;
for Delay_Until_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Delay_Until_Statement_Node
(The_Context : ASIS.Context)
return Delay_Until_Statement_Ptr;
function Delay_Expression
(Element : Delay_Until_Statement_Node) return Asis.Expression;
procedure Set_Delay_Expression
(Element : in out Delay_Until_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Delay_Until_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Delay_Until_Statement_Node)
return Traverse_List;
function Clone
(Element : Delay_Until_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Delay_Until_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-----------------------------------
-- Delay_Relative_Statement_Node --
-----------------------------------
type Delay_Relative_Statement_Node is
new Delay_Until_Statement_Node with private;
type Delay_Relative_Statement_Ptr is
access all Delay_Relative_Statement_Node;
for Delay_Relative_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Delay_Relative_Statement_Node
(The_Context : ASIS.Context)
return Delay_Relative_Statement_Ptr;
function Statement_Kind (Element : Delay_Relative_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Delay_Relative_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Delay_Relative_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
------------------------------------------
-- Terminate_Alternative_Statement_Node --
------------------------------------------
type Terminate_Alternative_Statement_Node is
new Statement_Node with private;
type Terminate_Alternative_Statement_Ptr is
access all Terminate_Alternative_Statement_Node;
for Terminate_Alternative_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Terminate_Alternative_Statement_Node
(The_Context : ASIS.Context)
return Terminate_Alternative_Statement_Ptr;
function Statement_Kind (Element : Terminate_Alternative_Statement_Node)
return Asis.Statement_Kinds;
function Clone
(Element : Terminate_Alternative_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Terminate_Alternative_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
--------------------------
-- Abort_Statement_Node --
--------------------------
type Abort_Statement_Node is
new Statement_Node with private;
type Abort_Statement_Ptr is
access all Abort_Statement_Node;
for Abort_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Abort_Statement_Node
(The_Context : ASIS.Context)
return Abort_Statement_Ptr;
function Aborted_Tasks
(Element : Abort_Statement_Node;
Include_Pragmas : in Boolean := False) return Asis.Element_List;
procedure Set_Aborted_Tasks
(Element : in out Abort_Statement_Node;
Value : in Asis.Element);
function Aborted_Tasks_List
(Element : Abort_Statement_Node) return Asis.Element;
function Statement_Kind (Element : Abort_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Abort_Statement_Node)
return Traverse_List;
function Clone
(Element : Abort_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Abort_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
--------------------------
-- Raise_Statement_Node --
--------------------------
type Raise_Statement_Node is
new Statement_Node with private;
type Raise_Statement_Ptr is
access all Raise_Statement_Node;
for Raise_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Raise_Statement_Node
(The_Context : ASIS.Context)
return Raise_Statement_Ptr;
function Raised_Exception
(Element : Raise_Statement_Node) return Asis.Expression;
procedure Set_Raised_Exception
(Element : in out Raise_Statement_Node;
Value : in Asis.Expression);
function Raise_Statement_Message
(Element : Raise_Statement_Node) return Asis.Expression;
procedure Set_Raise_Statement_Message
(Element : in out Raise_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Raise_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Raise_Statement_Node)
return Traverse_List;
function Clone
(Element : Raise_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Raise_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
-------------------------
-- Code_Statement_Node --
-------------------------
type Code_Statement_Node is
new Statement_Node with private;
type Code_Statement_Ptr is
access all Code_Statement_Node;
for Code_Statement_Ptr'Storage_Pool use Lists.Pool;
function New_Code_Statement_Node
(The_Context : ASIS.Context)
return Code_Statement_Ptr;
function Qualified_Expression
(Element : Code_Statement_Node) return Asis.Expression;
procedure Set_Qualified_Expression
(Element : in out Code_Statement_Node;
Value : in Asis.Expression);
function Statement_Kind (Element : Code_Statement_Node)
return Asis.Statement_Kinds;
function Children (Element : access Code_Statement_Node)
return Traverse_List;
function Clone
(Element : Code_Statement_Node;
Parent : Asis.Element)
return Asis.Element;
procedure Copy
(Source : in Asis.Element;
Target : access Code_Statement_Node;
Cloner : in Cloner_Class;
Parent : in Asis.Element);
private
type Base_Path_Statement_Node is abstract
new Statement_Node with
record
Statement_Paths : aliased Primary_Path_Lists.List;
end record;
type If_Statement_Node is
new Base_Path_Statement_Node with
record
null;
end record;
type Case_Statement_Node is
new Base_Path_Statement_Node with
record
Case_Expression : aliased Asis.Expression;
end record;
type Selective_Accept_Statement_Node is
new Base_Path_Statement_Node with
record
null;
end record;
type Timed_Entry_Call_Statement_Node is
new Base_Path_Statement_Node with
record
null;
end record;
type Conditional_Entry_Call_Statement_Node is
new Base_Path_Statement_Node with
record
null;
end record;
type Asynchronous_Select_Statement_Node is
new Base_Path_Statement_Node with
record
null;
end record;
type Null_Statement_Node is
new Statement_Node with
record
null;
end record;
type Assignment_Statement_Node is
new Statement_Node with
record
Assignment_Variable_Name : aliased Asis.Expression;
Assignment_Expression : aliased Asis.Expression;
end record;
type Loop_Statement_Node is
new Statement_Node with
record
Statement_Identifier : aliased Asis.Defining_Name;
Back_Identifier : aliased Asis.Identifier;
Is_Name_Repeated : aliased Boolean := False;
Loop_Statements : aliased Primary_Statement_Lists.List;
end record;
type While_Loop_Statement_Node is
new Loop_Statement_Node with
record
While_Condition : aliased Asis.Expression;
end record;
type For_Loop_Statement_Node is
new Loop_Statement_Node with
record
Loop_Parameter_Specification : aliased Asis.Declaration;
end record;
type Block_Statement_Node is
new Statement_Node with
record
Is_Name_Repeated : aliased Boolean := False;
Is_Declare_Block : aliased Boolean := False;
Block_Declarative_Items : aliased Primary_Declaration_Lists.List;
Block_Statements : aliased Primary_Statement_Lists.List;
Block_Exception_Handlers : aliased Primary_Handler_Lists.List;
Statement_Identifier : aliased Asis.Defining_Name;
Back_Identifier : aliased Asis.Identifier;
Handled_Statements : aliased Asis.Element;
end record;
type Exit_Statement_Node is
new Statement_Node with
record
Exit_Loop_Name : aliased Asis.Expression;
Corresponding_Loop_Exited : aliased Asis.Statement;
Exit_Condition : aliased Asis.Expression;
end record;
type Goto_Statement_Node is
new Statement_Node with
record
Goto_Label : aliased Asis.Expression;
Corresponding_Destination_Statement : aliased Asis.Statement;
end record;
type Base_Call_Statement_Node is abstract
new Statement_Node with
record
Called_Name : aliased Asis.Expression;
Corresponding_Called_Entity : aliased Asis.Declaration;
Call_Statement_Parameters : aliased Primary_Association_Lists.List;
Normalized_Call_Statement_Parameters : aliased Secondary_Association_Lists.List_Node;
end record;
type Procedure_Call_Statement_Node is
new Base_Call_Statement_Node with
record
Is_Call_On_Dispatching_Operation : aliased Boolean := False;
Is_Dispatching_Call : aliased Boolean := False;
end record;
type Entry_Call_Statement_Node is
new Base_Call_Statement_Node with
record
null;
end record;
type Simple_Return_Statement_Node is
new Statement_Node with
record
Return_Expression : aliased Asis.Expression;
end record;
type Extended_Return_Statement_Node is
new Statement_Node with
record
Return_Object_Specification : aliased Asis.Declaration;
Extended_Return_Statements : aliased Primary_Statement_Lists.List;
Extended_Return_Exception_Handlers : aliased Primary_Handler_Lists.List;
Handled_Statements : aliased Asis.Element;
end record;
type Accept_Statement_Node is
new Statement_Node with
record
Accept_Entry_Index : aliased Asis.Expression;
Accept_Entry_Direct_Name : aliased Asis.Name;
Accept_Parameters : aliased Primary_Parameter_Lists.List;
Accept_Body_Statements : aliased Primary_Statement_Lists.List;
Accept_Body_Exception_Handlers : aliased Primary_Handler_Lists.List;
Corresponding_Entry : aliased Asis.Declaration;
Is_Name_Repeated : aliased Boolean := False;
Handled_Statements : aliased Asis.Element;
end record;
type Requeue_Statement_Node is
new Statement_Node with
record
Requeue_Entry_Name : aliased Asis.Name;
end record;
type Requeue_Statement_With_Abort_Node is
new Requeue_Statement_Node with
record
null;
end record;
type Delay_Until_Statement_Node is
new Statement_Node with
record
Delay_Expression : aliased Asis.Expression;
end record;
type Delay_Relative_Statement_Node is
new Delay_Until_Statement_Node with
record
null;
end record;
type Terminate_Alternative_Statement_Node is
new Statement_Node with
record
null;
end record;
type Abort_Statement_Node is
new Statement_Node with
record
Aborted_Tasks : aliased Primary_Expression_Lists.List;
end record;
type Raise_Statement_Node is
new Statement_Node with
record
Raised_Exception : aliased Asis.Expression;
Raise_Statement_Message : aliased Asis.Expression;
end record;
type Code_Statement_Node is
new Statement_Node with
record
Qualified_Expression : aliased Asis.Expression;
end record;
end Asis.Gela.Elements.Stmt;
|
engine/items/tmhm2.asm | genterz/pokecross | 28 | 6845 | <reponame>genterz/pokecross
CanLearnTMHMMove:
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
ld hl, wBaseTMHM
push hl
ld a, [wPutativeTMHMMove]
ld b, a
ld c, 0
ld hl, TMHMMoves
.loop
ld a, [hli]
and a
jr z, .end
cp b
jr z, .asm_11659
inc c
jr .loop
.asm_11659
pop hl
ld b, CHECK_FLAG
push de
ld d, 0
predef SmallFarFlagAction
pop de
ret
.end
pop hl
ld c, 0
ret
GetTMHMMove:
ld a, [wTempTMHM]
dec a
ld hl, TMHMMoves
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wTempTMHM], a
ret
INCLUDE "data/moves/tmhm_moves.asm"
|
myLanguage.g4 | Abductcows/GlorifiedCalculatorCompiler | 0 | 6179 | grammar myLanguage;
/*
Parser rules
*/
program: 'mainclass' ID '{' 'public' 'static' 'void' 'main' '(' ')' comp_stmt '}';
comp_stmt: '{' stmt+ '}';
stmt: assign_stmt
| for_stmt
| while_stmt
| if_stmt
| comp_stmt
| declaration
| null_stmt
| println_stmt
;
declaration: type ID (',' ID)* ';'; // Regular expression form allows every id to be on the same depth of the parse tree
type: 'int' # TypeInt
| 'float' # TypeFloat
;
null_stmt: ';';
println_stmt : 'println' '(' expr ')' ';';
assign_stmt: assign_expr ';';
assign_expr: ID '=' expr;
bool_expr: expr c_op expr;
expr: assign_expr
| rval
;
for_stmt: 'for' '(' opassign_expr';' opbool_expr';' opassign_expr ')' stmt;
opassign_expr: assign_expr
|
;
opbool_expr: bool_expr # OpBoolPresent
| # OpBoolAbsent
;
while_stmt: 'while' '(' bool_expr ')' stmt;
if_stmt: 'if' '(' bool_expr ')' stmt # PlainIf
| 'if' '(' bool_expr ')' stmt 'else' stmt # IfElse
;
c_op: '=='
| '<'
| '<='
| '>'
| '>='
| '!='
;
rval: term # RvalTerm
| rval '+' term # RvalPlus
| rval '-' term # RvalMinus
;
term: factor # TermFactor
| term '*' factor # TermMultFactor
| term '/' factor # TermDivFactor
;
factor: '(' expr ')' # FactorExpr
| '-' factor # FactorNegative
| ID # FactorID
| INT # FactorInt
| FLOAT # FactorFloat
;
/*
Lexer rules
*/
fragment DIGIT : [0-9];
fragment LETTER : [A-Za-z];
ID: LETTER (LETTER | DIGIT | '_')*;
INT: '0' | [1-9] DIGIT*;
FLOAT: INT '.' DIGIT*;
WS : [ \t\r\n]+ -> skip;
|
theorems/homotopy/LoopSpaceCircle.agda | mikeshulman/HoTT-Agda | 0 | 9436 | <reponame>mikeshulman/HoTT-Agda
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
{-
This file contains three proofs of Ω(S¹) = ℤ and the fact that the circle is
a 1-type:
- Something closely related to Mike’s original proof
- Dan’s encode-decode proof
- Guillaume’s proof using the flattening lemma.
This file is divided in a lot of different parts so that common parts can be
factored:
1. Definition of the universal cover and the encoding map (this part is common
to all three proofs)
2. Proof that [encode (loop^ n) == n] (this part is common to Mike’s proof and
the encode-decode proof)
3. Dan’s encode-decode proof that [Ω S¹ ≃ ℤ]
4. Mike’s proof that [Σ S¹ Cover] is contractible
5. Proof with the flattening lemma that [Σ S¹ S¹Cover] is contractible
6. Proof of [Ω S¹ ≃ ℤ] using the fact that [Σ S¹ S¹Cover] is contractible (common
to Mike’s proof and the flattening lemma proof)
7. Encode-decode proof of the whole equivalence
8. Proof that the circle is a 1-type (common to all three proofs)
Keep
- 1, 2, 3 for the encode-decode proof (+ 7, 8 for S¹ is a 1-type)
- 1, 2, 4, 6 for Mike’s proof (+ 8)
- 1, 5, 6 for the flattening lemma proof (+ 8)
-}
{- 2017/02/09 favonia:
1. [loop^] is defined in terms of [Group.exp], and the lemma
[encode'-decode] is changed accordingly. Although the original
[encode-decode] can be proved without the generalized [encode'],
[encode'] seems useful in proving the isomorphism (not just
type equivalence) without flipping the two sides [Ω S¹] and [ℤ].
2. Part 9 is added for further results.
-}
module homotopy.LoopSpaceCircle where
{- 1. Universal cover and encoding map (common to all three proofs) -}
module S¹Cover = S¹RecType ℤ succ-equiv
S¹Cover : S¹ → Type₀
S¹Cover = S¹Cover.f
encode' : {x₁ x₂ : S¹} (p : x₁ == x₂) → S¹Cover x₁ → S¹Cover x₂
encode' p n = transport S¹Cover p n
encode : {x : S¹} (p : base == x) → S¹Cover x
encode p = encode' p 0
{- 2. Encoding [loop^ n] (common to Mike’s proof and the encode-decode proof) -}
ΩS¹-group-structure : GroupStructure (base == base)
ΩS¹-group-structure = Ω^S-group-structure 0 ⊙S¹
module ΩS¹GroupStruct = GroupStructure ΩS¹-group-structure
-- We define the element of [Ω S¹] which is supposed to correspond to an
-- integer [n], this is the loop winding around the circle [n] times.
loop^ : (n : ℤ) → base == base
loop^ = ΩS¹GroupStruct.exp loop
-- Compatibility of [loop^] with the addition function
abstract
loop^+ : (n₁ n₂ : ℤ) → loop^ (n₁ ℤ+ n₂) == loop^ n₁ ∙ loop^ n₂
loop^+ = ΩS¹GroupStruct.exp-+ loop
-- Now we check that encoding [loop^ n] gives indeed [n], again by induction
-- on [n]
abstract
encode'-∙ : ∀ {x₀ x₁ x₂} (p₀ : x₀ == x₁) (p₁ : x₁ == x₂) n
→ encode' (p₀ ∙ p₁) n == encode' p₁ (encode' p₀ n)
encode'-∙ idp _ _ = idp
encode'-loop : ∀ n → encode' loop n == succ n
encode'-loop = S¹Cover.coe-loop-β
encode'-!loop : ∀ n → encode' (! loop) n == pred n
encode'-!loop n = coe-ap-! S¹Cover loop n ∙ S¹Cover.coe!-loop-β n
abstract
encode'-loop^ : (n₁ n₂ : ℤ) → encode' (loop^ n₁) n₂ == n₁ ℤ+ n₂
encode'-loop^ (pos 0) n₂ = idp
encode'-loop^ (pos 1) n₂ = encode'-loop n₂
encode'-loop^ (pos (S (S n₁))) n₂ =
encode' (loop ∙ loop^ (pos (S n₁))) n₂
=⟨ encode'-∙ loop (loop^ (pos (S n₁))) n₂ ⟩
encode' (loop^ (pos (S n₁))) (encode' loop n₂)
=⟨ encode'-loop n₂ |in-ctx encode' (loop^ (pos (S n₁))) ⟩
encode' (loop^ (pos (S n₁))) (succ n₂)
=⟨ encode'-loop^ (pos (S n₁)) (succ n₂) ⟩
pos (S n₁) ℤ+ succ n₂
=⟨ ℤ+-succ (pos (S n₁)) n₂ ⟩
pos (S (S n₁)) ℤ+ n₂ =∎
encode'-loop^ (negsucc 0) n₂ = encode'-!loop n₂
encode'-loop^ (negsucc (S n₁)) n₂ =
encode' (! loop ∙ loop^ (negsucc n₁)) n₂
=⟨ encode'-∙ (! loop) (loop^ (negsucc n₁)) n₂ ⟩
encode' (loop^ (negsucc n₁)) (encode' (! loop) n₂)
=⟨ encode'-!loop n₂ |in-ctx encode' (loop^ (negsucc n₁)) ⟩
encode' (loop^ (negsucc n₁)) (pred n₂)
=⟨ encode'-loop^ (negsucc n₁) (pred n₂) ⟩
negsucc n₁ ℤ+ pred n₂
=⟨ ℤ+-pred (negsucc n₁) n₂ ⟩
negsucc (S n₁) ℤ+ n₂
=∎
encode-loop^ : (n : ℤ) → encode (loop^ n) == n
encode-loop^ n = encode'-loop^ n 0 ∙ ℤ+-unit-r n
{- 3. Dan’s encode-decode proof -}
-- The decoding function at [base] is [loop^], but we extend it to the whole
-- of [S¹] so that [decode-encode] becomes easier (and we need [loop^+] to
-- be able to extend it)
decode : (x : S¹) → (S¹Cover x → base == x)
decode =
S¹-elim loop^ (↓-→-in λ {n} q →
↓-cst=idf-in' $
! (loop^+ n 1) ∙ ap loop^ (ℤ+-comm n 1 ∙ S¹Cover.↓-loop-out q))
abstract
decode-encode : (x : S¹) (p : base == x) → decode x (encode p) == p
decode-encode _ idp = idp -- Magic!
-- And we get the theorem
ΩS¹≃ℤ : (base == base) ≃ ℤ
ΩS¹≃ℤ = equiv encode (decode base) encode-loop^ (decode-encode base)
{- 4. Mike’s proof that [Σ S¹ Cover] is contractible -}
-- We want to prove that every point of [Σ S¹ S¹Cover] is equal to [(base , O)]
paths-mike : (xt : Σ S¹ S¹Cover) → (base , 0) == xt
paths-mike (x , t) = paths-mike-c x t where
abstract
-- We do it by circle-induction on the first component. When it’s [base],
-- we use the [↓-loop^] below (which is essentially [encode-loop^]) and
-- for [loop] we use [loop^+] and the fact that [ℤ] is a set.
paths-mike-c : (x : S¹) (t : S¹Cover x) → (base , 0) == (x , t) :> Σ S¹ S¹Cover
paths-mike-c = S¹-elim
(λ n → pair= (loop^ n) (↓-loop^ n))
(↓-Π-in (λ {n} {n'} q →
↓-cst=idf-in'
(pair= (loop^ n) (↓-loop^ n) ∙ pair= loop q
=⟨ Σ-∙ (↓-loop^ n) q ⟩
pair= (loop^ n ∙ loop) (↓-loop^ n ∙ᵈ q)
=⟨ pair== (! (loop^+ n 1) ∙ ap loop^ (ℤ+-comm n 1 ∙ S¹Cover.↓-loop-out q))
(set-↓-has-all-paths-↓ ℤ-is-set) ⟩
pair= (loop^ n') (↓-loop^ n') ∎))) where
↓-loop^ : (n : ℤ) → 0 == n [ S¹Cover ↓ loop^ n ]
↓-loop^ n = from-transp _ _ (encode-loop^ n)
abstract
contr-mike : is-contr (Σ S¹ S¹Cover)
contr-mike = ((base , 0) , paths-mike)
{- 5. Flattening lemma proof that [Σ S¹ Cover] is contractible -}
--We import the flattening lemma for the universal cover of the circle
--open FlatteningS¹ ℤ succ-equiv
open S¹Cover using (module Wt; Wt; cct; ppt; flattening-S¹)
-- We prove that the flattened HIT corresponding to the universal cover of the
-- circle (the real line) is contractible
Wt-is-contr : is-contr Wt
Wt-is-contr = (cct tt 0 , Wt.elim (base* ∘ snd) (loop* ∘ snd)) where
-- This is basically [loop^] using a different composition order
base* : (n : ℤ) → cct tt 0 == cct tt n
base* (pos 0) = idp
base* (pos 1) = ppt tt 0
base* (pos (S (S n))) = base* (pos (S n)) ∙ ppt tt (pos (S n))
base* (negsucc 0) = ! (ppt tt (negsucc O))
base* (negsucc (S n)) = base* (negsucc n) ∙ ! (ppt tt (negsucc (S n)))
abstract
loop* : (n : ℤ)
→ base* n == base* (succ n) [ (λ x → cct tt 0 == x) ↓ ppt tt n ]
loop* n = ↓-cst=idf-in' (aux n) where
-- This is basically [loop^+ 1 n]
aux : (n : ℤ) → base* n ∙ ppt tt n == base* (succ n)
aux (pos 0) = idp
aux (pos (S n)) = idp
aux (negsucc 0) = !-inv-l (ppt tt (negsucc O))
aux (negsucc (S n)) =
base* (negsucc (S n)) ∙ ppt tt (negsucc (S n))
=⟨ idp ⟩
(base* (negsucc n) ∙ ! (ppt tt (negsucc (S n)))) ∙ ppt tt (negsucc (S n))
=⟨ ∙-assoc (base* (negsucc n)) _ _ ⟩
base* (negsucc n) ∙ (! (ppt tt (negsucc (S n))) ∙ ppt tt (negsucc (S n)))
=⟨ !-inv-l (ppt tt (negsucc (S n)))
|in-ctx (λ u → base* (negsucc n) ∙ u) ⟩
base* (negsucc n) ∙ idp
=⟨ ∙-unit-r _ ⟩
base* (negsucc n) ∎
-- Then, using the flattening lemma we get that the total space of [Cover] is
-- contractible
abstract
contr-flattening : is-contr (Σ S¹ S¹Cover)
contr-flattening = transport! is-contr flattening-S¹ Wt-is-contr
{- 6. Proof that [Ω S¹ ≃ ℤ] using the fact that [Σ S¹ Cover] is contractible -}
tot-encode : Σ S¹ (λ x → base == x) → Σ S¹ S¹Cover
tot-encode (x , y) = (x , encode y)
-- The previous map induces an equivalence on the total spaces, because both
-- total spaces are contractible
abstract
total-is-equiv : is-equiv tot-encode
total-is-equiv = contr-to-contr-is-equiv _ (pathfrom-is-contr base) contr-flattening
-- Hence it’s an equivalence fiberwise
abstract
encode-is-equiv : (x : S¹) → is-equiv (encode {x})
encode-is-equiv = total-equiv-is-fiber-equiv (λ _ → encode) total-is-equiv
-- We can then conclude that the loop space of the circle is equivalent to [ℤ]
ΩS¹≃ℤ' : (base == base) ≃ ℤ
ΩS¹≃ℤ' = (encode {base} , encode-is-equiv base)
{- 7. Encode-decode proof of the whole fiberwise equivalence -}
-- This is quite similar to [paths-mike], we’re doing it by circle-induction,
-- the base case is [encode-loop^] and the loop case is using the fact that [ℤ]
-- is a set (and [loop^+] is already used in [decode])
encode-decode : (x : S¹) (t : S¹Cover x) → encode (decode x t) == t
encode-decode =
S¹-elim {P = λ x → (t : S¹Cover x) → encode (decode x t) == t}
encode-loop^ (↓-Π-in (λ q → prop-has-all-paths-↓ (ℤ-is-set _ _)))
encode-is-equiv' : (x : S¹) → is-equiv (encode {x})
encode-is-equiv' x = is-eq encode (decode x) (encode-decode x) (decode-encode x)
{- 8. Proof that the circle is a 1-type -}
abstract
S¹Cover-is-set : {y : S¹} → is-set (S¹Cover y)
S¹Cover-is-set {y} = S¹-elim {P = λ y → is-set (S¹Cover y)}
ℤ-is-set (prop-has-all-paths-↓ is-set-is-prop) y
ΩS¹-is-set : {y : S¹} → is-set (base == y)
ΩS¹-is-set {y} = equiv-preserves-level ((encode {y} , encode-is-equiv y) ⁻¹)
(S¹Cover-is-set {y})
S¹-level : has-level 1 S¹
S¹-level =
S¹-elim (λ _ → ΩS¹-is-set) (prop-has-all-paths-↓ (Π-level (λ x → is-set-is-prop)))
{- 9. More stuff -}
ΩS¹-iso-ℤ : Ω^S-group 0 ⊙S¹ S¹-level ≃ᴳ ℤ-group
ΩS¹-iso-ℤ = ≃-to-≃ᴳ ΩS¹≃ℤ encode-pres-∙ where
abstract
encode-∙ : ∀ {x₁ x₂} (loop₁ : base == x₁) (loop₂ : x₁ == x₂)
→ encode (loop₁ ∙ loop₂) == encode' loop₂ (encode loop₁)
encode-∙ idp _ = idp
encode-pres-∙ : ∀ (loop₁ loop₂ : base == base)
→ encode (loop₁ ∙ loop₂) == encode loop₁ ℤ+ encode loop₂
encode-pres-∙ loop₁ loop₂ =
encode (loop₁ ∙ loop₂)
=⟨ encode'-∙ loop₁ loop₂ 0 ⟩
encode' loop₂ (encode loop₁)
=⟨ ! $ decode-encode _ loop₂ |in-ctx (λ loop₂ → encode' loop₂ (encode loop₁)) ⟩
encode' (loop^ (encode loop₂)) (encode loop₁)
=⟨ encode'-loop^ (encode loop₂) (encode loop₁) ⟩
encode loop₂ ℤ+ encode loop₁
=⟨ ℤ+-comm (encode loop₂) (encode loop₁) ⟩
encode loop₁ ℤ+ encode loop₂
=∎
abstract
ΩS¹-is-abelian : is-abelian (Ω^S-group 0 ⊙S¹ S¹-level)
ΩS¹-is-abelian = iso-preserves-abelian (ΩS¹-iso-ℤ ⁻¹ᴳ) ℤ-group-is-abelian
|
16mul/16mul/16mul.asm | Shivaakriti/Basic_Assembly_Program | 0 | 165792 | .include "m128def.inc"
.cseg
.org 0x00
ldi r16,$2E
ldi r17,$43
ldi r18,$62
ldi r19,$30
mul r16,r19
mov r3,r0
mov r2,r1
mul r16,r18
add r2,r0
mov r8,r1
mul r17,r19
adc r2,r0
adc r8,r1
mul r17,r18
adc r8,r0
clc
mov r9,r1
end: rjmp end |
04/mult/Mult.asm | leafvmaple/Nand2Tetris | 1 | 9981 | <filename>04/mult/Mult.asm
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Put your code here.
@R2
M=0
@I
M=1
(LOOP)
@R0
D=M
@I
D=M&D
@NOT_ADD
D;JEQ
@R1
D=M
@R2
M=M+D
(NOT_ADD)
@R1
D=M
M=M+D
@I
D=M
M=M+D
D=M
@R0
D=M-D
@LOOP
D;JGE
(END)
@END
0;JMP
|
Appl/GeoDraw/Document/documentPrint.asm | steakknife/pcgeos | 504 | 10330 | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1992 -- All Rights Reserved
PROJECT: GeoDraw
MODULE: Document
FILE: documentPrint.asm
AUTHOR: <NAME>, Aug 12, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 8/12/92 Initial revision
DESCRIPTION:
$Id: documentPrint.asm,v 1.1 97/04/04 15:51:45 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DocumentCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DrawDocumentStartPrint
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print the document
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of DrawDocumentClass
cx,dx - OD of DrawPrintControl
bp - gstate
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DrawDocumentStartPrint method dynamic DrawDocumentClass,
MSG_PRINT_START_PRINTING
gstate local word push bp
printControl local optr push cx, dx
docSizeInfo local PageSizeReport
.enter
; Notify the print control of the size of the document
;
push si ;doc chunk
push bp ;stack frame
call DrawDocumentGetDocumentDimensions
mov di, bp
pop bp ;stack frame
movdw docSizeInfo.PSR_width,dxcx
movdw docSizeInfo.PSR_height,bxax
mov docSizeInfo.PSR_layout,di
call DrawDocumentGetDocumentMargins
mov docSizeInfo.PSR_margins.PCMP_left,ax
mov docSizeInfo.PSR_margins.PCMP_top,bx
mov docSizeInfo.PSR_margins.PCMP_right,cx
mov docSizeInfo.PSR_margins.PCMP_bottom,dx
push bp ;stack frame
movdw bxsi,printControl
mov dx,ss
lea bp,docSizeInfo
mov di,mask MF_FIXUP_DS or mask MF_CALL ;because stuff on stack
mov ax,MSG_PRINT_CONTROL_SET_DOC_SIZE_INFO
call ObjMessage
pop bp ;stack frame
pop si ;doc chunk
; Draw that document
;
push bp ;stack frame
mov bp,gstate
mov cl,mask DF_PRINT
mov ax,MSG_VIS_DRAW
call ObjCallInstanceNoLock
pop bp ;stack frame
; Mark the end of the single page
;
mov di,gstate
mov al,PEC_FORM_FEED
call GrNewPage
; Finish it
;
push bp ;stack frame
movdw bxsi,printControl
mov ax, MSG_PRINT_CONTROL_PRINTING_COMPLETED
mov di,mask MF_FIXUP_DS
call ObjMessage
pop bp ;stack frame
.leave
Destroy ax,cx,dx,bp
ret
DrawDocumentStartPrint endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DrawDocumentReportPageSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: The page controller is telling us that the page size
has changed
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of DrawDocumentClass
ss:bp - PageSizeReport
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DrawDocumentReportPageSize method dynamic DrawDocumentClass,
MSG_PRINT_REPORT_PAGE_SIZE
.enter
; Invalidate before incase document shrinks
;
mov ax,MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
mov ax,ss:[bp].PSR_margins.PCMP_left
mov bx,ss:[bp].PSR_margins.PCMP_top
mov cx,ss:[bp].PSR_margins.PCMP_right
mov dx,ss:[bp].PSR_margins.PCMP_bottom
call DrawDocumentSetDocumentMargins
movdw dxcx,ss:[bp].PSR_width
movdw bxax,ss:[bp].PSR_height
mov bp,ss:[bp].PSR_layout
call DrawDocumentSetDocumentDimensions
call DrawDocumentSendDocumentSizeToView
call DrawDocumentSetGrObjBodyBounds
; Invalidate afterword incase document grows
;
mov ax,MSG_VIS_INVALIDATE
call ObjCallInstanceNoLock
.leave
Destroy ax,cx,dx,bp
ret
DrawDocumentReportPageSize endm
DocumentCode ends
|
sum-thms.agda | rfindler/ial | 29 | 4183 | module sum-thms where
open import eq
open import sum
open import list
open import product
open import negation
inj₁-inj : ∀{ℓ ℓ'}{A : Set ℓ}{B : Set ℓ'}{x : A}{x'} → inj₁{ℓ}{ℓ'}{A}{B} x ≡ inj₁ x' → x ≡ x'
inj₁-inj refl = refl
¬∨ : ∀ {A B : Set} → ¬ A ∧ ¬ B → ¬ (A ∨ B)
¬∨ (u , u') (inj₁ x) = u x
¬∨ (u , u') (inj₂ y) = u' y
¬Σ : ∀{A : Set}{B : A → Set} → (∀(x : A) → ¬ B x) → ¬ Σ A B
¬Σ p (a , b) = p a b
¬∧1 : ∀ {A B : Set} → ¬ A → ¬ (A ∧ B)
¬∧1 f (a , b) = f a
¬∧2 : ∀ {A B : Set} → ¬ B → ¬ (A ∧ B)
¬∧2 f (a , b) = f b
¬∀ : ∀{A : Set}{B : A → Set} → Σ A (λ x → ¬ B x) → ¬ ∀(x : A) → B x
¬∀ (a , b) f = b (f a)
|
oeis/031/A031401.asm | neoneye/loda-programs | 11 | 4916 | <filename>oeis/031/A031401.asm
; A031401: Period of continued fraction for sqrt(A031400(n)).
; 1,2,4,8,4,4,4,4,4,4,4
lpb $0
gcd $0,3
mul $0,2
lpe
mov $1,2
pow $1,$0
mov $0,$1
mod $0,10
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0_notsx.log_21829_599.asm | ljhsiun2/medusa | 9 | 101222 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rdx
push %rsi
// Store
lea addresses_PSE+0x15bfb, %r12
nop
sub $35073, %r13
movb $0x51, (%r12)
nop
nop
nop
nop
xor $16322, %rsi
// Store
lea addresses_PSE+0x15bfb, %r12
nop
nop
nop
add $35951, %r14
movl $0x51525354, (%r12)
nop
nop
and %r9, %r9
// Load
mov $0xbfb, %rdx
nop
nop
nop
nop
add $60532, %r14
mov (%rdx), %r13
nop
nop
sub %r9, %r9
// Store
lea addresses_WT+0x169fb, %r9
nop
xor %r11, %r11
movl $0x51525354, (%r9)
inc %r9
// Store
lea addresses_RW+0xf553, %r11
nop
and %r14, %r14
mov $0x5152535455565758, %r12
movq %r12, %xmm0
movups %xmm0, (%r11)
nop
nop
nop
sub $17253, %rdx
// Faulty Load
lea addresses_PSE+0x15bfb, %rsi
nop
nop
nop
nop
nop
xor %rdx, %rdx
movb (%rsi), %r12b
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rsi
pop %rdx
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 4, 'NT': False, 'same': True, 'congruent': 0}}
{'src': {'type': 'addresses_P', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
src/main/antlr4/org/bschlangaul/antlr/Baum.g4 | bschlangaul-sammlung/java | 0 | 7679 | <reponame>bschlangaul-sammlung/java
grammar Baum;
einstiegsPunkt: baum+ EOF;
baum: 'baum' baumArt '(' aktion+ ')';
aktion: befehl (':' wert+)? ';';
befehl: (SETZE | DRUCKE | LÖSCHE);
wert: ZAHL;
baumArt: ('avl' | 'binär');
ZAHL: [0-9]+;
SETZE: 'setze';
DRUCKE: 'drucke';
LÖSCHE: 'lösche';
ZEILEN_ENDE: '\n' -> skip;
LEERZEICHEN: [ \t]+ -> skip;
|
pixy/src/host/pantilt_in_ada/pixy.ads | GambuzX/Pixy-SIW | 1 | 14094 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Interfaces; use Interfaces;
package pixy is
type uint8 is mod 2**8;
type uint16 is mod 2**16;
type uint32 is mod 2**32;
type int8 is range -(2**7) .. (2**7) - 1;
for int8'size use 8;
type int16 is range -(2**15) .. (2**15) - 1;
for int16'size use 16;
type int32 is range -(2**31) .. (2**31) - 1;
for int32'size use 32;
type Sensor_Width is range 0 .. 319;
type Sensor_Height is range 0 .. 199;
type RCS_Position is range 0 .. 1000;
type RCS_Error is range -1000 .. 1000;
RCS_Azimuth_Channel : constant uint8 := 0;
RCS_Altitude_Channel : constant uint8 := 1;
RCS_Pan_Channel : constant uint8 := 0;
RCS_Tilt_Channel : constant uint8 := 1;
Blocktype_Bormal : constant int16 := 0;
Blocktype_Color_Code : constant int16 := 1;
type Block is record
c_type : aliased uint16; -- ../libpixyusb/include/pixy.h:73
signature : aliased uint16; -- ../libpixyusb/include/pixy.h:74
x : aliased uint16; -- ../libpixyusb/include/pixy.h:75
y : aliased uint16; -- ../libpixyusb/include/pixy.h:76
width : aliased uint16; -- ../libpixyusb/include/pixy.h:77
height : aliased uint16; -- ../libpixyusb/include/pixy.h:78
angle : aliased uint16; -- ../libpixyusb/include/pixy.h:79
end record;
pragma Convention (C_Pass_By_Copy, Block);
function init return int; -- ../libpixyusb/include/pixy.h:90
pragma Import (C, init, "pixy_init");
function blocks_are_new return int; -- ../libpixyusb/include/pixy.h:99
pragma Import (C, blocks_are_new, "pixy_blocks_are_new");
function get_blocks (max_blocks : uint16; blocks : access Block) return int; -- ../libpixyusb/include/pixy.h:116
pragma Import (C, get_blocks, "pixy_get_blocks");
function command (name : Interfaces.C.Strings.chars_ptr -- , ...
) return int; -- ../libpixyusb/include/pixy.h:124
pragma Import (C, command, "pixy_command");
procedure close; -- ../libpixyusb/include/pixy.h:129
pragma Import (C, close, "pixy_close");
procedure error (error_code : int); -- ../libpixyusb/include/pixy.h:135
pragma Import (C, error, "pixy_error");
function led_set_RGB
(red : uint8;
green : uint8;
blue : uint8) return int; -- ../libpixyusb/include/pixy.h:145
pragma Import (C, led_set_RGB, "pixy_led_set_RGB");
function led_set_max_current (current : uint32) return int; -- ../libpixyusb/include/pixy.h:153
pragma Import (C, led_set_max_current, "pixy_led_set_max_current");
function led_get_max_current return int; -- ../libpixyusb/include/pixy.h:160
pragma Import (C, led_get_max_current, "pixy_led_get_max_current");
function cam_set_auto_white_balance (value : uint8) return int; -- ../libpixyusb/include/pixy.h:169
pragma Import (C, cam_set_auto_white_balance, "pixy_cam_set_auto_white_balance");
function cam_get_auto_white_balance return int; -- ../libpixyusb/include/pixy.h:177
pragma Import (C, cam_get_auto_white_balance, "pixy_cam_get_auto_white_balance");
function cam_get_white_balance_value return uint32; -- ../libpixyusb/include/pixy.h:184
pragma Import (C, cam_get_white_balance_value, "pixy_cam_get_white_balance_value");
function cam_set_white_balance_value
(red : uint8;
green : uint8;
blue : uint8) return int; -- ../libpixyusb/include/pixy.h:194
pragma Import (C, cam_set_white_balance_value, "pixy_cam_set_white_balance_value");
function cam_set_auto_exposure_compensation (enable : uint8) return int; -- ../libpixyusb/include/pixy.h:203
pragma Import (C, cam_set_auto_exposure_compensation, "pixy_cam_set_auto_exposure_compensation");
function cam_get_auto_exposure_compensation return int; -- ../libpixyusb/include/pixy.h:211
pragma Import (C, cam_get_auto_exposure_compensation, "pixy_cam_get_auto_exposure_compensation");
function cam_set_exposure_compensation (gain : uint8; compensation : uint16) return int; -- ../libpixyusb/include/pixy.h:220
pragma Import (C, cam_set_exposure_compensation, "pixy_cam_set_exposure_compensation");
function cam_get_exposure_compensation (gain : access uint8; compensation : access uint16) return int; -- ../libpixyusb/include/pixy.h:229
pragma Import (C, cam_get_exposure_compensation, "pixy_cam_get_exposure_compensation");
function cam_set_brightness (brightness : uint8) return int; -- ../libpixyusb/include/pixy.h:237
pragma Import (C, cam_set_brightness, "pixy_cam_set_brightness");
function cam_get_brightness return int; -- ../libpixyusb/include/pixy.h:244
pragma Import (C, cam_get_brightness, "pixy_cam_get_brightness");
function rcs_get_position (channel : uint8) return int; -- ../libpixyusb/include/pixy.h:252
pragma Import (C, rcs_get_position, "pixy_rcs_get_position");
function rcs_set_position (channel : uint8; position : uint16) return int; -- ../libpixyusb/include/pixy.h:261
pragma Import (C, rcs_set_position, "pixy_rcs_set_position");
function rcs_set_frequency (frequency : uint16) return int; -- ../libpixyusb/include/pixy.h:267
pragma Import (C, rcs_set_frequency, "pixy_rcs_set_frequency");
function get_firmware_version
(major : access uint16;
minor : access uint16;
build : access uint16) return int; -- ../libpixyusb/include/pixy.h:277
pragma Import (C, get_firmware_version, "pixy_get_firmware_version");
end pixy;
|
programs/oeis/212/A212415.asm | karttu/loda | 0 | 24526 | <reponame>karttu/loda<filename>programs/oeis/212/A212415.asm<gh_stars>0
; A212415: Number of (w,x,y,z) with all terms in {1,...,n} and w<x>=y<=z.
; 0,0,3,17,55,135,280,518,882,1410,2145,3135,4433,6097,8190,10780,13940,17748,22287,27645,33915,41195,49588,59202,70150,82550,96525,112203,129717,149205,170810,194680,220968,249832,281435,315945
mov $3,3
lpb $0,1
sub $0,1
add $2,$4
add $1,$2
add $4,$3
add $3,5
lpe
|
test/Succeed/Issue5545.agda | cagix/agda | 1,989 | 764 | <gh_stars>1000+
-- Andreas, 2021-09-06, issue #5545,
-- regression introduced by #5522 (fix for #5291).
--
-- Note: this test requires that there is no newline at the end of file.
-- So, it violates the whitespace requirement of fix-whitespace,
-- and needs to be an exception in the configuration of fix-whitespace.
{-# OPTIONS --allow-unsolved-metas #-}
-- No newline at end of file triggered "Unterminated {!" error.
_ : Set
_ = {! !} |
programs/oeis/021/A021356.asm | neoneye/loda | 22 | 7977 | <gh_stars>10-100
; A021356: Decimal expansion of 1/352.
; 0,0,2,8,4,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0
add $0,1
mov $1,10
pow $1,$0
mul $1,2
div $1,704
mod $1,10
mov $0,$1
|
common/titleScreen.asm | laoo/TimePilot | 24 | 240867 | <filename>common/titleScreen.asm
.proc titleScreen
jsr waitFrameNormal
lda #0
sta dmactl
jsr clearbufScreenSimple
jsr clearbufScreenTxt
jsr copyTitleLogo
jsr copyTitleTexts
jsr waitFrameNormal
lda <dataTitleScreenDlist
sta dlptr
lda >dataTitleScreenDlist
sta dlptr+1
jsr setTitleScreenNMI
jsr gameInit.disablePM
jsr RMT.rmt_silence
lda SCORE.doHighScoreFlag
beq titleLoop
lda ntsc
sta ntsc_counter
jmp SCORE.doHighScore
titleLoop
jsr waitFrameNormal
dec screenDelay
bne skip
inc screenMode
lda screenMode
cmp #1
beq mode1
cmp #2
beq mode2
cmp #3
beq mode3
mode0
jsr titleScreenMode0
jmp skip
mode1
jsr titleScreenMode1
bne skip
mode2
jsr titleScreenMode2
jmp skip
mode3
jsr titleScreenMode3
skip
lda trig0
beq normalMode
lda consol
cmp #6
beq normalMode
cmp #5
bne titleLoop
lda rapidusDetected
beq titleLoop
jmp gameModes.swarm
normalMode
jmp gameModes.normal
screenDelay dta b(200)
screenMode dta b(0)
.endp
.proc titleScreenMode0
lda #200
sta titleScreen.screenDelay
lda #0
sta titleScreen.screenMode
sta titleScreenDLI.color+1
lda #$80
sta titleScreenDLI.color
jsr waitFrameNormal
jsr setTitleScreenNMI
jsr waitFrameNormal
lda <dataTitleScreenDlist
sta dlptr
lda >dataTitleScreenDlist
sta dlptr+1
jmp copyTitleTexts
.endp
.proc titleScreenMode1
lda #10
sta titleScreen.screenDelay
rts
.endp
.proc titleScreenMode2
lda #200
sta titleScreen.screenDelay
jsr waitFrameNormal
lda <dataTitleScreenDlist2
sta dlptr
lda >dataTitleScreenDlist2
sta dlptr+1
jsr setTitleScreenHiScoreNMI
jmp copyTitleTextsHiScore
.endp
.proc titleScreenMode3
lda #25
sta titleScreen.screenDelay
jmp waitFrameNormal
.endp
.proc copyTitleLogo
lda #0
tax
ldy #91
@ txa
sta bufScreen0+83,x
tya
sta bufScreen0+123,x
iny
inx
cpx #34
bne @-
rts
.endp
.proc setTitleScreenNMI
lda #0
sta nmien
lda #<titleScreenDLI
sta NMI.DLI+1
lda #>titleScreenDLI
sta NMI.DLI+2
lda #<titleScreenVBL
sta NMI.VBL+1
lda #>titleScreenVBL
sta NMI.VBL+2
lda #$c0
sta nmien
rts
.endp
.proc setTitleScreenHiScoreNMI
lda #0
sta nmien
lda #<titleScreenHiScoreDLI
sta NMI.DLI+1
lda #>titleScreenHiScoreDLI
sta NMI.DLI+2
lda #$c0
sta nmien
rts
.endp
.proc copyTitleTexts
lda rapidusDetected
beq txtPlay
; or rapidus enabled
lda #0
ldx #<titleScreenTexts.rapidus
ldy #>titleScreenTexts.rapidus
jsr copyText
jmp nextText
; play
txtPlay
lda #0
ldx #<titleScreenTexts.play
ldy #>titleScreenTexts.play
jsr copyText
nextText
; 1-up bonus
lda #0
ldx #<titleScreenTexts.bonus1
ldy #>titleScreenTexts.bonus1
jsr copyText
lda #0
ldx #<titleScreenTexts.bonus2
ldy #>titleScreenTexts.bonus2
jsr copyText
; konami
lda #0
ldx #<titleScreenTexts.konami
ldy #>titleScreenTexts.konami
jsr copyText
; NG
lda #0
ldx #<titleScreenTexts.newgen
ldy #>titleScreenTexts.newgen
jmp copyText
.endp
.proc copyTitleTextsHiScore
; score table
lda #0
ldx #<titleScreenTexts.hiscore
ldy #>titleScreenTexts.hiscore
jmp copyText
.endp
.proc titleScreenTexts
play dta b(8),b(0),d'PLAY#'
rapidus dta b(2),b(0),d'RAPIDUS ENABLED!#'
pause dta b(0),b(0),d' PAUSED #'
pause2 dta b(3),b(0),d'OPTION TO QUIT#'
bonus1 dta b(0),b(1),d'1ST BONUS 10000 PTS.#'
bonus2 dta b(0),b(2),d'AND EVERY 50000 PTS.#'
konami dta b(4),b(7),d'@1982 KONAMI#'
newgen dta b(0),b(8),d'@2018 NEW GENERATION#'
hiscore dta b(0),b(1),d'SCORE RANKING TABLE '
dta d'1ST 10000 SOLO '
dta d'2ND 8800 LAOO '
dta d'3RD 8460 MIKER'
hiscoreMove dta d'4TH 6502 TIGER'
dta d'5TH 4300 VOY #'
.endp
|
programs/oeis/099/A099820.asm | neoneye/loda | 22 | 176426 | <reponame>neoneye/loda
; A099820: Even nonnegative integers in base 2 (bisection of A007088).
; 0,10,100,110,1000,1010,1100,1110,10000,10010,10100,10110,11000,11010,11100,11110,100000,100010,100100,100110,101000,101010,101100,101110,110000,110010,110100,110110,111000,111010,111100,111110,1000000
seq $0,5836 ; Numbers n whose base 3 representation contains no 2.
seq $0,7089 ; Numbers in base 3.
mul $0,10
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/itypes.adb | best08618/asylo | 7 | 7415 | <gh_stars>1-10
-- { dg-do compile }
package body itypes is
Size : constant := 10;
type Arr is array (1 .. size) of Integer;
type Rec is record
Field1 : Arr := (others => 0);
Field2 : Arr := (others => 0);
Field3 : Arr := (others => 0);
Field4 : Arr := (others => 0);
Field5 : Arr := (others => 0);
Field6 : Arr := (others => 0);
Field7 : Arr := (others => 0);
end record;
procedure Proc is
Temp1 : Rec;
begin
null;
end;
end;
|
oeis/255/A255875.asm | neoneye/loda-programs | 11 | 21045 | <reponame>neoneye/loda-programs<filename>oeis/255/A255875.asm
; A255875: a(n) = Fibonacci(n+2) + n - 2.
; Submitted by <NAME>
; 1,3,6,10,16,25,39,61,96,152,242,387,621,999,1610,2598,4196,6781,10963,17729,28676,46388,75046,121415,196441,317835,514254,832066,1346296,2178337,3524607,5702917,9227496,14930384,24157850,39088203,63246021,102334191,165580178,267914334,433494476,701408773,1134903211,1836311945,2971215116,4807527020,7778742094,12586269071,20365011121,32951280147,53316291222,86267571322,139583862496,225851433769,365435296215,591286729933,956722026096,1548008755976,2504730782018,4052739537939,6557470319901
mov $2,$0
seq $0,1911 ; a(n) = Fibonacci(n+3) - 2.
add $0,$2
add $0,1
|
libsrc/_DEVELOPMENT/l/z80/long/l_long_store_mhl.asm | jpoikela/z88dk | 640 | 165683 |
SECTION code_clib
SECTION code_l
PUBLIC l_long_store_mhl
l_long_store_mhl:
; store long to address in hl
;
; enter : debc = long
;
; exit : *hl = debc
; hl += 3
;
; uses : hl
ld (hl),c
inc hl
ld (hl),b
inc hl
ld (hl),e
inc hl
ld (hl),d
ret
|
lista1/exerc4.asm | Durfan/ufsj-lab-aoc1 | 0 | 16400 | .data
a: .word 0:2
b: .word 0
c: .word 0
d: .word 0
e: .word 0
.text
la $s0,a
la $s1,b
la $s2,c
la $s3,d
la $s4,e
li $t0,10
sw $t0,0($s0)
lw $t0,0($s0)
li $t1,5
add $t0,$t0,$t1
sw $t0,4($s0)
lw $t0,0($s0)
lw $t1,4($s0)
add $t2,$t0,$t1
sw $t2,0($s1)
sub $t2,$t0,$t1
sw $t2,0($s2)
lw $t0,0($s1)
lw $t1,0($s2)
add $t2,$t0,$t1
sw $t2,0($s3)
lw $t0,0($s1)
lw $t1,0($s0)
add $t0,$t0,$t1
li $t5,2
lw $t1,0($s3)
mul $t2,$t5,$t1
lw $t1,0($s2)
mul $t3,$t5,$t1
add $t2,$t2,$t3
lw $t1,4($s0)
sub $t2,$t2,$t1
sub $t0,$t0,$t2
sw $t0,0($s4)
|
c/00-hello-world/build/main.adb | willbr/gameboy-tests | 0 | 13259 | <filename>c/00-hello-world/build/main.adb
M:main
F:G$main$0_0$0({2}DF,SV:S),C,0,0,0,0,0
S:G$test$0_0$0({1}SC:U),E,0,0
S:G$main$0_0$0({2}DF,SV:S),C,0,0
|
test/Fail/Issue292c.agda | shlevy/agda | 1,989 | 10476 | <filename>test/Fail/Issue292c.agda
-- Andreas, 2011-05-30
-- {-# OPTIONS -v tc.lhs.unify:50 #-}
module Issue292c where
data ⊥ : Set where
infix 3 ¬_
¬_ : Set → Set
¬ P = P → ⊥
infix 4 _≅_
data _≅_ {A : Set} (x : A) : ∀ {B : Set} → B → Set where
refl : x ≅ x
record Σ (A : Set) (B : A → Set) : Set where
constructor _,_
field
proj₁ : A
proj₂ : B proj₁
open Σ public
data Bool : Set where true false : Bool
data Unit1 : Set where unit1 : Unit1
data Unit2 : Set where unit2 : Unit2
D : Bool -> Set
D true = Unit1
D false = Unit2
P : Set -> Set
P S = Σ S (\s → s ≅ unit1)
pbool : P (D true)
pbool = unit1 , refl
¬pbool2 : ¬ P (D false)
¬pbool2 ( unit2 , () )
{- expected error
unit2 ≅ unit1 should be empty, but that's not obvious to me
when checking that the clause ¬pbool2 (unit2 , ()) has type
¬ P (D false)
-}
|
Fields/FieldOfFractions/Multiplication.agda | Smaug123/agdaproofs | 4 | 12941 | <reponame>Smaug123/agdaproofs
{-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Rings.Definition
open import Rings.IntegralDomains.Definition
open import Setoids.Setoids
open import Sets.EquivalenceRelations
module Fields.FieldOfFractions.Multiplication {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} {_*_ : A → A → A} {R : Ring S _+_ _*_} (I : IntegralDomain R) where
open import Fields.FieldOfFractions.Setoid I
fieldOfFractionsTimes : fieldOfFractionsSet → fieldOfFractionsSet → fieldOfFractionsSet
fieldOfFractionsTimes (record { num = a ; denom = b ; denomNonzero = b!=0 }) (record { num = c ; denom = d ; denomNonzero = d!=0 }) = record { num = a * c ; denom = b * d ; denomNonzero = ans }
where
open Setoid S
open Ring R
ans : ((b * d) ∼ Ring.0R R) → False
ans pr with IntegralDomain.intDom I pr
ans pr | f = exFalso (d!=0 (f b!=0))
fieldOfFractionsTimesWellDefined : {a b c d : fieldOfFractionsSet} → (Setoid._∼_ fieldOfFractionsSetoid a c) → (Setoid._∼_ fieldOfFractionsSetoid b d) → (Setoid._∼_ fieldOfFractionsSetoid (fieldOfFractionsTimes a b) (fieldOfFractionsTimes c d))
fieldOfFractionsTimesWellDefined {record { num = a ; denom = b }} {record { num = c ; denom = d }} {record { num = e ; denom = f }} {record { num = g ; denom = h }} af=be ch=dg = need
where
open Setoid S
open Equivalence eq
need : ((a * c) * (f * h)) ∼ ((b * d) * (e * g))
need = transitive (Ring.*WellDefined R reflexive (Ring.*Commutative R)) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (symmetric (Ring.*Associative R)) reflexive) (transitive (Ring.*WellDefined R (Ring.*WellDefined R reflexive ch=dg) reflexive) (transitive (Ring.*Commutative R) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (Ring.*Commutative R) reflexive) (transitive (Ring.*WellDefined R af=be reflexive) (transitive (Ring.*Associative R) (transitive (Ring.*WellDefined R (transitive (symmetric (Ring.*Associative R)) (transitive (Ring.*WellDefined R reflexive (Ring.*Commutative R)) (Ring.*Associative R))) reflexive) (symmetric (Ring.*Associative R)))))))))))
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.