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 |
|---|---|---|---|---|
common/octets.ads | lkujaw/ada-blake2 | 1 | 13363 | <gh_stars>1-10
-----------------------------------------------------------------------
-- Copyright 2021 <NAME> --
-- --
-- Permission is hereby granted, free of charge, to any person --
-- obtaining a copy of this software and associated documentation --
-- files (the "Software") to deal in the Software without --
-- restriction, including without limitation the rights to use, --
-- copy, modify, merge, publish, distribute, sublicense, and sell --
-- copies of the Software, and to permit persons to whom the --
-- Software is furnished to do so. --
-- --
-- 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. --
-- --
-- SPDX-License-Identifier: MIT-0 --
-- --
-- File: octets.ads (Ada Package Specification) --
-- Language: SPARK83 [1] subset of Ada (1987) [2] --
-- Author: <NAME> --
-- Description: Specification of the Octets (8-bit) type --
-- --
-- References: --
-- [1] SPARK Team, SPARK83 - The SPADE Ada83 Kernel, --
-- Altran Praxis, 17 Oct. 2011. --
-- [2] Programming languages - Ada, ISO/IEC 8652:1987, --
-- 15 Jun. 1987. --
-----------------------------------------------------------------------
package Octets is
pragma Pure;
Bits : constant := 8;
type T is range 0 .. 255;
for T'Size use Bits;
end Octets;
|
unittests/ASM/H0F3A/66_20_1.asm | cobalt2727/FEX | 628 | 80711 | %ifdef CONFIG
{
"RegData": {
"XMM0": ["0xFFFFFFFFFFFF42FF", "0xFFFFFFFFFFFFFFFF"]
}
}
%endif
mov rsi, 0xe0000000
mov rax, -1
mov [rsi + 8 * 0], rax
mov [rsi + 8 * 1], rax
movaps xmm0, [rsi + 16 * 0]
mov rcx, 0
mov edi, 0x42
; This tests a frontend decoder bug in FEX
; FEX thought this was ch
pinsrb xmm0, edi, 0x01
hlt
|
demos/SicDemos/graph-screen/mandel.asm | roycrippen/sicxe | 0 | 87359 | mandel START 0
first LDX screen
LDA width
FLOAT
STF f_wid
MUL height
ADD screen
STA scrend
LDA height
FLOAT
STF f_hei
LDA #4
FLOAT
STF excon
CLEAR A
CLEAR S . i
CLEAR T . j
loop CLEAR A
ADDR S,A
MUL #4
SUB width
SUB width . A = 4i - 2width
FLOAT
DIVF f_wid . F in [-2, 2]
STF c_x
CLEAR A
ADDR T,A
MUL #4
SUB height
SUB height . A = 4j - 2height
FLOAT
DIVF f_hei . F in [-2, 2]
STF c_y
JSUB calc . A = numIterations
MUL #11
DIV iters
JSUB color . A = color
STCH first,X
RMO S,A
ADD #1
RMO A,S
COMP width
JLT over
CLEAR S
RMO T,A
ADD #1
RMO A,T
over TIX scrend
JLT loop
halt J halt
. subroutines
calc STF tempFc
STX tempXc
STL tempLc
CLEAR X
CLEAR F
STF tempFX
STF tempFY
loopcl LDF tempFY . F = y
ADDF tempFX . F = (x + y)
STF tempF1 . tempF1 = (x + y)
LDF tempFX . F = x
SUBF tempFY . F = x - y
MULF tempF1 . F = (x + y)(x - y) = x² - y²
ADDF c_x . F = x² - y² + c_x = new x
STF tempF1 . tempF1 = new x
LDA #2 . A = 2
FLOAT . F = 2
MULF tempFX . F = 2x
MULF tempFY . F = 2xy
ADDF c_y . F = 2xy + c_y = new y
STF tempFY . tempFY = new y
LDF tempF1 . F = new x
STF tempFX . tempFX = new x
. divergence comparison
MULF tempFX . F = x²
STF tempF1
LDF tempFY
MULF tempFY
ADDF tempF1
COMPF excon
JGT retcalc . abs(x + yi) > 2 => diverges
TIX iters
JLT loopcl
retcalc RMO X,A
LDF tempFc
LDX tempXc
LDL tempLc
RSUB
color COMP #3
JGT col1
J retcol
col1 COMP #6
JGT col2
SUB #3
MUL #16
ADD #3
J retcol
col2 COMP #9
JGT retmax
SUB #6
MUL #4
ADD #51
retcol ADD #192
RSUB
retmax LDA #255
RSUB
. memory init
screen WORD X'00A000'
width WORD 1000
height WORD 1000
scrend RESW 1
f_wid RESF 1
f_hei RESF 1
f_offx RESF 1
f_offy RESF 1
iters WORD 100
c_x RESF 1
c_y RESF 1
tempFX RESF 1
tempFY RESF 1
tempF1 RESF 1
tempFc RESF 1
tempXc RESW 1
tempLc RESW 1
tempFm RESF 1
negone WORD -1
excon RESW 1
END first
|
assembler/tests/t_6812/t_6812.asm | paulscottrobson/RCA-Cosmac-VIP-III | 1 | 21341 | cpu 68hc12
page 0
aba
abx
aby
adca #45
adca $45
adca $1234
adca >$45
adca ,y
adca 5,x
adca -5,sp
adca *,pc
adca *+10,pc
adca *+17,pc
adca a,y
adca b,sp
adca d,pc
adca 55,y
adca -55,sp
adca <5,y
adca <-5,sp
adca *+18,pc
adca *+258,pc
adca 555,y
adca -555,sp
adca >55,y
adca >-55,sp
adca *+259,pc
adca [d,sp]
adca [d,x]
adca [-5,y]
adca [500,y]
adca 4,+y
adca 4,y+
adca 4,-y
adca 4,y-
adcb #55
adcb $55
adcb ,x
adcb $1234
adda #55
adda $55
adda ,x
adda $1234
addb #55
addb $55
addb ,x
addb $1234
addd #55
addd $55
addd ,x
addd $1234
anda #55
anda $55
anda ,x
anda $1234
andb #55
andb $55
andb ,x
andb $1234
andcc #$fe
asl $55
asl ,x
asl $1234
asla
aslb
asld
asr $55
asr ,x
asr $1234
asra
asrb
bcc *
bclr $20 #$40
bclr $20,#$40
bclr $1234 #$40
bclr $1234,#$40
bclr ,x $40
bclr $20,y,$40
bclr *,pc,$40
bcs *
beq *
bge *
bgnd
bgt *
bhi *
bhs *
bita #$55
bita $55
bita ,x
bita $1234
bitb #$55
bitb $55
bitb ,x
bitb $1234
ble *
blo *
bls *
blt *
bmi *
bne *
bpl *
bra *
brclr $20 #$40 *
brclr $2000,#$40,*
brclr ,x,#$40,*
brclr *,pc,#$40,*
brn *
brset $20 #$40 *
brset $2000,#$40,*
brset ,x,#$40,*
brset *,pc,#$40,*
bset $20 #$40
bset $20,#$40
bset $1234 #$40
bset $1234,#$40
bset ,x $40
bset $20,y,$40
bsr *
bvc *
bvs *
call $2000,5
call 5,y,6
call 200,y,7
call 20000,y,8
call [d,y]
call [20,y]
cba
clc
andcc #$fe
cli
andcc #$ef
clr $55
clr ,x
clr $1234
clra
clrb
clv
andcc #$fd
cmpa #55
cmpa $55
cmpa ,x
cmpa $1234
cmpb #55
cmpb $55
cmpb ,x
cmpb $1234
com $55
com ,x
com $1234
coma
comb
cpd #55
cpd $55
cpd ,x
cpd $1234
cps #55
cps $55
cps ,x
cps $1234
cpx #55
cpx $55
cpx ,x
cpx $1234
cpy #55
cpy $55
cpy ,x
cpy $1234
daa
dbeq x,*
dbne x,*
dec $55
dec ,x
dec $1234
deca
decb
des
leas -1,sp
dex
dey
ediv
edivs
emacs $1234
emaxd ,x
emaxm ,x
emind ,x
eminm ,x
emul
emuls
eora #55
eora $55
eora ,x
eora $1234
eorb #55
eorb $55
eorb ,x
eorb $1234
etbl 5,y
exg ccr,sp
fdiv
ibeq a,*
ibne a,*
idiv
idivs
inc $55
inc ,x
inc $1234
inca
incb
ins
leas 1,sp
inx
iny
jmp $2000
jmp $20
jmp [d,x]
jsr $2000
jsr $20
jsr [d,x]
lbcc *
lbcs *
lbeq *
lbge *
lbgt *
lbhi *
lbhs *
lble *
lblo *
lbls *
lblt *
lbmi *
lbne *
lbpl *
lbra *
lbrn *
lbvc *
lbvs *
ldaa #55
ldaa $55
ldaa ,x
ldaa $1234
ldab #55
ldab $55
ldab ,x
ldab $1234
ldd #55
ldd $55
ldd ,x
ldd $1234
lds #55
lds $55
lds ,x
lds $1234
ldx #55
ldx $55
ldx ,x
ldx $1234
ldy #55
ldy $55
ldy ,x
ldy $1234
leas 2000,sp
leax ,y
leay ,x
lsl $55
lsl ,x
lsl $1234
lsla
lslb
lsld
lsr $55
lsr ,x
lsr $1234
lsra
lsrb
lsrd
maxa ,x
maxm ,x
mem
mina ,x
minm ,x
movb #$55 $1234
movb #$55,$1234
movb #$55 2,y
movb #$55,2,y
movb #$55,next_a,pc
next_a: movb $1234 $3456
movb $1234,$3456
movb $1234 2,y
movb $1234,2,y
movb $1234,next_b,pc
next_b: movb 2,y $1234
movb 2,y,$1234
movb next_c,pc,$1234
next_c: movb 2,y 2,y
movb 2,y,2,y
movb next_d,pc next_d,pc
next_d:
movw #$55 $1234
movw #$55,$1234
movw #$55 2,y
movw #$55,2,y
movw #$55,next_e,pc
next_e: movw $1234 $3456
movw $1234,$3456
movw $1234 2,y
movw $1234,2,y
movw $1234,next_f,pc
next_f: movw 2,y $1234
movw 2,y,$1234
movw next_g,pc,$1234
next_g: movw 2,y 2,y
movw 2,y,2,y
movw next_h,pc next_h,pc
next_h:
mul
neg $55
neg ,x
neg $1234
nega
negb
nop
oraa #55
oraa $55
oraa ,x
oraa $1234
orab #55
orab $55
orab ,x
orab $1234
orcc #$10
psha
pshb
pshc
pshd
pshx
pshy
pula
pulb
pulc
puld
pulx
puly
rev
revw
rol $55
rol ,x
rol $1234
rola
rolb
ror $55
ror ,x
ror $1234
rora
rorb
rtc
rti
rts
sba
sbca #55
sbca $55
sbca ,x
sbca $1234
sbcb #55
sbcb $55
sbcb ,x
sbcb $1234
sec
orcc #$01
sei
orcc #$10
sev
orcc #$02
sex a,d
staa $55
staa ,x
staa $1234
stab $55
stab ,x
stab $1234
std $55
std ,x
std $1234
sts $55
sts ,x
sts $1234
stx $55
stx ,x
stx $1234
sty $55
sty ,x
sty $1234
stop
suba #55
suba $55
suba ,x
suba $1234
subb #55
subb $55
subb ,x
subb $1234
subd #55
subd $55
subd ,x
subd $1234
swi
tab
tap
tfr a,ccr
tba
tbeq d,*
tbl a,x
tbne d,*
tfr a,b
tfr x,y
tpa
tfr ccr,a
trap #$42
tst $55
tst ,x
tst $1234
tsta
tstb
tsx
tfr sp,x
tsy
tfr sp,y
txs
tfr x,sp
tys
tfr y,sp
wai
wav
xgdx
exg d,x
xgdy
exg d,y
cpu 68hc12x
aslx
asly
asrx
asry
clrx
clry
comx
comy
decx
decy
incx
incy
lslx
lsly
lsrx
lsry
negx
negy
pshcw
pulcw
rolx
roly
rorx
rory
tstx
tsty
aslw $55
aslw ,x
aslw ,y
aslw ,sp
aslw *,pc
aslw 10,x
aslw 10,y
aslw 10,sp
aslw *+10,pc
aslw $1234
asrw $55
asrw ,x
asrw ,y
asrw ,sp
asrw *,pc
asrw 10,x
asrw 10,y
asrw 10,sp
asrw *+10,pc
asrw $1234
clrw $55
clrw ,x
clrw ,y
clrw ,sp
clrw *,pc
clrw 10,x
clrw 10,y
clrw 10,sp
clrw *+10,pc
clrw $1234
comw $55
comw ,x
comw ,y
comw ,sp
comw *,pc
comw 10,x
comw 10,y
comw 10,sp
comw *+10,pc
comw $1234
decw $55
decw ,x
decw ,y
decw ,sp
decw *,pc
decw 10,x
decw 10,y
decw 10,sp
decw *+10,pc
decw $1234
incw $55
incw ,x
incw ,y
incw ,sp
incw *,pc
incw 10,x
incw 10,y
incw 10,sp
incw *+10,pc
incw $1234
lslw $55
lslw ,x
lslw ,y
lslw ,sp
lslw *,pc
lslw 10,x
lslw 10,y
lslw 10,sp
lslw *+10,pc
lslw $1234
lsrw $55
lsrw ,x
lsrw ,y
lsrw ,sp
lsrw *,pc
lsrw 10,x
lsrw 10,y
lsrw 10,sp
lsrw *+10,pc
lsrw $1234
negw $55
negw ,x
negw ,y
negw ,sp
negw *,pc
negw 10,x
negw 10,y
negw 10,sp
negw *+10,pc
negw $1234
rolw $55
rolw ,x
rolw ,y
rolw ,sp
rolw *,pc
rolw 10,x
rolw 10,y
rolw 10,sp
rolw *+10,pc
rolw $1234
rorw $55
rorw ,x
rorw ,y
rorw ,sp
rorw *,pc
rorw 10,x
rorw 10,y
rorw 10,sp
rorw *+10,pc
rorw $1234
tstw $55
tstw ,x
tstw ,y
tstw ,sp
tstw *,pc
tstw 10,x
tstw 10,y
tstw 10,sp
tstw *+10,pc
tstw $1234
addx #$1234
addx $55
addx ,x
addx ,y
addx ,sp
addx *,pc
addx 10,x
addx 10,y
addx 10,sp
addx *+10,pc
addx $1234
addy #$1234
addy $55
addy ,x
addy ,y
addy ,sp
addy *,pc
addy 10,x
addy 10,y
addy 10,sp
addy *+10,pc
addy $1234
aded #$1234
aded $55
aded ,x
aded ,y
aded ,sp
aded *,pc
aded 10,x
aded 10,y
aded 10,sp
aded *+10,pc
aded $1234
adex #$1234
adex $55
adex ,x
adex ,y
adex ,sp
adex *,pc
adex 10,x
adex 10,y
adex 10,sp
adex *+10,pc
adex $1234
adey #$1234
adey $55
adey ,x
adey ,y
adey ,sp
adey *,pc
adey 10,x
adey 10,y
adey 10,sp
adey *+10,pc
adey $1234
andx #$1234
andx $55
andx ,x
andx ,y
andx ,sp
andx *,pc
andx 10,x
andx 10,y
andx 10,sp
andx *+10,pc
andx $1234
andy #$1234
andy $55
andy ,x
andy ,y
andy ,sp
andy *,pc
andy 10,x
andy 10,y
andy 10,sp
andy *+10,pc
andy $1234
bitx #$1234
bitx $55
bitx ,x
bitx ,y
bitx ,sp
bitx *,pc
bitx 10,x
bitx 10,y
bitx 10,sp
bitx *+10,pc
bitx $1234
bity #$1234
bity $55
bity ,x
bity ,y
bity ,sp
bity *,pc
bity 10,x
bity 10,y
bity 10,sp
bity *+10,pc
bity $1234
cped #$1234
cped $55
cped ,x
cped ,y
cped ,sp
cped *,pc
cped 10,x
cped 10,y
cped 10,sp
cped *+10,pc
cped $1234
cpes #$1234
cpes $55
cpes ,x
cpes ,y
cpes ,sp
cpes *,pc
cpes 10,x
cpes 10,y
cpes 10,sp
cpes *+10,pc
cpes $1234
cpex #$1234
cpex $55
cpex ,x
cpex ,y
cpex ,sp
cpex *,pc
cpex 10,x
cpex 10,y
cpex 10,sp
cpex *+10,pc
cpex $1234
cpey #$1234
cpey $55
cpey ,y
cpey ,y
cpey ,sp
cpey *,pc
cpey 10,y
cpey 10,y
cpey 10,sp
cpey *+10,pc
cpey $1234
eorx #$1234
eorx $55
eorx ,x
eorx ,y
eorx ,sp
eorx *,pc
eorx 10,x
eorx 10,y
eorx 10,sp
eorx *+10,pc
eorx $1234
eory #$1234
eory $55
eory ,y
eory ,y
eory ,sp
eory *,pc
eory 10,y
eory 10,y
eory 10,sp
eory *+10,pc
eory $1234
orx #$1234
orx $55
orx ,x
orx ,y
orx ,sp
orx *,pc
orx 10,x
orx 10,y
orx 10,sp
orx *+10,pc
orx $1234
ory #$1234
ory $55
ory ,y
ory ,y
ory ,sp
ory *,pc
ory 10,y
ory 10,y
ory 10,sp
ory *+10,pc
ory $1234
sbed #$1234
sbed $55
sbed ,x
sbed ,y
sbed ,sp
sbed *,pc
sbed 10,x
sbed 10,y
sbed 10,sp
sbed *+10,pc
sbed $1234
sbex #$1234
sbex $55
sbex ,x
sbex ,y
sbex ,sp
sbex *,pc
sbex 10,x
sbex 10,y
sbex 10,sp
sbex *+10,pc
sbex $1234
sbey #$1234
sbey $55
sbey ,x
sbey ,y
sbey ,sp
sbey *,pc
sbey 10,y
sbey 10,y
sbey 10,sp
sbey *+10,pc
sbey $1234
subx #$1234
subx $55
subx ,x
subx ,y
subx ,sp
subx *,pc
subx 10,x
subx 10,y
subx 10,sp
subx *+10,pc
subx $1234
suby #$1234
suby $55
suby ,x
suby ,y
suby ,sp
suby *,pc
suby 10,y
suby 10,y
suby 10,sp
suby *+10,pc
suby $1234
gldaa $55
gldaa ,x
gldaa ,y
gldaa ,sp
gldaa *,pc
gldaa 10,y
gldaa 10,y
gldaa 10,sp
gldaa *+10,pc
gldaa $1234
gldab $55
gldab ,x
gldab ,y
gldab ,sp
gldab *,pc
gldab 10,y
gldab 10,y
gldab 10,sp
gldab *+10,pc
gldab $1234
gldd $55
gldd ,x
gldd ,y
gldd ,sp
gldd *,pc
gldd 10,y
gldd 10,y
gldd 10,sp
gldd *+10,pc
gldd $1234
glds $55
glds ,x
glds ,y
glds ,sp
glds *,pc
glds 10,y
glds 10,y
glds 10,sp
glds *+10,pc
glds $1234
gldx $55
gldx ,x
gldx ,y
gldx ,sp
gldx *,pc
gldx 10,y
gldx 10,y
gldx 10,sp
gldx *+10,pc
gldx $1234
gldy $55
gldy ,x
gldy ,y
gldy ,sp
gldy *,pc
gldy 10,y
gldy 10,y
gldy 10,sp
gldy *+10,pc
gldy $1234
gstaa $55
gstaa ,x
gstaa ,y
gstaa ,sp
gstaa *,pc
gstaa 10,y
gstaa 10,y
gstaa 10,sp
gstaa *+10,pc
gstaa $1234
gstab $55
gstab ,x
gstab ,y
gstab ,sp
gstab *,pc
gstab 10,y
gstab 10,y
gstab 10,sp
gstab *+10,pc
gstab $1234
gstd $55
gstd ,x
gstd ,y
gstd ,sp
gstd *,pc
gstd 10,y
gstd 10,y
gstd 10,sp
gstd *+10,pc
gstd $1234
gsts $55
gsts ,x
gsts ,y
gsts ,sp
gsts *,pc
gsts 10,y
gsts 10,y
gsts 10,sp
gsts *+10,pc
gsts $1234
gstx $55
gstx ,x
gstx ,y
gstx ,sp
gstx *,pc
gstx 10,y
gstx 10,y
gstx 10,sp
gstx *+10,pc
gstx $1234
gsty $55
gsty ,x
gsty ,y
gsty ,sp
gsty *,pc
gsty 10,y
gsty 10,y
gsty 10,sp
gsty *+10,pc
gsty $1234
btas $55,#$45
btas ,x,#$45
btas ,y,#$45
btas ,sp,#$45
btas *,pc,#$45
btas 10,y,#$45
btas 10,y,#$45
btas 10,sp,#$45
btas *+10,pc,#$45
btas $1234,#$45
ldaa $10
ldaa $1010
assume direct:$10
ldaa $10
ldaa $1010
irp reg,a,b,ccr,ccrl,d,x,y,sp,ccrh,xh,yh,sph
tfr a,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp,xl,yl,spl
tfr b,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp
tfr ccr,reg
tfr ccrl,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp,ccrw
tfr d,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp,ccrw
tfr x,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp,ccrw
tfr y,reg
endm
irp reg,a,b,ccr,ccrl,d,x,y,sp,ccrw
tfr sp,reg
endm
irp reg,a,b,ccr,ccrl
tfr xl,reg
endm
irp reg,a,b,ccr,ccrl
tfr yl,reg
endm
irp reg,a,b,ccr,ccrl
tfr spl,reg
endm
tfr xh,a
tfr yh,a
tfr sph,a
tfr ccrh,a
irp reg,ccrw,d,x,y,sp
tfr ccrw,reg
endm
movb #$56,$1234
movb #$56,,y
movb #$56,64,y
movb #$56,1000,y
movb #$56,[d,sp]
movb #$56,[500,y]
movb $2356,$1234
movb $2356,,y
movb $2356,64,y
movb $2356,1000,y
movb $2356,[d,sp]
movb $2356,[500,y]
movb 0,y,$1234
movb 0,y,,y
movb 0,y,64,y
movb 0,y,1000,y
movb 0,y,[d,sp]
movb 0,y,[500,y]
movb 100,y,$1234
movb 100,y,,y
movb 100,y,64,y
movb 100,y,1000,y
movb 100,y,[d,sp]
movb 100,y,[500,y]
movb 1000,y,$1234
movb 1000,y,,y
movb 1000,y,64,y
movb 1000,y,10000,y
movb 1000,y,[d,sp]
movb 1000,y,[500,y]
movb [d,sp],$1234
movb [d,sp],,y
movb [d,sp],64,y
movb [d,sp],10000,y
movb [d,sp],[d,sp]
movb [d,sp],[500,y]
movb [500,y],$1234
movb [500,y],,y
movb [500,y],64,y
movb [500,y],10000,y
movb [500,y],[d,sp]
movb [500,y],[500,y]
movw #$a56,$1234
movw #$a56,,y
movw #$a56,64,y
movw #$a56,1000,y
movw #$a56,[d,sp]
movw #$a56,[500,y]
movw $2356,$1234
movw $2356,,y
movw $2356,64,y
movw $2356,1000,y
movw $2356,[d,sp]
movw $2356,[500,y]
movw 0,y,$1234
movw 0,y,,y
movw 0,y,64,y
movw 0,y,1000,y
movw 0,y,[d,sp]
movw 0,y,[500,y]
movw 100,y,$1234
movw 100,y,,y
movw 100,y,64,y
movw 100,y,1000,y
movw 100,y,[d,sp]
movw 100,y,[500,y]
movw 1000,y,$1234
movw 1000,y,,y
movw 1000,y,64,y
movw 1000,y,10000,y
movw 1000,y,[d,sp]
movw 1000,y,[500,y]
movw [d,sp],$1234
movw [d,sp],,y
movw [d,sp],64,y
movw [d,sp],10000,y
movw [d,sp],[d,sp]
movw [d,sp],[500,y]
movw [500,y],$1234
movw [500,y],,y
movw [500,y],64,y
movw [500,y],10000,y
movw [500,y],[d,sp]
movw [500,y],[500,y]
|
utils/vector3.adb | Lucretia/old_nehe_ada95 | 0 | 12713 | <filename>utils/vector3.adb
---------------------------------------------------------------------------------
-- Copyright 2004-2005 © <NAME>
--
-- This code is to be used for tutorial purposes only.
-- You may not redistribute this code in any form without my express permission.
---------------------------------------------------------------------------------
with Ada.Numerics.Generic_Elementary_Functions;
package body Vector3 is
package Trig is new Ada.Numerics.Generic_Elementary_Functions(Float);
-- ||V|| = Sqrt(V.V)
function Length(Self : in Object) return Float is
begin
return Trig.Sqrt((Self.X * Self.X) + (Self.Y * Self.Y) + (Self.Z * Self.Z));
end Length;
-- V
-- Norm(V) = -----
-- ||V||
procedure Normalise(Self : in out Object) is
L : Float := Length(Self);
begin
Self.X := Self.X / L;
Self.Y := Self.Y / L;
Self.Z := Self.Z / L;
end Normalise;
-- Dot product.
function Dot(Self, Operand : in Object) return Float is
begin
return (Self.X * Operand.X) + (Self.Y * Operand.Y) + (Self.Z * Operand.Z);
end Dot;
-- Cross product.
function Cross(Self, Operand : in Object) return Object is
begin
return Object'((Self.Y * Operand.Z) - (Self.Z * Operand.Y), (Self.Z * Operand.X) - (Self.X * Operand.Z), (Self.X * Operand.Y) - (Self.Y * Operand.X));
end Cross;
function "+"(Left, Right : in Object) return Object is
begin
return Object'(Left.X + Right.X, Left.Y + Right.Y, Left.Z + Right.Z);
end "+";
function "-"(Left, Right : in Object) return Object is
begin
return Object'(Left.X - Right.X, Left.Y - Right.Y, Left.Z - Right.Z);
end "-";
function "-"(Left : in Object) return Object is
begin
return Object'(-Left.X, -Left.Y, -Left.Z);
end "-";
function "*"(Left : in Object; Right : in Float) return Object is
begin
return Object'(Left.X * Right, Left.Y * Right, Left.Z * Right);
end "*";
function "/"(Left : in Object; Right : in Float) return Object is
begin
return Object'(Left.X / Right, Left.Y / Right, Left.Z / Right);
end "/";
function Output(Self : in Object) return String is
begin
return "X: " & Float'Image(Self.X) & " Y: " & Float'Image(Self.Y) & " Z: " & Float'Image(Self.Z);
end Output;
end Vector3;
|
src/hnf-tests.agda | xoltar/cedille | 0 | 7810 | <gh_stars>0
module hnf-tests where
open import bool
open import list
open import nat
open import product
open import string
open import cedille-types
open import conversion
open import ctxt
open import is-free
open import rename
open import subst
open import syntax-util
open import to-string
S : term
S = mlam "n" (mlam "s" (mlam "z" (mapp (mvar "s") (mapp (mapp (mvar "n") (mvar "s")) (mvar "z")))))
plus : term
plus = mlam "n" (mlam "m" (mapp (mapp (mvar "n") S) (mvar "m")))
run : term → term
run t = hnf new-ctxt unfold-head t
show : term → string
show t = term-to-string t
s2 = show (run (mapp S (mvar "z")))
-- λ s . (λ x . λ s . x λ s' . f s' s) s
t1 = mlam "s" (mapp (mlam "x" (mlam "s" (mapp (mvar "x") (mlam "s'" (mapp (mapp (mvar "f") (mvar "s'")) (mvar "s")))))) (mvar "s"))
s1 = show (run t1)
Γ = ctxt-var-decl "s" new-ctxt
q = show (subst-term Γ (mvar "s") "x" (mlam "s" (mapp (mvar "x") (mlam "s'" (mapp (mapp (mvar "f") (mvar "s'")) (mvar "s"))))))
r = show (subst-term Γ (mvar "s") "x" (mlam "s" (mlam "s'" (mapp (mapp (mvar "f") (mvar "s'")) (mvar "s")))))
aa = rename-var-if Γ empty-renamectxt "s" (mvar "s")
Γ' = ctxt-var-decl "s'" Γ
ρ = renamectxt-insert empty-renamectxt "s" "s'"
bb = show (substh-term Γ' ρ (mvar "s") "x" (mlam "s'" (mapp (mapp (mvar "f") (mvar "s'")) (mvar "s"))))
cc = rename-var-if Γ' ρ "s'" (mvar "s")
try-pull-lift-types : type → type → type
try-pull-lift-types tp1 tp2 with decompose-tpapps tp1 | decompose-tpapps (hnf new-ctxt unfold-head tp2)
try-pull-lift-types tp1 tp2 | Lft _ _ X t l , args1 | Lft _ _ X' t' l' , args2 =
if conv-tty* new-ctxt args1 args2 then
try-pull-term-in t l (length args1) [] []
else
TpApp tp1 tp2
where try-pull-term-in : term → liftingType → ℕ → 𝕃 var → 𝕃 liftingType → type
try-pull-term-in t (LiftParens _ l _) n vars ltps = try-pull-term-in t l n vars ltps
try-pull-term-in t (LiftArrow _ l) 0 vars ltps =
recompose-tpapps
(Lft posinfo-gen posinfo-gen X (Lam* vars (hnf Γ no-unfolding (App t NotErased (App* t' (map mvar vars)))))
(LiftArrow* ltps l) , args1)
try-pull-term-in (Lam _ _ _ x _ t) (LiftArrow l1 l2) (suc n) vars ltps =
try-pull-term-in t l2 n (x :: vars) (l1 :: ltps)
try-pull-term-in t (LiftArrow l1 l2) (suc n) vars ltps =
let x = fresh-var "x" (ctxt-binds-var Γ) empty-renamectxt in
try-pull-term-in (App t NotErased (mvar x)) l2 n (x :: vars) (l1 :: ltps)
try-pull-term-in t l n vars ltps = TpApp tp1 tp2
try-pull-lift-types tp1 tp2 | h , a | h' , a' = TpApp tp1 tp2
lta = (TpApp (Lft posinfo-gen posinfo-gen "X" (mvar "f")
(LiftArrow (LiftStar posinfo-gen) (LiftArrow (LiftStar posinfo-gen) (LiftStar posinfo-gen))))
(mtpvar "doit"))
ltb = (TpApp (Lft posinfo-gen posinfo-gen "X" (mvar "t") (LiftStar posinfo-gen)) (mtpvar "doit"))
lt = try-pull-lift-types lta ltb
lts = to-string lt
|
test/Succeed/HidingIsPartOfArgumentNameSince2-5-3.agda | cruhland/agda | 1,989 | 3522 | <filename>test/Succeed/HidingIsPartOfArgumentNameSince2-5-3.agda
-- Andreas, 2019-01-20, re #2597.
-- Undocumented language change introduced by patch 31a5982f38 (released in 2.5.3):
-- Hiding of argument now treated as part of name when inserting implicits.
-- Patch introduced in src/full/Agda/TypeChecking/Implicit.hs
--
-- ... | x == y && sameHiding hidingx a = impInsert $ reverse hs
-- | x == y && sameHiding hidingx a = BadImplicits
--
-- Intended was most likely
-- | x == y && not (sameHiding hidingx a) = BadImplicits
--
-- The patch makes this code legal:
test : {{X : Set}} {X : Set} → Set
test {X = X} = X
-- Succeeds in 2.5.3.
-- Fails in 2.5.2 with error:
-- Unexpected implicit argument
-- when checking that the clause test {X = X} = X has type
-- {{X : Set}} {X = X₁ : Set} → Set
|
OS/ASM/OSPort_a.asm | anton-qiu/QuickRTOS | 0 | 167177 | <filename>OS/ASM/OSPort_a.asm<gh_stars>0
$INCLUDE (.\Common\ASM\include.asm)
AREA OS_PORT_ASM, CODE // READONLY, ALIGN=4
ENTRY
EXTERN DATA (psCurrentTCB)
PUBLIC OS_RestoreContext?A
PUBLIC OS_ContextSwitch?A
;;/*******************************************************************************
;;* Function Name : void TASK_SAVECONTEXT(void)
;;* Description : Saves current processor state to (Task)Stack
;;* and update psCurrentTCB->pTopOfStack with the current SP.
;;* Should only be called from System/User Mode.
;;* DO NOT CALL FROM EXCEPTION MODE.
;;*---------------------------------------------------------------------
;;* Global Variable : psCurrentTCB
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
TASK_SAVECONTEXT MACRO /* Currently no parameters */
;;-----------------------------
STMFD SP!, {LR} ;; Push return address
STMFD SP, {LR}^ ;; Push User LR
SUB SP, SP, #4 ;; then update SP
STMFD SP!, {R0-R12} ;; Push registers
MRS R1, CPSR ;; Push current CPSR
STMFD SP!, {R1}
;; Saves Top of Stack to psCurrentTCB->pTopOfStack
LDR R1, =psCurrentTCB ;; R1 = &psCurrentTCB
LDR R2, [R1] ;; R2 = psCurrentTCB
STR SP, [R2] ;; psCurrentTCB->pTopOfStack = SP
ENDM
;;/*******************************************************************************
;;* Function Name : void OS_RestoreContext(void)
;;* Description : Restore Context from psCurrentTCB->pTopOfStack
;;* (Current Task Stack) to restore processor registers state.
;;* and jump to the task code (in Program Counter).
;;* Should only be called from System/User Mode.
;;* DO NOT CALL FROM EXCEPTION MODE.
;;*---------------------------------------------------------------------
;;* Global Variable : psCurrentTCB
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : -
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
IF (ENV_RVDS == 1)
CODE32
OS_RestoreContext?A PROC
ENDIF
IF (ENV_KEIL == 1)
OS_RestoreContext?A PROC CODE32
ENDIF
LDR R1, =psCurrentTCB ;;R1 = &(psCurrentTCB)
LDR R0, [R1] ;;R0 = psCurrentTCB
LDR SP, [R0] ;;SP = (psCurrentTCB->pTopOfStack)
LDMFD SP!, {R0} ;; Pop CPSR
MSR SPSR_cxsf, R0
LDMFD SP!, {R0-R12,LR,PC}^ ;; Pop registers and jump
ENDP
;;/*******************************************************************************
;;* Function Name : void OS_ContextSwitch(TS_TCB *psDest)
;;* Description : Perform software context switch (Force Context Switch).
;;* This function will internally save the context, and restore
;;* context from the target TCB.
;;* Should only be called from System/User Mode.
;;* DO NOT CALL FROM EXCEPTION MODE.
;;*---------------------------------------------------------------------
;;* Global Variable : psCurrentTCB
;;*
;;* Input Parameter : -
;;* Output Parameter : -
;;* Subroutine Called : OS_RestoreContext()
;;* DD/MM/YY(Author) Changes Notes
;;*---------------------------------------------------------------------
;;* 11/01/07(ABQ) : Initial Version
;;*******************************************************************************/
IF (ENV_RVDS == 1)
CODE32
OS_ContextSwitch?A PROC
ENDIF
IF (ENV_KEIL == 1)
OS_ContextSwitch?A PROC CODE32
ENDIF
;; SAVE CONTEXT
TASK_SAVECONTEXT
STR R0, [R1] ;; psCurrentTCB = psDest;
;; RESTORE CONTEXT
B OS_RestoreContext?A
ENDP
;;----------------------------------------------------------------------------
;;----------------------------------------------------------------------------
END
|
examples/tactics/ac/Bool.agda | cruhland/agda | 1,989 | 7283 |
module Bool where
import Logic
open Logic
data Bool : Set where
false : Bool
true : Bool
infixr 5 _&&_
_&&_ : Bool -> Bool -> Bool
true && x = x
false && _ = false
not : Bool -> Bool
not true = false
not false = true
IsTrue : Bool -> Set
IsTrue true = True
IsTrue false = False
IsFalse : Bool -> Set
IsFalse x = IsTrue (not x)
module BoolEq where
_==_ : Bool -> Bool -> Bool
true == x = x
false == x = not x
subst : {x y : Bool}(P : Bool -> Set) -> IsTrue (x == y) -> P x -> P y
subst {true}{true} _ _ px = px
subst {false}{false} _ _ px = px
subst {true}{false} _ () _
subst {false}{true} _ () _
isTrue== : {x : Bool} -> IsTrue x -> IsTrue (x == true)
isTrue== {true} _ = tt
isTrue== {false} ()
infix 1 if_then_else_
if_then_else_ : {A : Set} -> Bool -> A -> A -> A
if true then x else y = x
if false then x else y = y
open BoolEq
if'_then_else_ : {A : Set} -> (x : Bool) -> (IsTrue x -> A) -> (IsFalse x -> A) -> A
if' true then f else g = f tt
if' false then f else g = g tt
isTrue&&₁ : {x y : Bool} -> IsTrue (x && y) -> IsTrue x
isTrue&&₁ {true} _ = tt
isTrue&&₁ {false} ()
isTrue&&₂ : {x y : Bool} -> IsTrue (x && y) -> IsTrue y
isTrue&&₂ {true} p = p
isTrue&&₂ {false} ()
|
lab2/es4.asm | neskov7/AssemblyProgramsCE | 0 | 28631 | .model small
.stack
.data
giorni db 2
ore db 2
minuti db 30
minutiTotali dw 0
oreingiorno db 24
minutiinora db 60
.code
.startup
mov bx,0
mov ax,0
mov al, giorni
cbw
mul oreingiorno
mov bx,ax
mov al,ore
cbw
add ax,bx
mul minutiinora
mov bx,ax
mov al,minuti
cbw
add ax,bx
jo err
mov minutiTotali ,ax
jmp fine
err:
mov minutiTotali, 0FFFFh
fine:
.exit
end |
oeis/205/A205163.asm | neoneye/loda-programs | 11 | 22048 | <gh_stars>10-100
; A205163: Number of (n+1) X 2 0..3 arrays with every 2 X 2 subblock having unequal diagonal elements or unequal antidiagonal elements, and new values 0..3 introduced in row major order.
; Submitted by <NAME>
; 13,159,2277,33831,506493,7594479,113908437,1708600311,25628925933,384433652799,5766504083397,86497559125191,1297463380500573,19461950688376719,291929260268255157,4378938903851640471,65684083557258046413,985261253357321014239,14778918800355166167717,221683782005313545378151,3325256730079661339259453,49878850951194794564653359,748182764267921541897085077,11222741464018821998738130231,168341121960282326591917515693,2525116829404234888711299422079,37876752441063523300167101391237
add $0,1
mov $1,5
pow $1,$0
lpb $0
sub $0,1
add $1,1
mul $1,3
lpe
sub $1,20
mul $1,6
add $1,129
mov $0,$1
div $0,9
|
courses/spark_for_ada_programmers/labs/source/030_spark_language_and_tools/aliasing.ads | AdaCore/training_material | 15 | 29492 | package Aliasing
with SPARK_Mode => On
is
type Rec is record
F, G : Integer;
end Record;
procedure Multiply (X, Y : in Rec;
Z : out Rec);
procedure Test;
end Aliasing;
|
Numeral/Natural/Relation.agda | Lolirofle/stuff-in-agda | 6 | 7598 | <reponame>Lolirofle/stuff-in-agda
module Numeral.Natural.Relation where
open import Data.Boolean.Stmt
open import Numeral.Natural
open import Numeral.Natural.Oper.Comparisons
open import Logic.Propositional
open import Logic
import Lvl
open import Relator.Equals
open import Type
Positive : ℕ → Stmt
Positive(n) = IsTrue(positive? n)
zero-not-positive : ¬ Positive(𝟎)
zero-not-positive ()
positive-not-zero : ∀{n} → ⦃ _ : Positive(n) ⦄ → (n ≢ 𝟎)
positive-not-zero {𝟎} ⦃ pos ⦄ _ = pos
non-zero-positive : ∀{n} → (n ≢ 𝟎) → Positive(n)
non-zero-positive {𝟎} p = p [≡]-intro
non-zero-positive {𝐒 n} p = [⊤]-intro
|
arch/ARM/STM32/svd/stm32l4x5/stm32_svd-dbgmcu.ads | morbos/Ada_Drivers_Library | 2 | 9927 | -- This spec has been automatically generated from STM32L4x5.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package STM32_SVD.DBGMCU is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype IDCODE_DEV_ID_Field is HAL.UInt16;
subtype IDCODE_REV_ID_Field is HAL.UInt16;
-- MCU Device ID Code Register
type IDCODE_Register is record
-- Read-only. Device Identifier
DEV_ID : IDCODE_DEV_ID_Field;
-- Read-only. Revision Identifier
REV_ID : IDCODE_REV_ID_Field;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for IDCODE_Register use record
DEV_ID at 0 range 0 .. 15;
REV_ID at 0 range 16 .. 31;
end record;
subtype CR_TRACE_MODE_Field is HAL.UInt2;
-- Debug MCU Configuration Register
type CR_Register is record
-- Debug Sleep Mode
DBG_SLEEP : Boolean := False;
-- Debug Stop Mode
DBG_STOP : Boolean := False;
-- Debug Standby Mode
DBG_STANDBY : Boolean := False;
-- unspecified
Reserved_3_4 : HAL.UInt2 := 16#0#;
-- Trace pin assignment control
TRACE_IOEN : Boolean := False;
-- Trace pin assignment control
TRACE_MODE : CR_TRACE_MODE_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
DBG_SLEEP at 0 range 0 .. 0;
DBG_STOP at 0 range 1 .. 1;
DBG_STANDBY at 0 range 2 .. 2;
Reserved_3_4 at 0 range 3 .. 4;
TRACE_IOEN at 0 range 5 .. 5;
TRACE_MODE at 0 range 6 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-- APB Low Freeze Register 1
type APB1_FZR1_Register is record
-- Debug Timer 2 stopped when Core is halted
DBG_TIMER2_STOP : Boolean := False;
-- TIM3 counter stopped when core is halted
DBG_TIM3_STOP : Boolean := False;
-- TIM4 counter stopped when core is halted
DBG_TIM4_STOP : Boolean := False;
-- TIM5 counter stopped when core is halted
DBG_TIM5_STOP : Boolean := False;
-- Debug Timer 6 stopped when Core is halted
DBG_TIMER6_STOP : Boolean := False;
-- TIM7 counter stopped when core is halted
DBG_TIM7_STOP : Boolean := False;
-- unspecified
Reserved_6_9 : HAL.UInt4 := 16#0#;
-- Debug RTC stopped when Core is halted
DBG_RTC_STOP : Boolean := False;
-- Debug Window Wachdog stopped when Core is halted
DBG_WWDG_STOP : Boolean := False;
-- Debug Independent Wachdog stopped when Core is halted
DBG_IWDG_STOP : Boolean := False;
-- unspecified
Reserved_13_20 : HAL.UInt8 := 16#0#;
-- I2C1 SMBUS timeout mode stopped when core is halted
DBG_I2C1_STOP : Boolean := False;
-- I2C2 SMBUS timeout mode stopped when core is halted
DBG_I2C2_STOP : Boolean := False;
-- I2C3 SMBUS timeout counter stopped when core is halted
DBG_I2C3_STOP : Boolean := False;
-- unspecified
Reserved_24_24 : HAL.Bit := 16#0#;
-- bxCAN stopped when core is halted
DBG_CAN_STOP : Boolean := False;
-- unspecified
Reserved_26_30 : HAL.UInt5 := 16#0#;
-- LPTIM1 counter stopped when core is halted
DBG_LPTIMER_STOP : Boolean := False;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB1_FZR1_Register use record
DBG_TIMER2_STOP at 0 range 0 .. 0;
DBG_TIM3_STOP at 0 range 1 .. 1;
DBG_TIM4_STOP at 0 range 2 .. 2;
DBG_TIM5_STOP at 0 range 3 .. 3;
DBG_TIMER6_STOP at 0 range 4 .. 4;
DBG_TIM7_STOP at 0 range 5 .. 5;
Reserved_6_9 at 0 range 6 .. 9;
DBG_RTC_STOP at 0 range 10 .. 10;
DBG_WWDG_STOP at 0 range 11 .. 11;
DBG_IWDG_STOP at 0 range 12 .. 12;
Reserved_13_20 at 0 range 13 .. 20;
DBG_I2C1_STOP at 0 range 21 .. 21;
DBG_I2C2_STOP at 0 range 22 .. 22;
DBG_I2C3_STOP at 0 range 23 .. 23;
Reserved_24_24 at 0 range 24 .. 24;
DBG_CAN_STOP at 0 range 25 .. 25;
Reserved_26_30 at 0 range 26 .. 30;
DBG_LPTIMER_STOP at 0 range 31 .. 31;
end record;
-- APB Low Freeze Register 2
type APB1_FZR2_Register is record
-- unspecified
Reserved_0_4 : HAL.UInt5 := 16#0#;
-- LPTIM2 counter stopped when core is halted
DBG_LPTIM2_STOP : Boolean := False;
-- unspecified
Reserved_6_31 : HAL.UInt26 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB1_FZR2_Register use record
Reserved_0_4 at 0 range 0 .. 4;
DBG_LPTIM2_STOP at 0 range 5 .. 5;
Reserved_6_31 at 0 range 6 .. 31;
end record;
-- APB High Freeze Register
type APB2_FZR_Register is record
-- unspecified
Reserved_0_10 : HAL.UInt11 := 16#0#;
-- TIM1 counter stopped when core is halted
DBG_TIM1_STOP : Boolean := False;
-- unspecified
Reserved_12_12 : HAL.Bit := 16#0#;
-- TIM8 counter stopped when core is halted
DBG_TIM8_STOP : Boolean := False;
-- unspecified
Reserved_14_15 : HAL.UInt2 := 16#0#;
-- TIM15 counter stopped when core is halted
DBG_TIM15_STOP : Boolean := False;
-- TIM16 counter stopped when core is halted
DBG_TIM16_STOP : Boolean := False;
-- TIM17 counter stopped when core is halted
DBG_TIM17_STOP : Boolean := False;
-- unspecified
Reserved_19_31 : HAL.UInt13 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for APB2_FZR_Register use record
Reserved_0_10 at 0 range 0 .. 10;
DBG_TIM1_STOP at 0 range 11 .. 11;
Reserved_12_12 at 0 range 12 .. 12;
DBG_TIM8_STOP at 0 range 13 .. 13;
Reserved_14_15 at 0 range 14 .. 15;
DBG_TIM15_STOP at 0 range 16 .. 16;
DBG_TIM16_STOP at 0 range 17 .. 17;
DBG_TIM17_STOP at 0 range 18 .. 18;
Reserved_19_31 at 0 range 19 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Debug support
type DBGMCU_Peripheral is record
-- MCU Device ID Code Register
IDCODE : aliased IDCODE_Register;
-- Debug MCU Configuration Register
CR : aliased CR_Register;
-- APB Low Freeze Register 1
APB1_FZR1 : aliased APB1_FZR1_Register;
-- APB Low Freeze Register 2
APB1_FZR2 : aliased APB1_FZR2_Register;
-- APB High Freeze Register
APB2_FZR : aliased APB2_FZR_Register;
end record
with Volatile;
for DBGMCU_Peripheral use record
IDCODE at 16#0# range 0 .. 31;
CR at 16#4# range 0 .. 31;
APB1_FZR1 at 16#8# range 0 .. 31;
APB1_FZR2 at 16#C# range 0 .. 31;
APB2_FZR at 16#10# range 0 .. 31;
end record;
-- Debug support
DBGMCU_Periph : aliased DBGMCU_Peripheral
with Import, Address => System'To_Address (16#E0042000#);
end STM32_SVD.DBGMCU;
|
Task/Find-limit-of-recursion/Ada/find-limit-of-recursion.ada | mullikine/RosettaCodeData | 1 | 23374 | with Ada.Text_IO; use Ada.Text_IO;
procedure Test_Recursion_Depth is
function Recursion (Depth : Positive) return Positive is
begin
return Recursion (Depth + 1);
exception
when Storage_Error =>
return Depth;
end Recursion;
begin
Put_Line ("Recursion depth on this system is" & Integer'Image (Recursion (1)));
end Test_Recursion_Depth;
|
src/boot/entry.asm | RyanSchuster/vos64 | 1 | 86354 | %define MOD_ENTRY
; module: Entry
%include "defs/common.inc"
%include "boot/layout.inc"
%include "debug/debug.inc"
%include "hal/pmem.inc"
%ifdef TEST_BITMAP
%include "lib/bitmap.inc"
%endif ; TEST_BITMAP
[section .text]
[bits 64]
;-------------------------------------------------------------------------------
; function: Entry
;
; brief: Entry point for the kernel proper
;
; pass:
; /
;
; return:
; Doesn't return
; /
;
; sideeffects:
; /
;
; detail:
; /
;-------------------------------------------------------------------------------
[global Entry]
Entry:
mov rsp, stack
call DebugInit
%ifdef TEST_BITMAP
; call BitmapTest
cli
hlt
%endif
call PMemInit
; loadAddrBegin
; loadAddrEnd
; loadSize
PRINTQ kernSize
cli
hlt
[section .data]
message:
db "There is no chin under Mr. Vos's beard. Only another beard."
db CHAR_CR, CHAR_LF, CHAR_NUL
[section .bss]
testSnap1:
resb debug_snap_t_size
testSnap2:
resb debug_snap_t_size
resb 0x1000
stack:
test_bss:
resb 0x100000
|
oeis/021/A021140.asm | neoneye/loda-programs | 11 | 105005 | <reponame>neoneye/loda-programs
; A021140: Decimal expansion of 1/136.
; 0,0,7,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2
add $0,1
mov $2,10
pow $2,$0
div $2,136
mov $0,$2
mod $0,10
|
other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/kart/risc.lzh/risc/sfxdos/ascii.asm | prismotizm/gigaleak | 0 | 2409 | Name: ascii.asm
Type: file
Size: 12622
Last-Modified: '1991-10-30T10:00:28Z'
SHA-1: C3E7C99A9AA8E3A6AD662A1567522A4BCD8180B3
Description: null
|
programs/oeis/037/A037953.asm | neoneye/loda | 22 | 88093 | <reponame>neoneye/loda
; A037953: C(n,[ (n-5)/2 ]).
; 0,0,0,0,0,1,1,7,8,36,45,165,220,715,1001,3003,4368,12376,18564,50388,77520,203490,319770,817190,1307504,3268760,5311735,13037895,21474180,51895935,86493225,206253075
mov $1,$0
div $1,2
add $1,3
bin $0,$1
|
everything.agda | rfindler/ial | 29 | 6809 | <filename>everything.agda
module everything where
open import lib public
|
src/fot/LTC-PCF/Data/Nat/Inequalities/ConversionRules.agda | asr/fotc | 11 | 5377 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Conversion rules for inequalities
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module LTC-PCF.Data.Nat.Inequalities.ConversionRules where
open import Common.FOL.Relation.Binary.EqReasoning
open import LTC-PCF.Base
open import LTC-PCF.Data.Nat.Inequalities
------------------------------------------------------------------------------
private
-- Before to prove some properties for lt it is convenient
-- to descompose the behavior of the function step by step.
-- Initially, we define the possible states (lt-s₁,
-- lt-s₂, ...). Then we write down the proof for
-- the execution step from the state p to the state q, e.g.
--
-- proof₁→proof₂ : ∀ m n → lt-s₂ m n → lt-s₃ m n.
-- The terms lt-00, lt-0S, lt-S0 and lt-SS show the use of the
-- states lt-s₁, lt-s₂, ..., and the proofs associated with the
-- execution steps.
----------------------------------------------------------------------
-- The steps of lt.
-- Initially, the conversion rule fix-eq is applied.
lt-s₁ : D → D → D
lt-s₁ m n = lth (fix lth) · m · n
-- First argument application.
lt-s₂ : D → D
lt-s₂ m = lam (λ n →
if (iszero₁ n)
then false
else (if (iszero₁ m)
then true
else (fix lth · pred₁ m · pred₁ n)))
-- Second argument application.
lt-s₃ : D → D → D
lt-s₃ m n = if (iszero₁ n)
then false
else (if (iszero₁ m)
then true
else (fix lth · pred₁ m · pred₁ n))
-- Reduction iszero₁ n ≡ b.
lt-s₄ : D → D → D → D
lt-s₄ m n b = if b
then false
else (if (iszero₁ m)
then true
else (fix lth · pred₁ m · pred₁ n))
-- Reduction iszero₁ n ≡ true.
-- It should be
-- lt-s₅ : D → D → D
-- lt-s₅ m n = false
-- but we do not give a name to this step.
-- Reduction iszero₁ n ≡ false.
lt-s₅ : D → D → D
lt-s₅ m n = if (iszero₁ m) then true else (fix lth · pred₁ m · pred₁ n)
-- Reduction iszero₁ m ≡ b.
lt-s₆ : D → D → D → D
lt-s₆ m n b = if b then true else (fix lth · pred₁ m · pred₁ n)
-- Reduction iszero₁ m ≡ true.
-- It should be
-- lt-s₇ : D → D → D
-- lt-s₇ m n = true
-- but we do not give a name to this step.
-- Reduction iszero₁ m ≡ false.
lt-s₇ : D → D → D
lt-s₇ m n = fix lth · pred₁ m · pred₁ n
-- Reduction pred₁ (succ m) ≡ m.
lt-s₈ : D → D → D
lt-s₈ m n = fix lth · m · pred₁ n
-- Reduction pred₁ (succ n) ≡ n.
lt-s₉ : D → D → D
lt-s₉ m n = fix lth · m · n
----------------------------------------------------------------------
-- The execution steps
{-
To prove the execution steps, e.g.
proof₃→proof₄ : ∀ m n → lt-s₃ m n → lt-s₄ m n)
we usually need to prove that
C [m] ≡ C [n] (1)
given that
m ≡ n, (2)
where (2) is a conversion rule usually.
We prove (1) using
subst : ∀ {x y} (A : D → Set) → x ≡ y → A x → A y
where
• P is given by λ t → C [m] ≡ C [t],
• x ≡ y is given m ≡ n and
• P x is given by C [m] ≡ C [m] (i.e. refl).
-}
-- Application of the conversion rule fix-eq.
proof₀₋₁ : ∀ m n → fix lth · m · n ≡ lt-s₁ m n
proof₀₋₁ m n = subst (λ x → x · m · n ≡ lth (fix lth) · m · n)
(sym (fix-eq lth))
refl
-- Application of the first argument.
proof₁₋₂ : ∀ m n → lt-s₁ m n ≡ lt-s₂ m · n
proof₁₋₂ m n = subst (λ x → x · n ≡ lt-s₂ m · n)
(sym (beta lt-s₂ m))
refl
-- Application of the second argument.
proof₂₋₃ : ∀ m n → lt-s₂ m · n ≡ lt-s₃ m n
proof₂₋₃ m n = beta (lt-s₃ m) n
-- Reduction iszero n ≡ b using that proof.
proof₃₋₄ : ∀ m n b → iszero₁ n ≡ b → lt-s₃ m n ≡ lt-s₄ m n b
proof₃₋₄ m n .(iszero₁ n) refl = refl
-- Reduction of iszero₁ n ≡ true using the conversion rule if-true.
proof₄₊ : ∀ m n → lt-s₄ m n true ≡ false
proof₄₊ m n = if-true false
-- Reduction of iszero₁ n ≡ false ... using the conversion rule
-- if-false.
proof₄₋₅ : ∀ m n → lt-s₄ m n false ≡ lt-s₅ m n
proof₄₋₅ m n = if-false (lt-s₅ m n)
-- Reduction iszero₁ m ≡ b using that proof.
proof₅₋₆ : ∀ m n b → iszero₁ m ≡ b → lt-s₅ m n ≡ lt-s₆ m n b
proof₅₋₆ m n .(iszero₁ m) refl = refl
-- Reduction of iszero₁ m ≡ true using the conversion rule if-true.
proof₆₊ : ∀ m n → lt-s₆ m n true ≡ true
proof₆₊ m n = if-true true
-- Reduction of iszero₁ m ≡ false ... using the conversion rule
-- if-false.
proof₆₋₇ : ∀ m n → lt-s₆ m n false ≡ lt-s₇ m n
proof₆₋₇ m n = if-false (lt-s₇ m n)
-- Reduction pred (succ m) ≡ m using the conversion rule pred-S.
proof₇₋₈ : ∀ m n → lt-s₇ (succ₁ m) n ≡ lt-s₈ m n
proof₇₋₈ m n = subst (λ x → lt-s₈ x n ≡ lt-s₈ m n)
(sym (pred-S m))
refl
-- Reduction pred (succ n) ≡ n using the conversion rule pred-S.
proof₈₋₉ : ∀ m n → lt-s₈ m (succ₁ n) ≡ lt-s₉ m n
proof₈₋₉ m n = subst (λ x → lt-s₉ m x ≡ lt-s₉ m n)
(sym (pred-S n))
refl
------------------------------------------------------------------------------
private
X≮0 : ∀ n → n ≮ zero
X≮0 n = fix lth · n · zero ≡⟨ proof₀₋₁ n zero ⟩
lt-s₁ n zero ≡⟨ proof₁₋₂ n zero ⟩
lt-s₂ n · zero ≡⟨ proof₂₋₃ n zero ⟩
lt-s₃ n zero ≡⟨ proof₃₋₄ n zero true iszero-0 ⟩
lt-s₄ n zero true ≡⟨ proof₄₊ n zero ⟩
false ∎
lt-00 : zero ≮ zero
lt-00 = X≮0 zero
lt-0S : ∀ n → zero < succ₁ n
lt-0S n =
fix lth · zero · (succ₁ n) ≡⟨ proof₀₋₁ zero (succ₁ n) ⟩
lt-s₁ zero (succ₁ n) ≡⟨ proof₁₋₂ zero (succ₁ n) ⟩
lt-s₂ zero · (succ₁ n) ≡⟨ proof₂₋₃ zero (succ₁ n) ⟩
lt-s₃ zero (succ₁ n) ≡⟨ proof₃₋₄ zero (succ₁ n) false (iszero-S n) ⟩
lt-s₄ zero (succ₁ n) false ≡⟨ proof₄₋₅ zero (succ₁ n) ⟩
lt-s₅ zero (succ₁ n) ≡⟨ proof₅₋₆ zero (succ₁ n) true iszero-0 ⟩
lt-s₆ zero (succ₁ n) true ≡⟨ proof₆₊ zero (succ₁ n) ⟩
true ∎
lt-S0 : ∀ n → succ₁ n ≮ zero
lt-S0 n = X≮0 (succ₁ n)
lt-SS : ∀ m n → lt (succ₁ m) (succ₁ n) ≡ lt m n
lt-SS m n =
fix lth · (succ₁ m) · (succ₁ n) ≡⟨ proof₀₋₁ (succ₁ m) (succ₁ n) ⟩
lt-s₁ (succ₁ m) (succ₁ n) ≡⟨ proof₁₋₂ (succ₁ m) (succ₁ n) ⟩
lt-s₂ (succ₁ m) · (succ₁ n) ≡⟨ proof₂₋₃ (succ₁ m) (succ₁ n) ⟩
lt-s₃ (succ₁ m) (succ₁ n) ≡⟨ proof₃₋₄ (succ₁ m) (succ₁ n) false (iszero-S n) ⟩
lt-s₄ (succ₁ m) (succ₁ n) false ≡⟨ proof₄₋₅ (succ₁ m) (succ₁ n) ⟩
lt-s₅ (succ₁ m) (succ₁ n) ≡⟨ proof₅₋₆ (succ₁ m) (succ₁ n) false (iszero-S m) ⟩
lt-s₆ (succ₁ m) (succ₁ n) false ≡⟨ proof₆₋₇ (succ₁ m) (succ₁ n) ⟩
lt-s₇ (succ₁ m) (succ₁ n) ≡⟨ proof₇₋₈ m (succ₁ n) ⟩
lt-s₈ m (succ₁ n) ≡⟨ proof₈₋₉ m n ⟩
lt-s₉ m n ∎
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0x48_notsx.log_21829_1407.asm | ljhsiun2/medusa | 9 | 161831 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xc483, %rax
nop
nop
nop
nop
and %r10, %r10
movups (%rax), %xmm2
vpextrq $1, %xmm2, %r15
nop
nop
nop
nop
nop
and %r14, %r14
lea addresses_UC_ht+0x10903, %rsi
lea addresses_WC_ht+0x1a013, %rdi
nop
cmp %r13, %r13
mov $73, %rcx
rep movsb
nop
nop
cmp %rcx, %rcx
lea addresses_A_ht+0xcd03, %rax
clflush (%rax)
nop
sub %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, %xmm1
vmovups %ymm1, (%rax)
nop
nop
nop
nop
xor %r15, %r15
lea addresses_UC_ht+0xa203, %rax
nop
nop
xor $64379, %r14
mov $0x6162636465666768, %r15
movq %r15, %xmm3
and $0xffffffffffffffc0, %rax
movaps %xmm3, (%rax)
nop
nop
add %r15, %r15
lea addresses_A_ht+0xb203, %rax
nop
nop
nop
nop
nop
add %r10, %r10
mov $0x6162636465666768, %r15
movq %r15, %xmm2
vmovups %ymm2, (%rax)
nop
and %r15, %r15
lea addresses_D_ht+0x16403, %rsi
lea addresses_UC_ht+0x16103, %rdi
nop
nop
nop
nop
nop
sub %r15, %r15
mov $107, %rcx
rep movsq
sub %r15, %r15
lea addresses_A_ht+0x903, %r14
nop
nop
nop
nop
nop
and $26907, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm1
movups %xmm1, (%r14)
cmp $14370, %r13
lea addresses_WC_ht+0xf7af, %rsi
clflush (%rsi)
nop
nop
nop
nop
cmp $10374, %rax
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
movups %xmm2, (%rsi)
nop
sub $8343, %r13
lea addresses_normal_ht+0x1983, %rcx
nop
nop
nop
nop
nop
and $14458, %rdi
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x819b, %rcx
nop
nop
cmp %r13, %r13
movw $0x6162, (%rcx)
nop
nop
nop
nop
nop
and $61761, %r15
lea addresses_D_ht+0x1a2d4, %rsi
lea addresses_UC_ht+0xfad6, %rdi
inc %r15
mov $110, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0xbb03, %rsi
lea addresses_WC_ht+0xc12b, %rdi
nop
and %r15, %r15
mov $111, %rcx
rep movsb
nop
nop
nop
nop
nop
and %rax, %rax
lea addresses_UC_ht+0xc8a7, %rsi
lea addresses_A_ht+0x6553, %rdi
nop
nop
nop
sub %rax, %rax
mov $93, %rcx
rep movsq
nop
nop
nop
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r9
push %rbp
push %rdx
push %rsi
// Faulty Load
lea addresses_PSE+0x10903, %r11
nop
nop
nop
nop
xor $63113, %rbp
movntdqa (%r11), %xmm1
vpextrq $0, %xmm1, %r9
lea oracles, %r10
and $0xff, %r9
shlq $12, %r9
mov (%r10,%r9,1), %r9
pop %rsi
pop %rdx
pop %rbp
pop %r9
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_PSE', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_PSE', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 6}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_normal_ht', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 9, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
src/main/resources/g4/TextExpParser.g4 | wellhor/RuleTools | 2 | 3416 | parser grammar TextExpParser;
options {
tokenVocab = TextExpLexer;
language = Java;
}
root : expression ((AND | OR) expression)+ | expression EOF;
expression :
leftExpr = expression operator = (AND | OR) rightExpr = expression # binaryExpression
| NOT expression # notExpression
| LPAREN expression RPAREN # rparenExpression
| WORD # singleWordExpression
| ROLE_WORD # roleWordExpression
| (WORD | ROLE_WORD) ((AFTER) (WORD | ROLE_WORD))+ # afterWordExpression
| STAR # starExpress
; |
Task/Balanced-ternary/Ada/balanced-ternary-3.ada | LaudateCorpus1/RosettaCodeData | 1 | 20989 | <filename>Task/Balanced-ternary/Ada/balanced-ternary-3.ada
with Ada.Text_Io; use Ada.Text_Io;
with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;
with BT; use BT;
procedure TestBT is
Result, A, B, C : Balanced_Ternary;
begin
A := To_Balanced_Ternary("+-0++0+");
B := To_Balanced_Ternary(-436);
C := To_Balanced_Ternary("+-++-");
Result := A * (B - C);
Put("a = "); Put(To_integer(A), 4); New_Line;
Put("b = "); Put(To_integer(B), 4); New_Line;
Put("c = "); Put(To_integer(C), 4); New_Line;
Put("a * (b - c) = "); Put(To_integer(Result), 4);
Put_Line (" " & To_String(Result));
end TestBT;
|
src/asm/boot.asm | foophoof/fuselage | 0 | 164640 | <gh_stars>0
extern kmain
global start
KERNEL_BASE equ 0xFFFFC00000000000
section .bootstrap
bits 32
start:
; make Multiboot information available to Rust as first argument
mov edi, ebx
; Check that we are loaded by a multiboot2-compliant bootloader
call check_multiboot2
; map first and 384th PML4 entry to PDP table
; (so virtual address 0xFFFFC00000000000 = physical address 0)
mov eax, pdp_table - KERNEL_BASE
or eax, 0b11 ; present + writable
mov [pml4_table - KERNEL_BASE], eax
mov [pml4_table - KERNEL_BASE + 384 * 8], eax
; map first PDP entry to PD table
mov eax, pd_table - KERNEL_BASE
or eax, 0b11
mov [pdp_table - KERNEL_BASE], eax
; map each PD entry to a huge (2MiB) page
mov ecx, 0
.loop:
mov eax, 0x200000
mul ecx
or eax, 0b10000011 ; present + writable + huge
mov [pd_table - KERNEL_BASE + ecx * 8], eax
inc ecx
cmp ecx, 512
jne .loop
; load PML4 to cr3 register
mov eax, pml4_table - KERNEL_BASE
mov cr3, eax
; enable PAE flag in cr4
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
; set the long mode bit in the EFER MSR
mov ecx, 0xC0000080
rdmsr
or eax, 1 << 8
wrmsr
; enable paging in the cr0 register
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
; load GDT
lgdt [gdt64.pointer - KERNEL_BASE]
; update selectors
mov ax, gdt64.data
mov ss, ax
mov ds, ax
mov es, ax
jmp gdt64.code:start64
check_multiboot2:
; Check if EAX contains the magic number as specified by the multiboot2 spec
cmp eax, 0x36d76289
jne .no_multiboot2
ret
.no_multiboot2:
mov esi, no_multiboot2_error - KERNEL_BASE
call print_error
print_error:
mov edi, 0xb8000
.loop:
cmp byte [esi], 0
jz .done
movsb
mov byte [edi], 0x04 ; red text on black background
inc edi
jmp .loop
.done:
hlt
jmp .done
bits 64
start64:
; set stack pointer
mov rsp, stack_top
; jump into Rust
mov rax, kmain
jmp rax
ONE_PAGE equ 4096
STACK_SIZE equ 1024 * 16 ; 16 KiB
section .bss
align 4096
pml4_table:
resb ONE_PAGE
pdp_table:
resb ONE_PAGE
pd_table:
resb ONE_PAGE
page_table:
resb ONE_PAGE
stack_bottom:
resb STACK_SIZE
stack_top:
section .rodata
align 8
gdt64:
dq 0
.code: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41) | (1<<43) | (1<<53)
.data: equ $ - gdt64
dq (1<<44) | (1<<47) | (1<<41)
.pointer:
dw $ - gdt64 - 1
dq gdt64
no_multiboot2_error: db "Boot loader is not multiboot2 compliant!",0
|
fox32rom/draw_pixel.asm | ry755/fox32 | 6 | 97189 | <filename>fox32rom/draw_pixel.asm<gh_stars>1-10
; generic pixel drawing routines
; draw a pixel to a framebuffer
; inputs:
; r0: X coordinate
; r1: Y coordinate
; r2: color
; r3: pointer to framebuffer
; r4: framebuffer width (pixels)
; outputs:
; none
draw_pixel_generic:
push r0
push r1
push r3
push r4
; calculate pointer to the framebuffer
mul r4, 4 ; 4 bytes per pixel
mul r1, r4 ; y * width * 4
mul r0, 4 ; x * 4
add r0, r1 ; y * width * 4 + (x * 4)
add r3, r0
mov r0, r3 ; r0: pointer to framebuffer
mov [r0], r2
pop r4
pop r3
pop r1
pop r0
ret
|
mykernel/ada/bootboot.ads | GeGuNa/boot_boot | 0 | 18001 | --
-- mykernel/ada/bootboot.ads
--
-- Copyright (C) 2017 - 2021 bzt (<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.
--
-- This file is part of the BOOTBOOT Protocol package.
-- @brief A sample BOOTBOOT compatible kernel
--
--
with System;
package bootboot is
type UInt8 is mod (2 ** 8);
type UInt16 is mod (2 ** 16);
type UInt32 is mod (2 ** 32);
type UInt64 is mod (2 ** 64);
type magic_type is array(0 .. 3) of UInt8;
type timezone_type is range -1440 .. +1440;
type datetime_type is array(0 .. 7) of UInt8;
type Screen is array(0 .. Integer'Last) of Uint32;
BOOTBOOT_MMIO : constant := 16#ffffffff_f8000000#; -- memory mapped IO virtual address
BOOTBOOT_FB : constant := 16#ffffffff_fc000000#; -- frame buffer virtual address
BOOTBOOT_INFO : constant := 16#ffffffff_ffe00000#; -- bootboot struct virtual address
BOOTBOOT_ENV : constant := 16#ffffffff_ffe01000#; -- environment string virtual address
BOOTBOOT_CORE : constant := 16#ffffffff_ffe02000#; -- core loadable segment start
-- minimum protocol level:
-- hardcoded kernel name, static kernel memory addresses
PROTOCOL_MINIMAL : constant := 0;
-- static protocol level:
-- kernel name parsed from environment, static kernel memory addresses
PROTOCOL_STATIC : constant := 1;
-- dynamic protocol level:
-- kernel name parsed, kernel memory addresses from ELF or PE symbols
PROTOCOL_DYNAMIC : constant := 2;
-- big-endian flag
PROTOCOL_BIGENDIAN : constant := 128;
-- loader types, just informational
LOADER_BIOS : constant := 0;
LOADER_UEFI : constant := 2;
LOADER_RPI : constant := 4;
LOADER_COREBOOT : constant := 8;
-- framebuffer pixel format, only 32 bits supported
FB_ARGB : constant := 0;
FB_RGBA : constant := 1;
FB_ABGR : constant := 2;
FB_BGRA : constant := 3;
MMAP_USED : constant := 0; -- don't use. Reserved or unknown regions
MMAP_FREE : constant := 1; -- usable memory
MMAP_ACPI : constant := 2; -- acpi memory, volatile and non-volatile as well
MMAP_MMIO : constant := 3; -- memory mapped IO region
INITRD_MAXSIZE : constant := 16; -- Mb
fb : Screen;
for fb'Address use System'To_Address(BOOTBOOT_FB);
pragma Volatile (fb);
type bootboot_struct is
record
-- first 64 bytes is platform independent
magic : magic_type; -- 'BOOT' magic
size : UInt32; -- length of bootboot structure, minimum 128
protocol : UInt8; -- 1, static addresses, see PROTOCOL_* and LOADER_* above
fb_type : UInt8; -- framebuffer type, see FB_* above
numcores : UInt16; -- number of processor cores
bspid : UInt16; -- Bootsrap processor ID (Local APIC Id on x86_64)
timezone : timezone_type; -- in minutes -1440..1440
datetime : datetime_type; -- in BCD yyyymmddhhiiss UTC (independent to timezone)
initrd_ptr : UInt64; -- ramdisk image position and size
initrd_size : UInt64;
fb_ptr : UInt64; -- framebuffer pointer and dimensions
fb_size : UInt32;
fb_width : UInt32;
fb_height : UInt32;
fb_scanline : UInt32;
-- the rest (64 bytes) is platform specific
x86_64_acpi_ptr : UInt64;
x86_64_smbi_ptr : UInt64;
x86_64_efi_ptr : UInt64;
x86_64_mp_ptr : UInt64;
x86_64_unused0 : UInt64;
x86_64_unused1 : UInt64;
x86_64_unused2 : UInt64;
x86_64_unused3 : UInt64;
end record;
bootboot : bootboot_struct;
for bootboot'Address use System'To_Address(BOOTBOOT_INFO);
pragma Volatile (bootboot);
-- mmap entry, type is stored in least significant tetrad (half byte) of size
-- this means size described in 16 byte units (not a problem, most modern
-- firmware report memory in pages, 4096 byte units anyway).
type MMapEnt_type is
record
ptr : UInt64;
size : UInt64;
end record;
MMap : MMapEnt_type;
for MMap'Address use System'To_Address(BOOTBOOT_INFO + 128);
pragma Volatile (MMap);
end bootboot;
|
components/src/gas_sensor/t67xx/t67xx_i2c_io.adb | morbos/Ada_Drivers_Library | 2 | 2831 | <filename>components/src/gas_sensor/t67xx/t67xx_i2c_io.adb
package body T67XX_I2C_IO is
----------
-- Read --
----------
procedure Read
(This : Any_IO_Port;
Func : UInt8;
Register : UInt16;
Nxfer : UInt16;
Response : out I2C_Data)
is
Result : I2C_Status;
Frame : T67XX_Frame;
Buf : I2C_Data (1 .. 5);
for Frame'Address use Buf'Address;
begin
Frame.Func := Func;
Frame.RegNum := Register;
Frame.NReg := Nxfer;
Swap (Frame.RegNum);
Swap (Frame.NReg);
Master_Transmit
(This.Port.all,
This.Device,
Buf,
Result);
if Result /= Ok then
raise Program_Error with "I2C read pt1 error:" & Result'Img;
end if;
This.Ptr.all;
-- Delay_Milliseconds (10);
Master_Receive (This.Port.all,
This.Device,
Response,
Result);
if Result /= Ok then
raise Program_Error with "I2C read pt2 error:" & Result'Img;
end if;
end Read;
procedure Swap (X : in out UInt16)
is
Result : UInt16 := X;
begin
Result := Shift_Left (X, 8) or (Shift_Right (X, 8));
X := Result;
end Swap;
end T67XX_I2C_IO;
|
Test_D.asm | LiaoHanwen/microcomputer-experiment | 0 | 89265 | <reponame>LiaoHanwen/microcomputer-experiment<filename>Test_D.asm
;Test D
;separator is spa 20h
;terminator is cret 0dh
mscore equ 100
;macro for output
optstr macro ostr
push ax
mov dx,offset ostr
mov ah,09h
int 21h
pop ax
endm
optnum macro onum
push ax
mov dl,onum
mov ah,02h
int 21h
pop ax
endm
data segment
buff db 80h
db 0
db 80h dup(0)
flag db 0
count db 0 ;count for score
score db 20h dup(0)
hint db 'input a sequence of scores: ',0dh,0ah,'$'
errstr db 0dh,0ah,'Error: Invalid input!','$'
ovfstr db 0dh,0ah,'Error: Overflow!','$'
head db 0dh,0ah,0dh,0ah,'Rank',09h,'ID',09h,'Score','$'
newl db 0dh,0ah,'$'
data ends
stack segment stack'stack'
db 100h dup(0)
stack ends
code segment
assume cs:code,ds:data,es:data,ss:stack
start: mov ax,data
mov ds,ax ;ds=data
mov es,ax ;es=data
optstr hint ;output hint
mov dx,offset buff
mov ah,0ah
int 21h ;input numbers
add dx,2 ;buff+2
mov si,dx ;set str-begin addr
mov dx,offset score
mov di,dx ;set score addr
mov al,0
;move scores to score
inlp: mov ah,[si]
cmp ah,20h
jz space ;space
cmp ah,0dh
jz ined ;end input (out loop)
cmp ah,30h
jb inverr ;not a number
cmp ah,39h
ja inverr ;not a number
sub ah,30h ;sub offset
mov [flag],1 ;flag=1
call multi ;al*10
add al,ah
cmp al,mscore
ja ovferr ;al>mscore
add si,1
jmp inlp
;if flag=1 write
;else ignore
space: mov ah,[flag]
cmp ah,0
jz spaed ;flag=0 not a number
mov [di],al
add [count],1
add di,1
mov al,0
mov [flag],0
spaed: add si,1
jmp inlp
ined: mov [di],al
add [count],1 ;the last score
xor cx,cx
optstr head
optstr newl ;output head
mov cl,[count]
mov bh,1 ;rank
otlp: call fdmax ;ah=score al=index
push ax
mov al,bh
call optal
pop ax
optnum 09h
push ax
call optal
pop ax
optnum 09h
mov al,ah
call optal
optstr newl
add bh,1
loop otlp
mov ax,4c00h
int 21h
;multiply 10
;al=al*10
multi: push bx
push ax
mov bl,10
mul bl
cmp ah,0
jnz ovferr
mov bl,al
pop ax
mov al,bl
pop bx
ret
;find maximum score
;ah=score al=index
fdmax: push cx
push bx
mov cl,[count]
mov ax,0
mov si,offset score
mov bl,0
fdlop: mov bh,[si]
add bl,1
cmp ah,bh
ja fdel ;ah>bh ->end loop
cmp bh,0ffh
jz fdel ;bh=ffh ->end loop
mov ax,bx ;ah<=bh
fdel: add si,1
loop fdlop
mov si,offset score
push ax
mov ah,0
add si,ax
sub si,1
pop ax
mov byte ptr [si],0ffh ;maximum=0
pop bx
pop cx
ret
;output al
optal: mov ah,0
mov dl,10
div dl
push ax
cmp al,0
jz optahr
call optal
optahr: pop ax
add ah,30h
optnum ah
ret
;invalid input error
inverr: optstr errstr
mov ax,4c00h
int 21h
;overflow error
ovferr: optstr ovfstr
mov ax,4c00h
int 21h
code ends
end start |
con_and_div.als | nishio/learning_alloy | 1 | 5254 | // 一貫性主義者と多様性主義者のパズル
// 一貫性主義者はすべて嘘をつくか、すべて正直に話すかのどちらか
// 多様性主義者はすべて嘘をつくこともすべて正直に話すこともない
abstract sig Person {
con: set Person,
div: set Person,
same: set Person
}
one sig P0 extends Person {}
one sig P1 extends Person {}
one sig P2 extends Person {}
one sig P3 extends Person {}
one sig P4 extends Person {}
fact{
all p, q: Person{
(q in p.con) <=> (
some c: Con{
c.by = p
c.who = q
}
)
(q in p.div) <=> (
some c: Div{
c.by = p
c.who = q
}
)
(q in p.same) <=> (
some c: Same{
c.by = p
c.who = q
}
)
}
}
enum Bool {T, F}
abstract sig Constrain{
by: one Person,
who: one Person
}{
by not in who
}
sig Con extends Constrain {}
sig Div extends Constrain {}
sig Same extends Constrain {}
pred is_correct(c: Constrain, bb: Person -> Bool){
(c in Con) => (c.who.bb = T)
(c in Div) => (c.who.bb = F)
(c in Same) => (c.who.bb = c.by.bb)
}
pred satisfy(cs: Constrain, p0, p1, p2, p3, p4: Bool){
let bb = (P0 -> p0) + (P1 -> p1) + (P2 -> p2) + (P3 -> p3) + (P4 -> p4)
{
// bb: Person -> Bool 一貫性主義者かどうか
#{bb.T} = 3
all p: bb.T { //すべての一貫性主義者について
// 全て正しいか全て嘘かのどちらか
(all c: by.p{is_correct[c, bb]})
or
(all c: by.p{not is_correct[c, bb]})
}
all p: bb.F { //すべての多様性主義者について
// 全て正しくはなく、またすべて嘘でもない
not (all c: by.p{is_correct[c, bb]})
not (all c: by.p{not is_correct[c, bb]})
}
}
}
run {
// 制約が1個以上ある
//some Constrain
// みんな2回以上しゃべる
all p: Person {#{by.p} >= 2}
// 相異なる制約は異なる
all disj c1, c2: Same {
not(c1.by = c2.by and c1.who = c2.who)
}
all disj c1, c2: Con {
not(c1.by = c2.by and c1.who = c2.who)
}
all disj c1, c2: Div {
not(c1.by = c2.by and c1.who = c2.who)
}
let answers = {
p0, p1, p2, p3, p4: Bool |
satisfy[Constrain, p0, p1, p2, p3, p4]}
{
one answers
all x: Constrain {
not one {
p0, p1, p2, p3, p4: Bool |
satisfy[Constrain - x, p0, p1, p2, p3, p4]
}
}
}
} for 40 Constrain
|
oeis/121/A121048.asm | neoneye/loda-programs | 11 | 92477 | ; A121048: n + phi(n), for Euler totient function phi(n).
; Submitted by <NAME>(m1)
; 2,3,5,6,9,8,13,12,15,14,21,16,25,20,23,24,33,24,37,28,33,32,45,32,45,38,45,40,57,38,61,48,53,50,59,48,73,56,63,56,81,54,85,64,69,68,93,64,91,70,83,76,105,72,95,80,93,86,117,76,121,92,99,96,113,86,133,100,113,94,141,96,145,110,115,112,137,102,157,112,135,122,165,108,149,128,143,128,177,114,163,136,153,140,167,128,193,140,159,140
add $0,1
mov $1,$0
mov $2,$0
lpb $2
mov $3,$2
gcd $3,$0
cmp $3,1
add $1,$3
sub $2,1
lpe
mov $0,$1
|
src/stm32-bkp.ads | damaki/EVB1000 | 0 | 11224 | <reponame>damaki/EVB1000
-- This spec has been automatically generated from STM32F105xx.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
with System;
package STM32.BKP is
pragma Preelaborate;
---------------
-- Registers --
---------------
------------------
-- DR1_Register --
------------------
subtype DR1_D1_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR1_Register is record
-- Backup data
D1 : DR1_D1_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR1_Register use record
D1 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR2_Register --
------------------
subtype DR2_D2_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR2_Register is record
-- Backup data
D2 : DR2_D2_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR2_Register use record
D2 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR3_Register --
------------------
subtype DR3_D3_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR3_Register is record
-- Backup data
D3 : DR3_D3_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR3_Register use record
D3 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR4_Register --
------------------
subtype DR4_D4_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR4_Register is record
-- Backup data
D4 : DR4_D4_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR4_Register use record
D4 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR5_Register --
------------------
subtype DR5_D5_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR5_Register is record
-- Backup data
D5 : DR5_D5_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR5_Register use record
D5 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR6_Register --
------------------
subtype DR6_D6_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR6_Register is record
-- Backup data
D6 : DR6_D6_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR6_Register use record
D6 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR7_Register --
------------------
subtype DR7_D7_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR7_Register is record
-- Backup data
D7 : DR7_D7_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR7_Register use record
D7 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR8_Register --
------------------
subtype DR8_D8_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR8_Register is record
-- Backup data
D8 : DR8_D8_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR8_Register use record
D8 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
------------------
-- DR9_Register --
------------------
subtype DR9_D9_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR9_Register is record
-- Backup data
D9 : DR9_D9_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR9_Register use record
D9 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR10_Register --
-------------------
subtype DR10_D10_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR10_Register is record
-- Backup data
D10 : DR10_D10_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR10_Register use record
D10 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
--------------------
-- RTCCR_Register --
--------------------
subtype RTCCR_CAL_Field is STM32.UInt7;
subtype RTCCR_CCO_Field is STM32.Bit;
-- RTC clock calibration register (BKP_RTCCR)
type RTCCR_Register is record
-- Calibration value
CAL : RTCCR_CAL_Field := 16#0#;
-- Calibration Clock Output
CCO : RTCCR_CCO_Field := 16#0#;
-- unspecified
Reserved_8_31 : STM32.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for RTCCR_Register use record
CAL at 0 range 0 .. 6;
CCO at 0 range 7 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- CR_Register --
-----------------
subtype CR_TPE_Field is STM32.Bit;
subtype CR_TPAL_Field is STM32.Bit;
-- Backup control register (BKP_CR)
type CR_Register is record
-- Tamper pin enable
TPE : CR_TPE_Field := 16#0#;
-- Tamper pin active level
TPAL : CR_TPAL_Field := 16#0#;
-- unspecified
Reserved_2_31 : STM32.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CR_Register use record
TPE at 0 range 0 .. 0;
TPAL at 0 range 1 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
------------------
-- CSR_Register --
------------------
subtype CSR_CTE_Field is STM32.Bit;
subtype CSR_CTI_Field is STM32.Bit;
subtype CSR_TPIE_Field is STM32.Bit;
subtype CSR_TEF_Field is STM32.Bit;
subtype CSR_TIF_Field is STM32.Bit;
-- BKP_CSR control/status register
type CSR_Register is record
-- Write-only. Clear Tamper event
CTE : CSR_CTE_Field := 16#0#;
-- Write-only. Clear Tamper Interrupt
CTI : CSR_CTI_Field := 16#0#;
-- Tamper Pin interrupt enable
TPIE : CSR_TPIE_Field := 16#0#;
-- unspecified
Reserved_3_7 : STM32.UInt5 := 16#0#;
-- Read-only. Tamper Event Flag
TEF : CSR_TEF_Field := 16#0#;
-- Read-only. Tamper Interrupt Flag
TIF : CSR_TIF_Field := 16#0#;
-- unspecified
Reserved_10_31 : STM32.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for CSR_Register use record
CTE at 0 range 0 .. 0;
CTI at 0 range 1 .. 1;
TPIE at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
TEF at 0 range 8 .. 8;
TIF at 0 range 9 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
-------------------
-- DR11_Register --
-------------------
subtype DR11_DR11_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR11_Register is record
-- Backup data
DR11 : DR11_DR11_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR11_Register use record
DR11 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR12_Register --
-------------------
subtype DR12_DR12_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR12_Register is record
-- Backup data
DR12 : DR12_DR12_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR12_Register use record
DR12 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR13_Register --
-------------------
subtype DR13_DR13_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR13_Register is record
-- Backup data
DR13 : DR13_DR13_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR13_Register use record
DR13 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR14_Register --
-------------------
subtype DR14_D14_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR14_Register is record
-- Backup data
D14 : DR14_D14_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR14_Register use record
D14 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR15_Register --
-------------------
subtype DR15_D15_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR15_Register is record
-- Backup data
D15 : DR15_D15_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR15_Register use record
D15 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR16_Register --
-------------------
subtype DR16_D16_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR16_Register is record
-- Backup data
D16 : DR16_D16_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR16_Register use record
D16 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR17_Register --
-------------------
subtype DR17_D17_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR17_Register is record
-- Backup data
D17 : DR17_D17_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR17_Register use record
D17 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR18_Register --
-------------------
subtype DR18_D18_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR18_Register is record
-- Backup data
D18 : DR18_D18_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR18_Register use record
D18 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR19_Register --
-------------------
subtype DR19_D19_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR19_Register is record
-- Backup data
D19 : DR19_D19_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR19_Register use record
D19 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR20_Register --
-------------------
subtype DR20_D20_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR20_Register is record
-- Backup data
D20 : DR20_D20_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR20_Register use record
D20 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR21_Register --
-------------------
subtype DR21_D21_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR21_Register is record
-- Backup data
D21 : DR21_D21_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR21_Register use record
D21 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR22_Register --
-------------------
subtype DR22_D22_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR22_Register is record
-- Backup data
D22 : DR22_D22_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR22_Register use record
D22 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR23_Register --
-------------------
subtype DR23_D23_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR23_Register is record
-- Backup data
D23 : DR23_D23_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR23_Register use record
D23 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR24_Register --
-------------------
subtype DR24_D24_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR24_Register is record
-- Backup data
D24 : DR24_D24_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR24_Register use record
D24 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR25_Register --
-------------------
subtype DR25_D25_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR25_Register is record
-- Backup data
D25 : DR25_D25_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR25_Register use record
D25 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR26_Register --
-------------------
subtype DR26_D26_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR26_Register is record
-- Backup data
D26 : DR26_D26_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR26_Register use record
D26 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR27_Register --
-------------------
subtype DR27_D27_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR27_Register is record
-- Backup data
D27 : DR27_D27_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR27_Register use record
D27 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR28_Register --
-------------------
subtype DR28_D28_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR28_Register is record
-- Backup data
D28 : DR28_D28_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR28_Register use record
D28 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR29_Register --
-------------------
subtype DR29_D29_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR29_Register is record
-- Backup data
D29 : DR29_D29_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR29_Register use record
D29 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR30_Register --
-------------------
subtype DR30_D30_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR30_Register is record
-- Backup data
D30 : DR30_D30_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR30_Register use record
D30 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR31_Register --
-------------------
subtype DR31_D31_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR31_Register is record
-- Backup data
D31 : DR31_D31_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR31_Register use record
D31 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR32_Register --
-------------------
subtype DR32_D32_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR32_Register is record
-- Backup data
D32 : DR32_D32_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR32_Register use record
D32 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR33_Register --
-------------------
subtype DR33_D33_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR33_Register is record
-- Backup data
D33 : DR33_D33_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR33_Register use record
D33 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR34_Register --
-------------------
subtype DR34_D34_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR34_Register is record
-- Backup data
D34 : DR34_D34_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR34_Register use record
D34 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR35_Register --
-------------------
subtype DR35_D35_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR35_Register is record
-- Backup data
D35 : DR35_D35_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR35_Register use record
D35 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR36_Register --
-------------------
subtype DR36_D36_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR36_Register is record
-- Backup data
D36 : DR36_D36_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR36_Register use record
D36 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR37_Register --
-------------------
subtype DR37_D37_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR37_Register is record
-- Backup data
D37 : DR37_D37_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR37_Register use record
D37 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR38_Register --
-------------------
subtype DR38_D38_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR38_Register is record
-- Backup data
D38 : DR38_D38_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR38_Register use record
D38 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR39_Register --
-------------------
subtype DR39_D39_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR39_Register is record
-- Backup data
D39 : DR39_D39_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR39_Register use record
D39 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR40_Register --
-------------------
subtype DR40_D40_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR40_Register is record
-- Backup data
D40 : DR40_D40_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR40_Register use record
D40 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR41_Register --
-------------------
subtype DR41_D41_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR41_Register is record
-- Backup data
D41 : DR41_D41_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR41_Register use record
D41 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-------------------
-- DR42_Register --
-------------------
subtype DR42_D42_Field is STM32.Short;
-- Backup data register (BKP_DR)
type DR42_Register is record
-- Backup data
D42 : DR42_D42_Field := 16#0#;
-- unspecified
Reserved_16_31 : STM32.Short := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for DR42_Register use record
D42 at 0 range 0 .. 15;
Reserved_16_31 at 0 range 16 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Backup registers
type BKP_Peripheral is record
-- Backup data register (BKP_DR)
DR1 : DR1_Register;
-- Backup data register (BKP_DR)
DR2 : DR2_Register;
-- Backup data register (BKP_DR)
DR3 : DR3_Register;
-- Backup data register (BKP_DR)
DR4 : DR4_Register;
-- Backup data register (BKP_DR)
DR5 : DR5_Register;
-- Backup data register (BKP_DR)
DR6 : DR6_Register;
-- Backup data register (BKP_DR)
DR7 : DR7_Register;
-- Backup data register (BKP_DR)
DR8 : DR8_Register;
-- Backup data register (BKP_DR)
DR9 : DR9_Register;
-- Backup data register (BKP_DR)
DR10 : DR10_Register;
-- RTC clock calibration register (BKP_RTCCR)
RTCCR : RTCCR_Register;
-- Backup control register (BKP_CR)
CR : CR_Register;
-- BKP_CSR control/status register
CSR : CSR_Register;
-- Backup data register (BKP_DR)
DR11 : DR11_Register;
-- Backup data register (BKP_DR)
DR12 : DR12_Register;
-- Backup data register (BKP_DR)
DR13 : DR13_Register;
-- Backup data register (BKP_DR)
DR14 : DR14_Register;
-- Backup data register (BKP_DR)
DR15 : DR15_Register;
-- Backup data register (BKP_DR)
DR16 : DR16_Register;
-- Backup data register (BKP_DR)
DR17 : DR17_Register;
-- Backup data register (BKP_DR)
DR18 : DR18_Register;
-- Backup data register (BKP_DR)
DR19 : DR19_Register;
-- Backup data register (BKP_DR)
DR20 : DR20_Register;
-- Backup data register (BKP_DR)
DR21 : DR21_Register;
-- Backup data register (BKP_DR)
DR22 : DR22_Register;
-- Backup data register (BKP_DR)
DR23 : DR23_Register;
-- Backup data register (BKP_DR)
DR24 : DR24_Register;
-- Backup data register (BKP_DR)
DR25 : DR25_Register;
-- Backup data register (BKP_DR)
DR26 : DR26_Register;
-- Backup data register (BKP_DR)
DR27 : DR27_Register;
-- Backup data register (BKP_DR)
DR28 : DR28_Register;
-- Backup data register (BKP_DR)
DR29 : DR29_Register;
-- Backup data register (BKP_DR)
DR30 : DR30_Register;
-- Backup data register (BKP_DR)
DR31 : DR31_Register;
-- Backup data register (BKP_DR)
DR32 : DR32_Register;
-- Backup data register (BKP_DR)
DR33 : DR33_Register;
-- Backup data register (BKP_DR)
DR34 : DR34_Register;
-- Backup data register (BKP_DR)
DR35 : DR35_Register;
-- Backup data register (BKP_DR)
DR36 : DR36_Register;
-- Backup data register (BKP_DR)
DR37 : DR37_Register;
-- Backup data register (BKP_DR)
DR38 : DR38_Register;
-- Backup data register (BKP_DR)
DR39 : DR39_Register;
-- Backup data register (BKP_DR)
DR40 : DR40_Register;
-- Backup data register (BKP_DR)
DR41 : DR41_Register;
-- Backup data register (BKP_DR)
DR42 : DR42_Register;
end record
with Volatile;
for BKP_Peripheral use record
DR1 at 0 range 0 .. 31;
DR2 at 4 range 0 .. 31;
DR3 at 8 range 0 .. 31;
DR4 at 12 range 0 .. 31;
DR5 at 16 range 0 .. 31;
DR6 at 20 range 0 .. 31;
DR7 at 24 range 0 .. 31;
DR8 at 28 range 0 .. 31;
DR9 at 32 range 0 .. 31;
DR10 at 36 range 0 .. 31;
RTCCR at 40 range 0 .. 31;
CR at 44 range 0 .. 31;
CSR at 48 range 0 .. 31;
DR11 at 60 range 0 .. 31;
DR12 at 64 range 0 .. 31;
DR13 at 68 range 0 .. 31;
DR14 at 72 range 0 .. 31;
DR15 at 76 range 0 .. 31;
DR16 at 80 range 0 .. 31;
DR17 at 84 range 0 .. 31;
DR18 at 88 range 0 .. 31;
DR19 at 92 range 0 .. 31;
DR20 at 96 range 0 .. 31;
DR21 at 100 range 0 .. 31;
DR22 at 104 range 0 .. 31;
DR23 at 108 range 0 .. 31;
DR24 at 112 range 0 .. 31;
DR25 at 116 range 0 .. 31;
DR26 at 120 range 0 .. 31;
DR27 at 124 range 0 .. 31;
DR28 at 128 range 0 .. 31;
DR29 at 132 range 0 .. 31;
DR30 at 136 range 0 .. 31;
DR31 at 140 range 0 .. 31;
DR32 at 144 range 0 .. 31;
DR33 at 148 range 0 .. 31;
DR34 at 152 range 0 .. 31;
DR35 at 156 range 0 .. 31;
DR36 at 160 range 0 .. 31;
DR37 at 164 range 0 .. 31;
DR38 at 168 range 0 .. 31;
DR39 at 172 range 0 .. 31;
DR40 at 176 range 0 .. 31;
DR41 at 180 range 0 .. 31;
DR42 at 184 range 0 .. 31;
end record;
-- Backup registers
BKP_Periph : aliased BKP_Peripheral
with Import, Address => BKP_Base;
end STM32.BKP;
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36204b.ada | best08618/asylo | 7 | 22167 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36204b.ada<gh_stars>1-10
-- C36204B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE:
-- CHECK THAT EACH ARRAY ATTRIBUTE YIELDS THE CORRECT VALUES WITH
-- ACCESS VALUES AND FUNCTION CALLS AS THE PREFIXES.
-- HISTORY:
-- L.BROWN 08/05/86
-- DWC 07/24/87 DELETED BLANK AT END OF TEST DESCRIPTION.
WITH REPORT; USE REPORT;
PROCEDURE C36204B IS
BEGIN
TEST("C36204B", "ARRAY ATTRIBUTES RETURN CORRECT VALUES " &
"FOR ACCESS VALUES AND FUNCTION CALLS AS " &
"PREFIXES");
DECLARE
TYPE ARR1 IS ARRAY (INTEGER RANGE IDENT_INT(1) ..
IDENT_INT(10)) OF INTEGER ;
TYPE ARR2 IS ARRAY (BOOLEAN,
INTEGER RANGE IDENT_INT(1) ..
IDENT_INT(3)) OF INTEGER ;
TYPE PTR1 IS ACCESS ARR1;
TYPE PTR2 IS ACCESS ARR2;
PT1 : PTR1 := NEW ARR1'(ARR1'RANGE => 0);
PT2 : PTR2 := NEW ARR2'(ARR2'RANGE(1) =>
(ARR2'RANGE(2) => 0));
SUBTYPE ARR1_RANGE IS INTEGER RANGE PT1'RANGE;
BEGIN
IF PT1'FIRST /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 1");
END IF;
IF PT2'FIRST(2) /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 1");
END IF;
IF ARR1_RANGE'FIRST /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 2");
END IF;
IF PT1'LAST /= IDENT_INT(10) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 3");
END IF;
IF PT2'LAST(2) /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 2");
END IF;
IF ARR1_RANGE'LAST /= IDENT_INT(10) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 4");
END IF;
IF PT1'LENGTH /= IDENT_INT(10) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 5");
END IF;
IF PT2'LENGTH(2) /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING ACCESS TYPES AS PREFIXES 3");
END IF;
END;
DECLARE
TYPE UNCON IS ARRAY (INTEGER RANGE <>) OF INTEGER ;
TYPE UNCON2 IS ARRAY (INTEGER RANGE <>,
INTEGER RANGE <>) OF INTEGER ;
ARY1 : STRING(IDENT_INT(5) .. IDENT_INT(8));
F : INTEGER := IDENT_INT(1);
L : INTEGER := IDENT_INT(3);
FUNCTION FUN( LO,HI : INTEGER ) RETURN UNCON IS
ARR : UNCON(IDENT_INT(LO) .. IDENT_INT(HI));
BEGIN
ARR := (ARR'RANGE => 0);
RETURN ARR;
END FUN;
FUNCTION FUN2( LO,HI : INTEGER ) RETURN UNCON2 IS
AR2 : UNCON2(IDENT_INT(LO) .. IDENT_INT(HI),
IDENT_INT(LO) .. IDENT_INT(HI));
BEGIN
AR2 := (AR2'RANGE(1) =>(AR2'RANGE(2) => 0));
RETURN AR2;
END FUN2;
BEGIN
ARY1 := (ARY1'RANGE => 'A');
IF FUN(F,L)'FIRST /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 1");
END IF;
IF FUN2(F,L)'FIRST(2) /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 1");
END IF;
IF "&"(ARY1,"XX")'FIRST /= IDENT_INT(5) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 2");
END IF;
IF FUN(F,L)'LAST /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 3");
END IF;
IF FUN2(F,L)'LAST(2) /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 2");
END IF;
IF "&"(ARY1,"YY")'LAST /= IDENT_INT(10) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 4");
END IF;
IF FUN(F,L)'LENGTH /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 5");
END IF;
IF FUN2(F,L)'LENGTH(2) /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR TWO-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 3");
END IF;
IF "&"(ARY1,"XX")'LENGTH /= IDENT_INT(6) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR ONE-DIM " &
"ARRAY USING FUNCTION RESULTS AS " &
"PREFIXES 6");
END IF;
DECLARE
SUBTYPE SMIN IS INTEGER RANGE FUN(F,L)'RANGE;
SUBTYPE SMIN2 IS INTEGER RANGE FUN2(F,L)'RANGE(2);
SUBTYPE SMIN3 IS INTEGER RANGE "&"(ARY1,"YY")'RANGE;
BEGIN
IF SMIN'FIRST /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"ONE-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 7");
END IF;
IF SMIN2'FIRST /= IDENT_INT(1) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"TWO-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 4");
END IF;
IF SMIN3'FIRST /= IDENT_INT(5) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"ONE-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 8");
END IF;
IF SMIN'LAST /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"ONE-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 9");
END IF;
IF SMIN2'LAST /= IDENT_INT(3) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"TWO-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 5");
END IF;
IF SMIN3'LAST /= IDENT_INT(10) THEN
FAILED("INCORRECT ATTRIBUTE VALUE FOR " &
"ONE-DIM ARRAY USING FUNCTION " &
"RESULTS AS PREFIXES 10");
END IF;
END;
END;
RESULT;
END C36204B;
|
oeis/029/A029635.asm | neoneye/loda-programs | 11 | 18587 | <reponame>neoneye/loda-programs
; A029635: The (1,2)-Pascal triangle (or Lucas triangle) read by rows.
; Submitted by <NAME>
; 2,1,2,1,3,2,1,4,5,2,1,5,9,7,2,1,6,14,16,9,2,1,7,20,30,25,11,2,1,8,27,50,55,36,13,2,1,9,35,77,105,91,49,15,2,1,10,44,112,182,196,140,64,17,2,1,11,54,156,294,378,336,204,81,19,2,1,12,65,210,450,672,714,540,285,100,21,2,1,13,77,275,660,1122,1386,1254,825,385,121,23,2,1,14,90,352,935,1782,2508,2640,2079
lpb $0
add $2,$1
add $1,1
sub $0,$1
bin $2,$0
lpe
bin $1,$0
mul $1,2
sub $1,$2
mov $0,$1
|
alloy4fun_models/trashltl/models/17/wR9JzAPEPJL6h7YbF.als | Kaixi26/org.alloytools.alloy | 0 | 954 | open main
pred idwR9JzAPEPJL6h7YbF_prop18 {
always all f: Protected | f in Protected until f in Trash
}
pred __repair { idwR9JzAPEPJL6h7YbF_prop18 }
check __repair { idwR9JzAPEPJL6h7YbF_prop18 <=> prop18o } |
src/cm_lite_states.asm | spannerisms/lttphack | 6 | 103231 | LITESTATES_SUBMENU:
%menu_header("LITE STATES", 16)
;===================================================================================================
%litestate("Litestate 01", $00)
%litestate("Litestate 02", $01)
%litestate("Litestate 03", $02)
%litestate("Litestate 04", $03)
%litestate("Litestate 05", $04)
%litestate("Litestate 06", $05)
%litestate("Litestate 07", $06)
%litestate("Litestate 08", $07)
%litestate("Litestate 09", $08)
%litestate("Litestate 10", $09)
%litestate("Litestate 11", $0A)
%litestate("Litestate 12", $0B)
%litestate("Litestate 13", $0C)
%litestate("Litestate 14", $0D)
%litestate("Litestate 15", $0E)
%litestate("Litestate 16", $0F)
;===================================================================================================
ValidateLiteState:
CLC
PHP
REP #$30
PHX
PHY
PHB
PHK
PLB
; times 0x0800
AND.w #$00FF
XBA
ASL
ASL
ASL
TAX
STA.w SA1IRAM.litestate_off
LDY.w #$0000
SEP #$20
-- LDA.w LiteStateHeader,Y
CMP.l LiteStateData,X
BNE .fail
INY
INX
CPY.w #$0010 : BCC --
SEC
BRA ++
.fail
CLC
; set carry flag for P we pull
++ LDA 6,S
ADC.b #$00
STA 6,S
PLB
REP #$10
PLY
PLX
PLP
RTL
;===================================================================================================
LiteStateHeader:
; "0123456789ABCDEF"
db "LITESTATELUIBETA"
; db "LITESTATELUICOOL"
;===================================================================================================
DeleteLiteState:
PHP
REP #$30
PHX
PHY
; times 0x0800
AND.w #$00FF
XBA
ASL
ASL
ASL
TAX
LDA.w #$0000
STA.l LiteStateData+$0,X
STA.l LiteStateData+$2,X
STA.l LiteStateData+$4,X
STA.l LiteStateData+$6,X
STA.l LiteStateData+$8,X
STA.l LiteStateData+$A,X
STA.l LiteStateData+$C,X
STA.l LiteStateData+$E,X
PLY
PLX
PLP
RTL
;===================================================================================================
; save room data to sram before saving
; hold Y to set
; hold X to clear
; press A to load
; save preset type so loadlastpreset works with these
SaveLiteState:
PHP
REP #$30
PHA
PHX
PHY
PHD
PHB
SEP #$20
LDA.w $008A : BMI .banned
LDA.w $0010 : CMP.b #$06 : BEQ .banned
REP #$20
; map
; header (0x10 bytes)
; SRAM (0x402 bytes)
; Overlords+Sprites ($F0)
; Overlords+Sprites ($30)
; Sprites (0x200 bytes)
PHD : PHK : PLB
PEA.w $0000
PLD
JSL $02B87B
PLD
REP #$30
LDA.b SA1IRAM.litestate_act
AND.w #$00FF
XBA
ASL
ASL
ASL
TAY
LDA.w #$000F
LDX.w #LiteStateHeader
%MVN(LiteStateHeader>>16,LiteStateData>>16)
PHK
PLB
SEP #$20
LDA.b #$80
JSR DMALiteStates
.exit
REP #$30
PLB
PLD
PLY
PLX
PLA
PLP
-- RTL
.banned
JSL CM_MenuSFX_error
BRA .exit
;===================================================================================================
LoadLiteState:
REP #$30
JSL ValidateLiteState
BCC --
STZ.w SA1IRAM.preset_addr
LDA.w SA1IRAM.litestate_last
AND.w #$00FF
XBA
ASL
ASL
ASL
ADC.w #$0010
TAY
PHK
PLB
SEP #$20
LDA.b #$80 : STA.w $2100 : STA.w $0013
STZ.w $4200
LDA.b #$00
JSR DMALiteStates
JSL SetHUDItemGraphics
REP #$20
LDA.w #$0000 : TCD
SEP #$30
PHA : PLB
JSL DecompSwordGfx
JSL Palette_Sword
JSL DecompShieldGfx
JSL Palette_Shield
JSL Palette_Armor
JSL ApplyAfterLoading
SEP #$30
JSL Rerandomize
JML TriggerTimerAndReset
;===================================================================================================
LiteSRAMSize = $0402
DMALiteStates:
REP #$10
STA.w $4350
LDA.b #$80 : STA.w $4351 ; wram
STY.w $4352
LDA.b #LiteStateData>>16 : STA.w $4354
STZ.w $2183
LDY.w #$F000 : STY.w $2181
LDY.w #LiteSRAMSize : STY.w $4355
LDA.b #$20 : STA.w $420B
LDX.w #$0000
.next_important
LDY.w .utmost_importance+0,X
BEQ .done_important
CPY.w #$0001 : BNE .not_dumb_room_hack
LDA.w $001B : BEQ .dumb_room_fake
REP #$20
LDA.w $00A0
ASL
CLC
ADC.w #$DF80
TAY
SEP #$20
BRA .not_dumb_room_hack
.dumb_room_fake
LDY.w #$FF00
.not_dumb_room_hack
STY.w $2181
LDA.w .utmost_importance+2,X
STA.w $2183
LDA.w .utmost_importance+3,X
STA.w $4355 : STZ.w $4356
LDA.b #$20 : STA.w $420B
INX : INX : INX : INX
BRA .next_important
.done_important
LDA.w $4350 : CMP.b #$80 : BEQ .saving
JSR SaveATon
PHD
JSL ResetBeforeLoading
PLD
SEP #$20
PHK
PLB
LDA.b $1B : BEQ .overworld
.underworld
; save important values
LDA.l $7E0468 : PHA ; shutters
LDA.l $7EC172 : PHA ; pegs
LDA.l $7EF36F : PHA ; keys
LDA.l $7E040C : PHA
LDA.w $010E : JSL SetDungeonEntranceAndProperties
SEP #$20
PLA : STA.l $7E040C
JSL PresetLoadArea_UW
SEP #$20
LDA.b #$01 : STA.w $4200
PLA : STA.l $7EF36F
PLA : JSL HandlePegState
SEP #$20
PLA : JSL HandleOpenShutters
REP #$20
LDA.w #$0007 : STA.b $10
BRA .done_stuff_1
.overworld
JSL HandleOverworldLoad
REP #$20
LDA.w #$0009 : STA.b $10
SEP #$20
STZ.w $0200 : STZ.b $B0
.done_stuff_1
JSR PullATon
.saving
SEP #$20
LDX.w #$0000
.next_less_important
LDY.w .less_importance+0,X
BEQ .done_less_important
STY.w $2181
LDA.w .less_importance+2,X
STA.w $2183
LDA.w .less_importance+3,X
STA.w $4355 : STZ.w $4356
LDA.b #$20 : STA.w $420B
INX : INX : INX : INX
BRA .next_less_important
.done_less_important
LDA.b $4350 : BPL .done_loading
; Some dumb after hacks
LDA.b $5D
CMP.b #$04 : BEQ .leave_state
CMP.b #$17 : BEQ .leave_state
.leave_state
.done_loading
RTS
; dl addr : db size
.utmost_importance
dl $7E001B : db $01 ; indoorsness
dl $7E00A0 : db $04 ; UW screen ID
dl $7E008A : db $04 ; OW screen ID
dl $7E0020 : db $04 ; coordinates
dl $7E002F : db $01 ; direction
dl $7E040A : db $02 ; OW screen ID
dl $7E0084 : db $06 ; OW tilemap
dl $7E010E : db $02 ; entrance
dl $7E0400 : db $09 ; dungeon stuff
dl $7E040C : db $01 ; dungeon id
dl $7E048E : db $02 ; room ID
dl $7E0303 : db $01 ; item
dl $7E0618 : db $08 ; OW pan
dl $7E0600 : db $20 ; camera stuff
dl $7E00EE : db $01 ; layer
dl $7E0476 : db $01 ; layer
dl $7E0468 : db $01 ; shutters
dl $7E0AA0 : db $18 ; gfx
dl $7EC172 : db $01 ; pegs
dl $7E0ABD : db $01 ; color math
dl $7F0001 : db $02 ; stupid hack for sprite deaths
dw $0000 ; end
.less_importance
dl $7E0046 : db $01 ; i frames
dl $7E031F : db $01 ; i frames
dl $7E005D : db $01 ; state
dl $7E0056 : db $01 ; bunny
dl $7E02E0 : db $01 ; bunny
dl $7E006C : db $01 ; door state
dl $7E00A4 : db $07 ; floor and quadrants
dl $7E00B7 : db $05 ; object pointers
dl $7E00E0 : db $04 ; camera
dl $7E00E6 : db $04 ; camera
dl $7E0624 : db $08 ; camera stuff
dl $7E0130 : db $04 ; music stuff
dl $7E0136 : db $01 ; music bank
dl $7E02FA : db $01 ; statue drag
dl $7E0345 : db $01 ; swimming
dl $7E02A1 : db $02 ; ancilla altitude
dl $7E044A : db $01 ; EG strength
dl $7E047A : db $01 ; armed EG
dl $7E045A : db $01 ; torches lit
dl $7E04F0 : db $04 ; torch timers
dl $7E0642 : db $01 ; shutter tags
dl $7E0FC7 : db $08 ; prize packs
dl $7E0B08 : db $02 ; overlord
dl $7E0B10 : db $02 ; overlord
dl $7E0B20 : db $02 ; overlord
dl $7E0CF9 : db $04 ; drop luck and trees
dl $7E1ABF : db $01 ; mirror portal
dl $7E1ACF : db $01 ; mirror portal
dl $7E1ADF : db $01 ; mirror portal
dl $7E1AEF : db $01 ; mirror portal
dl $7EC140 : db $31 ; cache stuff
dl $7EC180 : db $2A ; cache stuff
dw $0000 ; end
;===================================================================================================
SaveATon:
REP #$30
PLA
PHP
PHD
PHY
PHX
PHB
PHK
PLB
LDY.w $4350 : PHY
LDY.w $4352 : PHY
LDY.w $4354 : PHY
LDY.w $4356 : PHY
PHA
LDA.w #$0000
TCD
SEP #$30
RTS
PullATon:
REP #$30
PLA
PLY : STY.w $4356
PLY : STY.w $4354
PLY : STY.w $4352
PLY : STY.w $4350
PLB
PLX
PLY
PLD
PLP
PHA
RTS
|
src/asf-views-nodes-reader.ads | Letractively/ada-asf | 0 | 26304 | -----------------------------------------------------------------------
-- asf -- XHTML Reader
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Sax.Exceptions;
with Sax.Locators;
with Sax.Readers;
with Sax.Attributes;
with Unicode.CES;
with Input_Sources;
with EL.Contexts;
with EL.Contexts.Default;
with ASF.Factory;
private with EL.Functions;
private with Util.Strings.Maps;
package ASF.Views.Nodes.Reader is
type Xhtml_Reader is new Sax.Readers.Reader with private;
overriding
procedure Warning (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Error (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Fatal_Error (Handler : in out Xhtml_Reader;
Except : in Sax.Exceptions.Sax_Parse_Exception'Class);
overriding
procedure Set_Document_Locator (Handler : in out Xhtml_Reader;
Loc : in out Sax.Locators.Locator);
overriding
procedure Start_Document (Handler : in out Xhtml_Reader);
overriding
procedure End_Document (Handler : in out Xhtml_Reader);
overriding
procedure Start_Prefix_Mapping (Handler : in out Xhtml_Reader;
Prefix : in Unicode.CES.Byte_Sequence;
URI : in Unicode.CES.Byte_Sequence);
overriding
procedure End_Prefix_Mapping (Handler : in out Xhtml_Reader;
Prefix : in Unicode.CES.Byte_Sequence);
overriding
procedure Start_Element (Handler : in out Xhtml_Reader;
Namespace_URI : in Unicode.CES.Byte_Sequence := "";
Local_Name : in Unicode.CES.Byte_Sequence := "";
Qname : in Unicode.CES.Byte_Sequence := "";
Atts : in Sax.Attributes.Attributes'Class);
overriding
procedure End_Element (Handler : in out Xhtml_Reader;
Namespace_URI : in Unicode.CES.Byte_Sequence := "";
Local_Name : in Unicode.CES.Byte_Sequence := "";
Qname : in Unicode.CES.Byte_Sequence := "");
overriding
procedure Characters (Handler : in out Xhtml_Reader;
Ch : in Unicode.CES.Byte_Sequence);
overriding
procedure Ignorable_Whitespace (Handler : in out Xhtml_Reader;
Ch : in Unicode.CES.Byte_Sequence);
overriding
procedure Processing_Instruction (Handler : in out Xhtml_Reader;
Target : in Unicode.CES.Byte_Sequence;
Data : in Unicode.CES.Byte_Sequence);
overriding
procedure Skipped_Entity (Handler : in out Xhtml_Reader;
Name : in Unicode.CES.Byte_Sequence);
overriding
procedure Start_Cdata (Handler : in out Xhtml_Reader);
overriding
procedure End_Cdata (Handler : in out Xhtml_Reader);
overriding
function Resolve_Entity (Handler : Xhtml_Reader;
Public_Id : Unicode.CES.Byte_Sequence;
System_Id : Unicode.CES.Byte_Sequence)
return Input_Sources.Input_Source_Access;
overriding
procedure Start_DTD (Handler : in out Xhtml_Reader;
Name : Unicode.CES.Byte_Sequence;
Public_Id : Unicode.CES.Byte_Sequence := "";
System_Id : Unicode.CES.Byte_Sequence := "");
-- Get the root node that was created upon parsing of the XHTML file.
function Get_Root (Reader : Xhtml_Reader) return Tag_Node_Access;
-- Set the XHTML reader to ignore or not the white spaces.
-- When set to True, the ignorable white spaces will not be kept.
procedure Set_Ignore_White_Spaces (Reader : in out Xhtml_Reader;
Value : in Boolean);
-- Set the XHTML reader to escape or not the unknown tags.
-- When set to True, the tags which are not recognized will be
-- emitted as a raw text component and they will be escaped using
-- the XML escape rules.
procedure Set_Escape_Unknown_Tags (Reader : in out Xhtml_Reader;
Value : in Boolean);
-- Set the XHTML reader to ignore empty lines.
procedure Set_Ignore_Empty_Lines (Reader : in out Xhtml_Reader;
Value : in Boolean);
-- Parse an XML stream, and calls the appropriate SAX callbacks for each
-- event.
-- This is not re-entrant: you can not call Parse with the same Parser
-- argument in one of the SAX callbacks. This has undefined behavior.
procedure Parse (Parser : in out Xhtml_Reader;
Name : in ASF.Views.File_Info_Access;
Input : in out Input_Sources.Input_Source'Class;
Factory : access ASF.Factory.Component_Factory;
Context : in EL.Contexts.ELContext_Access);
private
-- Collect the text for an EL expression. The EL expression starts
-- with either '#{' or with '${' and ends with the matching '}'.
-- If the <b>Value</b> string does not contain the whole EL experssion
-- the <b>Expr_Buffer</b> stored in the reader is used to collect
-- that expression.
procedure Collect_Expression (Handler : in out Xhtml_Reader);
-- Collect the raw-text in a buffer. The text must be flushed
-- when a new element is started or when an exiting element is closed.
procedure Collect_Text (Handler : in out Xhtml_Reader;
Value : in Unicode.CES.Byte_Sequence);
use EL.Functions;
-- use ASF.Components.Factory;
package NS_Mapping renames Util.Strings.Maps;
-- Skip indicates the number of frames to skip in the saved locations
-- stack
type NS_Function_Mapper is new Function_Mapper with record
Mapping : NS_Mapping.Map;
Mapper : Function_Mapper_Access;
Factory : access ASF.Factory.Component_Factory;
end record;
-- Find the function knowing its name.
overriding
function Get_Function (Mapper : NS_Function_Mapper;
Namespace : String;
Name : String) return Function_Access;
-- Bind a name to a function in the given namespace.
overriding
procedure Set_Function (Mapper : in out NS_Function_Mapper;
Namespace : in String;
Name : in String;
Func : in Function_Access);
-- Find the create function in bound to the name in the given namespace.
-- Returns null if no such binding exist.
function Find (Mapper : in NS_Function_Mapper;
Namespace : in String;
Name : in String) return ASF.Views.Nodes.Binding_Access;
procedure Set_Namespace (Mapper : in out NS_Function_Mapper;
Prefix : in String;
URI : in String);
-- Remove the namespace prefix binding.
procedure Remove_Namespace (Mapper : in out NS_Function_Mapper;
Prefix : in String);
type Element_Context is record
Parent : Tag_Node_Access;
Text : Boolean;
end record;
type Element_Context_Access is access all Element_Context;
type Element_Context_Array is array (Natural range <>) of aliased Element_Context;
type Element_Context_Array_Access is access all Element_Context_Array;
type Text_State is (NO_CONTENT, HAS_CONTENT, PARSE_EXPR);
type Xhtml_Reader is new Sax.Readers.Reader with record
Locator : Sax.Locators.Locator;
Root : Tag_Node_Access;
Text : Text_Tag_Node_Access;
Current : Element_Context_Access;
ELContext : EL.Contexts.ELContext_Access;
Functions : aliased NS_Function_Mapper;
Context : aliased EL.Contexts.Default.Default_Context;
Stack : Element_Context_Array_Access;
Stack_Pos : Natural := 0;
-- The line and file information.
Line : Line_Info;
State : Text_State := NO_CONTENT;
Default_State : Text_State := NO_CONTENT;
-- Current expression buffer (See Collect_Expression)
Expr_Buffer : Unbounded_String;
-- Some pending white spaces to append to the current text.
Spaces : Unbounded_String;
-- When not empty, the 'xmlns' attribute to insert in the element. The XML Sax parser
-- notifies us about 'xmlns' attributes through the Start_Prefix_Mapping operation.
-- When the default namespace with empty prefix is found, we have to add the corresponding
-- attribute in Start_Element so that it is written in the facelet tree.
Add_NS : Unbounded_String;
-- Whether the unknown tags are escaped using XML escape rules.
Escape_Unknown_Tags : Boolean := True;
-- Whether white spaces can be ignored.
Ignore_White_Spaces : Boolean := True;
-- Whether empty lines should be ignored (when white spaces are kept).
Ignore_Empty_Lines : Boolean := True;
end record;
end ASF.Views.Nodes.Reader;
|
other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/フランス_PAL/Fra_asm1/zel_label.asm | prismotizm/gigaleak | 0 | 27211 | Name: zel_label.asm
Type: file
Size: 17565
Last-Modified: '2016-05-13T04:20:48Z'
SHA-1: 78F510C1A63FC26921B88376F462E7F9E86C965E
Description: null
|
project_testing/Graphics/f1.asm | Ahmed-ata112/processor_simulation_game | 1 | 247416 |
.model small
.stack 64
.data
.code
main proc far
mov ax, @data
mov ds, ax
; Clear screen
mov ah,0
mov al,3h
int 10h
mov ah, 0 ;Change video mode (Graphical MODE)
mov al, 13h ;Max memory size 16KByte
;AL:4 (320 * 200=64000 [2 bits for each pixel, 4 colours])
;AL:6 (640 * 200=128000[1 bit for each pixel, 2 colours B / W])
int 10h
mov cx, 0 ;Column
mov dx, 50 ;Row
mov al, 0fh ;Pixel color
mov ah, 0ch ;Draw Pixel Command
back: int 10h
inc cx
cmp cx, 320
jnz back
hlt
main endp
end main
|
tests/src/rejuvenation_suite.ads | TNO/Rejuvenation-Ada | 0 | 16481 | <filename>tests/src/rejuvenation_suite.ads
with AUnit.Test_Suites; use AUnit.Test_Suites;
package Rejuvenation_Suite is
function Suite return Access_Test_Suite;
end Rejuvenation_Suite;
|
programs/oeis/160/A160902.asm | neoneye/loda | 22 | 13297 | ; A160902: Square array read by antidiagonals: a(m,n) = the smallest prime >= m*n.
; 2,2,2,3,5,3,5,7,7,5,5,11,11,11,5,7,11,13,13,11,7,7,13,17,17,17,13,7,11,17,19,23,23,19,17,11,11,17,23,29,29,29,23,17,11,11,19,29,29,31,31,29,29,19,11,11,23,29,37,37,37,37,37,29,23,11,13,23,31,37,41,43,43,41,37
seq $0,3991 ; Multiplication table read by antidiagonals: T(i,j) = i*j, i>=1, j>=1.
seq $0,7918 ; Least prime >= n (version 1 of the "next prime" function).
|
antlrparser/src/main/antlr4/net/aequologica/sangiovannilipioni/antlr/SGL2.g4 | sangiovannilipioni/sangiovannilipioni.api | 0 | 1404 | grammar SGL2;
book : sheet+;
sheet : sheetid row+;
sheetid : '-1' CONTENT NEWLINE;
row : cell+ NEWLINE;
cell : DIGITS CONTENT;
NEWLINE : [\r\n]+;
DIGITS : [0-9]+;
CONTENT : '|' .*? '|';
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2050.asm | ljhsiun2/medusa | 9 | 83650 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1d5e8, %r10
add $36319, %r12
mov $0x6162636465666768, %rcx
movq %rcx, (%r10)
nop
nop
nop
xor $14129, %r15
lea addresses_WT_ht+0x6988, %rsi
lea addresses_A_ht+0x7628, %rdi
and $39507, %rbp
mov $67, %rcx
rep movsq
nop
xor $5218, %rcx
lea addresses_UC_ht+0x7708, %rdi
nop
nop
sub $3270, %r12
and $0xffffffffffffffc0, %rdi
movaps (%rdi), %xmm1
vpextrq $0, %xmm1, %r10
nop
nop
nop
nop
nop
and %r10, %r10
lea addresses_D_ht+0x19988, %r15
nop
nop
and $42901, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
vmovups %ymm2, (%r15)
nop
nop
nop
nop
inc %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rax
push %rbx
push %rdi
// Store
lea addresses_A+0x4576, %rax
nop
nop
nop
nop
nop
xor %rbx, %rbx
movb $0x51, (%rax)
nop
nop
nop
add $49828, %r11
// Faulty Load
lea addresses_PSE+0x1d588, %rdi
nop
add $23589, %rbx
mov (%rdi), %r9w
lea oracles, %rbx
and $0xff, %r9
shlq $12, %r9
mov (%rbx,%r9,1), %r9
pop %rdi
pop %rbx
pop %rax
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_A', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Application Support/BBEdit/Text Filters/frontmost_to_two_spaces.applescript | bhdicaire/bbeditSetup | 0 | 2378 | tell application "BBEdit"
tell text window 1
set tab width to 2
set expand tabs to true
end tell
end tell |
Kernel/asm/keyboard.asm | mlombardia/arqui_tpe | 1 | 243494 | <filename>Kernel/asm/keyboard.asm<gh_stars>1-10
GLOBAL kbd_getKey
section .text
kbd_getKey:
push rbp ; create stackframe
mov rbp, rsp
xor rax, rax ; empty register
in al, 0x64 ; port for keyboard controller
and al, 0x01 ; bitwise AND for last bit
test al, al ; if it is 0: jump to end; if it is 1: data available
jz .end
in al, 0x60 ; read output
.end:
leave
ret |
oeis/048/A048483.asm | neoneye/loda-programs | 11 | 86926 | ; A048483: Array read by antidiagonals: T(k,n) = (k+1)2^n - k.
; Submitted by <NAME>
; 1,2,1,4,3,1,8,7,4,1,16,15,10,5,1,32,31,22,13,6,1,64,63,46,29,16,7,1,128,127,94,61,36,19,8,1,256,255,190,125,76,43,22,9,1,512,511,382,253,156,91,50,25,10,1,1024,1023,766,509,316,187
lpb $0
add $1,1
sub $0,$1
lpe
sub $1,$0
mov $2,2
pow $2,$1
sub $2,1
mul $0,$2
add $2,$0
mov $0,$2
add $0,1
|
variapatches/nothing_item_plm.asm | strotlog/SMBasepatch | 0 | 163153 | <gh_stars>0
;;; plm used for nothing items
;;;
;;; compile with asar (https://www.smwcentral.net/?a=details&id=14560&p=section),
;;; or a variant of xkas that supports arch directive
lorom
arch snes.cpu
;;; use this 35 bytes unused plms space for the nothing item plm instructions lists:
;;; $BAD1: Unused. Setup ;;;
org $84BAD1
;;; Instruction list for visible/chozo nothing
visible_block_plm_start:
dw $8724,visible_block_plm_end ; Always go to the end
visible_block_plm_end:
dw $8724,$DFA9 ; Go to $DFA9
;;; instruction list for nothing shot block
shot_block_plm_start:
dw $8A2E,$E007 ; Call $E007 (item shot block)
dw $8724,shot_block_plm_end ; Always Go to the end
shot_block_plm_end:
dw $8A2E,$E032 ; Call $E032 (empty item shot block reconcealing)
dw $8724,shot_block_plm_start ; Go to start
;;; nothing PLM entries ;;;
print "nothing plm (visible block): ", pc
dw $EE86,visible_block_plm_start ; Nothing, visible/chozo block
print "nothing plm (shot block): ", pc
dw $EE86,shot_block_plm_start ; Nothing, shot block
;;; end of free space
warnpc $84BAF3
|
modules/workflow-condition-parser/src/main/antlr4/org/opencastproject/workflow/conditionparser/antlr/WorkflowCondition.g4 | MaximilianKorn/opencast | 300 | 1983 | grammar WorkflowCondition;
booleanExpression : booleanTerm ( OR booleanExpression )? ;
booleanTerm : booleanValue ( AND booleanTerm )? ;
booleanValue : ( NOT )* ( '(' booleanExpression ')' | relation | BOOL ) ;
relation : relationOperand COMPARISONOPERATOR relationOperand ;
relationOperand : atom ( NUMERICALOPERATOR atom )* | atom ;
atom : '(' relationOperand ')' | NUMBER | STRING | BOOL ;
AND: 'AND' ;
OR: 'OR' ;
NOT: 'NOT' ;
NUMBER: '-'? [0-9]+ ('.' [0-9]+)? ;
COMPARISONOPERATOR: '<=' | '<' | '==' | '>' | '!=' | '>=' ;
NUMERICALOPERATOR: '+' | '-' | '*' | '/' ;
BOOL: 'true' | 'false' ;
STRING : '\'' ( '\'\'' | ~['] )* '\'';
WS: [ \t\r\n]+ -> skip ;
|
Pi/AuxLemmas.agda | DreamLinuxer/popl21-artifact | 5 | 7502 | module Pi.AuxLemmas where
open import Data.Empty
open import Data.Unit
open import Data.Sum
open import Data.Product
open import Relation.Binary.PropositionalEquality
open import Pi.Syntax
open import Pi.Opsem
Lemma₁ : ∀ {A B C D v v' κ κ'} {c : A ↔ B} {c' : C ↔ D}
→ ⟨ c ∣ v ∣ κ ⟩ ↦ [ c' ∣ v' ∣ κ' ]
→ A ≡ C × B ≡ D
Lemma₁ ↦₁ = refl , refl
Lemma₁ ↦₂ = refl , refl
Lemma₂ : ∀ {A B v v' κ κ'} {c c' : A ↔ B}
→ ⟨ c ∣ v ∣ κ ⟩ ↦ [ c' ∣ v' ∣ κ' ]
→ c ≡ c' × κ ≡ κ'
Lemma₂ ↦₁ = refl , refl
Lemma₂ ↦₂ = refl , refl
Lemma₃ : ∀ {A B v v' κ} {c : A ↔ B}
→ (r : ⟨ c ∣ v ∣ κ ⟩ ↦ [ c ∣ v' ∣ κ ])
→ base c ⊎ A ≡ B
Lemma₃ (↦₁ {b = b}) = inj₁ b
Lemma₃ ↦₂ = inj₂ refl
Lemma₄ : ∀ {A v v' κ} {c : A ↔ A}
→ (r : ⟨ c ∣ v ∣ κ ⟩ ↦ [ c ∣ v' ∣ κ ])
→ base c ⊎ c ≡ id↔
Lemma₄ {c = swap₊} ↦₁ = inj₁ tt
Lemma₄ {c = swap⋆} ↦₁ = inj₁ tt
Lemma₄ ↦₂ = inj₂ refl
|
hw4/Question2/Minijava.g4 | mohammadhosseinkarimian/IUSTCompiler | 0 | 5889 | <filename>hw4/Question2/Minijava.g4<gh_stars>0
grammar Minijava;
start returns [value_attr = str(), type_attr = str()]: mainClass classDeclaration* EOF;
mainClass returns [value_attr = str(), type_attr = str()]:
'class' identifier '{' 'public' 'static' 'void' 'main' '(' 'String' '[' ']' identifier ')' '{' statement '}' '}';
classDeclaration returns [value_attr = str(), type_attr = str()]:
'class' identifier ( 'extends' identifier )? '{' varDeclaration* methodDeclaration* '}';
varDeclaration returns [value_attr = str(), type_attr = str()]:
typ identifier ';';
methodDeclaration returns [value_attr = str(), type_attr = str()]:
'public' typ identifier '(' (param (',' param)*)? ')' '{' varDeclaration* statement* 'return' expression ';' '}';
typ returns [value_attr = str(), type_attr = str()]:
'int'
| 'int' '[' ']'
| 'boolean'
| identifier;
statement returns [value_attr = str(), type_attr = str()]: '{' statement* '}'
| 'if' '(' expression ')' statement 'else' statement
| 'while' '(' expression ')' statement
| 'System.out.println' '(' expression ')' ';'
| identifier '=' expression ';'
| identifier '[' expression ']' '=' expression ';';
expression returns [value_attr = str(), type_attr = str()]:
expression binaryOperator expression
| expression '[' expression ']'
| expression '.length'
| expression '.' identifier '(' ( expression ( ',' expression )* )? ')'
| IntegerLiteral
| 'true'
| 'false'
| identifier
| 'this'
| 'new' 'int' '[' expression ']'
| 'new' identifier '(' ')'
| '!' expression
| '(' expression ')';
param returns [value_attr = str(), type_attr = str()]: typ identifier;
binaryOperator returns [value_attr = str(), type_attr = str()]: '&&' | '<' | '+' | '-' | '*';
identifier returns [value_attr = str(), type_attr = str()]: Letter;
Letter : [a-zA-Z_][0-9a-zA-Z_]*;
IntegerLiteral : '0' | [1-9][0-9]*;
WhiteSpace : [ \r\t\n]+ -> skip;
MULTILINE_COMMENT : '/*' .*? '*/' -> skip;
LINE_COMMENT : '//' .*? '\n' -> skip;
|
Day-04/given_number_is_odd_or_even.asm | MasumBhai/50-Day-challenge-with-Assembly-Language | 1 | 95541 | ;Day 04 Date (10/04/21)
;problem- Check Given_number_is_odd_or_even
.model small
.stack 100h
include 'emu8086.inc'
.data
n_line db 0ah,0dh,"$" ;for new line
msg1 db "input your number : $"
msg2 db 10,13,"The number is odd $"
msg3 db 10,13,"The number is even $"
.code
main proc
mov ax,@data
mov ds,ax
mov bl,2 ; i am storing it at first cause (even-odd depends on) divisible by 2
lea dx,msg1
mov ah,9
int 21h
lea dx,n_line
mov ah,9
int 21h
mov ah,1
int 21h
div bl ; divide al by bl
cmp ah,0
je even
jmp odd
stop:
mov ah,4ch
int 21h ;terminate with return code
main endp
odd:
lea dx,msg2
mov ah,9
int 21h
jmp stop
even:
lea dx,msg3
mov ah,9
int 21h
jmp stop
end main
|
programs/oeis/181/A181385.asm | karttu/loda | 0 | 82450 | <filename>programs/oeis/181/A181385.asm<gh_stars>0
; A181385: Maximal number that can be obtained by reversing n in an integer base.
; 0,1,2,3,4,7,9,13,16,21,25,31,36,43,49,57,64,73,81,91,100,111,121,133,144,157,169,183,196,211,225,241,256,273,289,307,324,343,361,381,400,421,441,463,484,507,529,553,576,601,625,651,676,703,729,757,784,813,841
mov $3,$0
mov $4,$0
pow $0,0
add $0,2
div $0,2
sub $4,2
pow $4,2
sub $4,$0
mov $1,$4
mov $2,4
lpb $0,1
sub $0,1
div $1,$2
lpe
add $1,$3
|
data/github.com/pigworker/CS410-17/ecf7c3bbe9b468eb72578d05c7dd4dfa913dce44/lectures/Lec6Done.agda | ajnavarro/language-dataset | 36 | 5373 | module Lec6Done where
open import Lec1Done
data List (X : Set) : Set where
[] : List X
_,-_ : X -> List X -> List X
infixr 4 _,-_
-- ListF : Set -> Set -> Set
-- ListF X T = One + (X * T)
mkList : {X : Set} -> One + (X * List X) -> List X
mkList (inl <>) = []
mkList (inr (x , xs)) = x ,- xs
foldr : {X T : Set} -> ((One + (X * T)) -> T) -> List X -> T
foldr alg [] = alg (inl <>)
foldr alg (x ,- xs) = alg (inr (x , foldr alg xs))
ex1 = foldr mkList (1 ,- 2 ,- 3 ,- [])
length : {X : Set} -> List X -> Nat
length = foldr \ { (inl <>) -> zero ; (inr (x , n)) -> suc n }
record CoList (X : Set) : Set where
coinductive
field
force : One + (X * CoList X)
open CoList
[]~ : {X : Set} -> CoList X
force []~ = inl <>
_,~_ : {X : Set} -> X -> CoList X -> CoList X
force (x ,~ xs) = inr (x , xs)
infixr 4 _,~_
unfoldr : {X S : Set} -> (S -> (One + (X * S))) -> S -> CoList X
force (unfoldr coalg s) with coalg s
force (unfoldr coalg s) | inl <> = inl <>
force (unfoldr coalg s) | inr (x , s') = inr (x , unfoldr coalg s')
ex2 = unfoldr force (1 ,~ 2 ,~ 3 ,~ []~)
repeat : {X : Set} -> X -> CoList X
repeat = unfoldr \ x -> inr (x , x)
prefix : {X : Set} -> Nat -> CoList X -> List X
prefix zero xs = []
prefix (suc n) xs with force xs
prefix (suc n) xs | inl <> = []
prefix (suc n) xs | inr (x , xs') = x ,- prefix n xs'
ex2' = prefix 3 ex2
record Stream (X : Set) : Set where
coinductive
field
hdTl : X * Stream X
open Stream
forever : {X : Set} -> X -> Stream X
fst (hdTl (forever x)) = x
snd (hdTl (forever x)) = forever x
unfold : {X S : Set} -> (S -> X * S) -> S -> Stream X
fst (hdTl (unfold coalg s)) = fst (coalg s)
snd (hdTl (unfold coalg s)) = unfold coalg (snd (coalg s))
|
1-base/math/applet/test/suite/math_tests-geometry_2d.ads | charlie5/lace-alire | 1 | 26656 | with Ahven.Framework;
package math_Tests.Geometry_2d
is
type Test is new Ahven.Framework.Test_Case with null record;
overriding procedure Initialize (T : in out Test);
end math_Tests.Geometry_2d;
|
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_751.asm | ljhsiun2/medusa | 9 | 24261 | <filename>Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_751.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xf185, %rsi
lea addresses_WC_ht+0x741b, %rdi
nop
nop
nop
xor $58256, %r11
mov $97, %rcx
rep movsb
nop
nop
nop
sub $41296, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %rbp
push %rbx
push %rcx
push %rdx
// Load
lea addresses_WT+0xa31b, %rbp
clflush (%rbp)
nop
nop
nop
nop
nop
dec %rcx
mov (%rbp), %ebx
nop
nop
nop
nop
sub %rcx, %rcx
// Faulty Load
lea addresses_normal+0x2b1b, %rbp
nop
nop
nop
nop
cmp %r12, %r12
mov (%rbp), %rbx
lea oracles, %rbp
and $0xff, %rbx
shlq $12, %rbx
mov (%rbp,%rbx,1), %rbx
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
orka_egl/src/egl-errors.ads | onox/orka | 52 | 19547 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2020 onox <<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.
package EGL.Errors is
pragma Preelaborate;
-- Not Pure because Error_Flag can change with each call
type Error_Code is
(Success,
Not_Initialized,
Bad_Access,
Bad_Alloc,
Bad_Attribute,
Bad_Config,
Bad_Context,
Bad_Current_Surface,
Bad_Display,
Bad_Match,
Bad_Native_Pixmap,
Bad_Native_Window,
Bad_Parameter,
Bad_Surface,
Context_Lost,
Bad_Device);
Context_Lost_Error : exception;
Not_Initialized_Error : exception;
Invalid_Operation_Error : exception;
Invalid_Value_Error : exception;
Internal_Error : exception;
procedure Raise_Exception_On_EGL_Error
with Inline;
private
for Error_Code use
(Success => 16#3000#,
Not_Initialized => 16#3001#,
Bad_Access => 16#3002#,
Bad_Alloc => 16#3003#,
Bad_Attribute => 16#3004#,
Bad_Config => 16#3005#,
Bad_Context => 16#3006#,
Bad_Current_Surface => 16#3007#,
Bad_Display => 16#3008#,
Bad_Match => 16#3009#,
Bad_Native_Pixmap => 16#300A#,
Bad_Native_Window => 16#300B#,
Bad_Parameter => 16#300C#,
Bad_Surface => 16#300D#,
Context_Lost => 16#300E#,
Bad_Device => 16#322B#);
for Error_Code'Size use Enum'Size;
end EGL.Errors;
|
cohesion/david_jaz_261/Axiom/LEM.agda | glangmead/formalization | 6 | 2178 | {-# OPTIONS --without-K --rewriting #-}
module Axiom.LEM where
open import Basics
open import Flat
open import lib.Basics
postulate LEM : {@♭ i : ULevel} (@♭ P : PropT i) → Dec (P holds)
|
theorems/homotopy/SuspensionJoin.agda | cmknapp/HoTT-Agda | 0 | 12183 | <reponame>cmknapp/HoTT-Agda
{-# OPTIONS --without-K #-}
open import HoTT
module homotopy.SuspensionJoin {i} (A : Type i) where
{- To -}
false, : A → Bool × A
false, a = false , a
true, : A → Bool × A
true, a = true , a
module To = SuspensionRec {i} (left false :> Bool * A) (left true) (λ a → glue (false, a) ∙ ! (glue (true, a)))
to : Suspension A → (Bool * A)
to = To.f
{- From -}
from : Bool * A → Suspension A
from = From.f module _ where
from-bool : Bool → Suspension A
from-bool false = north
from-bool true = south
from-glue : (c : Bool × A) → from-bool (fst c) == south
from-glue (false , a) = merid a
from-glue (true , a) = idp
module From = PushoutRec {d = *-span Bool A} from-bool (λ _ → south) from-glue
{- ToFrom -}
to-from : (c : Bool * A) → to (from c) == c
to-from = Pushout-elim to-from-left (λ a → glue (true , a)) to-from-glue where
to-from-left : (b : Bool) → to (from (left b)) == left b
to-from-left false = idp
to-from-left true = idp
to-from-glue' : (b : Bool) (a : A)
→ ap to (ap from (glue (b , a))) ∙' glue (true , a) == to-from-left b ∙ glue (b , a)
to-from-glue' true a =
ap to (ap from (glue (true , a))) ∙' glue (true , a) =⟨ From.glue-β (true , a) |in-ctx (λ u → ap to u ∙' glue (true , a)) ⟩
idp ∙' glue (true , a) =⟨ ∙'-unit-l _ ⟩
glue (true , a) ∎
to-from-glue' false a =
ap to (ap from (glue (false , a))) ∙' glue (true , a) =⟨ From.glue-β (false , a) |in-ctx (λ u → ap to u ∙' glue (true , a)) ⟩
ap to (merid a) ∙' glue (true , a) =⟨ To.merid-β a |in-ctx (λ u → u ∙' glue (true , a)) ⟩
(glue (false , a) ∙ ! (glue (true , a))) ∙' glue (true , a) =⟨ coh (glue (false , a)) (glue (true , a)) ⟩
glue (false , a) ∎ where
coh : ∀ {i} {A : Type i} {a b c : A} (p : a == b) (q : c == b) → (p ∙ ! q) ∙' q == p
coh idp idp = idp
to-from-glue : (c : Bool × A)
→ to-from-left (fst c) == glue (true , snd c) [ (λ z → to (from z) == z) ↓ glue c ]
to-from-glue c = ↓-∘=idf-in to from (uncurry to-from-glue' c)
{- FromTo -}
from-to : (c : Suspension A) → from (to c) == c
from-to = Suspension-elim idp idp from-to-merid where
from-to-merid' : (a : A) → ap from (ap to (merid a)) == merid a
from-to-merid' a =
ap from (ap to (merid a)) =⟨ To.merid-β a |in-ctx ap from ⟩
ap from (glue (false , a) ∙ ! (glue (true , a))) =⟨ ap-∙ from (glue (false , a)) (! (glue (true , a))) ⟩
ap from (glue (false , a)) ∙ ap from (! (glue (true , a))) =⟨ ap-! from (glue (true , a)) |in-ctx (λ u → ap from (glue (false , a)) ∙ u) ⟩
ap from (glue (false , a)) ∙ ! (ap from (glue (true , a))) =⟨ From.glue-β (false , a) |in-ctx (λ u → u ∙ ! (ap from (glue (true , a)))) ⟩
merid a ∙ ! (ap from (glue (true , a))) =⟨ From.glue-β (true , a) |in-ctx (λ u → merid a ∙ ! u) ⟩
merid a ∙ idp =⟨ ∙-unit-r _ ⟩
merid a ∎
from-to-merid : (a : A) → idp == idp [ (λ z → from (to z) == z) ↓ merid a ]
from-to-merid a = ↓-∘=idf-in from to (from-to-merid' a)
{- Conclusion -}
e : Suspension A ≃ (Bool * A)
e = equiv to from to-from from-to
|
Games/banchorce/source/anim.asm | CiaranGruber/Ti-84-Calculator | 1 | 99567 | ;---------------------------------------------------------------;
; ;
; Banchor ;
; Animation Routines ;
; ;
;---------------------------------------------------------------;
;------------------------------------------------
; clearAnimTable - Clear animTable
; input: none
; output: none
;------------------------------------------------
clearAnimTable:
ld hl,animTable
ld b,ANIM_ENTRY_SIZE*MAX_ANIMS
jp _ld_hl_bz
;------------------------------------------------
; drawAnims - Draw animations
; input: none
; output: none
;------------------------------------------------
drawAnims:
ld ix,animTable
ld b,MAX_ANIMS
drawAnimsLoop:
push bc
push ix
ld a,(ix+A_CNT)
or a
jr z,endDrawAnimsLoop
dec a
ld e,a
ld d,64
mlt de
ld hl,sprExplosion
add hl,de
ld e,(ix+A_X)
ld d,(ix+A_Y)
call drawSprite
endDrawAnimsLoop:
pop ix
pop bc
ld de,ANIM_ENTRY_SIZE
add ix,de
djnz drawAnimsLoop
ret
;------------------------------------------------
; newAnim - Create a new explosion animation
; input: B = X Coord
; C = Y Coord
; output: none
;------------------------------------------------
newAnim:
push bc
ld b,MAX_ANIMS
ld hl,animTable
ld de,ANIM_ENTRY_SIZE
findEmptyAnimEntry:
ld a,(hl)
or a
jr z,foundEmptyAnimEntry
add hl,de
djnz findEmptyAnimEntry
pop bc
ret
foundEmptyAnimEntry:
ld (hl),1
inc hl
pop bc
ld (hl),b
inc hl
ld (hl),c
ret
;------------------------------------------------
; updateAnims - Update explosion animations
; input: none
; output: none
;------------------------------------------------
updateAnims:
ld a,(frame)
bit 0,a
ret nz
ld hl,animTable
ld de,ANIM_ENTRY_SIZE
ld b,MAX_ANIMS
updateAnimsLoop:
ld a,(hl)
or a
jr z,endUpdateAnimsLoop
inc (hl)
ld a,(hl)
cp ANIM_MAX+1
jr c,endUpdateAnimsLoop
ld (hl),0
endUpdateAnimsLoop:
add hl,de
djnz updateAnimsLoop
ret
.end
|
dino/lcs/123p/CD.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 89614 | copyright zengfr site:http://github.com/zengfr/romhack
010756 move.b D0, ($cd,A3) [123p+ CA]
01075A move.b D0, ($b2,A3)
010EBA move.b D0, ($cd,A3) [123p+ CA]
010EBE move.b ($5e,A2), ($e9,A3)
0116A4 move.b D0, ($cd,A3) [123p+ CA]
0116A8 move.b D0, ($b2,A3)
011DBC move.b D0, ($cd,A3) [123p+ CA]
011DC0 move.b D0, ($b2,A3)
012600 move.b D0, ($cd,A3) [123p+ CA]
012604 move.b D0, ($b2,A3)
018CBA clr.b ($cd,A6) [123p+ 78]
018CBE jmp $5bdc.l [123p+ CD]
01C248 move.b #$2, ($cd,A6) [123p+ 1C]
01C24E jsr $986c.l [123p+ CD]
01C428 move.b #$2, ($cd,A6) [123p+ 1C]
01C42E jsr $986c.l [123p+ CD]
01CC72 move.b #$2, ($cd,A6) [123p+ 1C]
01CC78 jsr $986c.l [123p+ CD]
01CDF6 tst.b ($cd,A6)
01CDFA bne $1ce02 [123p+ CD]
01CECC move.b D0, ($cd,A6)
01CED0 move.b D0, ($7e,A6)
01D0C0 move.b ($cd,A6), D0
01D0C4 bne $1d0ce [123p+ CD]
01D114 tst.b ($cd,A6)
01D118 bne $1d15c
01D14C move.b #$1, ($cd,A6)
01D152 move.b D0, ($7e,A6) [123p+ CD]
01D160 clr.b ($cd,A6) [123p+ CA]
01D164 rts
03C87E tst.b ($cd,A0) [enemy+76]
03C882 beq $3c916 [123p+ CD]
copyright zengfr site:http://github.com/zengfr/romhack
|
GAS/Gas/GASC/UtilsLib/Errors.asm | Gabidal/GAS_Pack | 1 | 8913 | openErr:
append Error, openError, 23
sout Error
jmp endCompile
readErr:
append Error, readError, 32
sout Error
jmp endCompile
writeErr:
append Error, writeError, 43
sout Error
jmp endCompile
closeErr:
append Error, closeError, 18
sout Error
jmp endCompile |
examples/teapot.asm | Spooghetti420/ARM-Assembly-Image-Renderer | 0 | 23799 | // Run at: https://peterhigginson.co.uk/AQA/
// r12 marks the pointer to the image data in memory
mov r12, #img_data
// r11 is the current position in VRAM which is being written to
mov r11, #256
// r0 signifies the row of pixels (item of image data in the img_data section) which is being drawn
mov r0, #0
loop:
mov r1, r12
add r1, r1, r0
// Get the image data of the current row, r0, storing into r2
ldr r2, [r1]
add r0, r0, #1
cmp r0, #24
bgt exit
// Begin extracting each pixel (bit)
mov r3, #31
pixels:
// Now extracting nth bit:
// Operand of bit extraction is r2
// Output register is r7
mov r7, #0
// Bit to be extracted is r3
// Bit mask for AND operation
mov r6, #1
lsl r6, r6, r3
and r7, r2, r6
lsr r7, r7, r3
cmp r7, #1
bne blank_pixel
str r7, [r11]
blank_pixel:
// Update the pixel of VRAM being drawn to to the next pixel
add r11, r11, #1
// Move onto next pixel in the row
cmp r3, #0
sub r3, r3, #1
bgt pixels
b loop
exit:
halt
img_data:
dat 0
dat 0
dat 0
dat 245760
dat 114688
dat 245760
dat 2096664
dat 8388412
dat 536870712
dat 285212656
dat 276824048
dat 276824048
dat 419430368
dat 218103776
dat 117440480
dat 67108832
dat 67108736
dat 16777088
dat 8388480
dat 8388352
dat 4193792
dat 2095104
dat 16384
dat 0 |
test/data/input/load-immediate-0.asm | CDPcode/optimips-prime | 0 | 4373 | <filename>test/data/input/load-immediate-0.asm
la $s1, 0x0000002A |
gfx/pokemon/mew/anim_idle.asm | Dev727/ancientplatinum | 28 | 163661 | <reponame>Dev727/ancientplatinum
setrepeat 2
frame 0, 05
frame 4, 05
dorepeat 1
frame 0, 10
frame 4, 20
dorepeat 1
endanim
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_1171.asm | ljhsiun2/medusa | 9 | 95712 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_UC+0x15ca4, %rsi
inc %rdi
movb $0x51, (%rsi)
nop
nop
sub %rdx, %rdx
// Store
lea addresses_A+0x1664, %rsi
cmp %r14, %r14
mov $0x5152535455565758, %rdx
movq %rdx, (%rsi)
nop
nop
nop
nop
nop
inc %rsi
// Store
lea addresses_normal+0x1d564, %r11
add %rbx, %rbx
movw $0x5152, (%r11)
nop
nop
nop
nop
sub $32112, %rbx
// REPMOV
lea addresses_A+0x1f17, %rsi
lea addresses_UC+0x1b664, %rdi
cmp %r13, %r13
mov $92, %rcx
rep movsq
nop
nop
nop
sub %r11, %r11
// Load
lea addresses_UC+0x1ca64, %rbx
nop
nop
nop
nop
and $28285, %r14
mov (%rbx), %r13
nop
nop
nop
dec %r11
// REPMOV
lea addresses_WT+0x9e64, %rsi
lea addresses_D+0x1d164, %rdi
clflush (%rsi)
nop
nop
nop
lfence
mov $29, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %r11
// Faulty Load
lea addresses_D+0x4664, %rbx
nop
nop
nop
inc %r13
movb (%rbx), %r11b
lea oracles, %r14
and $0xff, %r11
shlq $12, %r11
mov (%r14,%r11,1), %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_A'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_UC'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WT'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_D'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
src/arch/x86_64/bootsectors/multiboot.asm | feds01/Pure64 | 1 | 170927 | ; =============================================================================
; Pure64 Multiboot -- a 64-bit OS/software loader written in Assembly for x86-64 systems
; Copyright (C) 2008-2017 Return Infinity -- see LICENSE.TXT
;
; http://stackoverflow.com/questions/33488194/creating-a-simple-multiboot-kernel-loaded-with-grub2
; https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#OS-image-format
; =============================================================================
[BITS 32]
[global _start]
[ORG 0x100000] ;If using '-f bin' we need to specify the
;origin point for our code with ORG directive
;multiboot loaders load us at physical
;address 0x100000
FLAG_ALIGN equ 1<<0 ; align loaded modules on page boundaries
FLAG_MEMINFO equ 1<<1 ; provide memory map
FLAG_VIDEO equ 1<<2 ; set video mode
FLAG_AOUT_KLUDGE equ 1<<16
;FLAGS[16] indicates to GRUB we are not
;an ELF executable and the fields
;header address, load address, load end address;
;bss end address and entry address will be available
;in Multiboot header
MAGIC equ 0x1BADB002
;magic number GRUB searches for in the first 8k
;of the kernel file GRUB is told to load
FLAGS equ FLAG_ALIGN | FLAG_MEMINFO | FLAG_VIDEO | FLAG_AOUT_KLUDGE
CHECKSUM equ -(MAGIC + FLAGS)
mode_type equ 0 ; Linear
width equ 1024
height equ 768
depth equ 24
_start: ; We need some code before the multiboot header
xor eax, eax ; Clear eax and ebx in the event
xor ebx, ebx ; we are not loaded by GRUB.
jmp multiboot_entry ; Jump over the multiboot header
align 4 ; Multiboot header must be 32-bit aligned
multiboot_header:
dd MAGIC ; magic
dd FLAGS ; flags
dd CHECKSUM ; checksum
dd multiboot_header ; header address
dd _start ; load address of code entry point
dd 0x00 ; load end address : not necessary
dd 0x00 ; bss end address : not necessary
dd multiboot_entry ; entry address GRUB will start at
dd mode_type
dd width
dd height
dd depth
align 16
multiboot_entry:
push 0
popf
cld ; Clear direction flag
; Copy memory map
mov esi, ebx ; GRUB stores the Multiboot info table at the address in EBX
mov edi, 0x6000 ; We want the memory map stored here
add esi, 44 ; Memory map address at this offset in the Mutliboot table
lodsd ; Grab the memory map size in bytes
mov ecx, eax
lodsd ; Grab the memory map address
mov esi, eax
memmap_entry:
lodsd ; Size of entry
cmp eax, 0
je memmap_end
movsd ; base_addr_low
movsd ; base_addr_high
movsd ; length_low
movsd ; length_high
movsd ; type
xor eax, eax
stosd ; padding
stosd
stosd
jmp memmap_entry
memmap_end:
xor eax, eax
mov ecx, 8
rep stosd
; Copy loader and kernel to expected location
mov esi, multiboot_end
mov edi, 0x00008000
mov ecx, 8192 ; Copy 32K
rep movsd ; Copy loader to expected address
cli
jmp 0x00008000
times 512-$+$$ db 0 ; Padding
multiboot_end:
; =============================================================================
; EOF
|
alloy4fun_models/trainstlt/models/8/84W46nvDDaij3cdo2.als | Kaixi26/org.alloytools.alloy | 0 | 892 | <filename>alloy4fun_models/trainstlt/models/8/84W46nvDDaij3cdo2.als
open main
pred id84W46nvDDaij3cdo2_prop9 {
(all t:Train| eventually (no t.pos and after one t.pos:>Entry) )
}
pred __repair { id84W46nvDDaij3cdo2_prop9 }
check __repair { id84W46nvDDaij3cdo2_prop9 <=> prop9o } |
src/presets/cm_presets_defeatvitreous.asm | spannerisms/lttphack | 6 | 9428 | <reponame>spannerisms/lttphack
;===================================================================================================
; PRESET DATA HEADER
;===================================================================================================
presetheader_defeatvitreous:
dw presetSRAM_defeatvitreous ; location of SRAM
dw presetpersistent_defeatvitreous ; location of persistent data
;===================================================================================================
%menu_header("Defeat Vitreous", 16)
;===================================================================================================
;---------------------------------------------------------------------------------------------------
; VITREOUS
;---------------------------------------------------------------------------------------------------
;===================================================================================================
;---------------------------------------------------------------------------------------------------
%preset_UW("Link's Bed", "defeatvitreous", "vitreous", "links_bed")
dw $0104 ; Screen ID
dw $0940, $215A ; Link Coords
dw $0900, $2110 ; Camera HV
db $00 ; Item
db $02 ; Direction
;-----------------------------
db $00 ; Entrance
db $20 ; Room layout
db $00 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Courtyard", "defeatvitreous", "vitreous", "courtyard")
dw $0055 ; Screen ID
dw $0A78, $0BE1 ; Link Coords
dw $0A00, $0B10 ; Camera HV
db $00 ; Item
db $02 ; Direction
;-----------------------------
db $7D ; Entrance
db $AF ; Room layout
db $01 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_OW("Lobby Quadrant Glitch", "defeatvitreous", "vitreous", "lobby_quadrant_glitch")
dw $001B ; Screen ID
dw $07F8, $06FA ; Link Coords
dw $0784, $069C ; Camera HV
db $00 ; Item
db $00 ; Direction
;-----------------------------
dw $0803, $0709 ; Scroll X,Y
dw $0530 ; Tilemap position
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Ice Chair", "defeatvitreous", "vitreous", "ice_chair")
dw $004F ; Screen ID
dw $FFC8, $0E04 ; Link Coords
dw $FF02, $0C00 ; Camera HV
db $00 ; Item
db $00 ; Direction
;-----------------------------
db $04 ; Entrance
db $10 ; Room layout
db $0C ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write16_enable()
%write16($7E0600, $0C00) ; Camera boundaries
%write16($7E0602, $0A00) ; Camera boundaries
%write16($7E0604, $0C10) ; Camera boundaries
%write16($7E0606, $0B10) ; Camera boundaries
%write16($7E0608, $FF00) ; Camera boundaries
%write16($7E060A, $FE00) ; Camera boundaries
%write16($7E060C, $FF00) ; Camera boundaries
%write16($7E060E, $FF00) ; Camera boundaries
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Supply Run", "defeatvitreous", "vitreous", "supply_run")
dw $002F ; Screen ID
dw $FF78, $0BE1 ; Link Coords
dw $FE98, $0910 ; Camera HV
db $00 ; Item
db $02 ; Direction
;-----------------------------
db $04 ; Entrance
db $B0 ; Room layout
db $01 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write16_enable()
%write16($7E0600, $0900) ; Camera boundaries
%write16($7E0602, $0600) ; Camera boundaries
%write16($7E0604, $0910) ; Camera boundaries
%write16($7E0606, $0710) ; Camera boundaries
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_OW("Leaving Kakariko", "defeatvitreous", "vitreous", "leaving_kakariko")
dw $0018 ; Screen ID
dw $0346, $0605 ; Link Coords
dw $02C4, $0600 ; Camera HV
db $01 ; Item
db $00 ; Direction
;-----------------------------
dw $0351, $066D ; Scroll X,Y
dw $0058 ; Tilemap position
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_OW("Bridge to Witch Hut", "defeatvitreous", "vitreous", "bridge_to_witch_hut")
dw $0015 ; Screen ID
dw $0AA4, $05E2 ; Link Coords
dw $0A32, $051E ; Camera HV
db $01 ; Item
db $02 ; Direction
;-----------------------------
dw $0AAF, $058D ; Scroll X,Y
dw $0906 ; Tilemap position
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_OW("Trudge to PoD", "defeatvitreous", "vitreous", "trudge_to_pod")
dw $0015 ; Screen ID
dw $0AA8, $0459 ; Link Coords
dw $0A2E, $0400 ; Camera HV
db $01 ; Item
db $00 ; Direction
;-----------------------------
dw $0AB3, $046F ; Scroll X,Y
dw $0084 ; Tilemap position
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Beetle Colosseum", "defeatvitreous", "vitreous", "beetle_colosseum")
dw $002B ; Screen ID
dw $160A, $04F8 ; Link Coords
dw $1600, $048B ; Camera HV
db $00 ; Item
db $04 ; Direction
;-----------------------------
db $38 ; Entrance
db $4F ; Room layout
db $4A ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_OW("PoD Entrance", "defeatvitreous", "vitreous", "pod_entrance")
dw $005E ; Screen ID
dw $0F50, $063B ; Link Coords
dw $0ED6, $0600 ; Camera HV
db $00 ; Item
db $02 ; Direction
;-----------------------------
dw $0F5B, $066D ; Scroll X,Y
dw $005A ; Tilemap position
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Death Hole", "defeatvitreous", "vitreous", "death_hole")
dw $004A ; Screen ID
dw $14F8, $0814 ; Link Coords
dw $1480, $0800 ; Camera HV
db $00 ; Item
db $00 ; Direction
;-----------------------------
db $26 ; Entrance
db $80 ; Room layout
db $01 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Trudge to Catwalk", "defeatvitreous", "vitreous", "trudge_to_catwalk")
dw $00FA ; Screen ID
dw $14C0, $FF30 ; Link Coords
dw $1448, $FEC5 ; Camera HV
db $01 ; Item
db $00 ; Direction
;-----------------------------
db $26 ; Entrance
db $E0 ; Room layout
db $00 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Sewers to Throne Room", "defeatvitreous", "vitreous", "sewers_to_throne_room")
dw $0040 ; Screen ID
dw $21E8, $060C ; Link Coords
dw $2100, $0602 ; Camera HV
db $01 ; Item
db $06 ; Direction
;-----------------------------
db $26 ; Entrance
db $50 ; Room layout
db $0C ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Reload Enemies", "defeatvitreous", "vitreous", "reload_enemies")
dw $0051 ; Screen ID
dw $22F8, $0814 ; Link Coords
dw $2280, $0800 ; Camera HV
db $01 ; Item
db $00 ; Direction
;-----------------------------
db $26 ; Entrance
db $C0 ; Room layout
db $01 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("East Hall YBA", "defeatvitreous", "vitreous", "east_hall_yba")
dw $0001 ; Screen ID
dw $03E8, $0078 ; Link Coords
dw $0300, $000B ; Camera HV
db $01 ; Item
db $06 ; Direction
;-----------------------------
db $26 ; Entrance
db $90 ; Room layout
db $0E ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write_end()
;---------------------------------------------------------------------------------------------------
%preset_UW("Vitreous", "defeatvitreous", "vitreous", "vitreous")
dw $F080 ; Screen ID
dw $01C8, $11DB ; Link Coords
dw $0102, $10EC ; Camera HV
db $0B ; Item
db $02 ; Direction
;-----------------------------
db $26 ; Entrance
db $B0 ; Room layout
db $00 ; Door / Peg state / Layer
dw $0000 ; Dead sprites
;-----------------------------
%write16_enable()
%write16($7E0600, $1100) ; Camera boundaries
%write16($7E0602, $091E) ; Camera boundaries
%write16($7E0604, $1110) ; Camera boundaries
%write16($7E0606, $0F00) ; Camera boundaries
%write16($7E0608, $0100) ; Camera boundaries
%write16($7E060A, $0000) ; Camera boundaries
%write16($7E060C, $0100) ; Camera boundaries
%write16($7E060E, $0100) ; Camera boundaries
%write_end()
;===================================================================================================
presetpersistent_defeatvitreous:
;===================================================================================================
presetpersistent_defeatvitreous_vitreous:
;-----------------------------
.links_bed
%write_sq()
%write8($7E044A, $00) ; EG strength
%write8($7E047A, $00) ; Armed EG
..end
;-----------------------------
.courtyard
%write8($7E044A, $02) ; EG strength
..end
;-----------------------------
.lobby_quadrant_glitch
..end
;-----------------------------
.ice_chair
%write8($7E044A, $01) ; EG strength
..end
;-----------------------------
.supply_run
%write8($7E047A, $01) ; Armed EG
..end
;-----------------------------
.leaving_kakariko
..end
;-----------------------------
.bridge_to_witch_hut
..end
;-----------------------------
.trudge_to_pod
..end
;-----------------------------
.beetle_colosseum
%write8($7E044A, $02) ; EG strength
%write8($7E047A, $00) ; Armed EG
..end
;-----------------------------
.pod_entrance
..end
;-----------------------------
.death_hole
..end
;-----------------------------
.trudge_to_catwalk
%write8($7E044A, $01) ; EG strength
..end
;-----------------------------
.sewers_to_throne_room
%write8($7E047A, $01) ; Armed EG
..end
;-----------------------------
.reload_enemies
..end
;-----------------------------
.east_hall_yba
%write8($7E047A, $00) ; Armed EG
..end
;-----------------------------
.vitreous
..end
;===================================================================================================
presetSRAM_defeatvitreous:
;-----------------------------
.vitreous
;-----------------------------
..links_bed
%write8($7EF36F, $FF) ; Keys
%writeroom($104, $0002)
...end
;-----------------------------
..courtyard
%write8($7EF359, $01) ; Sword
%write8($7EF35A, $01) ; Shield
%write8($7EF3C5, $01) ; Game state
%write8($7EF3C6, $11) ; Game flags A
%write8($7EF3C8, $03) ; Spawn point
%writeroom($055, $000F)
...end
;-----------------------------
..lobby_quadrant_glitch
...end
;-----------------------------
..ice_chair
%write8($7EF36F, $00) ; Keys
%writeroom($04F, $0004)
%writeroom($050, $000F)
%writeroom($060, $0005)
%writeroom($061, $000F)
...end
;-----------------------------
..supply_run
%write8($7EF36D, $10) ; Health
%writeroom($02F, $0003)
%writeroom($03F, $0005)
%writeroom($040, $000F)
...end
;-----------------------------
..leaving_kakariko
%write8($7EF343, $01) ; Bombs
%write8($7EF35C, $02) ; Bottle 1
%write8($7EF36F, $FF) ; Keys
%write16sram($7EF360, $003C) ; Rupees
%writeroom($103, $001A)
%writeroom($119, $0003)
%writeroom($11D, $01A3)
...end
;-----------------------------
..bridge_to_witch_hut
...end
;-----------------------------
..trudge_to_pod
%write8($7EF35C, $04) ; Bottle 1
%write16sram($7EF360, $0000) ; Rupees
%writeroom($109, $0002)
...end
;-----------------------------
..beetle_colosseum
%write8($7EF343, $02) ; Bombs
%write8($7EF36D, $08) ; Health
%writeroom($008, $0001)
%writeroom($009, $0003)
%writeroom($00A, $000F)
%writeroom($01A, $000F)
%writeroom($01B, $0002)
%writeroom($02B, $000A)
...end
;-----------------------------
..pod_entrance
%write8($7EF343, $04) ; Bombs
%writeroom($02A, $000F)
%writeroom($03A, $800F)
%writeroom($04A, $200F)
...end
;-----------------------------
..death_hole
%write8($7EF343, $06) ; Bombs
%write8($7EF36F, $00) ; Keys
...end
;-----------------------------
..trudge_to_catwalk
%write8($7EF343, $04) ; Bombs
%write8($7EF34F, $01) ; Bottles
%write8($7EF36D, $18) ; Health
%writeroom($00A, $800F)
%writeroom($0FA, $000F)
...end
;-----------------------------
..sewers_to_throne_room
%write8($7EF36D, $10) ; Health
%writeroom($00F, $0004)
%writeroom($010, $000A)
%writeroom($020, $000A)
%writeroom($030, $000A)
%writeroom($0FB, $000F)
%writeroom($0FC, $000C)
%writeroom($0FD, $000F)
%writeroom($0FE, $000F)
%writeroom($0FF, $000B)
...end
;-----------------------------
..reload_enemies
%writeroom($041, $000F)
%writeroom($051, $000F)
...end
;-----------------------------
..east_hall_yba
%write8($7EF343, $03) ; Bombs
%write8($7EF36D, $08) ; Health
%writeroom($001, $000C)
%writeroom($052, $000F)
...end
;-----------------------------
..vitreous
%write8($7EF35C, $02) ; Bottle 1
%write8($7EF36D, $10) ; Health
%writeroom($062, $000F)
%writeroom($063, $0002)
%writeroom($070, $0005)
%writeroom($071, $000C)
%writeroom($072, $000C)
%writeroom($073, $0008)
%writeroom($080, $000F)
...end
;===================================================================================================
presetend_defeatvitreous:
print "defeatvitreous size: $", hex(presetend_defeatvitreous-presetheader_defeatvitreous)
|
focus.applescript | Cottin/yummy-applescripts | 0 | 2058 | <filename>focus.applescript
################################################################################
# FOCUS
# Block addictive sites that steal your time during the workday!
#
# How to use?
# Add the addictive sites in the 'dangerous' variable below and run at the
# beginning of your work day to block them!
################################################################################
activate
set yesno to {"yes", "no"}
choose from list yesno with title "Focus" with prompt "Want to focus?" default items (get item 1 in yesno)
set chosen to result
-- http://stackoverflow.com/questions/8621290/how-to-tell-an-applescript-to-stop-executing
if chosen is false then
error number -128
end if
set hostsFile to "/etc/hosts"
set theContent to read hostsFile as «class utf8»
set theOffset to (offset of "######## focus" in theContent) - 1
set coreContent to ""
if theOffset is -1 then
set coreContent to theContent
else
set coreContent to text 1 thru (theOffset) of theContent
end if
set dangerous to "######## focus
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 www.youtube.com
127.0.0.1 youtube.com
127.0.0.1 inbox.google.com"
set newContent to ""
if chosen as string is equal to "yes" then
set newContent to coreContent & dangerous
else
set newContent to coreContent
end if
do shell script "echo '" & newContent & "' > " & hostsFile with administrator privileges
do shell script "dscacheutil -flushcache"
|
yasm-1.3.0/modules/arch/x86/tests/larlsl.asm | xu5343/ffmpegtoolkit_CentOS7 | 2,151 | 244807 | <gh_stars>1000+
[bits 16]
lar ax, bx
lar ax, [bx]
lar ax, word [bx]
lar eax, bx
lar eax, ebx
lar eax, [bx]
lar eax, word [bx]
lsl ax, bx
lsl ax, [bx]
lsl ax, word [bx]
lsl eax, bx
lsl eax, ebx
lsl eax, [bx]
lsl eax, word [bx]
[bits 32]
lar ax, bx
lar ax, [ebx]
lar ax, word [ebx]
lar eax, bx
lar eax, ebx
lar eax, [ebx]
lar eax, word [ebx]
lsl ax, bx
lsl ax, [ebx]
lsl ax, word [ebx]
lsl eax, bx
lsl eax, ebx
lsl eax, [ebx]
lsl eax, word [ebx]
[bits 64]
lar ax, bx
lar ax, [rbx]
lar ax, word [rbx]
lar eax, bx
lar eax, ebx
lar eax, [rbx]
lar eax, word [rbx]
lar rax, bx
lar rax, ebx
lar rax, [rbx]
lar rax, word [rbx]
lsl ax, bx
lsl ax, [rbx]
lsl ax, word [rbx]
lsl eax, bx
lsl eax, ebx
lsl eax, [rbx]
lsl eax, word [rbx]
lsl rax, bx
lsl rax, ebx
lsl rax, [rbx]
lsl rax, word [rbx]
|
archive/agda-3/src/Everything.agda | m0davis/oscar | 0 | 15520 | <reponame>m0davis/oscar<gh_stars>0
module Everything where
open import Oscar.Prelude public
-- meta-class
open import Oscar.Class public
-- classes
open import Oscar.Class.Amgu public
open import Oscar.Class.Apply public
open import Oscar.Class.Bind public
open import Oscar.Class.Category public
open import Oscar.Class.Congruity public
open import Oscar.Class.Fmap public
open import Oscar.Class.Functor public
open import Oscar.Class.HasEquivalence public
open import Oscar.Class.Hmap public
open import Oscar.Class.Injectivity public
open import Oscar.Class.IsCategory public
open import Oscar.Class.IsDecidable public
open import Oscar.Class.IsEquivalence public
open import Oscar.Class.IsFunctor public
open import Oscar.Class.IsPrecategory public
open import Oscar.Class.IsPrefunctor public
open import Oscar.Class.Leftstar public
open import Oscar.Class.Leftunit public
open import Oscar.Class.Map public
open import Oscar.Class.Precategory public
open import Oscar.Class.Prefunctor public
open import Oscar.Class.Properthing public
open import Oscar.Class.Pure public
open import Oscar.Class.Quadricity public
open import Oscar.Class.Reflexivity public
open import Oscar.Class.Setoid public
open import Oscar.Class.Similarity public
open import Oscar.Class.SimilarityM public
open import Oscar.Class.SimilaritySingleton public
open import Oscar.Class.Smap public
open import Oscar.Class.Smapoid public
open import Oscar.Class.Successor₀ public
open import Oscar.Class.Successor₁ public
open import Oscar.Class.Surjection public
open import Oscar.Class.Surjextensionality public
open import Oscar.Class.Surjidentity public
open import Oscar.Class.Surjtranscommutativity public
open import Oscar.Class.Symmetrical public
open import Oscar.Class.Symmetry public
open import Oscar.Class.Thickandthin public
open import Oscar.Class.Transassociativity public
open import Oscar.Class.Transextensionality public
open import Oscar.Class.Transitivity public
open import Oscar.Class.Transleftidentity public
open import Oscar.Class.Transrightidentity public
open import Oscar.Class.Unit public
open import Oscar.Class.[ExtensibleType] public
open import Oscar.Class.[IsExtensionB] public
-- individual instances
open import Oscar.Class.Amgu.Term∃SubstitistMaybe public
open import Oscar.Class.Congruity.Proposequality public
open import Oscar.Class.Congruity.Proposextensequality public
open import Oscar.Class.HasEquivalence.ExtensionṖroperty public
open import Oscar.Class.HasEquivalence.Ṗroperty public
open import Oscar.Class.HasEquivalence.Substitunction public
open import Oscar.Class.Hmap.Transleftidentity public
open import Oscar.Class.Injectivity.Vec public
open import Oscar.Class.IsDecidable.Fin public
open import Oscar.Class.IsDecidable.¶ public
open import Oscar.Class.Properthing.ExtensionṖroperty public
open import Oscar.Class.Properthing.Ṗroperty public
open import Oscar.Class.Reflexivity.Function public
open import Oscar.Class.Smap.ExtensionFinExtensionTerm public
open import Oscar.Class.Smap.ExtensionṖroperty public
open import Oscar.Class.Smap.TransitiveExtensionLeftṖroperty public
open import Oscar.Class.Surjection.⋆ public
open import Oscar.Class.Symmetrical.ExtensionalUnifies public
open import Oscar.Class.Symmetrical.Symmetry public
open import Oscar.Class.Symmetrical.Unifies public
open import Oscar.Class.Transextensionality.Proposequality public
open import Oscar.Class.Transitivity.Function public
open import Oscar.Class.[ExtensibleType].Proposequality public
-- instance bundles
open import Oscar.Property.Category.AListProposequality public
open import Oscar.Property.Category.ExtensionProposextensequality public
open import Oscar.Property.Category.Function public
open import Oscar.Property.Functor.SubstitistProposequalitySubstitunctionProposextensequality public
open import Oscar.Property.Functor.SubstitunctionExtensionTerm public
open import Oscar.Property.Monad.Maybe public
open import Oscar.Property.Propergroup.Substitunction public
open import Oscar.Property.Setoid.ProductIndexEquivalence public
open import Oscar.Property.Setoid.Proposequality public
open import Oscar.Property.Setoid.Proposextensequality public
open import Oscar.Property.Setoid.ṖropertyEquivalence public
open import Oscar.Property.Thickandthin.FinFinProposequalityMaybeProposequality public
open import Oscar.Property.Thickandthin.FinTermProposequalityMaybeProposequality public
-- data
open import Oscar.Data.Constraint public
open import Oscar.Data.Decidable public
open import Oscar.Data.Descender public
open import Oscar.Data.ExtensionṖroperty public
open import Oscar.Data.Fin public
open import Oscar.Data.List public
open import Oscar.Data.Maybe public
open import Oscar.Data.ProductIndexEquivalence public
open import Oscar.Data.ProperlyExtensionNothing public
open import Oscar.Data.Proposequality public
open import Oscar.Data.ṖropertyEquivalence public
open import Oscar.Data.Substitist public
open import Oscar.Data.Substitunction public
open import Oscar.Data.Surjcollation public
open import Oscar.Data.Surjextenscollation public
open import Oscar.Data.Term public
open import Oscar.Data.Vec public
open import Oscar.Data.¶ public
open import Oscar.Data.𝟘 public
open import Oscar.Data.𝟙 public
open import Oscar.Data.𝟚 public
-- class derivations
open import Oscar.Class.Leftunit.ToUnit public
open import Oscar.Class.Symmetry.ToSym public
open import Oscar.Class.Transleftidentity.ToLeftunit public
|
gcc-gcc-7_3_0-release/gcc/ada/eval_fat.adb | best08618/asylo | 7 | 7246 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- E V A L _ F A T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Einfo; use Einfo;
with Errout; use Errout;
with Sem_Util; use Sem_Util;
package body Eval_Fat is
Radix : constant Int := 2;
-- This code is currently only correct for the radix 2 case. We use the
-- symbolic value Radix where possible to help in the unlikely case of
-- anyone ever having to adjust this code for another value, and for
-- documentation purposes.
-- Another assumption is that the range of the floating-point type is
-- symmetric around zero.
type Radix_Power_Table is array (Int range 1 .. 4) of Int;
Radix_Powers : constant Radix_Power_Table :=
(Radix ** 1, Radix ** 2, Radix ** 3, Radix ** 4);
-----------------------
-- Local Subprograms --
-----------------------
procedure Decompose
(RT : R;
X : T;
Fraction : out T;
Exponent : out UI;
Mode : Rounding_Mode := Round);
-- Decomposes a non-zero floating-point number into fraction and exponent
-- parts. The fraction is in the interval 1.0 / Radix .. T'Pred (1.0) and
-- uses Rbase = Radix. The result is rounded to a nearest machine number.
--------------
-- Adjacent --
--------------
function Adjacent (RT : R; X, Towards : T) return T is
begin
if Towards = X then
return X;
elsif Towards > X then
return Succ (RT, X);
else
return Pred (RT, X);
end if;
end Adjacent;
-------------
-- Ceiling --
-------------
function Ceiling (RT : R; X : T) return T is
XT : constant T := Truncation (RT, X);
begin
if UR_Is_Negative (X) then
return XT;
elsif X = XT then
return X;
else
return XT + Ureal_1;
end if;
end Ceiling;
-------------
-- Compose --
-------------
function Compose (RT : R; Fraction : T; Exponent : UI) return T is
Arg_Frac : T;
Arg_Exp : UI;
pragma Warnings (Off, Arg_Exp);
begin
Decompose (RT, Fraction, Arg_Frac, Arg_Exp);
return Scaling (RT, Arg_Frac, Exponent);
end Compose;
---------------
-- Copy_Sign --
---------------
function Copy_Sign (RT : R; Value, Sign : T) return T is
pragma Warnings (Off, RT);
Result : T;
begin
Result := abs Value;
if UR_Is_Negative (Sign) then
return -Result;
else
return Result;
end if;
end Copy_Sign;
---------------
-- Decompose --
---------------
procedure Decompose
(RT : R;
X : T;
Fraction : out T;
Exponent : out UI;
Mode : Rounding_Mode := Round)
is
Int_F : UI;
begin
Decompose_Int (RT, abs X, Int_F, Exponent, Mode);
Fraction := UR_From_Components
(Num => Int_F,
Den => Machine_Mantissa_Value (RT),
Rbase => Radix,
Negative => False);
if UR_Is_Negative (X) then
Fraction := -Fraction;
end if;
return;
end Decompose;
-------------------
-- Decompose_Int --
-------------------
-- This procedure should be modified with care, as there are many non-
-- obvious details that may cause problems that are hard to detect. For
-- zero arguments, Fraction and Exponent are set to zero. Note that sign
-- of zero cannot be preserved.
procedure Decompose_Int
(RT : R;
X : T;
Fraction : out UI;
Exponent : out UI;
Mode : Rounding_Mode)
is
Base : Int := Rbase (X);
N : UI := abs Numerator (X);
D : UI := Denominator (X);
N_Times_Radix : UI;
Even : Boolean;
-- True iff Fraction is even
Most_Significant_Digit : constant UI :=
Radix ** (Machine_Mantissa_Value (RT) - 1);
Uintp_Mark : Uintp.Save_Mark;
-- The code is divided into blocks that systematically release
-- intermediate values (this routine generates lots of junk).
begin
if N = Uint_0 then
Fraction := Uint_0;
Exponent := Uint_0;
return;
end if;
Calculate_D_And_Exponent_1 : begin
Uintp_Mark := Mark;
Exponent := Uint_0;
-- In cases where Base > 1, the actual denominator is Base**D. For
-- cases where Base is a power of Radix, use the value 1 for the
-- Denominator and adjust the exponent.
-- Note: Exponent has different sign from D, because D is a divisor
for Power in 1 .. Radix_Powers'Last loop
if Base = Radix_Powers (Power) then
Exponent := -D * Power;
Base := 0;
D := Uint_1;
exit;
end if;
end loop;
Release_And_Save (Uintp_Mark, D, Exponent);
end Calculate_D_And_Exponent_1;
if Base > 0 then
Calculate_Exponent : begin
Uintp_Mark := Mark;
-- For bases that are a multiple of the Radix, divide the base by
-- Radix and adjust the Exponent. This will help because D will be
-- much smaller and faster to process.
-- This occurs for decimal bases on machines with binary floating-
-- point for example. When calculating 1E40, with Radix = 2, N
-- will be 93 bits instead of 133.
-- N E
-- ------ * Radix
-- D
-- Base
-- N E
-- = -------------------------- * Radix
-- D D
-- (Base/Radix) * Radix
-- N E-D
-- = --------------- * Radix
-- D
-- (Base/Radix)
-- This code is commented out, because it causes numerous
-- failures in the regression suite. To be studied ???
while False and then Base > 0 and then Base mod Radix = 0 loop
Base := Base / Radix;
Exponent := Exponent + D;
end loop;
Release_And_Save (Uintp_Mark, Exponent);
end Calculate_Exponent;
-- For remaining bases we must actually compute the exponentiation
-- Because the exponentiation can be negative, and D must be integer,
-- the numerator is corrected instead.
Calculate_N_And_D : begin
Uintp_Mark := Mark;
if D < 0 then
N := N * Base ** (-D);
D := Uint_1;
else
D := Base ** D;
end if;
Release_And_Save (Uintp_Mark, N, D);
end Calculate_N_And_D;
Base := 0;
end if;
-- Now scale N and D so that N / D is a value in the interval [1.0 /
-- Radix, 1.0) and adjust Exponent accordingly, so the value N / D *
-- Radix ** Exponent remains unchanged.
-- Step 1 - Adjust N so N / D >= 1 / Radix, or N = 0
-- N and D are positive, so N / D >= 1 / Radix implies N * Radix >= D.
-- As this scaling is not possible for N is Uint_0, zero is handled
-- explicitly at the start of this subprogram.
Calculate_N_And_Exponent : begin
Uintp_Mark := Mark;
N_Times_Radix := N * Radix;
while not (N_Times_Radix >= D) loop
N := N_Times_Radix;
Exponent := Exponent - 1;
N_Times_Radix := N * Radix;
end loop;
Release_And_Save (Uintp_Mark, N, Exponent);
end Calculate_N_And_Exponent;
-- Step 2 - Adjust D so N / D < 1
-- Scale up D so N / D < 1, so N < D
Calculate_D_And_Exponent_2 : begin
Uintp_Mark := Mark;
while not (N < D) loop
-- As N / D >= 1, N / (D * Radix) will be at least 1 / Radix, so
-- the result of Step 1 stays valid
D := D * Radix;
Exponent := Exponent + 1;
end loop;
Release_And_Save (Uintp_Mark, D, Exponent);
end Calculate_D_And_Exponent_2;
-- Here the value N / D is in the range [1.0 / Radix .. 1.0)
-- Now find the fraction by doing a very simple-minded division until
-- enough digits have been computed.
-- This division works for all radices, but is only efficient for a
-- binary radix. It is just like a manual division algorithm, but
-- instead of moving the denominator one digit right, we move the
-- numerator one digit left so the numerator and denominator remain
-- integral.
Fraction := Uint_0;
Even := True;
Calculate_Fraction_And_N : begin
Uintp_Mark := Mark;
loop
while N >= D loop
N := N - D;
Fraction := Fraction + 1;
Even := not Even;
end loop;
-- Stop when the result is in [1.0 / Radix, 1.0)
exit when Fraction >= Most_Significant_Digit;
N := N * Radix;
Fraction := Fraction * Radix;
Even := True;
end loop;
Release_And_Save (Uintp_Mark, Fraction, N);
end Calculate_Fraction_And_N;
Calculate_Fraction_And_Exponent : begin
Uintp_Mark := Mark;
-- Determine correct rounding based on the remainder which is in
-- N and the divisor D. The rounding is performed on the absolute
-- value of X, so Ceiling and Floor need to check for the sign of
-- X explicitly.
case Mode is
when Round_Even =>
-- This rounding mode corresponds to the unbiased rounding
-- method that is used at run time. When the real value is
-- exactly between two machine numbers, choose the machine
-- number with its least significant bit equal to zero.
-- The recommendation advice in RM 4.9(38) is that static
-- expressions are rounded to machine numbers in the same
-- way as the target machine does.
if (Even and then N * 2 > D)
or else
(not Even and then N * 2 >= D)
then
Fraction := Fraction + 1;
end if;
when Round =>
-- Do not round to even as is done with IEEE arithmetic, but
-- instead round away from zero when the result is exactly
-- between two machine numbers. This biased rounding method
-- should not be used to convert static expressions to
-- machine numbers, see AI95-268.
if N * 2 >= D then
Fraction := Fraction + 1;
end if;
when Ceiling =>
if N > Uint_0 and then not UR_Is_Negative (X) then
Fraction := Fraction + 1;
end if;
when Floor =>
if N > Uint_0 and then UR_Is_Negative (X) then
Fraction := Fraction + 1;
end if;
end case;
-- The result must be normalized to [1.0/Radix, 1.0), so adjust if
-- the result is 1.0 because of rounding.
if Fraction = Most_Significant_Digit * Radix then
Fraction := Most_Significant_Digit;
Exponent := Exponent + 1;
end if;
-- Put back sign after applying the rounding
if UR_Is_Negative (X) then
Fraction := -Fraction;
end if;
Release_And_Save (Uintp_Mark, Fraction, Exponent);
end Calculate_Fraction_And_Exponent;
end Decompose_Int;
--------------
-- Exponent --
--------------
function Exponent (RT : R; X : T) return UI is
X_Frac : UI;
X_Exp : UI;
pragma Warnings (Off, X_Frac);
begin
Decompose_Int (RT, X, X_Frac, X_Exp, Round_Even);
return X_Exp;
end Exponent;
-----------
-- Floor --
-----------
function Floor (RT : R; X : T) return T is
XT : constant T := Truncation (RT, X);
begin
if UR_Is_Positive (X) then
return XT;
elsif XT = X then
return X;
else
return XT - Ureal_1;
end if;
end Floor;
--------------
-- Fraction --
--------------
function Fraction (RT : R; X : T) return T is
X_Frac : T;
X_Exp : UI;
pragma Warnings (Off, X_Exp);
begin
Decompose (RT, X, X_Frac, X_Exp);
return X_Frac;
end Fraction;
------------------
-- Leading_Part --
------------------
function Leading_Part (RT : R; X : T; Radix_Digits : UI) return T is
RD : constant UI := UI_Min (Radix_Digits, Machine_Mantissa_Value (RT));
L : UI;
Y : T;
begin
L := Exponent (RT, X) - RD;
Y := UR_From_Uint (UR_Trunc (Scaling (RT, X, -L)));
return Scaling (RT, Y, L);
end Leading_Part;
-------------
-- Machine --
-------------
function Machine
(RT : R;
X : T;
Mode : Rounding_Mode;
Enode : Node_Id) return T
is
X_Frac : T;
X_Exp : UI;
Emin : constant UI := Machine_Emin_Value (RT);
begin
Decompose (RT, X, X_Frac, X_Exp, Mode);
-- Case of denormalized number or (gradual) underflow
-- A denormalized number is one with the minimum exponent Emin, but that
-- breaks the assumption that the first digit of the mantissa is a one.
-- This allows the first non-zero digit to be in any of the remaining
-- Mant - 1 spots. The gap between subsequent denormalized numbers is
-- the same as for the smallest normalized numbers. However, the number
-- of significant digits left decreases as a result of the mantissa now
-- having leading seros.
if X_Exp < Emin then
declare
Emin_Den : constant UI := Machine_Emin_Value (RT)
- Machine_Mantissa_Value (RT) + Uint_1;
begin
if X_Exp < Emin_Den or not Has_Denormals (RT) then
if Has_Signed_Zeros (RT) and then UR_Is_Negative (X) then
Error_Msg_N
("floating-point value underflows to -0.0??", Enode);
return Ureal_M_0;
else
Error_Msg_N
("floating-point value underflows to 0.0??", Enode);
return Ureal_0;
end if;
elsif Has_Denormals (RT) then
-- Emin - Mant <= X_Exp < Emin, so result is denormal. Handle
-- gradual underflow by first computing the number of
-- significant bits still available for the mantissa and
-- then truncating the fraction to this number of bits.
-- If this value is different from the original fraction,
-- precision is lost due to gradual underflow.
-- We probably should round here and prevent double rounding as
-- a result of first rounding to a model number and then to a
-- machine number. However, this is an extremely rare case that
-- is not worth the extra complexity. In any case, a warning is
-- issued in cases where gradual underflow occurs.
declare
Denorm_Sig_Bits : constant UI := X_Exp - Emin_Den + 1;
X_Frac_Denorm : constant T := UR_From_Components
(UR_Trunc (Scaling (RT, abs X_Frac, Denorm_Sig_Bits)),
Denorm_Sig_Bits,
Radix,
UR_Is_Negative (X));
begin
if X_Frac_Denorm /= X_Frac then
Error_Msg_N
("gradual underflow causes loss of precision??",
Enode);
X_Frac := X_Frac_Denorm;
end if;
end;
end if;
end;
end if;
return Scaling (RT, X_Frac, X_Exp);
end Machine;
-----------
-- Model --
-----------
function Model (RT : R; X : T) return T is
X_Frac : T;
X_Exp : UI;
begin
Decompose (RT, X, X_Frac, X_Exp);
return Compose (RT, X_Frac, X_Exp);
end Model;
----------
-- Pred --
----------
function Pred (RT : R; X : T) return T is
begin
return -Succ (RT, -X);
end Pred;
---------------
-- Remainder --
---------------
function Remainder (RT : R; X, Y : T) return T is
A : T;
B : T;
Arg : T;
P : T;
Arg_Frac : T;
P_Frac : T;
Sign_X : T;
IEEE_Rem : T;
Arg_Exp : UI;
P_Exp : UI;
K : UI;
P_Even : Boolean;
pragma Warnings (Off, Arg_Frac);
begin
if UR_Is_Positive (X) then
Sign_X := Ureal_1;
else
Sign_X := -Ureal_1;
end if;
Arg := abs X;
P := abs Y;
if Arg < P then
P_Even := True;
IEEE_Rem := Arg;
P_Exp := Exponent (RT, P);
else
-- ??? what about zero cases?
Decompose (RT, Arg, Arg_Frac, Arg_Exp);
Decompose (RT, P, P_Frac, P_Exp);
P := Compose (RT, P_Frac, Arg_Exp);
K := Arg_Exp - P_Exp;
P_Even := True;
IEEE_Rem := Arg;
for Cnt in reverse 0 .. UI_To_Int (K) loop
if IEEE_Rem >= P then
P_Even := False;
IEEE_Rem := IEEE_Rem - P;
else
P_Even := True;
end if;
P := P * Ureal_Half;
end loop;
end if;
-- That completes the calculation of modulus remainder. The final step
-- is get the IEEE remainder. Here we compare Rem with (abs Y) / 2.
if P_Exp >= 0 then
A := IEEE_Rem;
B := abs Y * Ureal_Half;
else
A := IEEE_Rem * Ureal_2;
B := abs Y;
end if;
if A > B or else (A = B and then not P_Even) then
IEEE_Rem := IEEE_Rem - abs Y;
end if;
return Sign_X * IEEE_Rem;
end Remainder;
--------------
-- Rounding --
--------------
function Rounding (RT : R; X : T) return T is
Result : T;
Tail : T;
begin
Result := Truncation (RT, abs X);
Tail := abs X - Result;
if Tail >= Ureal_Half then
Result := Result + Ureal_1;
end if;
if UR_Is_Negative (X) then
return -Result;
else
return Result;
end if;
end Rounding;
-------------
-- Scaling --
-------------
function Scaling (RT : R; X : T; Adjustment : UI) return T is
pragma Warnings (Off, RT);
begin
if Rbase (X) = Radix then
return UR_From_Components
(Num => Numerator (X),
Den => Denominator (X) - Adjustment,
Rbase => Radix,
Negative => UR_Is_Negative (X));
elsif Adjustment >= 0 then
return X * Radix ** Adjustment;
else
return X / Radix ** (-Adjustment);
end if;
end Scaling;
----------
-- Succ --
----------
function Succ (RT : R; X : T) return T is
Emin : constant UI := Machine_Emin_Value (RT);
Mantissa : constant UI := Machine_Mantissa_Value (RT);
Exp : UI := UI_Max (Emin, Exponent (RT, X));
Frac : T;
New_Frac : T;
begin
if UR_Is_Zero (X) then
Exp := Emin;
end if;
-- Set exponent such that the radix point will be directly following the
-- mantissa after scaling.
if Has_Denormals (RT) or Exp /= Emin then
Exp := Exp - Mantissa;
else
Exp := Exp - 1;
end if;
Frac := Scaling (RT, X, -Exp);
New_Frac := Ceiling (RT, Frac);
if New_Frac = Frac then
if New_Frac = Scaling (RT, -Ureal_1, Mantissa - 1) then
New_Frac := New_Frac + Scaling (RT, Ureal_1, Uint_Minus_1);
else
New_Frac := New_Frac + Ureal_1;
end if;
end if;
return Scaling (RT, New_Frac, Exp);
end Succ;
----------------
-- Truncation --
----------------
function Truncation (RT : R; X : T) return T is
pragma Warnings (Off, RT);
begin
return UR_From_Uint (UR_Trunc (X));
end Truncation;
-----------------------
-- Unbiased_Rounding --
-----------------------
function Unbiased_Rounding (RT : R; X : T) return T is
Abs_X : constant T := abs X;
Result : T;
Tail : T;
begin
Result := Truncation (RT, Abs_X);
Tail := Abs_X - Result;
if Tail > Ureal_Half then
Result := Result + Ureal_1;
elsif Tail = Ureal_Half then
Result := Ureal_2 *
Truncation (RT, (Result / Ureal_2) + Ureal_Half);
end if;
if UR_Is_Negative (X) then
return -Result;
elsif UR_Is_Positive (X) then
return Result;
-- For zero case, make sure sign of zero is preserved
else
return X;
end if;
end Unbiased_Rounding;
end Eval_Fat;
|
examples/paper/performance/alloy/ropebridge.als | joukestoel/rebel2 | 5 | 2447 | module ropebridge
open util/ordering[State] as ord
sig State {
far: set Object,
near: set Object,
totalTime: one Int
}
abstract sig Object {}
abstract sig Adventurer extends Object {
timeToCross: one Int
}
one sig A1,A2,A3,A4 extends Adventurer {}
one sig Torch extends Object {}
fact travelTimes {
A1.timeToCross = 1
A2.timeToCross = 2
A3.timeToCross = 5
A4.timeToCross = 10
}
fact NoQuantumAdventurers {
all s: State | no s.(far & near)
}
fact EverybodyHasAPlace {
all s:State | Object = s.(far+near)
}
pred cross[from, from', to, to': Object, s,s':State] {
some a,b: from-Torch | {
from' = from - Torch - (a+b)
to'= to + Torch + a + b
a.timeToCross.gt[b.timeToCross] implies
s'.totalTime = s.totalTime.plus[a.timeToCross] else
s'.totalTime = s.totalTime.plus[b.timeToCross]
}
}
fact SomebodyCrossesEachTime {
all s: State, s': ord/next[s] | {
Torch in s.near implies
cross[s.near,s'.near,s.far,s'.far,s,s'] else
cross[s.far,s'.far,s.near, s'.near,s,s']
}
}
fact Initial {
ord/first.near = Object
ord/first.totalTime = 0
}
fact goal {
Object = ord/last.far && ord/last.totalTime = 17
}
pred show {}
run show for 6 State, 6 Int
run show for 6 State, 10 Int
|
alloy4fun_models/trashltl/models/15/SdRLo2fQGPsnm6DnN.als | Kaixi26/org.alloytools.alloy | 0 | 3377 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idSdRLo2fQGPsnm6DnN_prop16 {
all f:File | f in Protected implies always (historically f in Protected)
}
pred __repair { idSdRLo2fQGPsnm6DnN_prop16 }
check __repair { idSdRLo2fQGPsnm6DnN_prop16 <=> prop16o } |
Kernel/Assembly/X64.asm | bitPanG98/SillyOS | 1 | 241878 | [bits 64]
global PLATFORM_ENTRY
global FlushGDT
;Global our addresses
global KERNEL_STACK_TOP
global KERNEL_STACK_BOTTOM
extern PlatformMain
BLOCK_SIZE equ 8
KERNEL_HEAP_SIZE equ 2
KERNEL_STACK_SIZE equ 2
section .entry
;Everything start from here.
PLATFORM_ENTRY:
;Disable interrupt
cli
;Setup stack
mov rbp, KERNEL_STACK_TOP
mov rsp, rbp
; we assume rdi stored the address of the booting infomation
call PlatformMain
;if we somehow get in here, we need to stop it
cli
hlt
;Ref: See https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/CpuDxe/X64/CpuAsm.nasm
;Thanks to MouseOS: http://www.mouseos.com/os/tools/nasm.html
FlushGDT:
;edi: code esi: data
;allocate 16 byte
sub rsp, 0x10
lea rax, [.rocket_jump]
mov [rsp], rax
mov [rsp+4], di
jmp dword far [rsp]
.rocket_jump:
;restore stack
add rsp, 0x10
mov ax, si
mov es, ax
mov ds, ax
mov gs, ax
mov fs, ax
mov ss, ax
ret
section .bss
KERNEL_STACK_BOTTOM:
resb 4096 * KERNEL_STACK_SIZE ; 2 * 4K page
KERNEL_STACK_TOP: |
ada-wide_text_io-unbounded_io.ads | mgrojo/adalib | 15 | 17182 | -- 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.Strings.Wide_Unbounded;
package Ada.Wide_Text_IO.Unbounded_IO is
procedure Put
(File : in File_Type;
Item : in Strings.Wide_Unbounded.Wide_Unbounded_String);
procedure Put
(Item : in Strings.Wide_Unbounded.Wide_Unbounded_String);
procedure Put_Line
(File : in File_Type;
Item : in Strings.Wide_Unbounded.Wide_Unbounded_String);
procedure Put_Line
(Item : in Strings.Wide_Unbounded.Wide_Unbounded_String);
function Get_Line
(File : in File_Type)
return Strings.Wide_Unbounded.Wide_Unbounded_String;
function Get_Line
return Strings.Wide_Unbounded.Wide_Unbounded_String;
procedure Get_Line
(File : in File_Type;
Item : out Strings.Wide_Unbounded.Wide_Unbounded_String);
procedure Get_Line
(Item : out Strings.Wide_Unbounded.Wide_Unbounded_String);
end Ada.Wide_Text_IO.Unbounded_IO;
|
libsrc/_DEVELOPMENT/time/c/sccz80/tm_from_dostm.asm | ahjelm/z88dk | 640 | 16031 | ; void tm_from_dostm(struct tm *,struct dos_tm *)
SECTION code_time
PUBLIC tm_from_dostm
EXTERN asm_tm_from_dostm
tm_from_dostm:
pop af
pop hl
pop de
push de
push hl
push af
jp asm_tm_from_dostm
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _tm_from_dostm
defc _tm_from_dostm = tm_from_dostm
ENDIF
|
project/src/avr-interrupts.adb | pvrego/adaino | 8 | 28163 | <reponame>pvrego/adaino<gh_stars>1-10
with System.Machine_Code;
with AVR.USART;
with AVR.TWI;
with AVR.TIMERS.CLOCK;
-- =============================================================================
-- Package body AVR.INTERRUPTS
-- =============================================================================
package body AVR.INTERRUPTS is
procedure Enable is
begin
System.Machine_Code.Asm ("sei", Volatile => True);
end Enable;
procedure Disable is
begin
System.Machine_Code.Asm ("cli", Volatile => True);
end Disable;
procedure Handle_Interrupt_USART0_RX is
begin
AVR.USART.Handle_ISR_RXC (AVR.USART.USART0);
end Handle_Interrupt_USART0_RX;
#if MCU="ATMEGA2560" then
procedure Handle_Interrupt_USART1_RX is
begin
AVR.USART.Handle_ISR_RXC (AVR.USART.USART1);
end Handle_Interrupt_USART1_RX;
procedure Handle_Interrupt_USART2_RX is
begin
AVR.USART.Handle_ISR_RXC (AVR.USART.USART2);
end Handle_Interrupt_USART2_RX;
procedure Handle_Interrupt_USART3_RX is
begin
AVR.USART.Handle_ISR_RXC (AVR.USART.USART3);
end Handle_Interrupt_USART3_RX;
#end if;
procedure Handle_Interrupt_TWI is
begin
AVR.TWI.Handle_Interrupts;
end Handle_Interrupt_TWI;
procedure Handle_Interrupt_TIMER4_OVF is
begin
AVR.TIMERS.CLOCK.Schedule_Update_Clock;
end Handle_Interrupt_TIMER4_OVF;
end AVR.INTERRUPTS;
|
jgrapht-1.5.1/source/jgrapht-io/src/main/antlr4/org/jgrapht/nio/dot/DOT.g4 | MedAnisse/GrapheAlgo | 1 | 3886 | /*
* (C) Copyright 2016-2017, by <NAME> and Contributors.
*
* JGraphT : a free Java graph-theory library
*
* This program and the accompanying materials are dual-licensed under
* either
*
* (a) the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation, or (at your option) any
* later version.
*
* or (per the licensee's choosing)
*
* (b) the terms of the Eclipse Public License v1.0 as published by
* the Eclipse Foundation.
*/
grammar DOT;
graph
: graphHeader compoundStatement
;
compoundStatement
: '{' ( statement ';'? )* '}'
;
graphHeader
: STRICT? ( GRAPH | DIGRAPH ) graphIdentifier?
;
graphIdentifier
: identifier
;
statement
: nodeStatement | edgeStatement | attributeStatement | identifierPairStatement | subgraphStatement
;
identifierPairStatement
: identifierPair
;
attributeStatement
: ( GRAPH | NODE | EDGE ) attributesList
;
attributesList
: ( '[' aList? ']' )+
;
aList
: ( identifierPair (';'|',')? )+
;
edgeStatement
: ( nodeStatementNoAttributes | subgraphStatement ) ( ('->' | '--') ( nodeStatementNoAttributes | subgraphStatement ) )+ attributesList?
;
nodeStatement
: nodeIdentifier attributesList?
;
nodeStatementNoAttributes
: nodeIdentifier
;
nodeIdentifier
: identifier (port)?
;
port
: ':' identifier ( ':' identifier )?
;
subgraphStatement
: ( SUBGRAPH identifier? )? compoundStatement
;
identifierPair
: identifier '=' identifier
;
identifier
: Id | String | HtmlString | Numeral
;
// LEXER
STRICT
: ('S'|'s')('T'|'t')('R'|'r')('I'|'i')('C'|'c')('T'|'t')
;
GRAPH
: ('G'|'g')('R'|'r')('A'|'a')('P'|'p')('H'|'h')
;
DIGRAPH
: ('D'|'d')('I'|'i')('G'|'g')('R'|'r')('A'|'a')('P'|'p')('H'|'h')
;
NODE
: ('N'|'n')('O'|'o')('D'|'d')('E'|'e')
;
EDGE
: ('E'|'e')('D'|'d')('G'|'g')('E'|'e')
;
SUBGRAPH
: ('S'|'s')('U'|'u')('B'|'b')('G'|'g')('R'|'r')('A'|'a')('P'|'p')('H'|'h')
;
Numeral
: '-'? ( '.' Digit+ | Digit+ ( '.' Digit* )? )
;
String
: '"' SCharSequence? '"'
;
Id
: Letter ( Letter | Digit )*
;
HtmlString
: '<' ( HtmlTag | ~[<>] )* '>'
;
fragment
HtmlTag
: '<' .*? '>'
;
fragment
SCharSequence
: SChar+
;
fragment
SChar
: ~["\\]
| '\\' ["\\]
| '\\\n'
| '\\\r\n'
;
fragment
Digit
: [0-9]
;
fragment
Letter
: [a-zA-Z\u0080-\u00FF_]
;
WS
: [ \t\n\r]+ -> skip
;
COMMENT
: '/*' .*? '*/' -> skip
;
LINE_COMMENT
: '//' .*? '\r'? '\n' -> skip
;
PREPROC
: '#' .*? '\n' -> skip
;
|
source/tabula-users-load.ads | ytomino/vampire | 1 | 3712 | <gh_stars>1-10
-- The Village of Vampire by YT, このソースコードはNYSLです
procedure Tabula.Users.Load (
Name : in String;
Info : in out User_Info);
|
org.alloytools.alloy.diff/misc/string/string3.als | jringert/alloy-diff | 1 | 2916 | sig A {
x : String
}
sig B {
x : String
}
run {A.x="Jan" and B.x="Jan" and #String = 1} for 3
|
legacy/src/server/compiler/output/What/What.g4 | gjcampbell/antlr-editor | 2 | 982 | grammar What;
TAB : (' '|[\t]) -> pushMode(DOC);
mode DOC;
DNL : [\r\n] -> popMode;
mode FIELD_VALUE;
FVNL : [\r\n] -> popMode;
|
programs/oeis/124/A124759.asm | jmorken/loda | 1 | 168962 | ; A124759: Sum of products of consecutive terms for compositions in standard order.
; 0,0,0,1,0,2,2,2,0,3,4,3,3,4,3,3,0,4,6,4,6,6,4,4,4,6,6,5,4,5,4,4,0,5,8,5,9,8,5,5,8,9,8,7,5,6,5,5,5,8,9,7,8,8,6,6,5,7,7,6,5,6,5,5,0,6,10,6,12,10,6,6,12,12,10,9,6,7,6,6,10,12,12,10,10,10,8,8,6,8,8,7,6,7,6,6,6,10,12,9,12,11,8,8,10,11,10,9,7,8,7,7,6,9,10,8,9,9,7,7,6,8,8,7,6,7,6,6,0,7,12,7,15,12,7,7,16,15,12,11,7,8,7,7,15,16,15,13,12,12,10,10,7,9,9,8,7,8,7,7,12,15,16,13,15,14,11,11,12,13,12,11,9,10,9,9,7,10,11,9,10,10,8,8,7,9,9,8,7,8,7,7,7,12,15,11,16,14,10,10,15,15,13,12,9,10,9,9,12,14,14,12,12,12,10,10,8,10,10,9,8,9,8,8,7,11,13,10,13,12,9,9,11,12,11,10,8,9,8,8,7,10,11,9,10,10,8,8,7,9
mov $1,99
lpb $0
mov $2,$0
cal $2,285097 ; a(n) = difference between the positions of two least significant 1-bits in base-2 representation of n, or 0 if there are less than two 1-bits in n (when n is either zero or a power of 2).
div $0,2
add $1,$2
lpe
sub $1,99
|
programs/oeis/051/A051162.asm | karttu/loda | 0 | 87316 | <gh_stars>0
; A051162: Triangle T(n,k) = n+k, n >= 0, 0 <= k <= n.
; 0,1,2,2,3,4,3,4,5,6,4,5,6,7,8,5,6,7,8,9,10,6,7,8,9,10,11,12,7,8,9,10,11,12,13,14,8,9,10,11,12,13,14,15,16,9,10,11,12,13,14,15,16,17,18,10,11,12,13,14,15,16,17,18,19,20,11,12,13,14,15,16,17,18,19,20,21,22,12,13,14,15,16,17,18,19,20,21,22,23,24,13,14,15,16,17,18,19,20,21,22,23,24,25,26,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
lpb $0,1
sub $0,1
mov $1,$0
add $2,1
trn $0,$2
lpe
add $1,$2
|
src/Categories/Functor/Instance/0-Truncation.agda | Trebor-Huang/agda-categories | 279 | 11365 | <reponame>Trebor-Huang/agda-categories
{-# OPTIONS --without-K --safe #-}
module Categories.Functor.Instance.0-Truncation where
-- 0-trucation of groupoids as a functor from Groupoids to Setoids.
--
-- This is the right-adjoint of the inclusion functor from Setoids to
-- Groupoids (see Categories.Functor.Adjoint.Instance.ZeroTruncation)
import Function
open import Function.Equality using (_⟶_)
open import Relation.Binary using (Setoid)
open import Categories.Category using (Category; _[_≈_])
open import Categories.Functor hiding (id)
open import Categories.Category.Groupoid using (Groupoid)
open import Categories.Category.Instance.Groupoids using (Groupoids)
open import Categories.Category.Instance.Setoids using (Setoids)
open import Categories.NaturalTransformation.NaturalIsomorphism
using (NaturalIsomorphism; _≃_)
Trunc : ∀ {o ℓ e} → Functor (Groupoids o ℓ e) (Setoids o ℓ)
Trunc {o} {ℓ} {e} = record
{ F₀ = TruncSetoid
; F₁ = λ {G H} F → TruncMap {G} {H} F
; identity = Function.id
; homomorphism = λ {_ _ _ F G} f → F₁ G (F₁ F f)
; F-resp-≈ = λ {G H} → TruncRespNI {G} {H}
}
where
open Groupoid using (category)
open Functor
TruncSetoid : Groupoid o ℓ e → Setoid o ℓ
TruncSetoid G = record
{ Carrier = Obj
; _≈_ = _⇒_
; isEquivalence = record
{ refl = id
; sym = _⁻¹
; trans = λ f g → g ∘ f
}
}
where open Groupoid G
TruncMap : ∀ {G H} → Functor (category G) (category H) →
TruncSetoid G ⟶ TruncSetoid H
TruncMap F = record { _⟨$⟩_ = F₀ F ; cong = F₁ F }
TruncRespNI : ∀ {G H : Groupoid o ℓ e}
{E F : Functor (category G) (category H)} →
E ≃ F → Setoids o ℓ [ TruncMap {G} {H} E ≈ TruncMap {G} {H} F ]
TruncRespNI {_} {H} {_} {F} μ {a} f = F₁ F f ∘ ⇒.η a
where
open Groupoid H
open NaturalIsomorphism μ
|
Transynther/x86/_processed/AVXALIGN/_ht_zr_/i9-9900K_12_0xca_notsx.log_21829_72.asm | ljhsiun2/medusa | 9 | 21310 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x11123, %rsi
lea addresses_WT_ht+0x16867, %rdi
clflush (%rsi)
nop
xor %r9, %r9
mov $35, %rcx
rep movsl
nop
nop
nop
add %r14, %r14
lea addresses_WC_ht+0x1d767, %rsi
nop
add $36014, %r15
mov (%rsi), %r9d
nop
inc %r15
lea addresses_D_ht+0x10867, %rsi
lea addresses_UC_ht+0x11dc7, %rdi
nop
nop
xor %rbp, %rbp
mov $89, %rcx
rep movsw
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_A_ht+0x2f87, %r15
add $62088, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%r15)
nop
and %r9, %r9
lea addresses_normal_ht+0x1417b, %rsi
lea addresses_WC_ht+0x1eb84, %rdi
nop
add $931, %r10
mov $108, %rcx
rep movsq
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_UC_ht+0x111a7, %rsi
nop
nop
inc %rcx
mov $0x6162636465666768, %r10
movq %r10, %xmm7
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm7, (%rsi)
nop
nop
lfence
lea addresses_A_ht+0x45ab, %rsi
nop
nop
nop
nop
nop
sub %rdi, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, (%rsi)
cmp $7177, %rdi
lea addresses_WC_ht+0x9067, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
inc %rdi
mov (%rsi), %r14w
nop
sub $17764, %rsi
lea addresses_UC_ht+0x848b, %rsi
lea addresses_WC_ht+0xf637, %rdi
nop
sub $64591, %r15
mov $52, %rcx
rep movsb
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x4367, %rbp
nop
cmp $28615, %r14
mov $0x6162636465666768, %rcx
movq %rcx, (%rbp)
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x1ade1, %rsi
lea addresses_A_ht+0xb75f, %rdi
nop
nop
nop
xor $10491, %r10
mov $115, %rcx
rep movsw
nop
nop
nop
xor $12046, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r15
push %rax
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_WT+0xc867, %r11
nop
nop
nop
add $17093, %rsi
vmovntdqa (%r11), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r15
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_WT', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 2, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 2}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_UC_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_A_ht'}}
{'46': 20507, '00': 30, '48': 7, '44': 1285}
46 46 46 46 46 46 46 46 46 44 46 46 46 44 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 44 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 44 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 00 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 44 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 00 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 44 46 46 46 46 46 46 46 46 44 46 46 00 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 44 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 44 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46
*/
|
dev/smartdrv/pdetect.asm | minblock/msdos | 0 | 163121 | ;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1991
; * All Rights Reserved.
; */
include bambi.inc
zseg segment public 'CODE'
assume cs:zseg
assume ds:nothing
public detect_processor
.386
;******************************************************************************
; DetectProcessor - return type of processor (386/486 vs. 8088/86/286).
; This routine relies on Intel-approved code that takes advantage
; of the documented behavior of the high nibble of the flag word
; in the REAL MODE of the various processors. The MSB (bit 15)
; is always a one on the 8086 and 8088 and a zero on the 286 and
; 386/486. Bit 14 (NT flag) and bits 13/12 (IOPL bit field) are
; always zero on the 286, but can be set on the 386.
;
; For future compatibility of this test, it is strongly recommended
; that this specific instruction sequence be used. The exit codes
; can of course be changed to fit a particular need.
;
; CALLABLE FROM REAL MODE ONLY
;
; this routine was stolen from EMM/386 source code
;
; ENTRY: (none)
;
; EXIT: 0 = 8086/8088
; 2 = 286
; 3 = 386
; -4 = >=486
;------------------------------------------------------------------------------
;CPU086088 equ 0
;CPU186 equ 1 ;not detected here
;CPU286 equ 2
;CPU386 equ 4
;CPU486ORABV equ 8
detect_processor proc near
push si
push di
push ds
push es
pushf ; save entry flags
xor ax, ax ; 0000 into AX
push ax
popf ; try to put that in the flags
pushf
pop ax ; look at what really went into flags
test ax, 08000h ;Q: was high bit set ?
jnz short cpu_is_8086 ; Y: 8086/8088
mov ax, 07000h ; N: try to set the NT/IOPL bits
push ax
popf ; ... in the flags
sti ; (for VDMM/IOPL0)
pushf
pop ax ; look at actual flags
popf ; restore entry flags
test ax, 07000h ; Q: any high bits set ?
jz short cpu_is_286 ; N: 80286
;
; 386 or 486? See if we can set the AC (Alignment check) bit in Eflags
; Need to insure stack is DWORD aligned for this to work properly
;
push cx
xor cx,cx ; Assume stack aligned
mov ax,sp
and ax,000011B
jz short NoStkAdj ; Stack is aligned
mov cx,ax ; set "pop" count
sub sp,ax ; Move to DWORD aligned
NoStkAdj:
pushfd ; save entry flags (DWORD)
push dword ptr 40000h ; AC bit
popfd
pushfd
pop eax
popfd ; Recover entry flags (DWORD)
test eax,40000h ; Did AC bit set?
jnz short cpu_is_486 ; Yes, 486
inc ax ; Make AX non-zero
add sp,cx ; pop off alignment bytes
pop cx ; Entry cx
mov ax,CPU386 ; 386 detected
jmp short donedetection
cpu_is_486:
add sp,cx ; pop off alignment bytes
pop cx ; Entry cx
mov ax,CPU486ORABV ; 486 detected
jmp short donedetection
cpu_is_8086:
popf ; restore flags
mov ax,CPU086088 ; 8086/8088 detected
jmp short donedetection
cpu_is_286:
mov ax,CPU286 ; 286 detected
;;jmp short donedetection fall through
donedetection:
pop es
pop ds
pop di
pop si
ret
detect_processor endp
zseg ends
end
|
oeis/255/A255465.asm | neoneye/loda-programs | 11 | 16902 | <filename>oeis/255/A255465.asm
; A255465: a(n) = A255464(2^n-1).
; Submitted by <NAME>
; 1,6,22,90,358,1434,5734,22938,91750,367002,1468006,5872026,23488102,93952410,375809638,1503238554,6012954214,24051816858,96207267430,384829069722,1539316278886,6157265115546,24629060462182,98516241848730,394064967394918,1576259869579674,6305039478318694,25220157913274778,100880631653099110,403522526612396442,1614090106449585766,6456360425798343066,25825441703193372262,103301766812773489050,413207067251093956198,1652828269004375824794,6611313076017503299174,26445252304070013196698
mov $1,4
pow $1,$0
mul $1,7
add $1,2
div $1,5
mov $0,$1
|
oeis/142/A142405.asm | neoneye/loda-programs | 11 | 164444 | ; A142405: Primes congruent to 23 mod 48.
; Submitted by <NAME>
; 23,71,167,263,311,359,503,599,647,743,839,887,983,1031,1223,1319,1367,1511,1559,1607,1847,2039,2087,2423,2663,2711,2903,2999,3191,3527,3623,3671,3719,3767,3863,3911,4007,4391,4583,4679,4871,4919,4967,5303,5351,5399,5591,5639,5783,5879,5927,6263,6311,6359,6551,6599,6791,6983,7079,7127,7559,7607,7703,8039,8087,8231,8423,8663,8807,8951,8999,9239,9431,9479,9623,9719,9767,10007,10103,10151,10247,10343,10391,10487,10631,11159,11351,11399,11447,11783,11831,11927,12071,12119,12263,12503,12647,12743
mov $2,$0
pow $2,2
mov $4,9
lpb $2
mov $3,$4
add $3,13
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,48
lpe
mov $0,$4
add $0,14
|
Numbers/Modulo/Group.agda | Smaug123/agdaproofs | 4 | 16164 | {-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Definition
open import Groups.Abelian.Definition
open import Groups.FiniteGroups.Definition
open import Numbers.Naturals.Semiring
open import Numbers.Naturals.Order
open import Numbers.Naturals.Order.Lemmas
open import Setoids.Setoids
open import Sets.FinSet.Definition
open import Sets.FinSet.Lemmas
open import Functions.Definition
open import Functions.Lemmas
open import Semirings.Definition
open import Numbers.Modulo.Definition
open import Numbers.Modulo.Addition
open import Orders.Total.Definition
open import Numbers.Modulo.ModuloFunction
module Numbers.Modulo.Group where
open TotalOrder ℕTotalOrder
open Semiring ℕSemiring
private
0<s : {n : ℕ} → 0 <N succ n
0<s {n} = le n (applyEquality succ (Semiring.sumZeroRight ℕSemiring n))
inverseN : {n : ℕ} → .(0<n : 0 <N n) → (x : ℤn n 0<n) → ℤn n 0<n
inverseN 0<n record { x = 0 ; xLess = _ } = record { x = 0 ; xLess = 0<n }
inverseN 0<n record { x = succ x ; xLess = xLess } with <NProp xLess
... | le subtr pr = record { x = succ subtr ; xLess = le x (transitivity (commutative (succ x) (succ subtr)) pr) }
invLeft : {n : ℕ} → .(0<n : 0 <N n) → (x : ℤn n 0<n) → _+n_ 0<n (inverseN 0<n x) x ≡ record { x = 0 ; xLess = 0<n }
invLeft {n} 0<n record { x = 0 ; xLess = xLess } = plusZnIdentityLeft 0<n (record { x = 0 ; xLess = 0<n })
invLeft {n} 0<n record { x = (succ x) ; xLess = xLess } with <NProp xLess
... | le subtr pr rewrite pr = equalityZn (modN 0<n)
ℤnGroup : (n : ℕ) → .(pr : 0 <N n) → Group (reflSetoid (ℤn n pr)) (_+n_ pr)
Group.+WellDefined (ℤnGroup n 0<n) refl refl = refl
Group.0G (ℤnGroup n 0<n) = record { x = 0 ; xLess = 0<n }
Group.inverse (ℤnGroup n 0<n) = inverseN 0<n
Group.+Associative (ℤnGroup n 0<n) {a} {b} {c} = equalityCommutative (plusZnAssociative 0<n a b c)
Group.identRight (ℤnGroup n 0<n) {a} = plusZnIdentityRight 0<n a
Group.identLeft (ℤnGroup n 0<n) {a} = plusZnIdentityLeft 0<n a
Group.invLeft (ℤnGroup n 0<n) {a} = invLeft 0<n a
Group.invRight (ℤnGroup n 0<n) {a} = transitivity (plusZnCommutative 0<n a (inverseN 0<n a)) (invLeft 0<n a)
ℤnAbGroup : (n : ℕ) → (pr : 0 <N n) → AbelianGroup (ℤnGroup n pr)
AbelianGroup.commutative (ℤnAbGroup n pr) {a} {b} = plusZnCommutative pr a b
ℤnFinite : (n : ℕ) → (pr : 0 <N n) → FiniteGroup (ℤnGroup n pr) (FinSet n)
SetoidToSet.project (FiniteGroup.toSet (ℤnFinite (succ n) 0<n)) record { x = x ; xLess = xLess } = ofNat x xLess
SetoidToSet.wellDefined (FiniteGroup.toSet (ℤnFinite (succ n) 0<n)) x y x=y rewrite x=y = refl
SetoidToSet.surj (FiniteGroup.toSet (ℤnFinite (succ n) 0<n)) b = record { x = toNat b ; xLess = toNatSmaller b } , ofNatToNat b
SetoidToSet.inj (FiniteGroup.toSet (ℤnFinite (succ n) 0<n)) record { x = x ; xLess = xLess } record { x = y ; xLess = yLess } eq = equalityZn (ofNatInjective x y xLess yLess eq)
FiniteGroup.finite (ℤnFinite n pr) = record { size = n ; mapping = id ; bij = idIsBijective }
|
Ktlyns.Core/Ktlyns.g4 | luxgile/Ktlyns | 0 | 6197 | <reponame>luxgile/Ktlyns<gh_stars>0
grammar Ktlyns;
@parser::header {
using Kat;
using System.Collections.Generic;
}
program:
statements;
block
locals[KBlock Block]:
LBRC statements RBRC # RBlockStmts
| LBRC RBRC # RBlockEmpty;
statements
locals[KBlock Block]:
statement+;
statement
locals[KStmt Stmt]:
expr SDOT # RStatement
| var_decl SDOT # RStatementVarDecl
| mth_var_decl SDOT # RStatementMthVarDecl
| arr_decl SDOT # RStatementArrDecl
| if_else_decl # RStatementIfElse
| loop_decl # RStatementLoop
| BREAK SDOT # RStatementBreak
| mth_decl # RStatementMthDecl
| class_decl # RStatementClassDecl
| ex_mth_decl SDOT # RStatementExMthDecl;
class_decl
locals[KClassDecl Class]:
CLASS id block #RClassDecl;
if_else_decl
locals[KStmt Stmt]:
IF LPRN expr RPRN (
block
| statement
) (
ELSE (
block
| statement
)
)? # RIfElse;
loop_decl
locals[KStmt Stmt]:
AT LPRN expr RPRN block # RLoopOne
| AT LPRN expr COMMA expr RPRN block # RLoopTwo;
var_decl
locals[KStmt Stmt]:
id id # RVarDecl //Even if we cannot have null declarations, this is needed for method args
| id id EQ expr # RVarDeclExpr;
mth_var_decl
locals[KStmt Stmt]:
LPRN id* RPRN COLON id id EQ expr # RMthVarDecl;
arr_decl
locals[KStmt Stmt]:
id id EQ '[' INT ']' LPRN expr? RPRN # RArrDeclExpr;
mth_decl
locals[KStmt Stmt]:
METHOD id LPRN mth_decl_arg RPRN COLON id? block;
ex_mth_decl
locals[KStmt Stmt]:
EXTERNAL METHOD id LPRN mth_decl_arg RPRN COLON id;
expr
locals[KExpr Expr]:
string # RExprString
| id # RExprId
| id LPRN call_args RPRN # RExprCall
| LPRN expr RPRN # RExprGroup
| expr DOT id # RExprAccess
| unary # RExprUnary
| expr CAST id # RExprCast
//Number operators
| expr STAR expr # RExprBinMult
| expr SLASH expr # RExprBinDiv
| expr PLUS expr # RExprBinAdd
| expr MINUS expr # RExprBinSub
//Logical operators
| expr EQEQ expr # RExprBinEq
| expr NEQEQ expr # RExprBinNEq
| expr GREAT expr # RExprBinGreat
| expr EQGREAT expr # RExprBinEGreat
| expr LESS expr # RExprBinLess
| expr EQLESS expr # RExprBinELess
| expr AND expr # RExprBinAnd
| expr OR expr # RExprBinOr
//-----------------
| expr EQ expr # RExprAssign
| RET expr? # RExprReturn;
unary
locals[KExpr Expr]:
factor # RUnaryFactor
| MINUS factor # RUnaryMinus
| NOT factor # RUnaryNot;
factor
locals[KExpr Expr]:
INT # RFactorInt
| DEC # RFactorDec
| TRUE # RFactorTrue
| FALSE # RFactorFalse;
string
locals[KExpr Expr]:
STR # KString;
id
locals[KId Id]:
ID # RIDSimple
| id LBKT expr RBKT # RIDArray
| (AMP)+ id # RIDAddress
| (STAR)+ id # RIDPointer;
call_args
locals[List<KExpr> Exprs]:
# RCallArgs
| expr # RCallArgsExpr
| call_args COMMA expr # RCallArgsAdd;
mth_decl_arg
locals[List<KVarDecl> Decls]:
# RMthDeclArg
| var_decl # RMthDeclArgVar
| mth_decl_arg COMMA VARADIC? var_decl # RMthDeclArgAdd;
WS:
[ \n\t\r]+ -> skip;
DEC:
[0-9]+ '.' [0-9]+;
INT:
[0-9]+;
TRUE:
'true';
FALSE:
'false';
PLUS:
'+';
MINUS:
'-';
SLASH:
'/';
STAR:
'*';
AMP:
'&';
STR:
'"' .*? '"';
LPRN:
'(';
RPRN:
')';
LBRC:
'{';
RBRC:
'}';
LBKT:
'[';
RBKT:
']';
COMMA:
',';
DOT:
'.';
SDOT:
';';
EQ:
'=';
COLON:
':';
VARADIC:
'...';
IF:
'if';
ELSE:
'else';
AT:
'@';
RET:
'ret';
BREAK:
'break';
AND:
'&&';
OR:
'||';
NOT:
'!';
EQEQ:
'==';
NEQEQ:
'!=';
GREAT:
'>';
EQGREAT:
'>=';
LESS:
'<';
EQLESS:
'<=';
CAST:
'to';
CLASS: 'class';
METHOD:
'mth';
EXTERNAL:
'ext';
ID:
[a-zA-Z][a-zA-Z0-9_-]* (
'[]'
| '*'
)*;
COMMENT:
'/*' .*? '*/' -> skip;
LINE_COMMENT:
'//' ~[\r\n]* -> skip; |
data/pokemon/base_stats/zapdos.asm | opiter09/ASM-Machina | 1 | 97448 | <reponame>opiter09/ASM-Machina
db DEX_ZAPDOS ; pokedex id
db 90, 90, 85, 100, 125
; hp atk def spd spc
db ELECTRIC, FLYING ; type
db 3 ; catch rate
db 216 ; base exp
INCBIN "gfx/pokemon/front/zapdos.pic", 0, 1 ; sprite dimensions
dw ZapdosPicFront, ZapdosPicBack
db DRILL_PECK, THUNDERSHOCK, QUICK_ATTACK, NO_MOVE ; level 1 learnset
db GROWTH_SLOW ; growth rate
; tm/hm learnset
tmhm RAZOR_WIND, WHIRLWIND, TOXIC, TAKE_DOWN, DOUBLE_EDGE, \
HYPER_BEAM, RAGE, THUNDERBOLT, THUNDER, MIMIC, \
DOUBLE_TEAM, REFLECT, BIDE, SWIFT, SKY_ATTACK, \
REST, THUNDER_WAVE, SUBSTITUTE, FLY, FLASH
; end
db 0 ; padding
|
oeis/314/A314025.asm | neoneye/loda-programs | 11 | 177768 | ; A314025: Coordination sequence Gal.6.250.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by <NAME>
; 1,5,11,15,20,25,29,34,39,43,49,54,59,65,69,74,79,83,88,93,97,103,108,113,119,123,128,133,137,142,147,151,157,162,167,173,177,182,187,191,196,201,205,211,216,221,227,231,236,241
mov $1,$0
seq $0,310367 ; Coordination sequence Gal.6.129.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
add $0,2
mul $0,2
div $0,3
sub $0,1
mul $1,2
add $0,$1
|
dist-test/sh.asm | LongLeonardoLe/xv6 | 0 | 161124 | <gh_stars>0
_sh: file format elf32-i386
Disassembly of section .text:
00000000 <runcmd>:
struct cmd *parsecmd(char*);
// Execute cmd. Never returns.
void
runcmd(struct cmd *cmd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 28 sub $0x28,%esp
struct execcmd *ecmd;
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
6: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
a: 75 05 jne 11 <runcmd+0x11>
exit();
c: e8 2f 13 00 00 call 1340 <exit>
switch(cmd->type){
11: 8b 45 08 mov 0x8(%ebp),%eax
14: 8b 00 mov (%eax),%eax
16: 83 f8 05 cmp $0x5,%eax
19: 77 09 ja 24 <runcmd+0x24>
1b: 8b 04 85 fc 18 00 00 mov 0x18fc(,%eax,4),%eax
22: ff e0 jmp *%eax
default:
panic("runcmd");
24: 83 ec 0c sub $0xc,%esp
27: 68 d0 18 00 00 push $0x18d0
2c: e8 48 07 00 00 call 779 <panic>
31: 83 c4 10 add $0x10,%esp
case EXEC:
ecmd = (struct execcmd*)cmd;
34: 8b 45 08 mov 0x8(%ebp),%eax
37: 89 45 f4 mov %eax,-0xc(%ebp)
if(ecmd->argv[0] == 0)
3a: 8b 45 f4 mov -0xc(%ebp),%eax
3d: 8b 40 04 mov 0x4(%eax),%eax
40: 85 c0 test %eax,%eax
42: 75 05 jne 49 <runcmd+0x49>
exit();
44: e8 f7 12 00 00 call 1340 <exit>
exec(ecmd->argv[0], ecmd->argv);
49: 8b 45 f4 mov -0xc(%ebp),%eax
4c: 8d 50 04 lea 0x4(%eax),%edx
4f: 8b 45 f4 mov -0xc(%ebp),%eax
52: 8b 40 04 mov 0x4(%eax),%eax
55: 83 ec 08 sub $0x8,%esp
58: 52 push %edx
59: 50 push %eax
5a: e8 19 13 00 00 call 1378 <exec>
5f: 83 c4 10 add $0x10,%esp
printf(2, "exec %s failed\n", ecmd->argv[0]);
62: 8b 45 f4 mov -0xc(%ebp),%eax
65: 8b 40 04 mov 0x4(%eax),%eax
68: 83 ec 04 sub $0x4,%esp
6b: 50 push %eax
6c: 68 d7 18 00 00 push $0x18d7
71: 6a 02 push $0x2
73: e8 9f 14 00 00 call 1517 <printf>
78: 83 c4 10 add $0x10,%esp
break;
7b: e9 c6 01 00 00 jmp 246 <runcmd+0x246>
case REDIR:
rcmd = (struct redircmd*)cmd;
80: 8b 45 08 mov 0x8(%ebp),%eax
83: 89 45 f0 mov %eax,-0x10(%ebp)
close(rcmd->fd);
86: 8b 45 f0 mov -0x10(%ebp),%eax
89: 8b 40 14 mov 0x14(%eax),%eax
8c: 83 ec 0c sub $0xc,%esp
8f: 50 push %eax
90: e8 d3 12 00 00 call 1368 <close>
95: 83 c4 10 add $0x10,%esp
if(open(rcmd->file, rcmd->mode) < 0){
98: 8b 45 f0 mov -0x10(%ebp),%eax
9b: 8b 50 10 mov 0x10(%eax),%edx
9e: 8b 45 f0 mov -0x10(%ebp),%eax
a1: 8b 40 08 mov 0x8(%eax),%eax
a4: 83 ec 08 sub $0x8,%esp
a7: 52 push %edx
a8: 50 push %eax
a9: e8 d2 12 00 00 call 1380 <open>
ae: 83 c4 10 add $0x10,%esp
b1: 85 c0 test %eax,%eax
b3: 79 1e jns d3 <runcmd+0xd3>
printf(2, "open %s failed\n", rcmd->file);
b5: 8b 45 f0 mov -0x10(%ebp),%eax
b8: 8b 40 08 mov 0x8(%eax),%eax
bb: 83 ec 04 sub $0x4,%esp
be: 50 push %eax
bf: 68 e7 18 00 00 push $0x18e7
c4: 6a 02 push $0x2
c6: e8 4c 14 00 00 call 1517 <printf>
cb: 83 c4 10 add $0x10,%esp
exit();
ce: e8 6d 12 00 00 call 1340 <exit>
}
runcmd(rcmd->cmd);
d3: 8b 45 f0 mov -0x10(%ebp),%eax
d6: 8b 40 04 mov 0x4(%eax),%eax
d9: 83 ec 0c sub $0xc,%esp
dc: 50 push %eax
dd: e8 1e ff ff ff call 0 <runcmd>
e2: 83 c4 10 add $0x10,%esp
break;
e5: e9 5c 01 00 00 jmp 246 <runcmd+0x246>
case LIST:
lcmd = (struct listcmd*)cmd;
ea: 8b 45 08 mov 0x8(%ebp),%eax
ed: 89 45 ec mov %eax,-0x14(%ebp)
if(fork1() == 0)
f0: e8 a4 06 00 00 call 799 <fork1>
f5: 85 c0 test %eax,%eax
f7: 75 12 jne 10b <runcmd+0x10b>
runcmd(lcmd->left);
f9: 8b 45 ec mov -0x14(%ebp),%eax
fc: 8b 40 04 mov 0x4(%eax),%eax
ff: 83 ec 0c sub $0xc,%esp
102: 50 push %eax
103: e8 f8 fe ff ff call 0 <runcmd>
108: 83 c4 10 add $0x10,%esp
wait();
10b: e8 38 12 00 00 call 1348 <wait>
runcmd(lcmd->right);
110: 8b 45 ec mov -0x14(%ebp),%eax
113: 8b 40 08 mov 0x8(%eax),%eax
116: 83 ec 0c sub $0xc,%esp
119: 50 push %eax
11a: e8 e1 fe ff ff call 0 <runcmd>
11f: 83 c4 10 add $0x10,%esp
break;
122: e9 1f 01 00 00 jmp 246 <runcmd+0x246>
case PIPE:
pcmd = (struct pipecmd*)cmd;
127: 8b 45 08 mov 0x8(%ebp),%eax
12a: 89 45 e8 mov %eax,-0x18(%ebp)
if(pipe(p) < 0)
12d: 83 ec 0c sub $0xc,%esp
130: 8d 45 dc lea -0x24(%ebp),%eax
133: 50 push %eax
134: e8 17 12 00 00 call 1350 <pipe>
139: 83 c4 10 add $0x10,%esp
13c: 85 c0 test %eax,%eax
13e: 79 10 jns 150 <runcmd+0x150>
panic("pipe");
140: 83 ec 0c sub $0xc,%esp
143: 68 f7 18 00 00 push $0x18f7
148: e8 2c 06 00 00 call 779 <panic>
14d: 83 c4 10 add $0x10,%esp
if(fork1() == 0){
150: e8 44 06 00 00 call 799 <fork1>
155: 85 c0 test %eax,%eax
157: 75 4c jne 1a5 <runcmd+0x1a5>
close(1);
159: 83 ec 0c sub $0xc,%esp
15c: 6a 01 push $0x1
15e: e8 05 12 00 00 call 1368 <close>
163: 83 c4 10 add $0x10,%esp
dup(p[1]);
166: 8b 45 e0 mov -0x20(%ebp),%eax
169: 83 ec 0c sub $0xc,%esp
16c: 50 push %eax
16d: e8 46 12 00 00 call 13b8 <dup>
172: 83 c4 10 add $0x10,%esp
close(p[0]);
175: 8b 45 dc mov -0x24(%ebp),%eax
178: 83 ec 0c sub $0xc,%esp
17b: 50 push %eax
17c: e8 e7 11 00 00 call 1368 <close>
181: 83 c4 10 add $0x10,%esp
close(p[1]);
184: 8b 45 e0 mov -0x20(%ebp),%eax
187: 83 ec 0c sub $0xc,%esp
18a: 50 push %eax
18b: e8 d8 11 00 00 call 1368 <close>
190: 83 c4 10 add $0x10,%esp
runcmd(pcmd->left);
193: 8b 45 e8 mov -0x18(%ebp),%eax
196: 8b 40 04 mov 0x4(%eax),%eax
199: 83 ec 0c sub $0xc,%esp
19c: 50 push %eax
19d: e8 5e fe ff ff call 0 <runcmd>
1a2: 83 c4 10 add $0x10,%esp
}
if(fork1() == 0){
1a5: e8 ef 05 00 00 call 799 <fork1>
1aa: 85 c0 test %eax,%eax
1ac: 75 4c jne 1fa <runcmd+0x1fa>
close(0);
1ae: 83 ec 0c sub $0xc,%esp
1b1: 6a 00 push $0x0
1b3: e8 b0 11 00 00 call 1368 <close>
1b8: 83 c4 10 add $0x10,%esp
dup(p[0]);
1bb: 8b 45 dc mov -0x24(%ebp),%eax
1be: 83 ec 0c sub $0xc,%esp
1c1: 50 push %eax
1c2: e8 f1 11 00 00 call 13b8 <dup>
1c7: 83 c4 10 add $0x10,%esp
close(p[0]);
1ca: 8b 45 dc mov -0x24(%ebp),%eax
1cd: 83 ec 0c sub $0xc,%esp
1d0: 50 push %eax
1d1: e8 92 11 00 00 call 1368 <close>
1d6: 83 c4 10 add $0x10,%esp
close(p[1]);
1d9: 8b 45 e0 mov -0x20(%ebp),%eax
1dc: 83 ec 0c sub $0xc,%esp
1df: 50 push %eax
1e0: e8 83 11 00 00 call 1368 <close>
1e5: 83 c4 10 add $0x10,%esp
runcmd(pcmd->right);
1e8: 8b 45 e8 mov -0x18(%ebp),%eax
1eb: 8b 40 08 mov 0x8(%eax),%eax
1ee: 83 ec 0c sub $0xc,%esp
1f1: 50 push %eax
1f2: e8 09 fe ff ff call 0 <runcmd>
1f7: 83 c4 10 add $0x10,%esp
}
close(p[0]);
1fa: 8b 45 dc mov -0x24(%ebp),%eax
1fd: 83 ec 0c sub $0xc,%esp
200: 50 push %eax
201: e8 62 11 00 00 call 1368 <close>
206: 83 c4 10 add $0x10,%esp
close(p[1]);
209: 8b 45 e0 mov -0x20(%ebp),%eax
20c: 83 ec 0c sub $0xc,%esp
20f: 50 push %eax
210: e8 53 11 00 00 call 1368 <close>
215: 83 c4 10 add $0x10,%esp
wait();
218: e8 2b 11 00 00 call 1348 <wait>
wait();
21d: e8 26 11 00 00 call 1348 <wait>
break;
222: eb 22 jmp 246 <runcmd+0x246>
case BACK:
bcmd = (struct backcmd*)cmd;
224: 8b 45 08 mov 0x8(%ebp),%eax
227: 89 45 e4 mov %eax,-0x1c(%ebp)
if(fork1() == 0)
22a: e8 6a 05 00 00 call 799 <fork1>
22f: 85 c0 test %eax,%eax
231: 75 12 jne 245 <runcmd+0x245>
runcmd(bcmd->cmd);
233: 8b 45 e4 mov -0x1c(%ebp),%eax
236: 8b 40 04 mov 0x4(%eax),%eax
239: 83 ec 0c sub $0xc,%esp
23c: 50 push %eax
23d: e8 be fd ff ff call 0 <runcmd>
242: 83 c4 10 add $0x10,%esp
break;
245: 90 nop
}
exit();
246: e8 f5 10 00 00 call 1340 <exit>
0000024b <getcmd>:
}
int
getcmd(char *buf, int nbuf)
{
24b: 55 push %ebp
24c: 89 e5 mov %esp,%ebp
24e: 83 ec 08 sub $0x8,%esp
printf(2, "$ ");
251: 83 ec 08 sub $0x8,%esp
254: 68 14 19 00 00 push $0x1914
259: 6a 02 push $0x2
25b: e8 b7 12 00 00 call 1517 <printf>
260: 83 c4 10 add $0x10,%esp
memset(buf, 0, nbuf);
263: 8b 45 0c mov 0xc(%ebp),%eax
266: 83 ec 04 sub $0x4,%esp
269: 50 push %eax
26a: 6a 00 push $0x0
26c: ff 75 08 pushl 0x8(%ebp)
26f: e8 a3 0e 00 00 call 1117 <memset>
274: 83 c4 10 add $0x10,%esp
gets(buf, nbuf);
277: 83 ec 08 sub $0x8,%esp
27a: ff 75 0c pushl 0xc(%ebp)
27d: ff 75 08 pushl 0x8(%ebp)
280: e8 df 0e 00 00 call 1164 <gets>
285: 83 c4 10 add $0x10,%esp
if(buf[0] == 0) // EOF
288: 8b 45 08 mov 0x8(%ebp),%eax
28b: 0f b6 00 movzbl (%eax),%eax
28e: 84 c0 test %al,%al
290: 75 07 jne 299 <getcmd+0x4e>
return -1;
292: b8 ff ff ff ff mov $0xffffffff,%eax
297: eb 05 jmp 29e <getcmd+0x53>
return 0;
299: b8 00 00 00 00 mov $0x0,%eax
}
29e: c9 leave
29f: c3 ret
000002a0 <strncmp>:
#ifdef USE_BUILTINS
// ***** processing for shell builtins begins here *****
int
strncmp(const char *p, const char *q, uint n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
while(n > 0 && *p && *p == *q)
2a3: eb 0c jmp 2b1 <strncmp+0x11>
n--, p++, q++;
2a5: 83 6d 10 01 subl $0x1,0x10(%ebp)
2a9: 83 45 08 01 addl $0x1,0x8(%ebp)
2ad: 83 45 0c 01 addl $0x1,0xc(%ebp)
// ***** processing for shell builtins begins here *****
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
2b1: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
2b5: 74 1a je 2d1 <strncmp+0x31>
2b7: 8b 45 08 mov 0x8(%ebp),%eax
2ba: 0f b6 00 movzbl (%eax),%eax
2bd: 84 c0 test %al,%al
2bf: 74 10 je 2d1 <strncmp+0x31>
2c1: 8b 45 08 mov 0x8(%ebp),%eax
2c4: 0f b6 10 movzbl (%eax),%edx
2c7: 8b 45 0c mov 0xc(%ebp),%eax
2ca: 0f b6 00 movzbl (%eax),%eax
2cd: 38 c2 cmp %al,%dl
2cf: 74 d4 je 2a5 <strncmp+0x5>
n--, p++, q++;
if(n == 0)
2d1: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
2d5: 75 07 jne 2de <strncmp+0x3e>
return 0;
2d7: b8 00 00 00 00 mov $0x0,%eax
2dc: eb 16 jmp 2f4 <strncmp+0x54>
return (uchar)*p - (uchar)*q;
2de: 8b 45 08 mov 0x8(%ebp),%eax
2e1: 0f b6 00 movzbl (%eax),%eax
2e4: 0f b6 d0 movzbl %al,%edx
2e7: 8b 45 0c mov 0xc(%ebp),%eax
2ea: 0f b6 00 movzbl (%eax),%eax
2ed: 0f b6 c0 movzbl %al,%eax
2f0: 29 c2 sub %eax,%edx
2f2: 89 d0 mov %edx,%eax
}
2f4: 5d pop %ebp
2f5: c3 ret
000002f6 <makeint>:
int
makeint(char *p)
{
2f6: 55 push %ebp
2f7: 89 e5 mov %esp,%ebp
2f9: 83 ec 10 sub $0x10,%esp
int val = 0;
2fc: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while ((*p >= '0') && (*p <= '9')) {
303: eb 23 jmp 328 <makeint+0x32>
val = 10*val + (*p-'0');
305: 8b 55 fc mov -0x4(%ebp),%edx
308: 89 d0 mov %edx,%eax
30a: c1 e0 02 shl $0x2,%eax
30d: 01 d0 add %edx,%eax
30f: 01 c0 add %eax,%eax
311: 89 c2 mov %eax,%edx
313: 8b 45 08 mov 0x8(%ebp),%eax
316: 0f b6 00 movzbl (%eax),%eax
319: 0f be c0 movsbl %al,%eax
31c: 83 e8 30 sub $0x30,%eax
31f: 01 d0 add %edx,%eax
321: 89 45 fc mov %eax,-0x4(%ebp)
++p;
324: 83 45 08 01 addl $0x1,0x8(%ebp)
int
makeint(char *p)
{
int val = 0;
while ((*p >= '0') && (*p <= '9')) {
328: 8b 45 08 mov 0x8(%ebp),%eax
32b: 0f b6 00 movzbl (%eax),%eax
32e: 3c 2f cmp $0x2f,%al
330: 7e 0a jle 33c <makeint+0x46>
332: 8b 45 08 mov 0x8(%ebp),%eax
335: 0f b6 00 movzbl (%eax),%eax
338: 3c 39 cmp $0x39,%al
33a: 7e c9 jle 305 <makeint+0xf>
val = 10*val + (*p-'0');
++p;
}
return val;
33c: 8b 45 fc mov -0x4(%ebp),%eax
}
33f: c9 leave
340: c3 ret
00000341 <setbuiltin>:
int
setbuiltin(char *p)
{
341: 55 push %ebp
342: 89 e5 mov %esp,%ebp
344: 83 ec 18 sub $0x18,%esp
int i;
p += strlen("_set");
347: 83 ec 0c sub $0xc,%esp
34a: 68 17 19 00 00 push $0x1917
34f: e8 9c 0d 00 00 call 10f0 <strlen>
354: 83 c4 10 add $0x10,%esp
357: 01 45 08 add %eax,0x8(%ebp)
while (strncmp(p, " ", 1) == 0) p++; // chomp spaces
35a: eb 04 jmp 360 <setbuiltin+0x1f>
35c: 83 45 08 01 addl $0x1,0x8(%ebp)
360: 83 ec 04 sub $0x4,%esp
363: 6a 01 push $0x1
365: 68 1c 19 00 00 push $0x191c
36a: ff 75 08 pushl 0x8(%ebp)
36d: e8 2e ff ff ff call 2a0 <strncmp>
372: 83 c4 10 add $0x10,%esp
375: 85 c0 test %eax,%eax
377: 74 e3 je 35c <setbuiltin+0x1b>
if (strncmp("uid", p, 3) == 0) {
379: 83 ec 04 sub $0x4,%esp
37c: 6a 03 push $0x3
37e: ff 75 08 pushl 0x8(%ebp)
381: 68 1e 19 00 00 push $0x191e
386: e8 15 ff ff ff call 2a0 <strncmp>
38b: 83 c4 10 add $0x10,%esp
38e: 85 c0 test %eax,%eax
390: 75 57 jne 3e9 <setbuiltin+0xa8>
p += strlen("uid");
392: 83 ec 0c sub $0xc,%esp
395: 68 1e 19 00 00 push $0x191e
39a: e8 51 0d 00 00 call 10f0 <strlen>
39f: 83 c4 10 add $0x10,%esp
3a2: 01 45 08 add %eax,0x8(%ebp)
while (strncmp(p, " ", 1) == 0) p++; // chomp spaces
3a5: eb 04 jmp 3ab <setbuiltin+0x6a>
3a7: 83 45 08 01 addl $0x1,0x8(%ebp)
3ab: 83 ec 04 sub $0x4,%esp
3ae: 6a 01 push $0x1
3b0: 68 1c 19 00 00 push $0x191c
3b5: ff 75 08 pushl 0x8(%ebp)
3b8: e8 e3 fe ff ff call 2a0 <strncmp>
3bd: 83 c4 10 add $0x10,%esp
3c0: 85 c0 test %eax,%eax
3c2: 74 e3 je 3a7 <setbuiltin+0x66>
i = makeint(p); // ugly
3c4: 83 ec 0c sub $0xc,%esp
3c7: ff 75 08 pushl 0x8(%ebp)
3ca: e8 27 ff ff ff call 2f6 <makeint>
3cf: 83 c4 10 add $0x10,%esp
3d2: 89 45 f4 mov %eax,-0xc(%ebp)
return (setuid(i));
3d5: 8b 45 f4 mov -0xc(%ebp),%eax
3d8: 83 ec 0c sub $0xc,%esp
3db: 50 push %eax
3dc: e8 27 10 00 00 call 1408 <setuid>
3e1: 83 c4 10 add $0x10,%esp
3e4: e9 49 01 00 00 jmp 532 <setbuiltin+0x1f1>
} else
if (strncmp("gid", p, 3) == 0) {
3e9: 83 ec 04 sub $0x4,%esp
3ec: 6a 03 push $0x3
3ee: ff 75 08 pushl 0x8(%ebp)
3f1: 68 22 19 00 00 push $0x1922
3f6: e8 a5 fe ff ff call 2a0 <strncmp>
3fb: 83 c4 10 add $0x10,%esp
3fe: 85 c0 test %eax,%eax
400: 75 57 jne 459 <setbuiltin+0x118>
p += strlen("gid");
402: 83 ec 0c sub $0xc,%esp
405: 68 22 19 00 00 push $0x1922
40a: e8 e1 0c 00 00 call 10f0 <strlen>
40f: 83 c4 10 add $0x10,%esp
412: 01 45 08 add %eax,0x8(%ebp)
while (strncmp(p, " ", 1) == 0) p++; // chomp spaces
415: eb 04 jmp 41b <setbuiltin+0xda>
417: 83 45 08 01 addl $0x1,0x8(%ebp)
41b: 83 ec 04 sub $0x4,%esp
41e: 6a 01 push $0x1
420: 68 1c 19 00 00 push $0x191c
425: ff 75 08 pushl 0x8(%ebp)
428: e8 73 fe ff ff call 2a0 <strncmp>
42d: 83 c4 10 add $0x10,%esp
430: 85 c0 test %eax,%eax
432: 74 e3 je 417 <setbuiltin+0xd6>
i = makeint(p); // ugly
434: 83 ec 0c sub $0xc,%esp
437: ff 75 08 pushl 0x8(%ebp)
43a: e8 b7 fe ff ff call 2f6 <makeint>
43f: 83 c4 10 add $0x10,%esp
442: 89 45 f4 mov %eax,-0xc(%ebp)
return (setgid(i));
445: 8b 45 f4 mov -0xc(%ebp),%eax
448: 83 ec 0c sub $0xc,%esp
44b: 50 push %eax
44c: e8 bf 0f 00 00 call 1410 <setgid>
451: 83 c4 10 add $0x10,%esp
454: e9 d9 00 00 00 jmp 532 <setbuiltin+0x1f1>
}
if (strncmp("priority", p, 8) == 0) {
459: 83 ec 04 sub $0x4,%esp
45c: 6a 08 push $0x8
45e: ff 75 08 pushl 0x8(%ebp)
461: 68 26 19 00 00 push $0x1926
466: e8 35 fe ff ff call 2a0 <strncmp>
46b: 83 c4 10 add $0x10,%esp
46e: 85 c0 test %eax,%eax
470: 0f 85 a5 00 00 00 jne 51b <setbuiltin+0x1da>
p += strlen("priority");
476: 83 ec 0c sub $0xc,%esp
479: 68 26 19 00 00 push $0x1926
47e: e8 6d 0c 00 00 call 10f0 <strlen>
483: 83 c4 10 add $0x10,%esp
486: 01 45 08 add %eax,0x8(%ebp)
while (strncmp(p, " ", 1) == 0) p++;
489: eb 04 jmp 48f <setbuiltin+0x14e>
48b: 83 45 08 01 addl $0x1,0x8(%ebp)
48f: 83 ec 04 sub $0x4,%esp
492: 6a 01 push $0x1
494: 68 1c 19 00 00 push $0x191c
499: ff 75 08 pushl 0x8(%ebp)
49c: e8 ff fd ff ff call 2a0 <strncmp>
4a1: 83 c4 10 add $0x10,%esp
4a4: 85 c0 test %eax,%eax
4a6: 74 e3 je 48b <setbuiltin+0x14a>
i = makeint(p);
4a8: 83 ec 0c sub $0xc,%esp
4ab: ff 75 08 pushl 0x8(%ebp)
4ae: e8 43 fe ff ff call 2f6 <makeint>
4b3: 83 c4 10 add $0x10,%esp
4b6: 89 45 f4 mov %eax,-0xc(%ebp)
while (strncmp(p, " ", 1) != 0) p++;
4b9: eb 04 jmp 4bf <setbuiltin+0x17e>
4bb: 83 45 08 01 addl $0x1,0x8(%ebp)
4bf: 83 ec 04 sub $0x4,%esp
4c2: 6a 01 push $0x1
4c4: 68 1c 19 00 00 push $0x191c
4c9: ff 75 08 pushl 0x8(%ebp)
4cc: e8 cf fd ff ff call 2a0 <strncmp>
4d1: 83 c4 10 add $0x10,%esp
4d4: 85 c0 test %eax,%eax
4d6: 75 e3 jne 4bb <setbuiltin+0x17a>
while (strncmp(p, " ", 1) == 0) p++;
4d8: eb 04 jmp 4de <setbuiltin+0x19d>
4da: 83 45 08 01 addl $0x1,0x8(%ebp)
4de: 83 ec 04 sub $0x4,%esp
4e1: 6a 01 push $0x1
4e3: 68 1c 19 00 00 push $0x191c
4e8: ff 75 08 pushl 0x8(%ebp)
4eb: e8 b0 fd ff ff call 2a0 <strncmp>
4f0: 83 c4 10 add $0x10,%esp
4f3: 85 c0 test %eax,%eax
4f5: 74 e3 je 4da <setbuiltin+0x199>
int j = makeint(p);
4f7: 83 ec 0c sub $0xc,%esp
4fa: ff 75 08 pushl 0x8(%ebp)
4fd: e8 f4 fd ff ff call 2f6 <makeint>
502: 83 c4 10 add $0x10,%esp
505: 89 45 f0 mov %eax,-0x10(%ebp)
return setpriority(i, j);
508: 83 ec 08 sub $0x8,%esp
50b: ff 75 f0 pushl -0x10(%ebp)
50e: ff 75 f4 pushl -0xc(%ebp)
511: e8 0a 0f 00 00 call 1420 <setpriority>
516: 83 c4 10 add $0x10,%esp
519: eb 17 jmp 532 <setbuiltin+0x1f1>
}
printf(2, "Invalid _set parameter\n");
51b: 83 ec 08 sub $0x8,%esp
51e: 68 2f 19 00 00 push $0x192f
523: 6a 02 push $0x2
525: e8 ed 0f 00 00 call 1517 <printf>
52a: 83 c4 10 add $0x10,%esp
return -1;
52d: b8 ff ff ff ff mov $0xffffffff,%eax
}
532: c9 leave
533: c3 ret
00000534 <getbuiltin>:
int
getbuiltin(char *p)
{
534: 55 push %ebp
535: 89 e5 mov %esp,%ebp
537: 83 ec 08 sub $0x8,%esp
p += strlen("_get");
53a: 83 ec 0c sub $0xc,%esp
53d: 68 47 19 00 00 push $0x1947
542: e8 a9 0b 00 00 call 10f0 <strlen>
547: 83 c4 10 add $0x10,%esp
54a: 01 45 08 add %eax,0x8(%ebp)
while (strncmp(p, " ", 1) == 0) p++; // chomp spaces
54d: eb 04 jmp 553 <getbuiltin+0x1f>
54f: 83 45 08 01 addl $0x1,0x8(%ebp)
553: 83 ec 04 sub $0x4,%esp
556: 6a 01 push $0x1
558: 68 1c 19 00 00 push $0x191c
55d: ff 75 08 pushl 0x8(%ebp)
560: e8 3b fd ff ff call 2a0 <strncmp>
565: 83 c4 10 add $0x10,%esp
568: 85 c0 test %eax,%eax
56a: 74 e3 je 54f <getbuiltin+0x1b>
if (strncmp("uid", p, 3) == 0) {
56c: 83 ec 04 sub $0x4,%esp
56f: 6a 03 push $0x3
571: ff 75 08 pushl 0x8(%ebp)
574: 68 1e 19 00 00 push $0x191e
579: e8 22 fd ff ff call 2a0 <strncmp>
57e: 83 c4 10 add $0x10,%esp
581: 85 c0 test %eax,%eax
583: 75 1f jne 5a4 <getbuiltin+0x70>
printf(2, "%d\n", getuid());
585: e8 66 0e 00 00 call 13f0 <getuid>
58a: 83 ec 04 sub $0x4,%esp
58d: 50 push %eax
58e: 68 4c 19 00 00 push $0x194c
593: 6a 02 push $0x2
595: e8 7d 0f 00 00 call 1517 <printf>
59a: 83 c4 10 add $0x10,%esp
return 0;
59d: b8 00 00 00 00 mov $0x0,%eax
5a2: eb 4f jmp 5f3 <getbuiltin+0xbf>
}
if (strncmp("gid", p, 3) == 0) {
5a4: 83 ec 04 sub $0x4,%esp
5a7: 6a 03 push $0x3
5a9: ff 75 08 pushl 0x8(%ebp)
5ac: 68 22 19 00 00 push $0x1922
5b1: e8 ea fc ff ff call 2a0 <strncmp>
5b6: 83 c4 10 add $0x10,%esp
5b9: 85 c0 test %eax,%eax
5bb: 75 1f jne 5dc <getbuiltin+0xa8>
printf(2, "%d\n", getgid());
5bd: e8 36 0e 00 00 call 13f8 <getgid>
5c2: 83 ec 04 sub $0x4,%esp
5c5: 50 push %eax
5c6: 68 4c 19 00 00 push $0x194c
5cb: 6a 02 push $0x2
5cd: e8 45 0f 00 00 call 1517 <printf>
5d2: 83 c4 10 add $0x10,%esp
return 0;
5d5: b8 00 00 00 00 mov $0x0,%eax
5da: eb 17 jmp 5f3 <getbuiltin+0xbf>
}
printf(2, "Invalid _get parameter\n");
5dc: 83 ec 08 sub $0x8,%esp
5df: 68 50 19 00 00 push $0x1950
5e4: 6a 02 push $0x2
5e6: e8 2c 0f 00 00 call 1517 <printf>
5eb: 83 c4 10 add $0x10,%esp
return -1;
5ee: b8 ff ff ff ff mov $0xffffffff,%eax
}
5f3: c9 leave
5f4: c3 ret
000005f5 <dobuiltin>:
{"_get", getbuiltin}
};
int FDTcount = sizeof(fdt) / sizeof(fdt[0]); // # entris in FDT
void
dobuiltin(char *cmd) {
5f5: 55 push %ebp
5f6: 89 e5 mov %esp,%ebp
5f8: 83 ec 18 sub $0x18,%esp
int i;
for (i=0; i<FDTcount; i++)
5fb: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
602: eb 4f jmp 653 <dobuiltin+0x5e>
if (strncmp(cmd, fdt[i].cmd, strlen(fdt[i].cmd)) == 0)
604: 8b 45 f4 mov -0xc(%ebp),%eax
607: 8b 04 c5 60 1f 00 00 mov 0x1f60(,%eax,8),%eax
60e: 83 ec 0c sub $0xc,%esp
611: 50 push %eax
612: e8 d9 0a 00 00 call 10f0 <strlen>
617: 83 c4 10 add $0x10,%esp
61a: 89 c2 mov %eax,%edx
61c: 8b 45 f4 mov -0xc(%ebp),%eax
61f: 8b 04 c5 60 1f 00 00 mov 0x1f60(,%eax,8),%eax
626: 83 ec 04 sub $0x4,%esp
629: 52 push %edx
62a: 50 push %eax
62b: ff 75 08 pushl 0x8(%ebp)
62e: e8 6d fc ff ff call 2a0 <strncmp>
633: 83 c4 10 add $0x10,%esp
636: 85 c0 test %eax,%eax
638: 75 15 jne 64f <dobuiltin+0x5a>
(*fdt[i].name)(cmd);
63a: 8b 45 f4 mov -0xc(%ebp),%eax
63d: 8b 04 c5 64 1f 00 00 mov 0x1f64(,%eax,8),%eax
644: 83 ec 0c sub $0xc,%esp
647: ff 75 08 pushl 0x8(%ebp)
64a: ff d0 call *%eax
64c: 83 c4 10 add $0x10,%esp
void
dobuiltin(char *cmd) {
int i;
for (i=0; i<FDTcount; i++)
64f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
653: a1 70 1f 00 00 mov 0x1f70,%eax
658: 39 45 f4 cmp %eax,-0xc(%ebp)
65b: 7c a7 jl 604 <dobuiltin+0xf>
if (strncmp(cmd, fdt[i].cmd, strlen(fdt[i].cmd)) == 0)
(*fdt[i].name)(cmd);
}
65d: 90 nop
65e: c9 leave
65f: c3 ret
00000660 <main>:
// ***** processing for shell builtins ends here *****
#endif
int
main(void)
{
660: 8d 4c 24 04 lea 0x4(%esp),%ecx
664: 83 e4 f0 and $0xfffffff0,%esp
667: ff 71 fc pushl -0x4(%ecx)
66a: 55 push %ebp
66b: 89 e5 mov %esp,%ebp
66d: 51 push %ecx
66e: 83 ec 14 sub $0x14,%esp
static char buf[100];
int fd;
// Assumes three file descriptors open.
while((fd = open("console", O_RDWR)) >= 0){
671: eb 16 jmp 689 <main+0x29>
if(fd >= 3){
673: 83 7d f4 02 cmpl $0x2,-0xc(%ebp)
677: 7e 10 jle 689 <main+0x29>
close(fd);
679: 83 ec 0c sub $0xc,%esp
67c: ff 75 f4 pushl -0xc(%ebp)
67f: e8 e4 0c 00 00 call 1368 <close>
684: 83 c4 10 add $0x10,%esp
break;
687: eb 1b jmp 6a4 <main+0x44>
{
static char buf[100];
int fd;
// Assumes three file descriptors open.
while((fd = open("console", O_RDWR)) >= 0){
689: 83 ec 08 sub $0x8,%esp
68c: 6a 02 push $0x2
68e: 68 68 19 00 00 push $0x1968
693: e8 e8 0c 00 00 call 1380 <open>
698: 83 c4 10 add $0x10,%esp
69b: 89 45 f4 mov %eax,-0xc(%ebp)
69e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6a2: 79 cf jns 673 <main+0x13>
break;
}
}
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
6a4: e9 b1 00 00 00 jmp 75a <main+0xfa>
// add support for built-ins here. cd is a built-in
if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){
6a9: 0f b6 05 a0 1f 00 00 movzbl 0x1fa0,%eax
6b0: 3c 63 cmp $0x63,%al
6b2: 75 5f jne 713 <main+0xb3>
6b4: 0f b6 05 a1 1f 00 00 movzbl 0x1fa1,%eax
6bb: 3c 64 cmp $0x64,%al
6bd: 75 54 jne 713 <main+0xb3>
6bf: 0f b6 05 a2 1f 00 00 movzbl 0x1fa2,%eax
6c6: 3c 20 cmp $0x20,%al
6c8: 75 49 jne 713 <main+0xb3>
// Clumsy but will have to do for now.
// Chdir has no effect on the parent if run in the child.
buf[strlen(buf)-1] = 0; // chop \n
6ca: 83 ec 0c sub $0xc,%esp
6cd: 68 a0 1f 00 00 push $0x1fa0
6d2: e8 19 0a 00 00 call 10f0 <strlen>
6d7: 83 c4 10 add $0x10,%esp
6da: 83 e8 01 sub $0x1,%eax
6dd: c6 80 a0 1f 00 00 00 movb $0x0,0x1fa0(%eax)
if(chdir(buf+3) < 0)
6e4: b8 a3 1f 00 00 mov $0x1fa3,%eax
6e9: 83 ec 0c sub $0xc,%esp
6ec: 50 push %eax
6ed: e8 be 0c 00 00 call 13b0 <chdir>
6f2: 83 c4 10 add $0x10,%esp
6f5: 85 c0 test %eax,%eax
6f7: 79 61 jns 75a <main+0xfa>
printf(2, "cannot cd %s\n", buf+3);
6f9: b8 a3 1f 00 00 mov $0x1fa3,%eax
6fe: 83 ec 04 sub $0x4,%esp
701: 50 push %eax
702: 68 70 19 00 00 push $0x1970
707: 6a 02 push $0x2
709: e8 09 0e 00 00 call 1517 <printf>
70e: 83 c4 10 add $0x10,%esp
continue;
711: eb 47 jmp 75a <main+0xfa>
}
#ifdef USE_BUILTINS
if (buf[0]=='_') { // assume it is a builtin command
713: 0f b6 05 a0 1f 00 00 movzbl 0x1fa0,%eax
71a: 3c 5f cmp $0x5f,%al
71c: 75 12 jne 730 <main+0xd0>
dobuiltin(buf);
71e: 83 ec 0c sub $0xc,%esp
721: 68 a0 1f 00 00 push $0x1fa0
726: e8 ca fe ff ff call 5f5 <dobuiltin>
72b: 83 c4 10 add $0x10,%esp
continue;
72e: eb 2a jmp 75a <main+0xfa>
}
#endif
if(fork1() == 0)
730: e8 64 00 00 00 call 799 <fork1>
735: 85 c0 test %eax,%eax
737: 75 1c jne 755 <main+0xf5>
runcmd(parsecmd(buf));
739: 83 ec 0c sub $0xc,%esp
73c: 68 a0 1f 00 00 push $0x1fa0
741: e8 ab 03 00 00 call af1 <parsecmd>
746: 83 c4 10 add $0x10,%esp
749: 83 ec 0c sub $0xc,%esp
74c: 50 push %eax
74d: e8 ae f8 ff ff call 0 <runcmd>
752: 83 c4 10 add $0x10,%esp
wait();
755: e8 ee 0b 00 00 call 1348 <wait>
break;
}
}
// Read and run input commands.
while(getcmd(buf, sizeof(buf)) >= 0){
75a: 83 ec 08 sub $0x8,%esp
75d: 6a 64 push $0x64
75f: 68 a0 1f 00 00 push $0x1fa0
764: e8 e2 fa ff ff call 24b <getcmd>
769: 83 c4 10 add $0x10,%esp
76c: 85 c0 test %eax,%eax
76e: 0f 89 35 ff ff ff jns 6a9 <main+0x49>
#endif
if(fork1() == 0)
runcmd(parsecmd(buf));
wait();
}
exit();
774: e8 c7 0b 00 00 call 1340 <exit>
00000779 <panic>:
}
void
panic(char *s)
{
779: 55 push %ebp
77a: 89 e5 mov %esp,%ebp
77c: 83 ec 08 sub $0x8,%esp
printf(2, "%s\n", s);
77f: 83 ec 04 sub $0x4,%esp
782: ff 75 08 pushl 0x8(%ebp)
785: 68 7e 19 00 00 push $0x197e
78a: 6a 02 push $0x2
78c: e8 86 0d 00 00 call 1517 <printf>
791: 83 c4 10 add $0x10,%esp
exit();
794: e8 a7 0b 00 00 call 1340 <exit>
00000799 <fork1>:
}
int
fork1(void)
{
799: 55 push %ebp
79a: 89 e5 mov %esp,%ebp
79c: 83 ec 18 sub $0x18,%esp
int pid;
pid = fork();
79f: e8 94 0b 00 00 call 1338 <fork>
7a4: 89 45 f4 mov %eax,-0xc(%ebp)
if(pid == -1)
7a7: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
7ab: 75 10 jne 7bd <fork1+0x24>
panic("fork");
7ad: 83 ec 0c sub $0xc,%esp
7b0: 68 82 19 00 00 push $0x1982
7b5: e8 bf ff ff ff call 779 <panic>
7ba: 83 c4 10 add $0x10,%esp
return pid;
7bd: 8b 45 f4 mov -0xc(%ebp),%eax
}
7c0: c9 leave
7c1: c3 ret
000007c2 <execcmd>:
// Constructors
struct cmd*
execcmd(void)
{
7c2: 55 push %ebp
7c3: 89 e5 mov %esp,%ebp
7c5: 83 ec 18 sub $0x18,%esp
struct execcmd *cmd;
cmd = malloc(sizeof(*cmd));
7c8: 83 ec 0c sub $0xc,%esp
7cb: 6a 54 push $0x54
7cd: e8 18 10 00 00 call 17ea <malloc>
7d2: 83 c4 10 add $0x10,%esp
7d5: 89 45 f4 mov %eax,-0xc(%ebp)
memset(cmd, 0, sizeof(*cmd));
7d8: 83 ec 04 sub $0x4,%esp
7db: 6a 54 push $0x54
7dd: 6a 00 push $0x0
7df: ff 75 f4 pushl -0xc(%ebp)
7e2: e8 30 09 00 00 call 1117 <memset>
7e7: 83 c4 10 add $0x10,%esp
cmd->type = EXEC;
7ea: 8b 45 f4 mov -0xc(%ebp),%eax
7ed: c7 00 01 00 00 00 movl $0x1,(%eax)
return (struct cmd*)cmd;
7f3: 8b 45 f4 mov -0xc(%ebp),%eax
}
7f6: c9 leave
7f7: c3 ret
000007f8 <redircmd>:
struct cmd*
redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd)
{
7f8: 55 push %ebp
7f9: 89 e5 mov %esp,%ebp
7fb: 83 ec 18 sub $0x18,%esp
struct redircmd *cmd;
cmd = malloc(sizeof(*cmd));
7fe: 83 ec 0c sub $0xc,%esp
801: 6a 18 push $0x18
803: e8 e2 0f 00 00 call 17ea <malloc>
808: 83 c4 10 add $0x10,%esp
80b: 89 45 f4 mov %eax,-0xc(%ebp)
memset(cmd, 0, sizeof(*cmd));
80e: 83 ec 04 sub $0x4,%esp
811: 6a 18 push $0x18
813: 6a 00 push $0x0
815: ff 75 f4 pushl -0xc(%ebp)
818: e8 fa 08 00 00 call 1117 <memset>
81d: 83 c4 10 add $0x10,%esp
cmd->type = REDIR;
820: 8b 45 f4 mov -0xc(%ebp),%eax
823: c7 00 02 00 00 00 movl $0x2,(%eax)
cmd->cmd = subcmd;
829: 8b 45 f4 mov -0xc(%ebp),%eax
82c: 8b 55 08 mov 0x8(%ebp),%edx
82f: 89 50 04 mov %edx,0x4(%eax)
cmd->file = file;
832: 8b 45 f4 mov -0xc(%ebp),%eax
835: 8b 55 0c mov 0xc(%ebp),%edx
838: 89 50 08 mov %edx,0x8(%eax)
cmd->efile = efile;
83b: 8b 45 f4 mov -0xc(%ebp),%eax
83e: 8b 55 10 mov 0x10(%ebp),%edx
841: 89 50 0c mov %edx,0xc(%eax)
cmd->mode = mode;
844: 8b 45 f4 mov -0xc(%ebp),%eax
847: 8b 55 14 mov 0x14(%ebp),%edx
84a: 89 50 10 mov %edx,0x10(%eax)
cmd->fd = fd;
84d: 8b 45 f4 mov -0xc(%ebp),%eax
850: 8b 55 18 mov 0x18(%ebp),%edx
853: 89 50 14 mov %edx,0x14(%eax)
return (struct cmd*)cmd;
856: 8b 45 f4 mov -0xc(%ebp),%eax
}
859: c9 leave
85a: c3 ret
0000085b <pipecmd>:
struct cmd*
pipecmd(struct cmd *left, struct cmd *right)
{
85b: 55 push %ebp
85c: 89 e5 mov %esp,%ebp
85e: 83 ec 18 sub $0x18,%esp
struct pipecmd *cmd;
cmd = malloc(sizeof(*cmd));
861: 83 ec 0c sub $0xc,%esp
864: 6a 0c push $0xc
866: e8 7f 0f 00 00 call 17ea <malloc>
86b: 83 c4 10 add $0x10,%esp
86e: 89 45 f4 mov %eax,-0xc(%ebp)
memset(cmd, 0, sizeof(*cmd));
871: 83 ec 04 sub $0x4,%esp
874: 6a 0c push $0xc
876: 6a 00 push $0x0
878: ff 75 f4 pushl -0xc(%ebp)
87b: e8 97 08 00 00 call 1117 <memset>
880: 83 c4 10 add $0x10,%esp
cmd->type = PIPE;
883: 8b 45 f4 mov -0xc(%ebp),%eax
886: c7 00 03 00 00 00 movl $0x3,(%eax)
cmd->left = left;
88c: 8b 45 f4 mov -0xc(%ebp),%eax
88f: 8b 55 08 mov 0x8(%ebp),%edx
892: 89 50 04 mov %edx,0x4(%eax)
cmd->right = right;
895: 8b 45 f4 mov -0xc(%ebp),%eax
898: 8b 55 0c mov 0xc(%ebp),%edx
89b: 89 50 08 mov %edx,0x8(%eax)
return (struct cmd*)cmd;
89e: 8b 45 f4 mov -0xc(%ebp),%eax
}
8a1: c9 leave
8a2: c3 ret
000008a3 <listcmd>:
struct cmd*
listcmd(struct cmd *left, struct cmd *right)
{
8a3: 55 push %ebp
8a4: 89 e5 mov %esp,%ebp
8a6: 83 ec 18 sub $0x18,%esp
struct listcmd *cmd;
cmd = malloc(sizeof(*cmd));
8a9: 83 ec 0c sub $0xc,%esp
8ac: 6a 0c push $0xc
8ae: e8 37 0f 00 00 call 17ea <malloc>
8b3: 83 c4 10 add $0x10,%esp
8b6: 89 45 f4 mov %eax,-0xc(%ebp)
memset(cmd, 0, sizeof(*cmd));
8b9: 83 ec 04 sub $0x4,%esp
8bc: 6a 0c push $0xc
8be: 6a 00 push $0x0
8c0: ff 75 f4 pushl -0xc(%ebp)
8c3: e8 4f 08 00 00 call 1117 <memset>
8c8: 83 c4 10 add $0x10,%esp
cmd->type = LIST;
8cb: 8b 45 f4 mov -0xc(%ebp),%eax
8ce: c7 00 04 00 00 00 movl $0x4,(%eax)
cmd->left = left;
8d4: 8b 45 f4 mov -0xc(%ebp),%eax
8d7: 8b 55 08 mov 0x8(%ebp),%edx
8da: 89 50 04 mov %edx,0x4(%eax)
cmd->right = right;
8dd: 8b 45 f4 mov -0xc(%ebp),%eax
8e0: 8b 55 0c mov 0xc(%ebp),%edx
8e3: 89 50 08 mov %edx,0x8(%eax)
return (struct cmd*)cmd;
8e6: 8b 45 f4 mov -0xc(%ebp),%eax
}
8e9: c9 leave
8ea: c3 ret
000008eb <backcmd>:
struct cmd*
backcmd(struct cmd *subcmd)
{
8eb: 55 push %ebp
8ec: 89 e5 mov %esp,%ebp
8ee: 83 ec 18 sub $0x18,%esp
struct backcmd *cmd;
cmd = malloc(sizeof(*cmd));
8f1: 83 ec 0c sub $0xc,%esp
8f4: 6a 08 push $0x8
8f6: e8 ef 0e 00 00 call 17ea <malloc>
8fb: 83 c4 10 add $0x10,%esp
8fe: 89 45 f4 mov %eax,-0xc(%ebp)
memset(cmd, 0, sizeof(*cmd));
901: 83 ec 04 sub $0x4,%esp
904: 6a 08 push $0x8
906: 6a 00 push $0x0
908: ff 75 f4 pushl -0xc(%ebp)
90b: e8 07 08 00 00 call 1117 <memset>
910: 83 c4 10 add $0x10,%esp
cmd->type = BACK;
913: 8b 45 f4 mov -0xc(%ebp),%eax
916: c7 00 05 00 00 00 movl $0x5,(%eax)
cmd->cmd = subcmd;
91c: 8b 45 f4 mov -0xc(%ebp),%eax
91f: 8b 55 08 mov 0x8(%ebp),%edx
922: 89 50 04 mov %edx,0x4(%eax)
return (struct cmd*)cmd;
925: 8b 45 f4 mov -0xc(%ebp),%eax
}
928: c9 leave
929: c3 ret
0000092a <gettoken>:
char whitespace[] = " \t\r\n\v";
char symbols[] = "<|>&;()";
int
gettoken(char **ps, char *es, char **q, char **eq)
{
92a: 55 push %ebp
92b: 89 e5 mov %esp,%ebp
92d: 83 ec 18 sub $0x18,%esp
char *s;
int ret;
s = *ps;
930: 8b 45 08 mov 0x8(%ebp),%eax
933: 8b 00 mov (%eax),%eax
935: 89 45 f4 mov %eax,-0xc(%ebp)
while(s < es && strchr(whitespace, *s))
938: eb 04 jmp 93e <gettoken+0x14>
s++;
93a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
{
char *s;
int ret;
s = *ps;
while(s < es && strchr(whitespace, *s))
93e: 8b 45 f4 mov -0xc(%ebp),%eax
941: 3b 45 0c cmp 0xc(%ebp),%eax
944: 73 1e jae 964 <gettoken+0x3a>
946: 8b 45 f4 mov -0xc(%ebp),%eax
949: 0f b6 00 movzbl (%eax),%eax
94c: 0f be c0 movsbl %al,%eax
94f: 83 ec 08 sub $0x8,%esp
952: 50 push %eax
953: 68 74 1f 00 00 push $0x1f74
958: e8 d4 07 00 00 call 1131 <strchr>
95d: 83 c4 10 add $0x10,%esp
960: 85 c0 test %eax,%eax
962: 75 d6 jne 93a <gettoken+0x10>
s++;
if(q)
964: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
968: 74 08 je 972 <gettoken+0x48>
*q = s;
96a: 8b 45 10 mov 0x10(%ebp),%eax
96d: 8b 55 f4 mov -0xc(%ebp),%edx
970: 89 10 mov %edx,(%eax)
ret = *s;
972: 8b 45 f4 mov -0xc(%ebp),%eax
975: 0f b6 00 movzbl (%eax),%eax
978: 0f be c0 movsbl %al,%eax
97b: 89 45 f0 mov %eax,-0x10(%ebp)
switch(*s){
97e: 8b 45 f4 mov -0xc(%ebp),%eax
981: 0f b6 00 movzbl (%eax),%eax
984: 0f be c0 movsbl %al,%eax
987: 83 f8 29 cmp $0x29,%eax
98a: 7f 14 jg 9a0 <gettoken+0x76>
98c: 83 f8 28 cmp $0x28,%eax
98f: 7d 28 jge 9b9 <gettoken+0x8f>
991: 85 c0 test %eax,%eax
993: 0f 84 94 00 00 00 je a2d <gettoken+0x103>
999: 83 f8 26 cmp $0x26,%eax
99c: 74 1b je 9b9 <gettoken+0x8f>
99e: eb 3a jmp 9da <gettoken+0xb0>
9a0: 83 f8 3e cmp $0x3e,%eax
9a3: 74 1a je 9bf <gettoken+0x95>
9a5: 83 f8 3e cmp $0x3e,%eax
9a8: 7f 0a jg 9b4 <gettoken+0x8a>
9aa: 83 e8 3b sub $0x3b,%eax
9ad: 83 f8 01 cmp $0x1,%eax
9b0: 77 28 ja 9da <gettoken+0xb0>
9b2: eb 05 jmp 9b9 <gettoken+0x8f>
9b4: 83 f8 7c cmp $0x7c,%eax
9b7: 75 21 jne 9da <gettoken+0xb0>
case '(':
case ')':
case ';':
case '&':
case '<':
s++;
9b9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
break;
9bd: eb 75 jmp a34 <gettoken+0x10a>
case '>':
s++;
9bf: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(*s == '>'){
9c3: 8b 45 f4 mov -0xc(%ebp),%eax
9c6: 0f b6 00 movzbl (%eax),%eax
9c9: 3c 3e cmp $0x3e,%al
9cb: 75 63 jne a30 <gettoken+0x106>
ret = '+';
9cd: c7 45 f0 2b 00 00 00 movl $0x2b,-0x10(%ebp)
s++;
9d4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
}
break;
9d8: eb 56 jmp a30 <gettoken+0x106>
default:
ret = 'a';
9da: c7 45 f0 61 00 00 00 movl $0x61,-0x10(%ebp)
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
9e1: eb 04 jmp 9e7 <gettoken+0xbd>
s++;
9e3: 83 45 f4 01 addl $0x1,-0xc(%ebp)
s++;
}
break;
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
9e7: 8b 45 f4 mov -0xc(%ebp),%eax
9ea: 3b 45 0c cmp 0xc(%ebp),%eax
9ed: 73 44 jae a33 <gettoken+0x109>
9ef: 8b 45 f4 mov -0xc(%ebp),%eax
9f2: 0f b6 00 movzbl (%eax),%eax
9f5: 0f be c0 movsbl %al,%eax
9f8: 83 ec 08 sub $0x8,%esp
9fb: 50 push %eax
9fc: 68 74 1f 00 00 push $0x1f74
a01: e8 2b 07 00 00 call 1131 <strchr>
a06: 83 c4 10 add $0x10,%esp
a09: 85 c0 test %eax,%eax
a0b: 75 26 jne a33 <gettoken+0x109>
a0d: 8b 45 f4 mov -0xc(%ebp),%eax
a10: 0f b6 00 movzbl (%eax),%eax
a13: 0f be c0 movsbl %al,%eax
a16: 83 ec 08 sub $0x8,%esp
a19: 50 push %eax
a1a: 68 7c 1f 00 00 push $0x1f7c
a1f: e8 0d 07 00 00 call 1131 <strchr>
a24: 83 c4 10 add $0x10,%esp
a27: 85 c0 test %eax,%eax
a29: 74 b8 je 9e3 <gettoken+0xb9>
s++;
break;
a2b: eb 06 jmp a33 <gettoken+0x109>
if(q)
*q = s;
ret = *s;
switch(*s){
case 0:
break;
a2d: 90 nop
a2e: eb 04 jmp a34 <gettoken+0x10a>
s++;
if(*s == '>'){
ret = '+';
s++;
}
break;
a30: 90 nop
a31: eb 01 jmp a34 <gettoken+0x10a>
default:
ret = 'a';
while(s < es && !strchr(whitespace, *s) && !strchr(symbols, *s))
s++;
break;
a33: 90 nop
}
if(eq)
a34: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
a38: 74 0e je a48 <gettoken+0x11e>
*eq = s;
a3a: 8b 45 14 mov 0x14(%ebp),%eax
a3d: 8b 55 f4 mov -0xc(%ebp),%edx
a40: 89 10 mov %edx,(%eax)
while(s < es && strchr(whitespace, *s))
a42: eb 04 jmp a48 <gettoken+0x11e>
s++;
a44: 83 45 f4 01 addl $0x1,-0xc(%ebp)
break;
}
if(eq)
*eq = s;
while(s < es && strchr(whitespace, *s))
a48: 8b 45 f4 mov -0xc(%ebp),%eax
a4b: 3b 45 0c cmp 0xc(%ebp),%eax
a4e: 73 1e jae a6e <gettoken+0x144>
a50: 8b 45 f4 mov -0xc(%ebp),%eax
a53: 0f b6 00 movzbl (%eax),%eax
a56: 0f be c0 movsbl %al,%eax
a59: 83 ec 08 sub $0x8,%esp
a5c: 50 push %eax
a5d: 68 74 1f 00 00 push $0x1f74
a62: e8 ca 06 00 00 call 1131 <strchr>
a67: 83 c4 10 add $0x10,%esp
a6a: 85 c0 test %eax,%eax
a6c: 75 d6 jne a44 <gettoken+0x11a>
s++;
*ps = s;
a6e: 8b 45 08 mov 0x8(%ebp),%eax
a71: 8b 55 f4 mov -0xc(%ebp),%edx
a74: 89 10 mov %edx,(%eax)
return ret;
a76: 8b 45 f0 mov -0x10(%ebp),%eax
}
a79: c9 leave
a7a: c3 ret
00000a7b <peek>:
int
peek(char **ps, char *es, char *toks)
{
a7b: 55 push %ebp
a7c: 89 e5 mov %esp,%ebp
a7e: 83 ec 18 sub $0x18,%esp
char *s;
s = *ps;
a81: 8b 45 08 mov 0x8(%ebp),%eax
a84: 8b 00 mov (%eax),%eax
a86: 89 45 f4 mov %eax,-0xc(%ebp)
while(s < es && strchr(whitespace, *s))
a89: eb 04 jmp a8f <peek+0x14>
s++;
a8b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
peek(char **ps, char *es, char *toks)
{
char *s;
s = *ps;
while(s < es && strchr(whitespace, *s))
a8f: 8b 45 f4 mov -0xc(%ebp),%eax
a92: 3b 45 0c cmp 0xc(%ebp),%eax
a95: 73 1e jae ab5 <peek+0x3a>
a97: 8b 45 f4 mov -0xc(%ebp),%eax
a9a: 0f b6 00 movzbl (%eax),%eax
a9d: 0f be c0 movsbl %al,%eax
aa0: 83 ec 08 sub $0x8,%esp
aa3: 50 push %eax
aa4: 68 74 1f 00 00 push $0x1f74
aa9: e8 83 06 00 00 call 1131 <strchr>
aae: 83 c4 10 add $0x10,%esp
ab1: 85 c0 test %eax,%eax
ab3: 75 d6 jne a8b <peek+0x10>
s++;
*ps = s;
ab5: 8b 45 08 mov 0x8(%ebp),%eax
ab8: 8b 55 f4 mov -0xc(%ebp),%edx
abb: 89 10 mov %edx,(%eax)
return *s && strchr(toks, *s);
abd: 8b 45 f4 mov -0xc(%ebp),%eax
ac0: 0f b6 00 movzbl (%eax),%eax
ac3: 84 c0 test %al,%al
ac5: 74 23 je aea <peek+0x6f>
ac7: 8b 45 f4 mov -0xc(%ebp),%eax
aca: 0f b6 00 movzbl (%eax),%eax
acd: 0f be c0 movsbl %al,%eax
ad0: 83 ec 08 sub $0x8,%esp
ad3: 50 push %eax
ad4: ff 75 10 pushl 0x10(%ebp)
ad7: e8 55 06 00 00 call 1131 <strchr>
adc: 83 c4 10 add $0x10,%esp
adf: 85 c0 test %eax,%eax
ae1: 74 07 je aea <peek+0x6f>
ae3: b8 01 00 00 00 mov $0x1,%eax
ae8: eb 05 jmp aef <peek+0x74>
aea: b8 00 00 00 00 mov $0x0,%eax
}
aef: c9 leave
af0: c3 ret
00000af1 <parsecmd>:
struct cmd *parseexec(char**, char*);
struct cmd *nulterminate(struct cmd*);
struct cmd*
parsecmd(char *s)
{
af1: 55 push %ebp
af2: 89 e5 mov %esp,%ebp
af4: 53 push %ebx
af5: 83 ec 14 sub $0x14,%esp
char *es;
struct cmd *cmd;
es = s + strlen(s);
af8: 8b 5d 08 mov 0x8(%ebp),%ebx
afb: 8b 45 08 mov 0x8(%ebp),%eax
afe: 83 ec 0c sub $0xc,%esp
b01: 50 push %eax
b02: e8 e9 05 00 00 call 10f0 <strlen>
b07: 83 c4 10 add $0x10,%esp
b0a: 01 d8 add %ebx,%eax
b0c: 89 45 f4 mov %eax,-0xc(%ebp)
cmd = parseline(&s, es);
b0f: 83 ec 08 sub $0x8,%esp
b12: ff 75 f4 pushl -0xc(%ebp)
b15: 8d 45 08 lea 0x8(%ebp),%eax
b18: 50 push %eax
b19: e8 61 00 00 00 call b7f <parseline>
b1e: 83 c4 10 add $0x10,%esp
b21: 89 45 f0 mov %eax,-0x10(%ebp)
peek(&s, es, "");
b24: 83 ec 04 sub $0x4,%esp
b27: 68 87 19 00 00 push $0x1987
b2c: ff 75 f4 pushl -0xc(%ebp)
b2f: 8d 45 08 lea 0x8(%ebp),%eax
b32: 50 push %eax
b33: e8 43 ff ff ff call a7b <peek>
b38: 83 c4 10 add $0x10,%esp
if(s != es){
b3b: 8b 45 08 mov 0x8(%ebp),%eax
b3e: 3b 45 f4 cmp -0xc(%ebp),%eax
b41: 74 26 je b69 <parsecmd+0x78>
printf(2, "leftovers: %s\n", s);
b43: 8b 45 08 mov 0x8(%ebp),%eax
b46: 83 ec 04 sub $0x4,%esp
b49: 50 push %eax
b4a: 68 88 19 00 00 push $0x1988
b4f: 6a 02 push $0x2
b51: e8 c1 09 00 00 call 1517 <printf>
b56: 83 c4 10 add $0x10,%esp
panic("syntax");
b59: 83 ec 0c sub $0xc,%esp
b5c: 68 97 19 00 00 push $0x1997
b61: e8 13 fc ff ff call 779 <panic>
b66: 83 c4 10 add $0x10,%esp
}
nulterminate(cmd);
b69: 83 ec 0c sub $0xc,%esp
b6c: ff 75 f0 pushl -0x10(%ebp)
b6f: e8 eb 03 00 00 call f5f <nulterminate>
b74: 83 c4 10 add $0x10,%esp
return cmd;
b77: 8b 45 f0 mov -0x10(%ebp),%eax
}
b7a: 8b 5d fc mov -0x4(%ebp),%ebx
b7d: c9 leave
b7e: c3 ret
00000b7f <parseline>:
struct cmd*
parseline(char **ps, char *es)
{
b7f: 55 push %ebp
b80: 89 e5 mov %esp,%ebp
b82: 83 ec 18 sub $0x18,%esp
struct cmd *cmd;
cmd = parsepipe(ps, es);
b85: 83 ec 08 sub $0x8,%esp
b88: ff 75 0c pushl 0xc(%ebp)
b8b: ff 75 08 pushl 0x8(%ebp)
b8e: e8 99 00 00 00 call c2c <parsepipe>
b93: 83 c4 10 add $0x10,%esp
b96: 89 45 f4 mov %eax,-0xc(%ebp)
while(peek(ps, es, "&")){
b99: eb 23 jmp bbe <parseline+0x3f>
gettoken(ps, es, 0, 0);
b9b: 6a 00 push $0x0
b9d: 6a 00 push $0x0
b9f: ff 75 0c pushl 0xc(%ebp)
ba2: ff 75 08 pushl 0x8(%ebp)
ba5: e8 80 fd ff ff call 92a <gettoken>
baa: 83 c4 10 add $0x10,%esp
cmd = backcmd(cmd);
bad: 83 ec 0c sub $0xc,%esp
bb0: ff 75 f4 pushl -0xc(%ebp)
bb3: e8 33 fd ff ff call 8eb <backcmd>
bb8: 83 c4 10 add $0x10,%esp
bbb: 89 45 f4 mov %eax,-0xc(%ebp)
parseline(char **ps, char *es)
{
struct cmd *cmd;
cmd = parsepipe(ps, es);
while(peek(ps, es, "&")){
bbe: 83 ec 04 sub $0x4,%esp
bc1: 68 9e 19 00 00 push $0x199e
bc6: ff 75 0c pushl 0xc(%ebp)
bc9: ff 75 08 pushl 0x8(%ebp)
bcc: e8 aa fe ff ff call a7b <peek>
bd1: 83 c4 10 add $0x10,%esp
bd4: 85 c0 test %eax,%eax
bd6: 75 c3 jne b9b <parseline+0x1c>
gettoken(ps, es, 0, 0);
cmd = backcmd(cmd);
}
if(peek(ps, es, ";")){
bd8: 83 ec 04 sub $0x4,%esp
bdb: 68 a0 19 00 00 push $0x19a0
be0: ff 75 0c pushl 0xc(%ebp)
be3: ff 75 08 pushl 0x8(%ebp)
be6: e8 90 fe ff ff call a7b <peek>
beb: 83 c4 10 add $0x10,%esp
bee: 85 c0 test %eax,%eax
bf0: 74 35 je c27 <parseline+0xa8>
gettoken(ps, es, 0, 0);
bf2: 6a 00 push $0x0
bf4: 6a 00 push $0x0
bf6: ff 75 0c pushl 0xc(%ebp)
bf9: ff 75 08 pushl 0x8(%ebp)
bfc: e8 29 fd ff ff call 92a <gettoken>
c01: 83 c4 10 add $0x10,%esp
cmd = listcmd(cmd, parseline(ps, es));
c04: 83 ec 08 sub $0x8,%esp
c07: ff 75 0c pushl 0xc(%ebp)
c0a: ff 75 08 pushl 0x8(%ebp)
c0d: e8 6d ff ff ff call b7f <parseline>
c12: 83 c4 10 add $0x10,%esp
c15: 83 ec 08 sub $0x8,%esp
c18: 50 push %eax
c19: ff 75 f4 pushl -0xc(%ebp)
c1c: e8 82 fc ff ff call 8a3 <listcmd>
c21: 83 c4 10 add $0x10,%esp
c24: 89 45 f4 mov %eax,-0xc(%ebp)
}
return cmd;
c27: 8b 45 f4 mov -0xc(%ebp),%eax
}
c2a: c9 leave
c2b: c3 ret
00000c2c <parsepipe>:
struct cmd*
parsepipe(char **ps, char *es)
{
c2c: 55 push %ebp
c2d: 89 e5 mov %esp,%ebp
c2f: 83 ec 18 sub $0x18,%esp
struct cmd *cmd;
cmd = parseexec(ps, es);
c32: 83 ec 08 sub $0x8,%esp
c35: ff 75 0c pushl 0xc(%ebp)
c38: ff 75 08 pushl 0x8(%ebp)
c3b: e8 ec 01 00 00 call e2c <parseexec>
c40: 83 c4 10 add $0x10,%esp
c43: 89 45 f4 mov %eax,-0xc(%ebp)
if(peek(ps, es, "|")){
c46: 83 ec 04 sub $0x4,%esp
c49: 68 a2 19 00 00 push $0x19a2
c4e: ff 75 0c pushl 0xc(%ebp)
c51: ff 75 08 pushl 0x8(%ebp)
c54: e8 22 fe ff ff call a7b <peek>
c59: 83 c4 10 add $0x10,%esp
c5c: 85 c0 test %eax,%eax
c5e: 74 35 je c95 <parsepipe+0x69>
gettoken(ps, es, 0, 0);
c60: 6a 00 push $0x0
c62: 6a 00 push $0x0
c64: ff 75 0c pushl 0xc(%ebp)
c67: ff 75 08 pushl 0x8(%ebp)
c6a: e8 bb fc ff ff call 92a <gettoken>
c6f: 83 c4 10 add $0x10,%esp
cmd = pipecmd(cmd, parsepipe(ps, es));
c72: 83 ec 08 sub $0x8,%esp
c75: ff 75 0c pushl 0xc(%ebp)
c78: ff 75 08 pushl 0x8(%ebp)
c7b: e8 ac ff ff ff call c2c <parsepipe>
c80: 83 c4 10 add $0x10,%esp
c83: 83 ec 08 sub $0x8,%esp
c86: 50 push %eax
c87: ff 75 f4 pushl -0xc(%ebp)
c8a: e8 cc fb ff ff call 85b <pipecmd>
c8f: 83 c4 10 add $0x10,%esp
c92: 89 45 f4 mov %eax,-0xc(%ebp)
}
return cmd;
c95: 8b 45 f4 mov -0xc(%ebp),%eax
}
c98: c9 leave
c99: c3 ret
00000c9a <parseredirs>:
struct cmd*
parseredirs(struct cmd *cmd, char **ps, char *es)
{
c9a: 55 push %ebp
c9b: 89 e5 mov %esp,%ebp
c9d: 83 ec 18 sub $0x18,%esp
int tok;
char *q, *eq;
while(peek(ps, es, "<>")){
ca0: e9 b6 00 00 00 jmp d5b <parseredirs+0xc1>
tok = gettoken(ps, es, 0, 0);
ca5: 6a 00 push $0x0
ca7: 6a 00 push $0x0
ca9: ff 75 10 pushl 0x10(%ebp)
cac: ff 75 0c pushl 0xc(%ebp)
caf: e8 76 fc ff ff call 92a <gettoken>
cb4: 83 c4 10 add $0x10,%esp
cb7: 89 45 f4 mov %eax,-0xc(%ebp)
if(gettoken(ps, es, &q, &eq) != 'a')
cba: 8d 45 ec lea -0x14(%ebp),%eax
cbd: 50 push %eax
cbe: 8d 45 f0 lea -0x10(%ebp),%eax
cc1: 50 push %eax
cc2: ff 75 10 pushl 0x10(%ebp)
cc5: ff 75 0c pushl 0xc(%ebp)
cc8: e8 5d fc ff ff call 92a <gettoken>
ccd: 83 c4 10 add $0x10,%esp
cd0: 83 f8 61 cmp $0x61,%eax
cd3: 74 10 je ce5 <parseredirs+0x4b>
panic("missing file for redirection");
cd5: 83 ec 0c sub $0xc,%esp
cd8: 68 a4 19 00 00 push $0x19a4
cdd: e8 97 fa ff ff call 779 <panic>
ce2: 83 c4 10 add $0x10,%esp
switch(tok){
ce5: 8b 45 f4 mov -0xc(%ebp),%eax
ce8: 83 f8 3c cmp $0x3c,%eax
ceb: 74 0c je cf9 <parseredirs+0x5f>
ced: 83 f8 3e cmp $0x3e,%eax
cf0: 74 26 je d18 <parseredirs+0x7e>
cf2: 83 f8 2b cmp $0x2b,%eax
cf5: 74 43 je d3a <parseredirs+0xa0>
cf7: eb 62 jmp d5b <parseredirs+0xc1>
case '<':
cmd = redircmd(cmd, q, eq, O_RDONLY, 0);
cf9: 8b 55 ec mov -0x14(%ebp),%edx
cfc: 8b 45 f0 mov -0x10(%ebp),%eax
cff: 83 ec 0c sub $0xc,%esp
d02: 6a 00 push $0x0
d04: 6a 00 push $0x0
d06: 52 push %edx
d07: 50 push %eax
d08: ff 75 08 pushl 0x8(%ebp)
d0b: e8 e8 fa ff ff call 7f8 <redircmd>
d10: 83 c4 20 add $0x20,%esp
d13: 89 45 08 mov %eax,0x8(%ebp)
break;
d16: eb 43 jmp d5b <parseredirs+0xc1>
case '>':
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
d18: 8b 55 ec mov -0x14(%ebp),%edx
d1b: 8b 45 f0 mov -0x10(%ebp),%eax
d1e: 83 ec 0c sub $0xc,%esp
d21: 6a 01 push $0x1
d23: 68 01 02 00 00 push $0x201
d28: 52 push %edx
d29: 50 push %eax
d2a: ff 75 08 pushl 0x8(%ebp)
d2d: e8 c6 fa ff ff call 7f8 <redircmd>
d32: 83 c4 20 add $0x20,%esp
d35: 89 45 08 mov %eax,0x8(%ebp)
break;
d38: eb 21 jmp d5b <parseredirs+0xc1>
case '+': // >>
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
d3a: 8b 55 ec mov -0x14(%ebp),%edx
d3d: 8b 45 f0 mov -0x10(%ebp),%eax
d40: 83 ec 0c sub $0xc,%esp
d43: 6a 01 push $0x1
d45: 68 01 02 00 00 push $0x201
d4a: 52 push %edx
d4b: 50 push %eax
d4c: ff 75 08 pushl 0x8(%ebp)
d4f: e8 a4 fa ff ff call 7f8 <redircmd>
d54: 83 c4 20 add $0x20,%esp
d57: 89 45 08 mov %eax,0x8(%ebp)
break;
d5a: 90 nop
parseredirs(struct cmd *cmd, char **ps, char *es)
{
int tok;
char *q, *eq;
while(peek(ps, es, "<>")){
d5b: 83 ec 04 sub $0x4,%esp
d5e: 68 c1 19 00 00 push $0x19c1
d63: ff 75 10 pushl 0x10(%ebp)
d66: ff 75 0c pushl 0xc(%ebp)
d69: e8 0d fd ff ff call a7b <peek>
d6e: 83 c4 10 add $0x10,%esp
d71: 85 c0 test %eax,%eax
d73: 0f 85 2c ff ff ff jne ca5 <parseredirs+0xb>
case '+': // >>
cmd = redircmd(cmd, q, eq, O_WRONLY|O_CREATE, 1);
break;
}
}
return cmd;
d79: 8b 45 08 mov 0x8(%ebp),%eax
}
d7c: c9 leave
d7d: c3 ret
00000d7e <parseblock>:
struct cmd*
parseblock(char **ps, char *es)
{
d7e: 55 push %ebp
d7f: 89 e5 mov %esp,%ebp
d81: 83 ec 18 sub $0x18,%esp
struct cmd *cmd;
if(!peek(ps, es, "("))
d84: 83 ec 04 sub $0x4,%esp
d87: 68 c4 19 00 00 push $0x19c4
d8c: ff 75 0c pushl 0xc(%ebp)
d8f: ff 75 08 pushl 0x8(%ebp)
d92: e8 e4 fc ff ff call a7b <peek>
d97: 83 c4 10 add $0x10,%esp
d9a: 85 c0 test %eax,%eax
d9c: 75 10 jne dae <parseblock+0x30>
panic("parseblock");
d9e: 83 ec 0c sub $0xc,%esp
da1: 68 c6 19 00 00 push $0x19c6
da6: e8 ce f9 ff ff call 779 <panic>
dab: 83 c4 10 add $0x10,%esp
gettoken(ps, es, 0, 0);
dae: 6a 00 push $0x0
db0: 6a 00 push $0x0
db2: ff 75 0c pushl 0xc(%ebp)
db5: ff 75 08 pushl 0x8(%ebp)
db8: e8 6d fb ff ff call 92a <gettoken>
dbd: 83 c4 10 add $0x10,%esp
cmd = parseline(ps, es);
dc0: 83 ec 08 sub $0x8,%esp
dc3: ff 75 0c pushl 0xc(%ebp)
dc6: ff 75 08 pushl 0x8(%ebp)
dc9: e8 b1 fd ff ff call b7f <parseline>
dce: 83 c4 10 add $0x10,%esp
dd1: 89 45 f4 mov %eax,-0xc(%ebp)
if(!peek(ps, es, ")"))
dd4: 83 ec 04 sub $0x4,%esp
dd7: 68 d1 19 00 00 push $0x19d1
ddc: ff 75 0c pushl 0xc(%ebp)
ddf: ff 75 08 pushl 0x8(%ebp)
de2: e8 94 fc ff ff call a7b <peek>
de7: 83 c4 10 add $0x10,%esp
dea: 85 c0 test %eax,%eax
dec: 75 10 jne dfe <parseblock+0x80>
panic("syntax - missing )");
dee: 83 ec 0c sub $0xc,%esp
df1: 68 d3 19 00 00 push $0x19d3
df6: e8 7e f9 ff ff call 779 <panic>
dfb: 83 c4 10 add $0x10,%esp
gettoken(ps, es, 0, 0);
dfe: 6a 00 push $0x0
e00: 6a 00 push $0x0
e02: ff 75 0c pushl 0xc(%ebp)
e05: ff 75 08 pushl 0x8(%ebp)
e08: e8 1d fb ff ff call 92a <gettoken>
e0d: 83 c4 10 add $0x10,%esp
cmd = parseredirs(cmd, ps, es);
e10: 83 ec 04 sub $0x4,%esp
e13: ff 75 0c pushl 0xc(%ebp)
e16: ff 75 08 pushl 0x8(%ebp)
e19: ff 75 f4 pushl -0xc(%ebp)
e1c: e8 79 fe ff ff call c9a <parseredirs>
e21: 83 c4 10 add $0x10,%esp
e24: 89 45 f4 mov %eax,-0xc(%ebp)
return cmd;
e27: 8b 45 f4 mov -0xc(%ebp),%eax
}
e2a: c9 leave
e2b: c3 ret
00000e2c <parseexec>:
struct cmd*
parseexec(char **ps, char *es)
{
e2c: 55 push %ebp
e2d: 89 e5 mov %esp,%ebp
e2f: 83 ec 28 sub $0x28,%esp
char *q, *eq;
int tok, argc;
struct execcmd *cmd;
struct cmd *ret;
if(peek(ps, es, "("))
e32: 83 ec 04 sub $0x4,%esp
e35: 68 c4 19 00 00 push $0x19c4
e3a: ff 75 0c pushl 0xc(%ebp)
e3d: ff 75 08 pushl 0x8(%ebp)
e40: e8 36 fc ff ff call a7b <peek>
e45: 83 c4 10 add $0x10,%esp
e48: 85 c0 test %eax,%eax
e4a: 74 16 je e62 <parseexec+0x36>
return parseblock(ps, es);
e4c: 83 ec 08 sub $0x8,%esp
e4f: ff 75 0c pushl 0xc(%ebp)
e52: ff 75 08 pushl 0x8(%ebp)
e55: e8 24 ff ff ff call d7e <parseblock>
e5a: 83 c4 10 add $0x10,%esp
e5d: e9 fb 00 00 00 jmp f5d <parseexec+0x131>
ret = execcmd();
e62: e8 5b f9 ff ff call 7c2 <execcmd>
e67: 89 45 f0 mov %eax,-0x10(%ebp)
cmd = (struct execcmd*)ret;
e6a: 8b 45 f0 mov -0x10(%ebp),%eax
e6d: 89 45 ec mov %eax,-0x14(%ebp)
argc = 0;
e70: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
ret = parseredirs(ret, ps, es);
e77: 83 ec 04 sub $0x4,%esp
e7a: ff 75 0c pushl 0xc(%ebp)
e7d: ff 75 08 pushl 0x8(%ebp)
e80: ff 75 f0 pushl -0x10(%ebp)
e83: e8 12 fe ff ff call c9a <parseredirs>
e88: 83 c4 10 add $0x10,%esp
e8b: 89 45 f0 mov %eax,-0x10(%ebp)
while(!peek(ps, es, "|)&;")){
e8e: e9 87 00 00 00 jmp f1a <parseexec+0xee>
if((tok=gettoken(ps, es, &q, &eq)) == 0)
e93: 8d 45 e0 lea -0x20(%ebp),%eax
e96: 50 push %eax
e97: 8d 45 e4 lea -0x1c(%ebp),%eax
e9a: 50 push %eax
e9b: ff 75 0c pushl 0xc(%ebp)
e9e: ff 75 08 pushl 0x8(%ebp)
ea1: e8 84 fa ff ff call 92a <gettoken>
ea6: 83 c4 10 add $0x10,%esp
ea9: 89 45 e8 mov %eax,-0x18(%ebp)
eac: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
eb0: 0f 84 84 00 00 00 je f3a <parseexec+0x10e>
break;
if(tok != 'a')
eb6: 83 7d e8 61 cmpl $0x61,-0x18(%ebp)
eba: 74 10 je ecc <parseexec+0xa0>
panic("syntax");
ebc: 83 ec 0c sub $0xc,%esp
ebf: 68 97 19 00 00 push $0x1997
ec4: e8 b0 f8 ff ff call 779 <panic>
ec9: 83 c4 10 add $0x10,%esp
cmd->argv[argc] = q;
ecc: 8b 4d e4 mov -0x1c(%ebp),%ecx
ecf: 8b 45 ec mov -0x14(%ebp),%eax
ed2: 8b 55 f4 mov -0xc(%ebp),%edx
ed5: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4)
cmd->eargv[argc] = eq;
ed9: 8b 55 e0 mov -0x20(%ebp),%edx
edc: 8b 45 ec mov -0x14(%ebp),%eax
edf: 8b 4d f4 mov -0xc(%ebp),%ecx
ee2: 83 c1 08 add $0x8,%ecx
ee5: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4)
argc++;
ee9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(argc >= MAXARGS)
eed: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
ef1: 7e 10 jle f03 <parseexec+0xd7>
panic("too many args");
ef3: 83 ec 0c sub $0xc,%esp
ef6: 68 e6 19 00 00 push $0x19e6
efb: e8 79 f8 ff ff call 779 <panic>
f00: 83 c4 10 add $0x10,%esp
ret = parseredirs(ret, ps, es);
f03: 83 ec 04 sub $0x4,%esp
f06: ff 75 0c pushl 0xc(%ebp)
f09: ff 75 08 pushl 0x8(%ebp)
f0c: ff 75 f0 pushl -0x10(%ebp)
f0f: e8 86 fd ff ff call c9a <parseredirs>
f14: 83 c4 10 add $0x10,%esp
f17: 89 45 f0 mov %eax,-0x10(%ebp)
ret = execcmd();
cmd = (struct execcmd*)ret;
argc = 0;
ret = parseredirs(ret, ps, es);
while(!peek(ps, es, "|)&;")){
f1a: 83 ec 04 sub $0x4,%esp
f1d: 68 f4 19 00 00 push $0x19f4
f22: ff 75 0c pushl 0xc(%ebp)
f25: ff 75 08 pushl 0x8(%ebp)
f28: e8 4e fb ff ff call a7b <peek>
f2d: 83 c4 10 add $0x10,%esp
f30: 85 c0 test %eax,%eax
f32: 0f 84 5b ff ff ff je e93 <parseexec+0x67>
f38: eb 01 jmp f3b <parseexec+0x10f>
if((tok=gettoken(ps, es, &q, &eq)) == 0)
break;
f3a: 90 nop
argc++;
if(argc >= MAXARGS)
panic("too many args");
ret = parseredirs(ret, ps, es);
}
cmd->argv[argc] = 0;
f3b: 8b 45 ec mov -0x14(%ebp),%eax
f3e: 8b 55 f4 mov -0xc(%ebp),%edx
f41: c7 44 90 04 00 00 00 movl $0x0,0x4(%eax,%edx,4)
f48: 00
cmd->eargv[argc] = 0;
f49: 8b 45 ec mov -0x14(%ebp),%eax
f4c: 8b 55 f4 mov -0xc(%ebp),%edx
f4f: 83 c2 08 add $0x8,%edx
f52: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4)
f59: 00
return ret;
f5a: 8b 45 f0 mov -0x10(%ebp),%eax
}
f5d: c9 leave
f5e: c3 ret
00000f5f <nulterminate>:
// NUL-terminate all the counted strings.
struct cmd*
nulterminate(struct cmd *cmd)
{
f5f: 55 push %ebp
f60: 89 e5 mov %esp,%ebp
f62: 83 ec 28 sub $0x28,%esp
struct execcmd *ecmd;
struct listcmd *lcmd;
struct pipecmd *pcmd;
struct redircmd *rcmd;
if(cmd == 0)
f65: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
f69: 75 0a jne f75 <nulterminate+0x16>
return 0;
f6b: b8 00 00 00 00 mov $0x0,%eax
f70: e9 e4 00 00 00 jmp 1059 <nulterminate+0xfa>
switch(cmd->type){
f75: 8b 45 08 mov 0x8(%ebp),%eax
f78: 8b 00 mov (%eax),%eax
f7a: 83 f8 05 cmp $0x5,%eax
f7d: 0f 87 d3 00 00 00 ja 1056 <nulterminate+0xf7>
f83: 8b 04 85 fc 19 00 00 mov 0x19fc(,%eax,4),%eax
f8a: ff e0 jmp *%eax
case EXEC:
ecmd = (struct execcmd*)cmd;
f8c: 8b 45 08 mov 0x8(%ebp),%eax
f8f: 89 45 f0 mov %eax,-0x10(%ebp)
for(i=0; ecmd->argv[i]; i++)
f92: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
f99: eb 14 jmp faf <nulterminate+0x50>
*ecmd->eargv[i] = 0;
f9b: 8b 45 f0 mov -0x10(%ebp),%eax
f9e: 8b 55 f4 mov -0xc(%ebp),%edx
fa1: 83 c2 08 add $0x8,%edx
fa4: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
fa8: c6 00 00 movb $0x0,(%eax)
return 0;
switch(cmd->type){
case EXEC:
ecmd = (struct execcmd*)cmd;
for(i=0; ecmd->argv[i]; i++)
fab: 83 45 f4 01 addl $0x1,-0xc(%ebp)
faf: 8b 45 f0 mov -0x10(%ebp),%eax
fb2: 8b 55 f4 mov -0xc(%ebp),%edx
fb5: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax
fb9: 85 c0 test %eax,%eax
fbb: 75 de jne f9b <nulterminate+0x3c>
*ecmd->eargv[i] = 0;
break;
fbd: e9 94 00 00 00 jmp 1056 <nulterminate+0xf7>
case REDIR:
rcmd = (struct redircmd*)cmd;
fc2: 8b 45 08 mov 0x8(%ebp),%eax
fc5: 89 45 ec mov %eax,-0x14(%ebp)
nulterminate(rcmd->cmd);
fc8: 8b 45 ec mov -0x14(%ebp),%eax
fcb: 8b 40 04 mov 0x4(%eax),%eax
fce: 83 ec 0c sub $0xc,%esp
fd1: 50 push %eax
fd2: e8 88 ff ff ff call f5f <nulterminate>
fd7: 83 c4 10 add $0x10,%esp
*rcmd->efile = 0;
fda: 8b 45 ec mov -0x14(%ebp),%eax
fdd: 8b 40 0c mov 0xc(%eax),%eax
fe0: c6 00 00 movb $0x0,(%eax)
break;
fe3: eb 71 jmp 1056 <nulterminate+0xf7>
case PIPE:
pcmd = (struct pipecmd*)cmd;
fe5: 8b 45 08 mov 0x8(%ebp),%eax
fe8: 89 45 e8 mov %eax,-0x18(%ebp)
nulterminate(pcmd->left);
feb: 8b 45 e8 mov -0x18(%ebp),%eax
fee: 8b 40 04 mov 0x4(%eax),%eax
ff1: 83 ec 0c sub $0xc,%esp
ff4: 50 push %eax
ff5: e8 65 ff ff ff call f5f <nulterminate>
ffa: 83 c4 10 add $0x10,%esp
nulterminate(pcmd->right);
ffd: 8b 45 e8 mov -0x18(%ebp),%eax
1000: 8b 40 08 mov 0x8(%eax),%eax
1003: 83 ec 0c sub $0xc,%esp
1006: 50 push %eax
1007: e8 53 ff ff ff call f5f <nulterminate>
100c: 83 c4 10 add $0x10,%esp
break;
100f: eb 45 jmp 1056 <nulterminate+0xf7>
case LIST:
lcmd = (struct listcmd*)cmd;
1011: 8b 45 08 mov 0x8(%ebp),%eax
1014: 89 45 e4 mov %eax,-0x1c(%ebp)
nulterminate(lcmd->left);
1017: 8b 45 e4 mov -0x1c(%ebp),%eax
101a: 8b 40 04 mov 0x4(%eax),%eax
101d: 83 ec 0c sub $0xc,%esp
1020: 50 push %eax
1021: e8 39 ff ff ff call f5f <nulterminate>
1026: 83 c4 10 add $0x10,%esp
nulterminate(lcmd->right);
1029: 8b 45 e4 mov -0x1c(%ebp),%eax
102c: 8b 40 08 mov 0x8(%eax),%eax
102f: 83 ec 0c sub $0xc,%esp
1032: 50 push %eax
1033: e8 27 ff ff ff call f5f <nulterminate>
1038: 83 c4 10 add $0x10,%esp
break;
103b: eb 19 jmp 1056 <nulterminate+0xf7>
case BACK:
bcmd = (struct backcmd*)cmd;
103d: 8b 45 08 mov 0x8(%ebp),%eax
1040: 89 45 e0 mov %eax,-0x20(%ebp)
nulterminate(bcmd->cmd);
1043: 8b 45 e0 mov -0x20(%ebp),%eax
1046: 8b 40 04 mov 0x4(%eax),%eax
1049: 83 ec 0c sub $0xc,%esp
104c: 50 push %eax
104d: e8 0d ff ff ff call f5f <nulterminate>
1052: 83 c4 10 add $0x10,%esp
break;
1055: 90 nop
}
return cmd;
1056: 8b 45 08 mov 0x8(%ebp),%eax
}
1059: c9 leave
105a: c3 ret
0000105b <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
105b: 55 push %ebp
105c: 89 e5 mov %esp,%ebp
105e: 57 push %edi
105f: 53 push %ebx
asm volatile("cld; rep stosb" :
1060: 8b 4d 08 mov 0x8(%ebp),%ecx
1063: 8b 55 10 mov 0x10(%ebp),%edx
1066: 8b 45 0c mov 0xc(%ebp),%eax
1069: 89 cb mov %ecx,%ebx
106b: 89 df mov %ebx,%edi
106d: 89 d1 mov %edx,%ecx
106f: fc cld
1070: f3 aa rep stos %al,%es:(%edi)
1072: 89 ca mov %ecx,%edx
1074: 89 fb mov %edi,%ebx
1076: 89 5d 08 mov %ebx,0x8(%ebp)
1079: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
107c: 90 nop
107d: 5b pop %ebx
107e: 5f pop %edi
107f: 5d pop %ebp
1080: c3 ret
00001081 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
1081: 55 push %ebp
1082: 89 e5 mov %esp,%ebp
1084: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
1087: 8b 45 08 mov 0x8(%ebp),%eax
108a: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
108d: 90 nop
108e: 8b 45 08 mov 0x8(%ebp),%eax
1091: 8d 50 01 lea 0x1(%eax),%edx
1094: 89 55 08 mov %edx,0x8(%ebp)
1097: 8b 55 0c mov 0xc(%ebp),%edx
109a: 8d 4a 01 lea 0x1(%edx),%ecx
109d: 89 4d 0c mov %ecx,0xc(%ebp)
10a0: 0f b6 12 movzbl (%edx),%edx
10a3: 88 10 mov %dl,(%eax)
10a5: 0f b6 00 movzbl (%eax),%eax
10a8: 84 c0 test %al,%al
10aa: 75 e2 jne 108e <strcpy+0xd>
;
return os;
10ac: 8b 45 fc mov -0x4(%ebp),%eax
}
10af: c9 leave
10b0: c3 ret
000010b1 <strcmp>:
int
strcmp(const char *p, const char *q)
{
10b1: 55 push %ebp
10b2: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
10b4: eb 08 jmp 10be <strcmp+0xd>
p++, q++;
10b6: 83 45 08 01 addl $0x1,0x8(%ebp)
10ba: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
10be: 8b 45 08 mov 0x8(%ebp),%eax
10c1: 0f b6 00 movzbl (%eax),%eax
10c4: 84 c0 test %al,%al
10c6: 74 10 je 10d8 <strcmp+0x27>
10c8: 8b 45 08 mov 0x8(%ebp),%eax
10cb: 0f b6 10 movzbl (%eax),%edx
10ce: 8b 45 0c mov 0xc(%ebp),%eax
10d1: 0f b6 00 movzbl (%eax),%eax
10d4: 38 c2 cmp %al,%dl
10d6: 74 de je 10b6 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
10d8: 8b 45 08 mov 0x8(%ebp),%eax
10db: 0f b6 00 movzbl (%eax),%eax
10de: 0f b6 d0 movzbl %al,%edx
10e1: 8b 45 0c mov 0xc(%ebp),%eax
10e4: 0f b6 00 movzbl (%eax),%eax
10e7: 0f b6 c0 movzbl %al,%eax
10ea: 29 c2 sub %eax,%edx
10ec: 89 d0 mov %edx,%eax
}
10ee: 5d pop %ebp
10ef: c3 ret
000010f0 <strlen>:
uint
strlen(char *s)
{
10f0: 55 push %ebp
10f1: 89 e5 mov %esp,%ebp
10f3: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
10f6: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
10fd: eb 04 jmp 1103 <strlen+0x13>
10ff: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1103: 8b 55 fc mov -0x4(%ebp),%edx
1106: 8b 45 08 mov 0x8(%ebp),%eax
1109: 01 d0 add %edx,%eax
110b: 0f b6 00 movzbl (%eax),%eax
110e: 84 c0 test %al,%al
1110: 75 ed jne 10ff <strlen+0xf>
;
return n;
1112: 8b 45 fc mov -0x4(%ebp),%eax
}
1115: c9 leave
1116: c3 ret
00001117 <memset>:
void*
memset(void *dst, int c, uint n)
{
1117: 55 push %ebp
1118: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
111a: 8b 45 10 mov 0x10(%ebp),%eax
111d: 50 push %eax
111e: ff 75 0c pushl 0xc(%ebp)
1121: ff 75 08 pushl 0x8(%ebp)
1124: e8 32 ff ff ff call 105b <stosb>
1129: 83 c4 0c add $0xc,%esp
return dst;
112c: 8b 45 08 mov 0x8(%ebp),%eax
}
112f: c9 leave
1130: c3 ret
00001131 <strchr>:
char*
strchr(const char *s, char c)
{
1131: 55 push %ebp
1132: 89 e5 mov %esp,%ebp
1134: 83 ec 04 sub $0x4,%esp
1137: 8b 45 0c mov 0xc(%ebp),%eax
113a: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
113d: eb 14 jmp 1153 <strchr+0x22>
if(*s == c)
113f: 8b 45 08 mov 0x8(%ebp),%eax
1142: 0f b6 00 movzbl (%eax),%eax
1145: 3a 45 fc cmp -0x4(%ebp),%al
1148: 75 05 jne 114f <strchr+0x1e>
return (char*)s;
114a: 8b 45 08 mov 0x8(%ebp),%eax
114d: eb 13 jmp 1162 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
114f: 83 45 08 01 addl $0x1,0x8(%ebp)
1153: 8b 45 08 mov 0x8(%ebp),%eax
1156: 0f b6 00 movzbl (%eax),%eax
1159: 84 c0 test %al,%al
115b: 75 e2 jne 113f <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
115d: b8 00 00 00 00 mov $0x0,%eax
}
1162: c9 leave
1163: c3 ret
00001164 <gets>:
char*
gets(char *buf, int max)
{
1164: 55 push %ebp
1165: 89 e5 mov %esp,%ebp
1167: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
116a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
1171: eb 42 jmp 11b5 <gets+0x51>
cc = read(0, &c, 1);
1173: 83 ec 04 sub $0x4,%esp
1176: 6a 01 push $0x1
1178: 8d 45 ef lea -0x11(%ebp),%eax
117b: 50 push %eax
117c: 6a 00 push $0x0
117e: e8 d5 01 00 00 call 1358 <read>
1183: 83 c4 10 add $0x10,%esp
1186: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
1189: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
118d: 7e 33 jle 11c2 <gets+0x5e>
break;
buf[i++] = c;
118f: 8b 45 f4 mov -0xc(%ebp),%eax
1192: 8d 50 01 lea 0x1(%eax),%edx
1195: 89 55 f4 mov %edx,-0xc(%ebp)
1198: 89 c2 mov %eax,%edx
119a: 8b 45 08 mov 0x8(%ebp),%eax
119d: 01 c2 add %eax,%edx
119f: 0f b6 45 ef movzbl -0x11(%ebp),%eax
11a3: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
11a5: 0f b6 45 ef movzbl -0x11(%ebp),%eax
11a9: 3c 0a cmp $0xa,%al
11ab: 74 16 je 11c3 <gets+0x5f>
11ad: 0f b6 45 ef movzbl -0x11(%ebp),%eax
11b1: 3c 0d cmp $0xd,%al
11b3: 74 0e je 11c3 <gets+0x5f>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
11b5: 8b 45 f4 mov -0xc(%ebp),%eax
11b8: 83 c0 01 add $0x1,%eax
11bb: 3b 45 0c cmp 0xc(%ebp),%eax
11be: 7c b3 jl 1173 <gets+0xf>
11c0: eb 01 jmp 11c3 <gets+0x5f>
cc = read(0, &c, 1);
if(cc < 1)
break;
11c2: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
11c3: 8b 55 f4 mov -0xc(%ebp),%edx
11c6: 8b 45 08 mov 0x8(%ebp),%eax
11c9: 01 d0 add %edx,%eax
11cb: c6 00 00 movb $0x0,(%eax)
return buf;
11ce: 8b 45 08 mov 0x8(%ebp),%eax
}
11d1: c9 leave
11d2: c3 ret
000011d3 <stat>:
int
stat(char *n, struct stat *st)
{
11d3: 55 push %ebp
11d4: 89 e5 mov %esp,%ebp
11d6: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
11d9: 83 ec 08 sub $0x8,%esp
11dc: 6a 00 push $0x0
11de: ff 75 08 pushl 0x8(%ebp)
11e1: e8 9a 01 00 00 call 1380 <open>
11e6: 83 c4 10 add $0x10,%esp
11e9: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
11ec: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
11f0: 79 07 jns 11f9 <stat+0x26>
return -1;
11f2: b8 ff ff ff ff mov $0xffffffff,%eax
11f7: eb 25 jmp 121e <stat+0x4b>
r = fstat(fd, st);
11f9: 83 ec 08 sub $0x8,%esp
11fc: ff 75 0c pushl 0xc(%ebp)
11ff: ff 75 f4 pushl -0xc(%ebp)
1202: e8 91 01 00 00 call 1398 <fstat>
1207: 83 c4 10 add $0x10,%esp
120a: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
120d: 83 ec 0c sub $0xc,%esp
1210: ff 75 f4 pushl -0xc(%ebp)
1213: e8 50 01 00 00 call 1368 <close>
1218: 83 c4 10 add $0x10,%esp
return r;
121b: 8b 45 f0 mov -0x10(%ebp),%eax
}
121e: c9 leave
121f: c3 ret
00001220 <atoi>:
int
atoi(const char *s)
{
1220: 55 push %ebp
1221: 89 e5 mov %esp,%ebp
1223: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
1226: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
122d: eb 25 jmp 1254 <atoi+0x34>
n = n*10 + *s++ - '0';
122f: 8b 55 fc mov -0x4(%ebp),%edx
1232: 89 d0 mov %edx,%eax
1234: c1 e0 02 shl $0x2,%eax
1237: 01 d0 add %edx,%eax
1239: 01 c0 add %eax,%eax
123b: 89 c1 mov %eax,%ecx
123d: 8b 45 08 mov 0x8(%ebp),%eax
1240: 8d 50 01 lea 0x1(%eax),%edx
1243: 89 55 08 mov %edx,0x8(%ebp)
1246: 0f b6 00 movzbl (%eax),%eax
1249: 0f be c0 movsbl %al,%eax
124c: 01 c8 add %ecx,%eax
124e: 83 e8 30 sub $0x30,%eax
1251: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
1254: 8b 45 08 mov 0x8(%ebp),%eax
1257: 0f b6 00 movzbl (%eax),%eax
125a: 3c 2f cmp $0x2f,%al
125c: 7e 0a jle 1268 <atoi+0x48>
125e: 8b 45 08 mov 0x8(%ebp),%eax
1261: 0f b6 00 movzbl (%eax),%eax
1264: 3c 39 cmp $0x39,%al
1266: 7e c7 jle 122f <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
1268: 8b 45 fc mov -0x4(%ebp),%eax
}
126b: c9 leave
126c: c3 ret
0000126d <atoo>:
int
atoo(const char *s)
{
126d: 55 push %ebp
126e: 89 e5 mov %esp,%ebp
1270: 83 ec 10 sub $0x10,%esp
int n, sign;
n = 0;
1273: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while (*s == ' ')
127a: eb 04 jmp 1280 <atoo+0x13>
s++;
127c: 83 45 08 01 addl $0x1,0x8(%ebp)
int
atoo(const char *s)
{
int n, sign;
n = 0;
while (*s == ' ')
1280: 8b 45 08 mov 0x8(%ebp),%eax
1283: 0f b6 00 movzbl (%eax),%eax
1286: 3c 20 cmp $0x20,%al
1288: 74 f2 je 127c <atoo+0xf>
s++;
sign = (*s == '-') ? -1 : 1;
128a: 8b 45 08 mov 0x8(%ebp),%eax
128d: 0f b6 00 movzbl (%eax),%eax
1290: 3c 2d cmp $0x2d,%al
1292: 75 07 jne 129b <atoo+0x2e>
1294: b8 ff ff ff ff mov $0xffffffff,%eax
1299: eb 05 jmp 12a0 <atoo+0x33>
129b: b8 01 00 00 00 mov $0x1,%eax
12a0: 89 45 f8 mov %eax,-0x8(%ebp)
if (*s == '+' || *s == '-')
12a3: 8b 45 08 mov 0x8(%ebp),%eax
12a6: 0f b6 00 movzbl (%eax),%eax
12a9: 3c 2b cmp $0x2b,%al
12ab: 74 0a je 12b7 <atoo+0x4a>
12ad: 8b 45 08 mov 0x8(%ebp),%eax
12b0: 0f b6 00 movzbl (%eax),%eax
12b3: 3c 2d cmp $0x2d,%al
12b5: 75 27 jne 12de <atoo+0x71>
s++;
12b7: 83 45 08 01 addl $0x1,0x8(%ebp)
while ('0' <= *s && *s <= '7')
12bb: eb 21 jmp 12de <atoo+0x71>
n = n*8 + *s++ - '0';
12bd: 8b 45 fc mov -0x4(%ebp),%eax
12c0: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx
12c7: 8b 45 08 mov 0x8(%ebp),%eax
12ca: 8d 50 01 lea 0x1(%eax),%edx
12cd: 89 55 08 mov %edx,0x8(%ebp)
12d0: 0f b6 00 movzbl (%eax),%eax
12d3: 0f be c0 movsbl %al,%eax
12d6: 01 c8 add %ecx,%eax
12d8: 83 e8 30 sub $0x30,%eax
12db: 89 45 fc mov %eax,-0x4(%ebp)
while (*s == ' ')
s++;
sign = (*s == '-') ? -1 : 1;
if (*s == '+' || *s == '-')
s++;
while ('0' <= *s && *s <= '7')
12de: 8b 45 08 mov 0x8(%ebp),%eax
12e1: 0f b6 00 movzbl (%eax),%eax
12e4: 3c 2f cmp $0x2f,%al
12e6: 7e 0a jle 12f2 <atoo+0x85>
12e8: 8b 45 08 mov 0x8(%ebp),%eax
12eb: 0f b6 00 movzbl (%eax),%eax
12ee: 3c 37 cmp $0x37,%al
12f0: 7e cb jle 12bd <atoo+0x50>
n = n*8 + *s++ - '0';
return sign*n;
12f2: 8b 45 f8 mov -0x8(%ebp),%eax
12f5: 0f af 45 fc imul -0x4(%ebp),%eax
}
12f9: c9 leave
12fa: c3 ret
000012fb <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
12fb: 55 push %ebp
12fc: 89 e5 mov %esp,%ebp
12fe: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
1301: 8b 45 08 mov 0x8(%ebp),%eax
1304: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
1307: 8b 45 0c mov 0xc(%ebp),%eax
130a: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
130d: eb 17 jmp 1326 <memmove+0x2b>
*dst++ = *src++;
130f: 8b 45 fc mov -0x4(%ebp),%eax
1312: 8d 50 01 lea 0x1(%eax),%edx
1315: 89 55 fc mov %edx,-0x4(%ebp)
1318: 8b 55 f8 mov -0x8(%ebp),%edx
131b: 8d 4a 01 lea 0x1(%edx),%ecx
131e: 89 4d f8 mov %ecx,-0x8(%ebp)
1321: 0f b6 12 movzbl (%edx),%edx
1324: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
1326: 8b 45 10 mov 0x10(%ebp),%eax
1329: 8d 50 ff lea -0x1(%eax),%edx
132c: 89 55 10 mov %edx,0x10(%ebp)
132f: 85 c0 test %eax,%eax
1331: 7f dc jg 130f <memmove+0x14>
*dst++ = *src++;
return vdst;
1333: 8b 45 08 mov 0x8(%ebp),%eax
}
1336: c9 leave
1337: c3 ret
00001338 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
1338: b8 01 00 00 00 mov $0x1,%eax
133d: cd 40 int $0x40
133f: c3 ret
00001340 <exit>:
SYSCALL(exit)
1340: b8 02 00 00 00 mov $0x2,%eax
1345: cd 40 int $0x40
1347: c3 ret
00001348 <wait>:
SYSCALL(wait)
1348: b8 03 00 00 00 mov $0x3,%eax
134d: cd 40 int $0x40
134f: c3 ret
00001350 <pipe>:
SYSCALL(pipe)
1350: b8 04 00 00 00 mov $0x4,%eax
1355: cd 40 int $0x40
1357: c3 ret
00001358 <read>:
SYSCALL(read)
1358: b8 05 00 00 00 mov $0x5,%eax
135d: cd 40 int $0x40
135f: c3 ret
00001360 <write>:
SYSCALL(write)
1360: b8 10 00 00 00 mov $0x10,%eax
1365: cd 40 int $0x40
1367: c3 ret
00001368 <close>:
SYSCALL(close)
1368: b8 15 00 00 00 mov $0x15,%eax
136d: cd 40 int $0x40
136f: c3 ret
00001370 <kill>:
SYSCALL(kill)
1370: b8 06 00 00 00 mov $0x6,%eax
1375: cd 40 int $0x40
1377: c3 ret
00001378 <exec>:
SYSCALL(exec)
1378: b8 07 00 00 00 mov $0x7,%eax
137d: cd 40 int $0x40
137f: c3 ret
00001380 <open>:
SYSCALL(open)
1380: b8 0f 00 00 00 mov $0xf,%eax
1385: cd 40 int $0x40
1387: c3 ret
00001388 <mknod>:
SYSCALL(mknod)
1388: b8 11 00 00 00 mov $0x11,%eax
138d: cd 40 int $0x40
138f: c3 ret
00001390 <unlink>:
SYSCALL(unlink)
1390: b8 12 00 00 00 mov $0x12,%eax
1395: cd 40 int $0x40
1397: c3 ret
00001398 <fstat>:
SYSCALL(fstat)
1398: b8 08 00 00 00 mov $0x8,%eax
139d: cd 40 int $0x40
139f: c3 ret
000013a0 <link>:
SYSCALL(link)
13a0: b8 13 00 00 00 mov $0x13,%eax
13a5: cd 40 int $0x40
13a7: c3 ret
000013a8 <mkdir>:
SYSCALL(mkdir)
13a8: b8 14 00 00 00 mov $0x14,%eax
13ad: cd 40 int $0x40
13af: c3 ret
000013b0 <chdir>:
SYSCALL(chdir)
13b0: b8 09 00 00 00 mov $0x9,%eax
13b5: cd 40 int $0x40
13b7: c3 ret
000013b8 <dup>:
SYSCALL(dup)
13b8: b8 0a 00 00 00 mov $0xa,%eax
13bd: cd 40 int $0x40
13bf: c3 ret
000013c0 <getpid>:
SYSCALL(getpid)
13c0: b8 0b 00 00 00 mov $0xb,%eax
13c5: cd 40 int $0x40
13c7: c3 ret
000013c8 <sbrk>:
SYSCALL(sbrk)
13c8: b8 0c 00 00 00 mov $0xc,%eax
13cd: cd 40 int $0x40
13cf: c3 ret
000013d0 <sleep>:
SYSCALL(sleep)
13d0: b8 0d 00 00 00 mov $0xd,%eax
13d5: cd 40 int $0x40
13d7: c3 ret
000013d8 <uptime>:
SYSCALL(uptime)
13d8: b8 0e 00 00 00 mov $0xe,%eax
13dd: cd 40 int $0x40
13df: c3 ret
000013e0 <halt>:
SYSCALL(halt)
13e0: b8 16 00 00 00 mov $0x16,%eax
13e5: cd 40 int $0x40
13e7: c3 ret
000013e8 <date>:
SYSCALL(date)
13e8: b8 17 00 00 00 mov $0x17,%eax
13ed: cd 40 int $0x40
13ef: c3 ret
000013f0 <getuid>:
SYSCALL(getuid)
13f0: b8 18 00 00 00 mov $0x18,%eax
13f5: cd 40 int $0x40
13f7: c3 ret
000013f8 <getgid>:
SYSCALL(getgid)
13f8: b8 19 00 00 00 mov $0x19,%eax
13fd: cd 40 int $0x40
13ff: c3 ret
00001400 <getppid>:
SYSCALL(getppid)
1400: b8 1a 00 00 00 mov $0x1a,%eax
1405: cd 40 int $0x40
1407: c3 ret
00001408 <setuid>:
SYSCALL(setuid)
1408: b8 1b 00 00 00 mov $0x1b,%eax
140d: cd 40 int $0x40
140f: c3 ret
00001410 <setgid>:
SYSCALL(setgid)
1410: b8 1c 00 00 00 mov $0x1c,%eax
1415: cd 40 int $0x40
1417: c3 ret
00001418 <getprocs>:
SYSCALL(getprocs)
1418: b8 1d 00 00 00 mov $0x1d,%eax
141d: cd 40 int $0x40
141f: c3 ret
00001420 <setpriority>:
SYSCALL(setpriority)
1420: b8 1e 00 00 00 mov $0x1e,%eax
1425: cd 40 int $0x40
1427: c3 ret
00001428 <chmod>:
SYSCALL(chmod)
1428: b8 1f 00 00 00 mov $0x1f,%eax
142d: cd 40 int $0x40
142f: c3 ret
00001430 <chown>:
SYSCALL(chown)
1430: b8 20 00 00 00 mov $0x20,%eax
1435: cd 40 int $0x40
1437: c3 ret
00001438 <chgrp>:
SYSCALL(chgrp)
1438: b8 21 00 00 00 mov $0x21,%eax
143d: cd 40 int $0x40
143f: c3 ret
00001440 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
1440: 55 push %ebp
1441: 89 e5 mov %esp,%ebp
1443: 83 ec 18 sub $0x18,%esp
1446: 8b 45 0c mov 0xc(%ebp),%eax
1449: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
144c: 83 ec 04 sub $0x4,%esp
144f: 6a 01 push $0x1
1451: 8d 45 f4 lea -0xc(%ebp),%eax
1454: 50 push %eax
1455: ff 75 08 pushl 0x8(%ebp)
1458: e8 03 ff ff ff call 1360 <write>
145d: 83 c4 10 add $0x10,%esp
}
1460: 90 nop
1461: c9 leave
1462: c3 ret
00001463 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
1463: 55 push %ebp
1464: 89 e5 mov %esp,%ebp
1466: 53 push %ebx
1467: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
146a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
1471: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
1475: 74 17 je 148e <printint+0x2b>
1477: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
147b: 79 11 jns 148e <printint+0x2b>
neg = 1;
147d: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
1484: 8b 45 0c mov 0xc(%ebp),%eax
1487: f7 d8 neg %eax
1489: 89 45 ec mov %eax,-0x14(%ebp)
148c: eb 06 jmp 1494 <printint+0x31>
} else {
x = xx;
148e: 8b 45 0c mov 0xc(%ebp),%eax
1491: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
1494: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
149b: 8b 4d f4 mov -0xc(%ebp),%ecx
149e: 8d 41 01 lea 0x1(%ecx),%eax
14a1: 89 45 f4 mov %eax,-0xc(%ebp)
14a4: 8b 5d 10 mov 0x10(%ebp),%ebx
14a7: 8b 45 ec mov -0x14(%ebp),%eax
14aa: ba 00 00 00 00 mov $0x0,%edx
14af: f7 f3 div %ebx
14b1: 89 d0 mov %edx,%eax
14b3: 0f b6 80 84 1f 00 00 movzbl 0x1f84(%eax),%eax
14ba: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
14be: 8b 5d 10 mov 0x10(%ebp),%ebx
14c1: 8b 45 ec mov -0x14(%ebp),%eax
14c4: ba 00 00 00 00 mov $0x0,%edx
14c9: f7 f3 div %ebx
14cb: 89 45 ec mov %eax,-0x14(%ebp)
14ce: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
14d2: 75 c7 jne 149b <printint+0x38>
if(neg)
14d4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
14d8: 74 2d je 1507 <printint+0xa4>
buf[i++] = '-';
14da: 8b 45 f4 mov -0xc(%ebp),%eax
14dd: 8d 50 01 lea 0x1(%eax),%edx
14e0: 89 55 f4 mov %edx,-0xc(%ebp)
14e3: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
14e8: eb 1d jmp 1507 <printint+0xa4>
putc(fd, buf[i]);
14ea: 8d 55 dc lea -0x24(%ebp),%edx
14ed: 8b 45 f4 mov -0xc(%ebp),%eax
14f0: 01 d0 add %edx,%eax
14f2: 0f b6 00 movzbl (%eax),%eax
14f5: 0f be c0 movsbl %al,%eax
14f8: 83 ec 08 sub $0x8,%esp
14fb: 50 push %eax
14fc: ff 75 08 pushl 0x8(%ebp)
14ff: e8 3c ff ff ff call 1440 <putc>
1504: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
1507: 83 6d f4 01 subl $0x1,-0xc(%ebp)
150b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
150f: 79 d9 jns 14ea <printint+0x87>
putc(fd, buf[i]);
}
1511: 90 nop
1512: 8b 5d fc mov -0x4(%ebp),%ebx
1515: c9 leave
1516: c3 ret
00001517 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
1517: 55 push %ebp
1518: 89 e5 mov %esp,%ebp
151a: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
151d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
1524: 8d 45 0c lea 0xc(%ebp),%eax
1527: 83 c0 04 add $0x4,%eax
152a: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
152d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
1534: e9 59 01 00 00 jmp 1692 <printf+0x17b>
c = fmt[i] & 0xff;
1539: 8b 55 0c mov 0xc(%ebp),%edx
153c: 8b 45 f0 mov -0x10(%ebp),%eax
153f: 01 d0 add %edx,%eax
1541: 0f b6 00 movzbl (%eax),%eax
1544: 0f be c0 movsbl %al,%eax
1547: 25 ff 00 00 00 and $0xff,%eax
154c: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
154f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
1553: 75 2c jne 1581 <printf+0x6a>
if(c == '%'){
1555: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1559: 75 0c jne 1567 <printf+0x50>
state = '%';
155b: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
1562: e9 27 01 00 00 jmp 168e <printf+0x177>
} else {
putc(fd, c);
1567: 8b 45 e4 mov -0x1c(%ebp),%eax
156a: 0f be c0 movsbl %al,%eax
156d: 83 ec 08 sub $0x8,%esp
1570: 50 push %eax
1571: ff 75 08 pushl 0x8(%ebp)
1574: e8 c7 fe ff ff call 1440 <putc>
1579: 83 c4 10 add $0x10,%esp
157c: e9 0d 01 00 00 jmp 168e <printf+0x177>
}
} else if(state == '%'){
1581: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
1585: 0f 85 03 01 00 00 jne 168e <printf+0x177>
if(c == 'd'){
158b: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
158f: 75 1e jne 15af <printf+0x98>
printint(fd, *ap, 10, 1);
1591: 8b 45 e8 mov -0x18(%ebp),%eax
1594: 8b 00 mov (%eax),%eax
1596: 6a 01 push $0x1
1598: 6a 0a push $0xa
159a: 50 push %eax
159b: ff 75 08 pushl 0x8(%ebp)
159e: e8 c0 fe ff ff call 1463 <printint>
15a3: 83 c4 10 add $0x10,%esp
ap++;
15a6: 83 45 e8 04 addl $0x4,-0x18(%ebp)
15aa: e9 d8 00 00 00 jmp 1687 <printf+0x170>
} else if(c == 'x' || c == 'p'){
15af: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
15b3: 74 06 je 15bb <printf+0xa4>
15b5: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
15b9: 75 1e jne 15d9 <printf+0xc2>
printint(fd, *ap, 16, 0);
15bb: 8b 45 e8 mov -0x18(%ebp),%eax
15be: 8b 00 mov (%eax),%eax
15c0: 6a 00 push $0x0
15c2: 6a 10 push $0x10
15c4: 50 push %eax
15c5: ff 75 08 pushl 0x8(%ebp)
15c8: e8 96 fe ff ff call 1463 <printint>
15cd: 83 c4 10 add $0x10,%esp
ap++;
15d0: 83 45 e8 04 addl $0x4,-0x18(%ebp)
15d4: e9 ae 00 00 00 jmp 1687 <printf+0x170>
} else if(c == 's'){
15d9: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
15dd: 75 43 jne 1622 <printf+0x10b>
s = (char*)*ap;
15df: 8b 45 e8 mov -0x18(%ebp),%eax
15e2: 8b 00 mov (%eax),%eax
15e4: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
15e7: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
15eb: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
15ef: 75 25 jne 1616 <printf+0xff>
s = "(null)";
15f1: c7 45 f4 14 1a 00 00 movl $0x1a14,-0xc(%ebp)
while(*s != 0){
15f8: eb 1c jmp 1616 <printf+0xff>
putc(fd, *s);
15fa: 8b 45 f4 mov -0xc(%ebp),%eax
15fd: 0f b6 00 movzbl (%eax),%eax
1600: 0f be c0 movsbl %al,%eax
1603: 83 ec 08 sub $0x8,%esp
1606: 50 push %eax
1607: ff 75 08 pushl 0x8(%ebp)
160a: e8 31 fe ff ff call 1440 <putc>
160f: 83 c4 10 add $0x10,%esp
s++;
1612: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
1616: 8b 45 f4 mov -0xc(%ebp),%eax
1619: 0f b6 00 movzbl (%eax),%eax
161c: 84 c0 test %al,%al
161e: 75 da jne 15fa <printf+0xe3>
1620: eb 65 jmp 1687 <printf+0x170>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
1622: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
1626: 75 1d jne 1645 <printf+0x12e>
putc(fd, *ap);
1628: 8b 45 e8 mov -0x18(%ebp),%eax
162b: 8b 00 mov (%eax),%eax
162d: 0f be c0 movsbl %al,%eax
1630: 83 ec 08 sub $0x8,%esp
1633: 50 push %eax
1634: ff 75 08 pushl 0x8(%ebp)
1637: e8 04 fe ff ff call 1440 <putc>
163c: 83 c4 10 add $0x10,%esp
ap++;
163f: 83 45 e8 04 addl $0x4,-0x18(%ebp)
1643: eb 42 jmp 1687 <printf+0x170>
} else if(c == '%'){
1645: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
1649: 75 17 jne 1662 <printf+0x14b>
putc(fd, c);
164b: 8b 45 e4 mov -0x1c(%ebp),%eax
164e: 0f be c0 movsbl %al,%eax
1651: 83 ec 08 sub $0x8,%esp
1654: 50 push %eax
1655: ff 75 08 pushl 0x8(%ebp)
1658: e8 e3 fd ff ff call 1440 <putc>
165d: 83 c4 10 add $0x10,%esp
1660: eb 25 jmp 1687 <printf+0x170>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
1662: 83 ec 08 sub $0x8,%esp
1665: 6a 25 push $0x25
1667: ff 75 08 pushl 0x8(%ebp)
166a: e8 d1 fd ff ff call 1440 <putc>
166f: 83 c4 10 add $0x10,%esp
putc(fd, c);
1672: 8b 45 e4 mov -0x1c(%ebp),%eax
1675: 0f be c0 movsbl %al,%eax
1678: 83 ec 08 sub $0x8,%esp
167b: 50 push %eax
167c: ff 75 08 pushl 0x8(%ebp)
167f: e8 bc fd ff ff call 1440 <putc>
1684: 83 c4 10 add $0x10,%esp
}
state = 0;
1687: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
168e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
1692: 8b 55 0c mov 0xc(%ebp),%edx
1695: 8b 45 f0 mov -0x10(%ebp),%eax
1698: 01 d0 add %edx,%eax
169a: 0f b6 00 movzbl (%eax),%eax
169d: 84 c0 test %al,%al
169f: 0f 85 94 fe ff ff jne 1539 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
16a5: 90 nop
16a6: c9 leave
16a7: c3 ret
000016a8 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
16a8: 55 push %ebp
16a9: 89 e5 mov %esp,%ebp
16ab: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
16ae: 8b 45 08 mov 0x8(%ebp),%eax
16b1: 83 e8 08 sub $0x8,%eax
16b4: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
16b7: a1 0c 20 00 00 mov 0x200c,%eax
16bc: 89 45 fc mov %eax,-0x4(%ebp)
16bf: eb 24 jmp 16e5 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
16c1: 8b 45 fc mov -0x4(%ebp),%eax
16c4: 8b 00 mov (%eax),%eax
16c6: 3b 45 fc cmp -0x4(%ebp),%eax
16c9: 77 12 ja 16dd <free+0x35>
16cb: 8b 45 f8 mov -0x8(%ebp),%eax
16ce: 3b 45 fc cmp -0x4(%ebp),%eax
16d1: 77 24 ja 16f7 <free+0x4f>
16d3: 8b 45 fc mov -0x4(%ebp),%eax
16d6: 8b 00 mov (%eax),%eax
16d8: 3b 45 f8 cmp -0x8(%ebp),%eax
16db: 77 1a ja 16f7 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
16dd: 8b 45 fc mov -0x4(%ebp),%eax
16e0: 8b 00 mov (%eax),%eax
16e2: 89 45 fc mov %eax,-0x4(%ebp)
16e5: 8b 45 f8 mov -0x8(%ebp),%eax
16e8: 3b 45 fc cmp -0x4(%ebp),%eax
16eb: 76 d4 jbe 16c1 <free+0x19>
16ed: 8b 45 fc mov -0x4(%ebp),%eax
16f0: 8b 00 mov (%eax),%eax
16f2: 3b 45 f8 cmp -0x8(%ebp),%eax
16f5: 76 ca jbe 16c1 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
16f7: 8b 45 f8 mov -0x8(%ebp),%eax
16fa: 8b 40 04 mov 0x4(%eax),%eax
16fd: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
1704: 8b 45 f8 mov -0x8(%ebp),%eax
1707: 01 c2 add %eax,%edx
1709: 8b 45 fc mov -0x4(%ebp),%eax
170c: 8b 00 mov (%eax),%eax
170e: 39 c2 cmp %eax,%edx
1710: 75 24 jne 1736 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
1712: 8b 45 f8 mov -0x8(%ebp),%eax
1715: 8b 50 04 mov 0x4(%eax),%edx
1718: 8b 45 fc mov -0x4(%ebp),%eax
171b: 8b 00 mov (%eax),%eax
171d: 8b 40 04 mov 0x4(%eax),%eax
1720: 01 c2 add %eax,%edx
1722: 8b 45 f8 mov -0x8(%ebp),%eax
1725: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
1728: 8b 45 fc mov -0x4(%ebp),%eax
172b: 8b 00 mov (%eax),%eax
172d: 8b 10 mov (%eax),%edx
172f: 8b 45 f8 mov -0x8(%ebp),%eax
1732: 89 10 mov %edx,(%eax)
1734: eb 0a jmp 1740 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
1736: 8b 45 fc mov -0x4(%ebp),%eax
1739: 8b 10 mov (%eax),%edx
173b: 8b 45 f8 mov -0x8(%ebp),%eax
173e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
1740: 8b 45 fc mov -0x4(%ebp),%eax
1743: 8b 40 04 mov 0x4(%eax),%eax
1746: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
174d: 8b 45 fc mov -0x4(%ebp),%eax
1750: 01 d0 add %edx,%eax
1752: 3b 45 f8 cmp -0x8(%ebp),%eax
1755: 75 20 jne 1777 <free+0xcf>
p->s.size += bp->s.size;
1757: 8b 45 fc mov -0x4(%ebp),%eax
175a: 8b 50 04 mov 0x4(%eax),%edx
175d: 8b 45 f8 mov -0x8(%ebp),%eax
1760: 8b 40 04 mov 0x4(%eax),%eax
1763: 01 c2 add %eax,%edx
1765: 8b 45 fc mov -0x4(%ebp),%eax
1768: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
176b: 8b 45 f8 mov -0x8(%ebp),%eax
176e: 8b 10 mov (%eax),%edx
1770: 8b 45 fc mov -0x4(%ebp),%eax
1773: 89 10 mov %edx,(%eax)
1775: eb 08 jmp 177f <free+0xd7>
} else
p->s.ptr = bp;
1777: 8b 45 fc mov -0x4(%ebp),%eax
177a: 8b 55 f8 mov -0x8(%ebp),%edx
177d: 89 10 mov %edx,(%eax)
freep = p;
177f: 8b 45 fc mov -0x4(%ebp),%eax
1782: a3 0c 20 00 00 mov %eax,0x200c
}
1787: 90 nop
1788: c9 leave
1789: c3 ret
0000178a <morecore>:
static Header*
morecore(uint nu)
{
178a: 55 push %ebp
178b: 89 e5 mov %esp,%ebp
178d: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
1790: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
1797: 77 07 ja 17a0 <morecore+0x16>
nu = 4096;
1799: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
17a0: 8b 45 08 mov 0x8(%ebp),%eax
17a3: c1 e0 03 shl $0x3,%eax
17a6: 83 ec 0c sub $0xc,%esp
17a9: 50 push %eax
17aa: e8 19 fc ff ff call 13c8 <sbrk>
17af: 83 c4 10 add $0x10,%esp
17b2: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
17b5: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
17b9: 75 07 jne 17c2 <morecore+0x38>
return 0;
17bb: b8 00 00 00 00 mov $0x0,%eax
17c0: eb 26 jmp 17e8 <morecore+0x5e>
hp = (Header*)p;
17c2: 8b 45 f4 mov -0xc(%ebp),%eax
17c5: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
17c8: 8b 45 f0 mov -0x10(%ebp),%eax
17cb: 8b 55 08 mov 0x8(%ebp),%edx
17ce: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
17d1: 8b 45 f0 mov -0x10(%ebp),%eax
17d4: 83 c0 08 add $0x8,%eax
17d7: 83 ec 0c sub $0xc,%esp
17da: 50 push %eax
17db: e8 c8 fe ff ff call 16a8 <free>
17e0: 83 c4 10 add $0x10,%esp
return freep;
17e3: a1 0c 20 00 00 mov 0x200c,%eax
}
17e8: c9 leave
17e9: c3 ret
000017ea <malloc>:
void*
malloc(uint nbytes)
{
17ea: 55 push %ebp
17eb: 89 e5 mov %esp,%ebp
17ed: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
17f0: 8b 45 08 mov 0x8(%ebp),%eax
17f3: 83 c0 07 add $0x7,%eax
17f6: c1 e8 03 shr $0x3,%eax
17f9: 83 c0 01 add $0x1,%eax
17fc: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
17ff: a1 0c 20 00 00 mov 0x200c,%eax
1804: 89 45 f0 mov %eax,-0x10(%ebp)
1807: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
180b: 75 23 jne 1830 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
180d: c7 45 f0 04 20 00 00 movl $0x2004,-0x10(%ebp)
1814: 8b 45 f0 mov -0x10(%ebp),%eax
1817: a3 0c 20 00 00 mov %eax,0x200c
181c: a1 0c 20 00 00 mov 0x200c,%eax
1821: a3 04 20 00 00 mov %eax,0x2004
base.s.size = 0;
1826: c7 05 08 20 00 00 00 movl $0x0,0x2008
182d: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
1830: 8b 45 f0 mov -0x10(%ebp),%eax
1833: 8b 00 mov (%eax),%eax
1835: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
1838: 8b 45 f4 mov -0xc(%ebp),%eax
183b: 8b 40 04 mov 0x4(%eax),%eax
183e: 3b 45 ec cmp -0x14(%ebp),%eax
1841: 72 4d jb 1890 <malloc+0xa6>
if(p->s.size == nunits)
1843: 8b 45 f4 mov -0xc(%ebp),%eax
1846: 8b 40 04 mov 0x4(%eax),%eax
1849: 3b 45 ec cmp -0x14(%ebp),%eax
184c: 75 0c jne 185a <malloc+0x70>
prevp->s.ptr = p->s.ptr;
184e: 8b 45 f4 mov -0xc(%ebp),%eax
1851: 8b 10 mov (%eax),%edx
1853: 8b 45 f0 mov -0x10(%ebp),%eax
1856: 89 10 mov %edx,(%eax)
1858: eb 26 jmp 1880 <malloc+0x96>
else {
p->s.size -= nunits;
185a: 8b 45 f4 mov -0xc(%ebp),%eax
185d: 8b 40 04 mov 0x4(%eax),%eax
1860: 2b 45 ec sub -0x14(%ebp),%eax
1863: 89 c2 mov %eax,%edx
1865: 8b 45 f4 mov -0xc(%ebp),%eax
1868: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
186b: 8b 45 f4 mov -0xc(%ebp),%eax
186e: 8b 40 04 mov 0x4(%eax),%eax
1871: c1 e0 03 shl $0x3,%eax
1874: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
1877: 8b 45 f4 mov -0xc(%ebp),%eax
187a: 8b 55 ec mov -0x14(%ebp),%edx
187d: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
1880: 8b 45 f0 mov -0x10(%ebp),%eax
1883: a3 0c 20 00 00 mov %eax,0x200c
return (void*)(p + 1);
1888: 8b 45 f4 mov -0xc(%ebp),%eax
188b: 83 c0 08 add $0x8,%eax
188e: eb 3b jmp 18cb <malloc+0xe1>
}
if(p == freep)
1890: a1 0c 20 00 00 mov 0x200c,%eax
1895: 39 45 f4 cmp %eax,-0xc(%ebp)
1898: 75 1e jne 18b8 <malloc+0xce>
if((p = morecore(nunits)) == 0)
189a: 83 ec 0c sub $0xc,%esp
189d: ff 75 ec pushl -0x14(%ebp)
18a0: e8 e5 fe ff ff call 178a <morecore>
18a5: 83 c4 10 add $0x10,%esp
18a8: 89 45 f4 mov %eax,-0xc(%ebp)
18ab: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
18af: 75 07 jne 18b8 <malloc+0xce>
return 0;
18b1: b8 00 00 00 00 mov $0x0,%eax
18b6: eb 13 jmp 18cb <malloc+0xe1>
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){
18b8: 8b 45 f4 mov -0xc(%ebp),%eax
18bb: 89 45 f0 mov %eax,-0x10(%ebp)
18be: 8b 45 f4 mov -0xc(%ebp),%eax
18c1: 8b 00 mov (%eax),%eax
18c3: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
18c6: e9 6d ff ff ff jmp 1838 <malloc+0x4e>
}
18cb: c9 leave
18cc: c3 ret
|
lab02/lab2/test_sleep.asm | ahchu1993/opsys | 0 | 100772 | <filename>lab02/lab2/test_sleep.asm
_test_sleep: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
int total;
}ttable;
void func(void *arg_ptr);
int main(int argc, char *argv[]){
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 20 sub $0x20,%esp
struct thread * t;
int i;
printf(1,"init ttable\n");
9: c7 44 24 04 64 0d 00 movl $0xd64,0x4(%esp)
10: 00
11: c7 04 24 01 00 00 00 movl $0x1,(%esp)
18: e8 d7 05 00 00 call 5f4 <printf>
lock_init(&ttable.lock);
1d: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
24: e8 b1 09 00 00 call 9da <lock_init>
ttable.total = 0;
29: c7 05 a4 13 00 00 00 movl $0x0,0x13a4
30: 00 00 00
lock_acquire(&ttable.lock);
33: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
3a: e8 a9 09 00 00 call 9e8 <lock_acquire>
for(t=ttable.threads;t < &ttable.threads[64];t++){
3f: c7 44 24 1c a4 12 00 movl $0x12a4,0x1c(%esp)
46: 00
47: eb 0f jmp 58 <main+0x58>
t->tid = 0;
49: 8b 44 24 1c mov 0x1c(%esp),%eax
4d: c7 00 00 00 00 00 movl $0x0,(%eax)
printf(1,"init ttable\n");
lock_init(&ttable.lock);
ttable.total = 0;
lock_acquire(&ttable.lock);
for(t=ttable.threads;t < &ttable.threads[64];t++){
53: 83 44 24 1c 04 addl $0x4,0x1c(%esp)
58: 81 7c 24 1c a4 13 00 cmpl $0x13a4,0x1c(%esp)
5f: 00
60: 72 e7 jb 49 <main+0x49>
t->tid = 0;
}
lock_release(&ttable.lock);
62: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
69: e8 9a 09 00 00 call a08 <lock_release>
printf(1,"testing thread sleep and wakeup \n\n\n");
6e: c7 44 24 04 74 0d 00 movl $0xd74,0x4(%esp)
75: 00
76: c7 04 24 01 00 00 00 movl $0x1,(%esp)
7d: e8 72 05 00 00 call 5f4 <printf>
void *stack = thread_create(func,0);
82: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
89: 00
8a: c7 04 24 69 01 00 00 movl $0x169,(%esp)
91: e8 8d 09 00 00 call a23 <thread_create>
96: 89 44 24 14 mov %eax,0x14(%esp)
thread_create(func,0);
9a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
a1: 00
a2: c7 04 24 69 01 00 00 movl $0x169,(%esp)
a9: e8 75 09 00 00 call a23 <thread_create>
thread_create(func,0);
ae: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
b5: 00
b6: c7 04 24 69 01 00 00 movl $0x169,(%esp)
bd: e8 61 09 00 00 call a23 <thread_create>
i=0;
c2: c7 44 24 18 00 00 00 movl $0x0,0x18(%esp)
c9: 00
while(i++ < 1000000);
ca: 90 nop
cb: 8b 44 24 18 mov 0x18(%esp),%eax
cf: 8d 50 01 lea 0x1(%eax),%edx
d2: 89 54 24 18 mov %edx,0x18(%esp)
d6: 3d 3f 42 0f 00 cmp $0xf423f,%eax
db: 7e ee jle cb <main+0xcb>
//find that thread
lock_acquire(&ttable.lock);
dd: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
e4: e8 ff 08 00 00 call 9e8 <lock_acquire>
for(t=ttable.threads;t < &ttable.threads[64];t++){
e9: c7 44 24 1c a4 12 00 movl $0x12a4,0x1c(%esp)
f0: 00
f1: eb 40 jmp 133 <main+0x133>
if(t->tid != 0){
f3: 8b 44 24 1c mov 0x1c(%esp),%eax
f7: 8b 00 mov (%eax),%eax
f9: 85 c0 test %eax,%eax
fb: 74 31 je 12e <main+0x12e>
printf(1,"found one... %d, wake up lazy boy !!!\n",t->tid);
fd: 8b 44 24 1c mov 0x1c(%esp),%eax
101: 8b 00 mov (%eax),%eax
103: 89 44 24 08 mov %eax,0x8(%esp)
107: c7 44 24 04 98 0d 00 movl $0xd98,0x4(%esp)
10e: 00
10f: c7 04 24 01 00 00 00 movl $0x1,(%esp)
116: e8 d9 04 00 00 call 5f4 <printf>
twakeup(t->tid);
11b: 8b 44 24 1c mov 0x1c(%esp),%eax
11f: 8b 00 mov (%eax),%eax
121: 89 04 24 mov %eax,(%esp)
124: e8 db 03 00 00 call 504 <twakeup>
i++;
129: 83 44 24 18 01 addl $0x1,0x18(%esp)
i=0;
while(i++ < 1000000);
//find that thread
lock_acquire(&ttable.lock);
for(t=ttable.threads;t < &ttable.threads[64];t++){
12e: 83 44 24 1c 04 addl $0x4,0x1c(%esp)
133: 81 7c 24 1c a4 13 00 cmpl $0x13a4,0x1c(%esp)
13a: 00
13b: 72 b6 jb f3 <main+0xf3>
printf(1,"found one... %d, wake up lazy boy !!!\n",t->tid);
twakeup(t->tid);
i++;
}
}
lock_release(&ttable.lock);
13d: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
144: e8 bf 08 00 00 call a08 <lock_release>
wait();
149: e8 06 03 00 00 call 454 <wait>
wait();
14e: e8 01 03 00 00 call 454 <wait>
wait();
153: e8 fc 02 00 00 call 454 <wait>
free(stack);
158: 8b 44 24 14 mov 0x14(%esp),%eax
15c: 89 04 24 mov %eax,(%esp)
15f: e8 43 06 00 00 call 7a7 <free>
exit();
164: e8 e3 02 00 00 call 44c <exit>
00000169 <func>:
}
void func(void *arg_ptr){
169: 55 push %ebp
16a: 89 e5 mov %esp,%ebp
16c: 83 ec 28 sub $0x28,%esp
int tid;
tid = getpid();
16f: e8 58 03 00 00 call 4cc <getpid>
174: 89 45 f4 mov %eax,-0xc(%ebp)
lock_acquire(&ttable.lock);
177: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
17e: e8 65 08 00 00 call 9e8 <lock_acquire>
(ttable.threads[ttable.total]).tid = tid;
183: a1 a4 13 00 00 mov 0x13a4,%eax
188: 8b 55 f4 mov -0xc(%ebp),%edx
18b: 89 14 85 a4 12 00 00 mov %edx,0x12a4(,%eax,4)
ttable.total++;
192: a1 a4 13 00 00 mov 0x13a4,%eax
197: 83 c0 01 add $0x1,%eax
19a: a3 a4 13 00 00 mov %eax,0x13a4
lock_release(&ttable.lock);
19f: c7 04 24 a0 12 00 00 movl $0x12a0,(%esp)
1a6: e8 5d 08 00 00 call a08 <lock_release>
printf(1,"I am thread %d, is about to sleep\n",tid);
1ab: 8b 45 f4 mov -0xc(%ebp),%eax
1ae: 89 44 24 08 mov %eax,0x8(%esp)
1b2: c7 44 24 04 c4 0d 00 movl $0xdc4,0x4(%esp)
1b9: 00
1ba: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1c1: e8 2e 04 00 00 call 5f4 <printf>
tsleep();
1c6: e8 31 03 00 00 call 4fc <tsleep>
printf(1,"I am wake up!\n");
1cb: c7 44 24 04 e7 0d 00 movl $0xde7,0x4(%esp)
1d2: 00
1d3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1da: e8 15 04 00 00 call 5f4 <printf>
texit();
1df: e8 10 03 00 00 call 4f4 <texit>
000001e4 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
1e4: 55 push %ebp
1e5: 89 e5 mov %esp,%ebp
1e7: 57 push %edi
1e8: 53 push %ebx
asm volatile("cld; rep stosb" :
1e9: 8b 4d 08 mov 0x8(%ebp),%ecx
1ec: 8b 55 10 mov 0x10(%ebp),%edx
1ef: 8b 45 0c mov 0xc(%ebp),%eax
1f2: 89 cb mov %ecx,%ebx
1f4: 89 df mov %ebx,%edi
1f6: 89 d1 mov %edx,%ecx
1f8: fc cld
1f9: f3 aa rep stos %al,%es:(%edi)
1fb: 89 ca mov %ecx,%edx
1fd: 89 fb mov %edi,%ebx
1ff: 89 5d 08 mov %ebx,0x8(%ebp)
202: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
205: 5b pop %ebx
206: 5f pop %edi
207: 5d pop %ebp
208: c3 ret
00000209 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
209: 55 push %ebp
20a: 89 e5 mov %esp,%ebp
20c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
20f: 8b 45 08 mov 0x8(%ebp),%eax
212: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
215: 90 nop
216: 8b 45 08 mov 0x8(%ebp),%eax
219: 8d 50 01 lea 0x1(%eax),%edx
21c: 89 55 08 mov %edx,0x8(%ebp)
21f: 8b 55 0c mov 0xc(%ebp),%edx
222: 8d 4a 01 lea 0x1(%edx),%ecx
225: 89 4d 0c mov %ecx,0xc(%ebp)
228: 0f b6 12 movzbl (%edx),%edx
22b: 88 10 mov %dl,(%eax)
22d: 0f b6 00 movzbl (%eax),%eax
230: 84 c0 test %al,%al
232: 75 e2 jne 216 <strcpy+0xd>
;
return os;
234: 8b 45 fc mov -0x4(%ebp),%eax
}
237: c9 leave
238: c3 ret
00000239 <strcmp>:
int
strcmp(const char *p, const char *q)
{
239: 55 push %ebp
23a: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
23c: eb 08 jmp 246 <strcmp+0xd>
p++, q++;
23e: 83 45 08 01 addl $0x1,0x8(%ebp)
242: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
246: 8b 45 08 mov 0x8(%ebp),%eax
249: 0f b6 00 movzbl (%eax),%eax
24c: 84 c0 test %al,%al
24e: 74 10 je 260 <strcmp+0x27>
250: 8b 45 08 mov 0x8(%ebp),%eax
253: 0f b6 10 movzbl (%eax),%edx
256: 8b 45 0c mov 0xc(%ebp),%eax
259: 0f b6 00 movzbl (%eax),%eax
25c: 38 c2 cmp %al,%dl
25e: 74 de je 23e <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
260: 8b 45 08 mov 0x8(%ebp),%eax
263: 0f b6 00 movzbl (%eax),%eax
266: 0f b6 d0 movzbl %al,%edx
269: 8b 45 0c mov 0xc(%ebp),%eax
26c: 0f b6 00 movzbl (%eax),%eax
26f: 0f b6 c0 movzbl %al,%eax
272: 29 c2 sub %eax,%edx
274: 89 d0 mov %edx,%eax
}
276: 5d pop %ebp
277: c3 ret
00000278 <strlen>:
uint
strlen(char *s)
{
278: 55 push %ebp
279: 89 e5 mov %esp,%ebp
27b: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
27e: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
285: eb 04 jmp 28b <strlen+0x13>
287: 83 45 fc 01 addl $0x1,-0x4(%ebp)
28b: 8b 55 fc mov -0x4(%ebp),%edx
28e: 8b 45 08 mov 0x8(%ebp),%eax
291: 01 d0 add %edx,%eax
293: 0f b6 00 movzbl (%eax),%eax
296: 84 c0 test %al,%al
298: 75 ed jne 287 <strlen+0xf>
;
return n;
29a: 8b 45 fc mov -0x4(%ebp),%eax
}
29d: c9 leave
29e: c3 ret
0000029f <memset>:
void*
memset(void *dst, int c, uint n)
{
29f: 55 push %ebp
2a0: 89 e5 mov %esp,%ebp
2a2: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
2a5: 8b 45 10 mov 0x10(%ebp),%eax
2a8: 89 44 24 08 mov %eax,0x8(%esp)
2ac: 8b 45 0c mov 0xc(%ebp),%eax
2af: 89 44 24 04 mov %eax,0x4(%esp)
2b3: 8b 45 08 mov 0x8(%ebp),%eax
2b6: 89 04 24 mov %eax,(%esp)
2b9: e8 26 ff ff ff call 1e4 <stosb>
return dst;
2be: 8b 45 08 mov 0x8(%ebp),%eax
}
2c1: c9 leave
2c2: c3 ret
000002c3 <strchr>:
char*
strchr(const char *s, char c)
{
2c3: 55 push %ebp
2c4: 89 e5 mov %esp,%ebp
2c6: 83 ec 04 sub $0x4,%esp
2c9: 8b 45 0c mov 0xc(%ebp),%eax
2cc: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
2cf: eb 14 jmp 2e5 <strchr+0x22>
if(*s == c)
2d1: 8b 45 08 mov 0x8(%ebp),%eax
2d4: 0f b6 00 movzbl (%eax),%eax
2d7: 3a 45 fc cmp -0x4(%ebp),%al
2da: 75 05 jne 2e1 <strchr+0x1e>
return (char*)s;
2dc: 8b 45 08 mov 0x8(%ebp),%eax
2df: eb 13 jmp 2f4 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
2e1: 83 45 08 01 addl $0x1,0x8(%ebp)
2e5: 8b 45 08 mov 0x8(%ebp),%eax
2e8: 0f b6 00 movzbl (%eax),%eax
2eb: 84 c0 test %al,%al
2ed: 75 e2 jne 2d1 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
2ef: b8 00 00 00 00 mov $0x0,%eax
}
2f4: c9 leave
2f5: c3 ret
000002f6 <gets>:
char*
gets(char *buf, int max)
{
2f6: 55 push %ebp
2f7: 89 e5 mov %esp,%ebp
2f9: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
2fc: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
303: eb 4c jmp 351 <gets+0x5b>
cc = read(0, &c, 1);
305: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
30c: 00
30d: 8d 45 ef lea -0x11(%ebp),%eax
310: 89 44 24 04 mov %eax,0x4(%esp)
314: c7 04 24 00 00 00 00 movl $0x0,(%esp)
31b: e8 44 01 00 00 call 464 <read>
320: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
323: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
327: 7f 02 jg 32b <gets+0x35>
break;
329: eb 31 jmp 35c <gets+0x66>
buf[i++] = c;
32b: 8b 45 f4 mov -0xc(%ebp),%eax
32e: 8d 50 01 lea 0x1(%eax),%edx
331: 89 55 f4 mov %edx,-0xc(%ebp)
334: 89 c2 mov %eax,%edx
336: 8b 45 08 mov 0x8(%ebp),%eax
339: 01 c2 add %eax,%edx
33b: 0f b6 45 ef movzbl -0x11(%ebp),%eax
33f: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
341: 0f b6 45 ef movzbl -0x11(%ebp),%eax
345: 3c 0a cmp $0xa,%al
347: 74 13 je 35c <gets+0x66>
349: 0f b6 45 ef movzbl -0x11(%ebp),%eax
34d: 3c 0d cmp $0xd,%al
34f: 74 0b je 35c <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
351: 8b 45 f4 mov -0xc(%ebp),%eax
354: 83 c0 01 add $0x1,%eax
357: 3b 45 0c cmp 0xc(%ebp),%eax
35a: 7c a9 jl 305 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
35c: 8b 55 f4 mov -0xc(%ebp),%edx
35f: 8b 45 08 mov 0x8(%ebp),%eax
362: 01 d0 add %edx,%eax
364: c6 00 00 movb $0x0,(%eax)
return buf;
367: 8b 45 08 mov 0x8(%ebp),%eax
}
36a: c9 leave
36b: c3 ret
0000036c <stat>:
int
stat(char *n, struct stat *st)
{
36c: 55 push %ebp
36d: 89 e5 mov %esp,%ebp
36f: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
372: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
379: 00
37a: 8b 45 08 mov 0x8(%ebp),%eax
37d: 89 04 24 mov %eax,(%esp)
380: e8 07 01 00 00 call 48c <open>
385: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
388: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
38c: 79 07 jns 395 <stat+0x29>
return -1;
38e: b8 ff ff ff ff mov $0xffffffff,%eax
393: eb 23 jmp 3b8 <stat+0x4c>
r = fstat(fd, st);
395: 8b 45 0c mov 0xc(%ebp),%eax
398: 89 44 24 04 mov %eax,0x4(%esp)
39c: 8b 45 f4 mov -0xc(%ebp),%eax
39f: 89 04 24 mov %eax,(%esp)
3a2: e8 fd 00 00 00 call 4a4 <fstat>
3a7: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
3aa: 8b 45 f4 mov -0xc(%ebp),%eax
3ad: 89 04 24 mov %eax,(%esp)
3b0: e8 bf 00 00 00 call 474 <close>
return r;
3b5: 8b 45 f0 mov -0x10(%ebp),%eax
}
3b8: c9 leave
3b9: c3 ret
000003ba <atoi>:
int
atoi(const char *s)
{
3ba: 55 push %ebp
3bb: 89 e5 mov %esp,%ebp
3bd: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
3c0: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
3c7: eb 25 jmp 3ee <atoi+0x34>
n = n*10 + *s++ - '0';
3c9: 8b 55 fc mov -0x4(%ebp),%edx
3cc: 89 d0 mov %edx,%eax
3ce: c1 e0 02 shl $0x2,%eax
3d1: 01 d0 add %edx,%eax
3d3: 01 c0 add %eax,%eax
3d5: 89 c1 mov %eax,%ecx
3d7: 8b 45 08 mov 0x8(%ebp),%eax
3da: 8d 50 01 lea 0x1(%eax),%edx
3dd: 89 55 08 mov %edx,0x8(%ebp)
3e0: 0f b6 00 movzbl (%eax),%eax
3e3: 0f be c0 movsbl %al,%eax
3e6: 01 c8 add %ecx,%eax
3e8: 83 e8 30 sub $0x30,%eax
3eb: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ee: 8b 45 08 mov 0x8(%ebp),%eax
3f1: 0f b6 00 movzbl (%eax),%eax
3f4: 3c 2f cmp $0x2f,%al
3f6: 7e 0a jle 402 <atoi+0x48>
3f8: 8b 45 08 mov 0x8(%ebp),%eax
3fb: 0f b6 00 movzbl (%eax),%eax
3fe: 3c 39 cmp $0x39,%al
400: 7e c7 jle 3c9 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
402: 8b 45 fc mov -0x4(%ebp),%eax
}
405: c9 leave
406: c3 ret
00000407 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
407: 55 push %ebp
408: 89 e5 mov %esp,%ebp
40a: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
40d: 8b 45 08 mov 0x8(%ebp),%eax
410: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
413: 8b 45 0c mov 0xc(%ebp),%eax
416: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
419: eb 17 jmp 432 <memmove+0x2b>
*dst++ = *src++;
41b: 8b 45 fc mov -0x4(%ebp),%eax
41e: 8d 50 01 lea 0x1(%eax),%edx
421: 89 55 fc mov %edx,-0x4(%ebp)
424: 8b 55 f8 mov -0x8(%ebp),%edx
427: 8d 4a 01 lea 0x1(%edx),%ecx
42a: 89 4d f8 mov %ecx,-0x8(%ebp)
42d: 0f b6 12 movzbl (%edx),%edx
430: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
432: 8b 45 10 mov 0x10(%ebp),%eax
435: 8d 50 ff lea -0x1(%eax),%edx
438: 89 55 10 mov %edx,0x10(%ebp)
43b: 85 c0 test %eax,%eax
43d: 7f dc jg 41b <memmove+0x14>
*dst++ = *src++;
return vdst;
43f: 8b 45 08 mov 0x8(%ebp),%eax
}
442: c9 leave
443: c3 ret
00000444 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
444: b8 01 00 00 00 mov $0x1,%eax
449: cd 40 int $0x40
44b: c3 ret
0000044c <exit>:
SYSCALL(exit)
44c: b8 02 00 00 00 mov $0x2,%eax
451: cd 40 int $0x40
453: c3 ret
00000454 <wait>:
SYSCALL(wait)
454: b8 03 00 00 00 mov $0x3,%eax
459: cd 40 int $0x40
45b: c3 ret
0000045c <pipe>:
SYSCALL(pipe)
45c: b8 04 00 00 00 mov $0x4,%eax
461: cd 40 int $0x40
463: c3 ret
00000464 <read>:
SYSCALL(read)
464: b8 05 00 00 00 mov $0x5,%eax
469: cd 40 int $0x40
46b: c3 ret
0000046c <write>:
SYSCALL(write)
46c: b8 10 00 00 00 mov $0x10,%eax
471: cd 40 int $0x40
473: c3 ret
00000474 <close>:
SYSCALL(close)
474: b8 15 00 00 00 mov $0x15,%eax
479: cd 40 int $0x40
47b: c3 ret
0000047c <kill>:
SYSCALL(kill)
47c: b8 06 00 00 00 mov $0x6,%eax
481: cd 40 int $0x40
483: c3 ret
00000484 <exec>:
SYSCALL(exec)
484: b8 07 00 00 00 mov $0x7,%eax
489: cd 40 int $0x40
48b: c3 ret
0000048c <open>:
SYSCALL(open)
48c: b8 0f 00 00 00 mov $0xf,%eax
491: cd 40 int $0x40
493: c3 ret
00000494 <mknod>:
SYSCALL(mknod)
494: b8 11 00 00 00 mov $0x11,%eax
499: cd 40 int $0x40
49b: c3 ret
0000049c <unlink>:
SYSCALL(unlink)
49c: b8 12 00 00 00 mov $0x12,%eax
4a1: cd 40 int $0x40
4a3: c3 ret
000004a4 <fstat>:
SYSCALL(fstat)
4a4: b8 08 00 00 00 mov $0x8,%eax
4a9: cd 40 int $0x40
4ab: c3 ret
000004ac <link>:
SYSCALL(link)
4ac: b8 13 00 00 00 mov $0x13,%eax
4b1: cd 40 int $0x40
4b3: c3 ret
000004b4 <mkdir>:
SYSCALL(mkdir)
4b4: b8 14 00 00 00 mov $0x14,%eax
4b9: cd 40 int $0x40
4bb: c3 ret
000004bc <chdir>:
SYSCALL(chdir)
4bc: b8 09 00 00 00 mov $0x9,%eax
4c1: cd 40 int $0x40
4c3: c3 ret
000004c4 <dup>:
SYSCALL(dup)
4c4: b8 0a 00 00 00 mov $0xa,%eax
4c9: cd 40 int $0x40
4cb: c3 ret
000004cc <getpid>:
SYSCALL(getpid)
4cc: b8 0b 00 00 00 mov $0xb,%eax
4d1: cd 40 int $0x40
4d3: c3 ret
000004d4 <sbrk>:
SYSCALL(sbrk)
4d4: b8 0c 00 00 00 mov $0xc,%eax
4d9: cd 40 int $0x40
4db: c3 ret
000004dc <sleep>:
SYSCALL(sleep)
4dc: b8 0d 00 00 00 mov $0xd,%eax
4e1: cd 40 int $0x40
4e3: c3 ret
000004e4 <uptime>:
SYSCALL(uptime)
4e4: b8 0e 00 00 00 mov $0xe,%eax
4e9: cd 40 int $0x40
4eb: c3 ret
000004ec <clone>:
SYSCALL(clone)
4ec: b8 16 00 00 00 mov $0x16,%eax
4f1: cd 40 int $0x40
4f3: c3 ret
000004f4 <texit>:
SYSCALL(texit)
4f4: b8 17 00 00 00 mov $0x17,%eax
4f9: cd 40 int $0x40
4fb: c3 ret
000004fc <tsleep>:
SYSCALL(tsleep)
4fc: b8 18 00 00 00 mov $0x18,%eax
501: cd 40 int $0x40
503: c3 ret
00000504 <twakeup>:
SYSCALL(twakeup)
504: b8 19 00 00 00 mov $0x19,%eax
509: cd 40 int $0x40
50b: c3 ret
0000050c <test>:
SYSCALL(test)
50c: b8 1a 00 00 00 mov $0x1a,%eax
511: cd 40 int $0x40
513: c3 ret
00000514 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
514: 55 push %ebp
515: 89 e5 mov %esp,%ebp
517: 83 ec 18 sub $0x18,%esp
51a: 8b 45 0c mov 0xc(%ebp),%eax
51d: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
520: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
527: 00
528: 8d 45 f4 lea -0xc(%ebp),%eax
52b: 89 44 24 04 mov %eax,0x4(%esp)
52f: 8b 45 08 mov 0x8(%ebp),%eax
532: 89 04 24 mov %eax,(%esp)
535: e8 32 ff ff ff call 46c <write>
}
53a: c9 leave
53b: c3 ret
0000053c <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
53c: 55 push %ebp
53d: 89 e5 mov %esp,%ebp
53f: 56 push %esi
540: 53 push %ebx
541: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
544: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
54b: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
54f: 74 17 je 568 <printint+0x2c>
551: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
555: 79 11 jns 568 <printint+0x2c>
neg = 1;
557: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
55e: 8b 45 0c mov 0xc(%ebp),%eax
561: f7 d8 neg %eax
563: 89 45 ec mov %eax,-0x14(%ebp)
566: eb 06 jmp 56e <printint+0x32>
} else {
x = xx;
568: 8b 45 0c mov 0xc(%ebp),%eax
56b: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
56e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
575: 8b 4d f4 mov -0xc(%ebp),%ecx
578: 8d 41 01 lea 0x1(%ecx),%eax
57b: 89 45 f4 mov %eax,-0xc(%ebp)
57e: 8b 5d 10 mov 0x10(%ebp),%ebx
581: 8b 45 ec mov -0x14(%ebp),%eax
584: ba 00 00 00 00 mov $0x0,%edx
589: f7 f3 div %ebx
58b: 89 d0 mov %edx,%eax
58d: 0f b6 80 4c 12 00 00 movzbl 0x124c(%eax),%eax
594: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
598: 8b 75 10 mov 0x10(%ebp),%esi
59b: 8b 45 ec mov -0x14(%ebp),%eax
59e: ba 00 00 00 00 mov $0x0,%edx
5a3: f7 f6 div %esi
5a5: 89 45 ec mov %eax,-0x14(%ebp)
5a8: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5ac: 75 c7 jne 575 <printint+0x39>
if(neg)
5ae: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5b2: 74 10 je 5c4 <printint+0x88>
buf[i++] = '-';
5b4: 8b 45 f4 mov -0xc(%ebp),%eax
5b7: 8d 50 01 lea 0x1(%eax),%edx
5ba: 89 55 f4 mov %edx,-0xc(%ebp)
5bd: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
5c2: eb 1f jmp 5e3 <printint+0xa7>
5c4: eb 1d jmp 5e3 <printint+0xa7>
putc(fd, buf[i]);
5c6: 8d 55 dc lea -0x24(%ebp),%edx
5c9: 8b 45 f4 mov -0xc(%ebp),%eax
5cc: 01 d0 add %edx,%eax
5ce: 0f b6 00 movzbl (%eax),%eax
5d1: 0f be c0 movsbl %al,%eax
5d4: 89 44 24 04 mov %eax,0x4(%esp)
5d8: 8b 45 08 mov 0x8(%ebp),%eax
5db: 89 04 24 mov %eax,(%esp)
5de: e8 31 ff ff ff call 514 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
5e3: 83 6d f4 01 subl $0x1,-0xc(%ebp)
5e7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
5eb: 79 d9 jns 5c6 <printint+0x8a>
putc(fd, buf[i]);
}
5ed: 83 c4 30 add $0x30,%esp
5f0: 5b pop %ebx
5f1: 5e pop %esi
5f2: 5d pop %ebp
5f3: c3 ret
000005f4 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
5f4: 55 push %ebp
5f5: 89 e5 mov %esp,%ebp
5f7: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
5fa: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
601: 8d 45 0c lea 0xc(%ebp),%eax
604: 83 c0 04 add $0x4,%eax
607: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
60a: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
611: e9 7c 01 00 00 jmp 792 <printf+0x19e>
c = fmt[i] & 0xff;
616: 8b 55 0c mov 0xc(%ebp),%edx
619: 8b 45 f0 mov -0x10(%ebp),%eax
61c: 01 d0 add %edx,%eax
61e: 0f b6 00 movzbl (%eax),%eax
621: 0f be c0 movsbl %al,%eax
624: 25 ff 00 00 00 and $0xff,%eax
629: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
62c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
630: 75 2c jne 65e <printf+0x6a>
if(c == '%'){
632: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
636: 75 0c jne 644 <printf+0x50>
state = '%';
638: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
63f: e9 4a 01 00 00 jmp 78e <printf+0x19a>
} else {
putc(fd, c);
644: 8b 45 e4 mov -0x1c(%ebp),%eax
647: 0f be c0 movsbl %al,%eax
64a: 89 44 24 04 mov %eax,0x4(%esp)
64e: 8b 45 08 mov 0x8(%ebp),%eax
651: 89 04 24 mov %eax,(%esp)
654: e8 bb fe ff ff call 514 <putc>
659: e9 30 01 00 00 jmp 78e <printf+0x19a>
}
} else if(state == '%'){
65e: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
662: 0f 85 26 01 00 00 jne 78e <printf+0x19a>
if(c == 'd'){
668: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
66c: 75 2d jne 69b <printf+0xa7>
printint(fd, *ap, 10, 1);
66e: 8b 45 e8 mov -0x18(%ebp),%eax
671: 8b 00 mov (%eax),%eax
673: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
67a: 00
67b: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
682: 00
683: 89 44 24 04 mov %eax,0x4(%esp)
687: 8b 45 08 mov 0x8(%ebp),%eax
68a: 89 04 24 mov %eax,(%esp)
68d: e8 aa fe ff ff call 53c <printint>
ap++;
692: 83 45 e8 04 addl $0x4,-0x18(%ebp)
696: e9 ec 00 00 00 jmp 787 <printf+0x193>
} else if(c == 'x' || c == 'p'){
69b: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
69f: 74 06 je 6a7 <printf+0xb3>
6a1: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
6a5: 75 2d jne 6d4 <printf+0xe0>
printint(fd, *ap, 16, 0);
6a7: 8b 45 e8 mov -0x18(%ebp),%eax
6aa: 8b 00 mov (%eax),%eax
6ac: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
6b3: 00
6b4: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
6bb: 00
6bc: 89 44 24 04 mov %eax,0x4(%esp)
6c0: 8b 45 08 mov 0x8(%ebp),%eax
6c3: 89 04 24 mov %eax,(%esp)
6c6: e8 71 fe ff ff call 53c <printint>
ap++;
6cb: 83 45 e8 04 addl $0x4,-0x18(%ebp)
6cf: e9 b3 00 00 00 jmp 787 <printf+0x193>
} else if(c == 's'){
6d4: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
6d8: 75 45 jne 71f <printf+0x12b>
s = (char*)*ap;
6da: 8b 45 e8 mov -0x18(%ebp),%eax
6dd: 8b 00 mov (%eax),%eax
6df: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
6e2: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
6e6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
6ea: 75 09 jne 6f5 <printf+0x101>
s = "(null)";
6ec: c7 45 f4 f6 0d 00 00 movl $0xdf6,-0xc(%ebp)
while(*s != 0){
6f3: eb 1e jmp 713 <printf+0x11f>
6f5: eb 1c jmp 713 <printf+0x11f>
putc(fd, *s);
6f7: 8b 45 f4 mov -0xc(%ebp),%eax
6fa: 0f b6 00 movzbl (%eax),%eax
6fd: 0f be c0 movsbl %al,%eax
700: 89 44 24 04 mov %eax,0x4(%esp)
704: 8b 45 08 mov 0x8(%ebp),%eax
707: 89 04 24 mov %eax,(%esp)
70a: e8 05 fe ff ff call 514 <putc>
s++;
70f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
713: 8b 45 f4 mov -0xc(%ebp),%eax
716: 0f b6 00 movzbl (%eax),%eax
719: 84 c0 test %al,%al
71b: 75 da jne 6f7 <printf+0x103>
71d: eb 68 jmp 787 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
71f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
723: 75 1d jne 742 <printf+0x14e>
putc(fd, *ap);
725: 8b 45 e8 mov -0x18(%ebp),%eax
728: 8b 00 mov (%eax),%eax
72a: 0f be c0 movsbl %al,%eax
72d: 89 44 24 04 mov %eax,0x4(%esp)
731: 8b 45 08 mov 0x8(%ebp),%eax
734: 89 04 24 mov %eax,(%esp)
737: e8 d8 fd ff ff call 514 <putc>
ap++;
73c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
740: eb 45 jmp 787 <printf+0x193>
} else if(c == '%'){
742: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
746: 75 17 jne 75f <printf+0x16b>
putc(fd, c);
748: 8b 45 e4 mov -0x1c(%ebp),%eax
74b: 0f be c0 movsbl %al,%eax
74e: 89 44 24 04 mov %eax,0x4(%esp)
752: 8b 45 08 mov 0x8(%ebp),%eax
755: 89 04 24 mov %eax,(%esp)
758: e8 b7 fd ff ff call 514 <putc>
75d: eb 28 jmp 787 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
75f: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
766: 00
767: 8b 45 08 mov 0x8(%ebp),%eax
76a: 89 04 24 mov %eax,(%esp)
76d: e8 a2 fd ff ff call 514 <putc>
putc(fd, c);
772: 8b 45 e4 mov -0x1c(%ebp),%eax
775: 0f be c0 movsbl %al,%eax
778: 89 44 24 04 mov %eax,0x4(%esp)
77c: 8b 45 08 mov 0x8(%ebp),%eax
77f: 89 04 24 mov %eax,(%esp)
782: e8 8d fd ff ff call 514 <putc>
}
state = 0;
787: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
78e: 83 45 f0 01 addl $0x1,-0x10(%ebp)
792: 8b 55 0c mov 0xc(%ebp),%edx
795: 8b 45 f0 mov -0x10(%ebp),%eax
798: 01 d0 add %edx,%eax
79a: 0f b6 00 movzbl (%eax),%eax
79d: 84 c0 test %al,%al
79f: 0f 85 71 fe ff ff jne 616 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
7a5: c9 leave
7a6: c3 ret
000007a7 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
7a7: 55 push %ebp
7a8: 89 e5 mov %esp,%ebp
7aa: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
7ad: 8b 45 08 mov 0x8(%ebp),%eax
7b0: 83 e8 08 sub $0x8,%eax
7b3: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7b6: a1 88 12 00 00 mov 0x1288,%eax
7bb: 89 45 fc mov %eax,-0x4(%ebp)
7be: eb 24 jmp 7e4 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7c0: 8b 45 fc mov -0x4(%ebp),%eax
7c3: 8b 00 mov (%eax),%eax
7c5: 3b 45 fc cmp -0x4(%ebp),%eax
7c8: 77 12 ja 7dc <free+0x35>
7ca: 8b 45 f8 mov -0x8(%ebp),%eax
7cd: 3b 45 fc cmp -0x4(%ebp),%eax
7d0: 77 24 ja 7f6 <free+0x4f>
7d2: 8b 45 fc mov -0x4(%ebp),%eax
7d5: 8b 00 mov (%eax),%eax
7d7: 3b 45 f8 cmp -0x8(%ebp),%eax
7da: 77 1a ja 7f6 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7dc: 8b 45 fc mov -0x4(%ebp),%eax
7df: 8b 00 mov (%eax),%eax
7e1: 89 45 fc mov %eax,-0x4(%ebp)
7e4: 8b 45 f8 mov -0x8(%ebp),%eax
7e7: 3b 45 fc cmp -0x4(%ebp),%eax
7ea: 76 d4 jbe 7c0 <free+0x19>
7ec: 8b 45 fc mov -0x4(%ebp),%eax
7ef: 8b 00 mov (%eax),%eax
7f1: 3b 45 f8 cmp -0x8(%ebp),%eax
7f4: 76 ca jbe 7c0 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
7f6: 8b 45 f8 mov -0x8(%ebp),%eax
7f9: 8b 40 04 mov 0x4(%eax),%eax
7fc: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
803: 8b 45 f8 mov -0x8(%ebp),%eax
806: 01 c2 add %eax,%edx
808: 8b 45 fc mov -0x4(%ebp),%eax
80b: 8b 00 mov (%eax),%eax
80d: 39 c2 cmp %eax,%edx
80f: 75 24 jne 835 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
811: 8b 45 f8 mov -0x8(%ebp),%eax
814: 8b 50 04 mov 0x4(%eax),%edx
817: 8b 45 fc mov -0x4(%ebp),%eax
81a: 8b 00 mov (%eax),%eax
81c: 8b 40 04 mov 0x4(%eax),%eax
81f: 01 c2 add %eax,%edx
821: 8b 45 f8 mov -0x8(%ebp),%eax
824: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
827: 8b 45 fc mov -0x4(%ebp),%eax
82a: 8b 00 mov (%eax),%eax
82c: 8b 10 mov (%eax),%edx
82e: 8b 45 f8 mov -0x8(%ebp),%eax
831: 89 10 mov %edx,(%eax)
833: eb 0a jmp 83f <free+0x98>
} else
bp->s.ptr = p->s.ptr;
835: 8b 45 fc mov -0x4(%ebp),%eax
838: 8b 10 mov (%eax),%edx
83a: 8b 45 f8 mov -0x8(%ebp),%eax
83d: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
83f: 8b 45 fc mov -0x4(%ebp),%eax
842: 8b 40 04 mov 0x4(%eax),%eax
845: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
84c: 8b 45 fc mov -0x4(%ebp),%eax
84f: 01 d0 add %edx,%eax
851: 3b 45 f8 cmp -0x8(%ebp),%eax
854: 75 20 jne 876 <free+0xcf>
p->s.size += bp->s.size;
856: 8b 45 fc mov -0x4(%ebp),%eax
859: 8b 50 04 mov 0x4(%eax),%edx
85c: 8b 45 f8 mov -0x8(%ebp),%eax
85f: 8b 40 04 mov 0x4(%eax),%eax
862: 01 c2 add %eax,%edx
864: 8b 45 fc mov -0x4(%ebp),%eax
867: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
86a: 8b 45 f8 mov -0x8(%ebp),%eax
86d: 8b 10 mov (%eax),%edx
86f: 8b 45 fc mov -0x4(%ebp),%eax
872: 89 10 mov %edx,(%eax)
874: eb 08 jmp 87e <free+0xd7>
} else
p->s.ptr = bp;
876: 8b 45 fc mov -0x4(%ebp),%eax
879: 8b 55 f8 mov -0x8(%ebp),%edx
87c: 89 10 mov %edx,(%eax)
freep = p;
87e: 8b 45 fc mov -0x4(%ebp),%eax
881: a3 88 12 00 00 mov %eax,0x1288
}
886: c9 leave
887: c3 ret
00000888 <morecore>:
static Header*
morecore(uint nu)
{
888: 55 push %ebp
889: 89 e5 mov %esp,%ebp
88b: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
88e: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
895: 77 07 ja 89e <morecore+0x16>
nu = 4096;
897: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
89e: 8b 45 08 mov 0x8(%ebp),%eax
8a1: c1 e0 03 shl $0x3,%eax
8a4: 89 04 24 mov %eax,(%esp)
8a7: e8 28 fc ff ff call 4d4 <sbrk>
8ac: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
8af: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
8b3: 75 07 jne 8bc <morecore+0x34>
return 0;
8b5: b8 00 00 00 00 mov $0x0,%eax
8ba: eb 22 jmp 8de <morecore+0x56>
hp = (Header*)p;
8bc: 8b 45 f4 mov -0xc(%ebp),%eax
8bf: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
8c2: 8b 45 f0 mov -0x10(%ebp),%eax
8c5: 8b 55 08 mov 0x8(%ebp),%edx
8c8: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
8cb: 8b 45 f0 mov -0x10(%ebp),%eax
8ce: 83 c0 08 add $0x8,%eax
8d1: 89 04 24 mov %eax,(%esp)
8d4: e8 ce fe ff ff call 7a7 <free>
return freep;
8d9: a1 88 12 00 00 mov 0x1288,%eax
}
8de: c9 leave
8df: c3 ret
000008e0 <malloc>:
void*
malloc(uint nbytes)
{
8e0: 55 push %ebp
8e1: 89 e5 mov %esp,%ebp
8e3: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8e6: 8b 45 08 mov 0x8(%ebp),%eax
8e9: 83 c0 07 add $0x7,%eax
8ec: c1 e8 03 shr $0x3,%eax
8ef: 83 c0 01 add $0x1,%eax
8f2: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
8f5: a1 88 12 00 00 mov 0x1288,%eax
8fa: 89 45 f0 mov %eax,-0x10(%ebp)
8fd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
901: 75 23 jne 926 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
903: c7 45 f0 80 12 00 00 movl $0x1280,-0x10(%ebp)
90a: 8b 45 f0 mov -0x10(%ebp),%eax
90d: a3 88 12 00 00 mov %eax,0x1288
912: a1 88 12 00 00 mov 0x1288,%eax
917: a3 80 12 00 00 mov %eax,0x1280
base.s.size = 0;
91c: c7 05 84 12 00 00 00 movl $0x0,0x1284
923: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
926: 8b 45 f0 mov -0x10(%ebp),%eax
929: 8b 00 mov (%eax),%eax
92b: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
92e: 8b 45 f4 mov -0xc(%ebp),%eax
931: 8b 40 04 mov 0x4(%eax),%eax
934: 3b 45 ec cmp -0x14(%ebp),%eax
937: 72 4d jb 986 <malloc+0xa6>
if(p->s.size == nunits)
939: 8b 45 f4 mov -0xc(%ebp),%eax
93c: 8b 40 04 mov 0x4(%eax),%eax
93f: 3b 45 ec cmp -0x14(%ebp),%eax
942: 75 0c jne 950 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
944: 8b 45 f4 mov -0xc(%ebp),%eax
947: 8b 10 mov (%eax),%edx
949: 8b 45 f0 mov -0x10(%ebp),%eax
94c: 89 10 mov %edx,(%eax)
94e: eb 26 jmp 976 <malloc+0x96>
else {
p->s.size -= nunits;
950: 8b 45 f4 mov -0xc(%ebp),%eax
953: 8b 40 04 mov 0x4(%eax),%eax
956: 2b 45 ec sub -0x14(%ebp),%eax
959: 89 c2 mov %eax,%edx
95b: 8b 45 f4 mov -0xc(%ebp),%eax
95e: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
961: 8b 45 f4 mov -0xc(%ebp),%eax
964: 8b 40 04 mov 0x4(%eax),%eax
967: c1 e0 03 shl $0x3,%eax
96a: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
96d: 8b 45 f4 mov -0xc(%ebp),%eax
970: 8b 55 ec mov -0x14(%ebp),%edx
973: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
976: 8b 45 f0 mov -0x10(%ebp),%eax
979: a3 88 12 00 00 mov %eax,0x1288
return (void*)(p + 1);
97e: 8b 45 f4 mov -0xc(%ebp),%eax
981: 83 c0 08 add $0x8,%eax
984: eb 38 jmp 9be <malloc+0xde>
}
if(p == freep)
986: a1 88 12 00 00 mov 0x1288,%eax
98b: 39 45 f4 cmp %eax,-0xc(%ebp)
98e: 75 1b jne 9ab <malloc+0xcb>
if((p = morecore(nunits)) == 0)
990: 8b 45 ec mov -0x14(%ebp),%eax
993: 89 04 24 mov %eax,(%esp)
996: e8 ed fe ff ff call 888 <morecore>
99b: 89 45 f4 mov %eax,-0xc(%ebp)
99e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
9a2: 75 07 jne 9ab <malloc+0xcb>
return 0;
9a4: b8 00 00 00 00 mov $0x0,%eax
9a9: eb 13 jmp 9be <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
9ab: 8b 45 f4 mov -0xc(%ebp),%eax
9ae: 89 45 f0 mov %eax,-0x10(%ebp)
9b1: 8b 45 f4 mov -0xc(%ebp),%eax
9b4: 8b 00 mov (%eax),%eax
9b6: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
9b9: e9 70 ff ff ff jmp 92e <malloc+0x4e>
}
9be: c9 leave
9bf: c3 ret
000009c0 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
9c0: 55 push %ebp
9c1: 89 e5 mov %esp,%ebp
9c3: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
9c6: 8b 55 08 mov 0x8(%ebp),%edx
9c9: 8b 45 0c mov 0xc(%ebp),%eax
9cc: 8b 4d 08 mov 0x8(%ebp),%ecx
9cf: f0 87 02 lock xchg %eax,(%edx)
9d2: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
9d5: 8b 45 fc mov -0x4(%ebp),%eax
}
9d8: c9 leave
9d9: c3 ret
000009da <lock_init>:
#include "mmu.h"
#include "spinlock.h"
#include "x86.h"
#include "proc.h"
void lock_init(lock_t *lock){
9da: 55 push %ebp
9db: 89 e5 mov %esp,%ebp
lock->locked = 0;
9dd: 8b 45 08 mov 0x8(%ebp),%eax
9e0: c7 00 00 00 00 00 movl $0x0,(%eax)
}
9e6: 5d pop %ebp
9e7: c3 ret
000009e8 <lock_acquire>:
void lock_acquire(lock_t *lock){
9e8: 55 push %ebp
9e9: 89 e5 mov %esp,%ebp
9eb: 83 ec 08 sub $0x8,%esp
while(xchg(&lock->locked,1) != 0);
9ee: 90 nop
9ef: 8b 45 08 mov 0x8(%ebp),%eax
9f2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
9f9: 00
9fa: 89 04 24 mov %eax,(%esp)
9fd: e8 be ff ff ff call 9c0 <xchg>
a02: 85 c0 test %eax,%eax
a04: 75 e9 jne 9ef <lock_acquire+0x7>
}
a06: c9 leave
a07: c3 ret
00000a08 <lock_release>:
void lock_release(lock_t *lock){
a08: 55 push %ebp
a09: 89 e5 mov %esp,%ebp
a0b: 83 ec 08 sub $0x8,%esp
xchg(&lock->locked,0);
a0e: 8b 45 08 mov 0x8(%ebp),%eax
a11: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
a18: 00
a19: 89 04 24 mov %eax,(%esp)
a1c: e8 9f ff ff ff call 9c0 <xchg>
}
a21: c9 leave
a22: c3 ret
00000a23 <thread_create>:
void *thread_create(void(*start_routine)(void*), void *arg){
a23: 55 push %ebp
a24: 89 e5 mov %esp,%ebp
a26: 83 ec 28 sub $0x28,%esp
int tid;
void * stack = malloc(2 * 4096);
a29: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
a30: e8 ab fe ff ff call 8e0 <malloc>
a35: 89 45 f4 mov %eax,-0xc(%ebp)
void *garbage_stack = stack;
a38: 8b 45 f4 mov -0xc(%ebp),%eax
a3b: 89 45 f0 mov %eax,-0x10(%ebp)
// printf(1,"start routine addr : %d\n",(uint)start_routine);
if((uint)stack % 4096){
a3e: 8b 45 f4 mov -0xc(%ebp),%eax
a41: 25 ff 0f 00 00 and $0xfff,%eax
a46: 85 c0 test %eax,%eax
a48: 74 14 je a5e <thread_create+0x3b>
stack = stack + (4096 - (uint)stack % 4096);
a4a: 8b 45 f4 mov -0xc(%ebp),%eax
a4d: 25 ff 0f 00 00 and $0xfff,%eax
a52: 89 c2 mov %eax,%edx
a54: b8 00 10 00 00 mov $0x1000,%eax
a59: 29 d0 sub %edx,%eax
a5b: 01 45 f4 add %eax,-0xc(%ebp)
}
if (stack == 0){
a5e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
a62: 75 1b jne a7f <thread_create+0x5c>
printf(1,"malloc fail \n");
a64: c7 44 24 04 fd 0d 00 movl $0xdfd,0x4(%esp)
a6b: 00
a6c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
a73: e8 7c fb ff ff call 5f4 <printf>
return 0;
a78: b8 00 00 00 00 mov $0x0,%eax
a7d: eb 6f jmp aee <thread_create+0xcb>
}
tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg);
a7f: 8b 4d 0c mov 0xc(%ebp),%ecx
a82: 8b 55 08 mov 0x8(%ebp),%edx
a85: 8b 45 f4 mov -0xc(%ebp),%eax
a88: 89 4c 24 0c mov %ecx,0xc(%esp)
a8c: 89 54 24 08 mov %edx,0x8(%esp)
a90: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp)
a97: 00
a98: 89 04 24 mov %eax,(%esp)
a9b: e8 4c fa ff ff call 4ec <clone>
aa0: 89 45 ec mov %eax,-0x14(%ebp)
if(tid < 0){
aa3: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
aa7: 79 1b jns ac4 <thread_create+0xa1>
printf(1,"clone fails\n");
aa9: c7 44 24 04 0b 0e 00 movl $0xe0b,0x4(%esp)
ab0: 00
ab1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ab8: e8 37 fb ff ff call 5f4 <printf>
return 0;
abd: b8 00 00 00 00 mov $0x0,%eax
ac2: eb 2a jmp aee <thread_create+0xcb>
}
if(tid > 0){
ac4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
ac8: 7e 05 jle acf <thread_create+0xac>
//store threads on thread table
return garbage_stack;
aca: 8b 45 f0 mov -0x10(%ebp),%eax
acd: eb 1f jmp aee <thread_create+0xcb>
}
if(tid == 0){
acf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
ad3: 75 14 jne ae9 <thread_create+0xc6>
printf(1,"tid = 0 return \n");
ad5: c7 44 24 04 18 0e 00 movl $0xe18,0x4(%esp)
adc: 00
add: c7 04 24 01 00 00 00 movl $0x1,(%esp)
ae4: e8 0b fb ff ff call 5f4 <printf>
}
// wait();
// free(garbage_stack);
return 0;
ae9: b8 00 00 00 00 mov $0x0,%eax
}
aee: c9 leave
aef: c3 ret
00000af0 <random>:
unsigned long rands = 1;
// generate 0 -> max random number exclude max.
int random(int max){
af0: 55 push %ebp
af1: 89 e5 mov %esp,%ebp
rands = rands * 1664525 + 1013904233;
af3: a1 60 12 00 00 mov 0x1260,%eax
af8: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax
afe: 05 69 f3 6e 3c add $0x3c6ef369,%eax
b03: a3 60 12 00 00 mov %eax,0x1260
return (int)(rands % max);
b08: a1 60 12 00 00 mov 0x1260,%eax
b0d: 8b 4d 08 mov 0x8(%ebp),%ecx
b10: ba 00 00 00 00 mov $0x0,%edx
b15: f7 f1 div %ecx
b17: 89 d0 mov %edx,%eax
b19: 5d pop %ebp
b1a: c3 ret
00000b1b <init_q>:
#include "queue.h"
#include "types.h"
#include "user.h"
void init_q(struct queue *q){
b1b: 55 push %ebp
b1c: 89 e5 mov %esp,%ebp
q->size = 0;
b1e: 8b 45 08 mov 0x8(%ebp),%eax
b21: c7 00 00 00 00 00 movl $0x0,(%eax)
q->head = 0;
b27: 8b 45 08 mov 0x8(%ebp),%eax
b2a: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
b31: 8b 45 08 mov 0x8(%ebp),%eax
b34: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
b3b: 5d pop %ebp
b3c: c3 ret
00000b3d <add_q>:
void add_q(struct queue *q, int v){
b3d: 55 push %ebp
b3e: 89 e5 mov %esp,%ebp
b40: 83 ec 28 sub $0x28,%esp
struct node * n = malloc(sizeof(struct node));
b43: c7 04 24 08 00 00 00 movl $0x8,(%esp)
b4a: e8 91 fd ff ff call 8e0 <malloc>
b4f: 89 45 f4 mov %eax,-0xc(%ebp)
n->next = 0;
b52: 8b 45 f4 mov -0xc(%ebp),%eax
b55: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
n->value = v;
b5c: 8b 45 f4 mov -0xc(%ebp),%eax
b5f: 8b 55 0c mov 0xc(%ebp),%edx
b62: 89 10 mov %edx,(%eax)
if(q->head == 0){
b64: 8b 45 08 mov 0x8(%ebp),%eax
b67: 8b 40 04 mov 0x4(%eax),%eax
b6a: 85 c0 test %eax,%eax
b6c: 75 0b jne b79 <add_q+0x3c>
q->head = n;
b6e: 8b 45 08 mov 0x8(%ebp),%eax
b71: 8b 55 f4 mov -0xc(%ebp),%edx
b74: 89 50 04 mov %edx,0x4(%eax)
b77: eb 0c jmp b85 <add_q+0x48>
}else{
q->tail->next = n;
b79: 8b 45 08 mov 0x8(%ebp),%eax
b7c: 8b 40 08 mov 0x8(%eax),%eax
b7f: 8b 55 f4 mov -0xc(%ebp),%edx
b82: 89 50 04 mov %edx,0x4(%eax)
}
q->tail = n;
b85: 8b 45 08 mov 0x8(%ebp),%eax
b88: 8b 55 f4 mov -0xc(%ebp),%edx
b8b: 89 50 08 mov %edx,0x8(%eax)
q->size++;
b8e: 8b 45 08 mov 0x8(%ebp),%eax
b91: 8b 00 mov (%eax),%eax
b93: 8d 50 01 lea 0x1(%eax),%edx
b96: 8b 45 08 mov 0x8(%ebp),%eax
b99: 89 10 mov %edx,(%eax)
}
b9b: c9 leave
b9c: c3 ret
00000b9d <empty_q>:
int empty_q(struct queue *q){
b9d: 55 push %ebp
b9e: 89 e5 mov %esp,%ebp
if(q->size == 0)
ba0: 8b 45 08 mov 0x8(%ebp),%eax
ba3: 8b 00 mov (%eax),%eax
ba5: 85 c0 test %eax,%eax
ba7: 75 07 jne bb0 <empty_q+0x13>
return 1;
ba9: b8 01 00 00 00 mov $0x1,%eax
bae: eb 05 jmp bb5 <empty_q+0x18>
else
return 0;
bb0: b8 00 00 00 00 mov $0x0,%eax
}
bb5: 5d pop %ebp
bb6: c3 ret
00000bb7 <pop_q>:
int pop_q(struct queue *q){
bb7: 55 push %ebp
bb8: 89 e5 mov %esp,%ebp
bba: 83 ec 28 sub $0x28,%esp
int val;
struct node *destroy;
if(!empty_q(q)){
bbd: 8b 45 08 mov 0x8(%ebp),%eax
bc0: 89 04 24 mov %eax,(%esp)
bc3: e8 d5 ff ff ff call b9d <empty_q>
bc8: 85 c0 test %eax,%eax
bca: 75 5d jne c29 <pop_q+0x72>
val = q->head->value;
bcc: 8b 45 08 mov 0x8(%ebp),%eax
bcf: 8b 40 04 mov 0x4(%eax),%eax
bd2: 8b 00 mov (%eax),%eax
bd4: 89 45 f4 mov %eax,-0xc(%ebp)
destroy = q->head;
bd7: 8b 45 08 mov 0x8(%ebp),%eax
bda: 8b 40 04 mov 0x4(%eax),%eax
bdd: 89 45 f0 mov %eax,-0x10(%ebp)
q->head = q->head->next;
be0: 8b 45 08 mov 0x8(%ebp),%eax
be3: 8b 40 04 mov 0x4(%eax),%eax
be6: 8b 50 04 mov 0x4(%eax),%edx
be9: 8b 45 08 mov 0x8(%ebp),%eax
bec: 89 50 04 mov %edx,0x4(%eax)
free(destroy);
bef: 8b 45 f0 mov -0x10(%ebp),%eax
bf2: 89 04 24 mov %eax,(%esp)
bf5: e8 ad fb ff ff call 7a7 <free>
q->size--;
bfa: 8b 45 08 mov 0x8(%ebp),%eax
bfd: 8b 00 mov (%eax),%eax
bff: 8d 50 ff lea -0x1(%eax),%edx
c02: 8b 45 08 mov 0x8(%ebp),%eax
c05: 89 10 mov %edx,(%eax)
if(q->size == 0){
c07: 8b 45 08 mov 0x8(%ebp),%eax
c0a: 8b 00 mov (%eax),%eax
c0c: 85 c0 test %eax,%eax
c0e: 75 14 jne c24 <pop_q+0x6d>
q->head = 0;
c10: 8b 45 08 mov 0x8(%ebp),%eax
c13: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
q->tail = 0;
c1a: 8b 45 08 mov 0x8(%ebp),%eax
c1d: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
return val;
c24: 8b 45 f4 mov -0xc(%ebp),%eax
c27: eb 05 jmp c2e <pop_q+0x77>
}
return -1;
c29: b8 ff ff ff ff mov $0xffffffff,%eax
}
c2e: c9 leave
c2f: c3 ret
00000c30 <sem_init>:
#include "types.h"
#include "user.h"
#include "semaphore.h"
void
sem_init(struct semaphore *s, int size){
c30: 55 push %ebp
c31: 89 e5 mov %esp,%ebp
c33: 83 ec 18 sub $0x18,%esp
s->size = size;
c36: 8b 45 08 mov 0x8(%ebp),%eax
c39: 8b 55 0c mov 0xc(%ebp),%edx
c3c: 89 50 08 mov %edx,0x8(%eax)
s->count = size;
c3f: 8b 45 08 mov 0x8(%ebp),%eax
c42: 8b 55 0c mov 0xc(%ebp),%edx
c45: 89 50 04 mov %edx,0x4(%eax)
lock_init(&s->lock);
c48: 8b 45 08 mov 0x8(%ebp),%eax
c4b: 89 04 24 mov %eax,(%esp)
c4e: e8 87 fd ff ff call 9da <lock_init>
}
c53: c9 leave
c54: c3 ret
00000c55 <sem_init_full>:
void
sem_init_full(struct semaphore *s, int size){
c55: 55 push %ebp
c56: 89 e5 mov %esp,%ebp
c58: 83 ec 18 sub $0x18,%esp
s->size = size;
c5b: 8b 45 08 mov 0x8(%ebp),%eax
c5e: 8b 55 0c mov 0xc(%ebp),%edx
c61: 89 50 08 mov %edx,0x8(%eax)
s->count= 0;
c64: 8b 45 08 mov 0x8(%ebp),%eax
c67: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
lock_init(&s->lock);
c6e: 8b 45 08 mov 0x8(%ebp),%eax
c71: 89 04 24 mov %eax,(%esp)
c74: e8 61 fd ff ff call 9da <lock_init>
}
c79: c9 leave
c7a: c3 ret
00000c7b <sem_aquire>:
//Attempts to aquire a lock. If count is not
//full then we will add the process to the list of
//processes holding the lock.
void
sem_aquire(struct semaphore * s){
c7b: 55 push %ebp
c7c: 89 e5 mov %esp,%ebp
c7e: 83 ec 28 sub $0x28,%esp
//Disable interrupts? nah
//We need to only get a hold of waiters?
//If count is full then place proccess on waiters list
//Else add to the holding list
lock_acquire(&s->lock);
c81: 8b 45 08 mov 0x8(%ebp),%eax
c84: 89 04 24 mov %eax,(%esp)
c87: e8 5c fd ff ff call 9e8 <lock_acquire>
if(s->count == 0){
c8c: 8b 45 08 mov 0x8(%ebp),%eax
c8f: 8b 40 04 mov 0x4(%eax),%eax
c92: 85 c0 test %eax,%eax
c94: 75 2f jne cc5 <sem_aquire+0x4a>
//printf(1, "Sem F\n");
//add proc to waiters list
int tid = getpid();
c96: e8 31 f8 ff ff call 4cc <getpid>
c9b: 89 45 f4 mov %eax,-0xc(%ebp)
//place requesting process to sleep
add_q(&s->waiters, tid); //Add process to queue
c9e: 8b 45 08 mov 0x8(%ebp),%eax
ca1: 8d 50 0c lea 0xc(%eax),%edx
ca4: 8b 45 f4 mov -0xc(%ebp),%eax
ca7: 89 44 24 04 mov %eax,0x4(%esp)
cab: 89 14 24 mov %edx,(%esp)
cae: e8 8a fe ff ff call b3d <add_q>
//printf(1, " Added to waiters semaphore with size: %d\n", s->size);
lock_release(&s->lock);
cb3: 8b 45 08 mov 0x8(%ebp),%eax
cb6: 89 04 24 mov %eax,(%esp)
cb9: e8 4a fd ff ff call a08 <lock_release>
tsleep();
cbe: e8 39 f8 ff ff call 4fc <tsleep>
cc3: eb 1a jmp cdf <sem_aquire+0x64>
}
else{
//printf(1, "Sem A\n");
s->count--;
cc5: 8b 45 08 mov 0x8(%ebp),%eax
cc8: 8b 40 04 mov 0x4(%eax),%eax
ccb: 8d 50 ff lea -0x1(%eax),%edx
cce: 8b 45 08 mov 0x8(%ebp),%eax
cd1: 89 50 04 mov %edx,0x4(%eax)
lock_release(&s->lock);
cd4: 8b 45 08 mov 0x8(%ebp),%eax
cd7: 89 04 24 mov %eax,(%esp)
cda: e8 29 fd ff ff call a08 <lock_release>
}
}
cdf: c9 leave
ce0: c3 ret
00000ce1 <sem_signal>:
//Removes a process from a lock and decreases count
//to indicate that more process can hold the lock.
void
sem_signal(struct semaphore * s){
ce1: 55 push %ebp
ce2: 89 e5 mov %esp,%ebp
ce4: 83 ec 28 sub $0x28,%esp
//printf(1, "Sem R\n");
//If count is full then place proccess on waiters list
lock_acquire(&s->lock);
ce7: 8b 45 08 mov 0x8(%ebp),%eax
cea: 89 04 24 mov %eax,(%esp)
ced: e8 f6 fc ff ff call 9e8 <lock_acquire>
if(s->count < s->size){
cf2: 8b 45 08 mov 0x8(%ebp),%eax
cf5: 8b 50 04 mov 0x4(%eax),%edx
cf8: 8b 45 08 mov 0x8(%ebp),%eax
cfb: 8b 40 08 mov 0x8(%eax),%eax
cfe: 39 c2 cmp %eax,%edx
d00: 7d 0f jge d11 <sem_signal+0x30>
s->count++;
d02: 8b 45 08 mov 0x8(%ebp),%eax
d05: 8b 40 04 mov 0x4(%eax),%eax
d08: 8d 50 01 lea 0x1(%eax),%edx
d0b: 8b 45 08 mov 0x8(%ebp),%eax
d0e: 89 50 04 mov %edx,0x4(%eax)
}
int tid;
tid = pop_q(&s->waiters);
d11: 8b 45 08 mov 0x8(%ebp),%eax
d14: 83 c0 0c add $0xc,%eax
d17: 89 04 24 mov %eax,(%esp)
d1a: e8 98 fe ff ff call bb7 <pop_q>
d1f: 89 45 f4 mov %eax,-0xc(%ebp)
if(tid != -1){
d22: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
d26: 74 2e je d56 <sem_signal+0x75>
//printf(1, "Sem A\n");
twakeup(tid);
d28: 8b 45 f4 mov -0xc(%ebp),%eax
d2b: 89 04 24 mov %eax,(%esp)
d2e: e8 d1 f7 ff ff call 504 <twakeup>
s->count--;
d33: 8b 45 08 mov 0x8(%ebp),%eax
d36: 8b 40 04 mov 0x4(%eax),%eax
d39: 8d 50 ff lea -0x1(%eax),%edx
d3c: 8b 45 08 mov 0x8(%ebp),%eax
d3f: 89 50 04 mov %edx,0x4(%eax)
if(s->count < 0) s->count = 0;
d42: 8b 45 08 mov 0x8(%ebp),%eax
d45: 8b 40 04 mov 0x4(%eax),%eax
d48: 85 c0 test %eax,%eax
d4a: 79 0a jns d56 <sem_signal+0x75>
d4c: 8b 45 08 mov 0x8(%ebp),%eax
d4f: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
}
lock_release(&s->lock);
d56: 8b 45 08 mov 0x8(%ebp),%eax
d59: 89 04 24 mov %eax,(%esp)
d5c: e8 a7 fc ff ff call a08 <lock_release>
d61: c9 leave
d62: c3 ret
|
simplest_jump.asm | L12161/assembly_habijabi | 0 | 176488 | ;practical exercise 1 prob a
code segment
assume cs:code ds:code
MOV AX, 3254H
MOV BX, 1F4BH
MOV CX, 412AH
ADD AX, CX
JMP L3T2
SUB AX, BX
L3T2:
AND AX, BX
HLT
code ends
end |
CSE250 Circuits and Electronics/LAB 2/1/Schematic1.als | iamraufu/BRACU | 12 | 2515 | * Schematics Aliases *
.ALIASES
R_R3 R3(1=$N_0002 2=$N_0001 )
R_R4 R4(1=0 2=$N_0002 )
V_V1 V1(+=$N_0003 -=0 )
R_R1 R1(1=$N_0003 2=$N_0001 )
R_R2 R2(1=$N_0003 2=$N_0001 )
.ENDALIASES
|
OlderBasicILP/Indirect/Hilbert/Nested.agda | mietek/hilbert-gentzen | 29 | 5140 | <gh_stars>10-100
module OlderBasicILP.Indirect.Hilbert.Nested where
open import OlderBasicILP.Indirect public
-- Derivations, as Hilbert-style combinator trees.
mutual
data Tm : Set where
VAR : ℕ → Tm
APP : Tm → Tm → Tm
CI : Tm
CK : Tm
CS : Tm
BOX : Tm → Tm
CDIST : Tm
CUP : Tm
CDOWN : Tm
CPAIR : Tm
CFST : Tm
CSND : Tm
UNIT : Tm
infix 3 _⊢_
data _⊢_ (Γ : Cx (Ty Tm)) : Ty Tm → Set where
var : ∀ {A} → A ∈ Γ → Γ ⊢ A
app : ∀ {A B} → Γ ⊢ A ▻ B → Γ ⊢ A → Γ ⊢ B
ci : ∀ {A} → Γ ⊢ A ▻ A
ck : ∀ {A B} → Γ ⊢ A ▻ B ▻ A
cs : ∀ {A B C} → Γ ⊢ (A ▻ B ▻ C) ▻ (A ▻ B) ▻ A ▻ C
box : ∀ {A} → (t : ∅ ⊢ A) → Γ ⊢ [ t ] ⦂ A
cdist : ∀ {A B T U} → Γ ⊢ T ⦂ (A ▻ B) ▻ U ⦂ A ▻ APP T U ⦂ B
cup : ∀ {A T} → Γ ⊢ T ⦂ A ▻ BOX T ⦂ T ⦂ A
cdown : ∀ {A T} → Γ ⊢ T ⦂ A ▻ A
cpair : ∀ {A B} → Γ ⊢ A ▻ B ▻ A ∧ B
cfst : ∀ {A B} → Γ ⊢ A ∧ B ▻ A
csnd : ∀ {A B} → Γ ⊢ A ∧ B ▻ B
unit : Γ ⊢ ⊤
[_] : ∀ {A Γ} → Γ ⊢ A → Tm
[ var i ] = VAR [ i ]ⁱ
[ app t u ] = APP [ t ] [ u ]
[ ci ] = CI
[ ck ] = CK
[ cs ] = CS
[ box t ] = BOX [ t ]
[ cdist ] = CDIST
[ cup ] = CUP
[ cdown ] = CDOWN
[ cpair ] = CPAIR
[ cfst ] = CFST
[ csnd ] = CSND
[ unit ] = UNIT
infix 3 _⊢⋆_
_⊢⋆_ : Cx (Ty Tm) → Cx (Ty Tm) → Set
Γ ⊢⋆ ∅ = 𝟙
Γ ⊢⋆ Ξ , A = Γ ⊢⋆ Ξ × Γ ⊢ A
-- Monotonicity with respect to context inclusion.
mono⊢ : ∀ {A Γ Γ′} → Γ ⊆ Γ′ → Γ ⊢ A → Γ′ ⊢ A
mono⊢ η (var i) = var (mono∈ η i)
mono⊢ η (app t u) = app (mono⊢ η t) (mono⊢ η u)
mono⊢ η ci = ci
mono⊢ η ck = ck
mono⊢ η cs = cs
mono⊢ η (box t) = box t
mono⊢ η cdist = cdist
mono⊢ η cup = cup
mono⊢ η cdown = cdown
mono⊢ η cpair = cpair
mono⊢ η cfst = cfst
mono⊢ η csnd = csnd
mono⊢ η unit = unit
mono⊢⋆ : ∀ {Ξ Γ Γ′} → Γ ⊆ Γ′ → Γ ⊢⋆ Ξ → Γ′ ⊢⋆ Ξ
mono⊢⋆ {∅} η ∙ = ∙
mono⊢⋆ {Ξ , A} η (ts , t) = mono⊢⋆ η ts , mono⊢ η t
-- Shorthand for variables.
V₀ : Tm
V₀ = VAR 0
V₁ : Tm
V₁ = VAR 1
V₂ : Tm
V₂ = VAR 2
v₀ : ∀ {A Γ} → Γ , A ⊢ A
v₀ = var i₀
v₁ : ∀ {A B Γ} → (Γ , A) , B ⊢ A
v₁ = var i₁
v₂ : ∀ {A B C Γ} → ((Γ , A) , B) , C ⊢ A
v₂ = var i₂
-- Reflexivity.
refl⊢⋆ : ∀ {Γ} → Γ ⊢⋆ Γ
refl⊢⋆ {∅} = ∙
refl⊢⋆ {Γ , A} = mono⊢⋆ weak⊆ refl⊢⋆ , v₀
-- Deduction theorem.
LAM : Tm → Tm
LAM (VAR zero) = CI
LAM (VAR (suc i)) = APP CK (VAR i)
LAM (APP T U) = APP (APP CS (LAM T)) (LAM U)
LAM CI = APP CK CI
LAM CK = APP CK CK
LAM CS = APP CK CS
LAM (BOX T) = APP CK (BOX T)
LAM CDIST = APP CK CDIST
LAM CUP = APP CK CUP
LAM CDOWN = APP CK CDOWN
LAM CPAIR = APP CK CPAIR
LAM CFST = APP CK CFST
LAM CSND = APP CK CSND
LAM UNIT = APP CK UNIT
lam : ∀ {A B Γ} → Γ , A ⊢ B → Γ ⊢ A ▻ B
lam (var top) = ci
lam (var (pop i)) = app ck (var i)
lam (app t u) = app (app cs (lam t)) (lam u)
lam ci = app ck ci
lam ck = app ck ck
lam cs = app ck cs
lam (box t) = app ck (box t)
lam cdist = app ck cdist
lam cup = app ck cup
lam cdown = app ck cdown
lam cpair = app ck cpair
lam cfst = app ck cfst
lam csnd = app ck csnd
lam unit = app ck unit
-- Detachment theorem.
DET : Tm → Tm
DET T = APP T V₀
det : ∀ {A B Γ} → Γ ⊢ A ▻ B → Γ , A ⊢ B
det t = app (mono⊢ weak⊆ t) v₀
-- Cut and multicut.
CUT : Tm → Tm → Tm
CUT T U = APP (LAM U) T
MULTICUT : Cx Tm → Tm → Tm
MULTICUT ∅ U = U
MULTICUT (TS , T) U = APP (MULTICUT TS (LAM U)) T
cut : ∀ {A B Γ} → Γ ⊢ A → Γ , A ⊢ B → Γ ⊢ B
cut t u = app (lam u) t
multicut : ∀ {Ξ A Γ} → Γ ⊢⋆ Ξ → Ξ ⊢ A → Γ ⊢ A
multicut {∅} ∙ u = mono⊢ bot⊆ u
multicut {Ξ , B} (ts , t) u = app (multicut ts (lam u)) t
-- Transitivity.
trans⊢⋆ : ∀ {Γ″ Γ′ Γ} → Γ ⊢⋆ Γ′ → Γ′ ⊢⋆ Γ″ → Γ ⊢⋆ Γ″
trans⊢⋆ {∅} ts ∙ = ∙
trans⊢⋆ {Γ″ , A} ts (us , u) = trans⊢⋆ ts us , multicut ts u
-- Contraction.
CCONT : Tm
CCONT = LAM (LAM (APP (APP V₁ V₀) V₀))
CONT : Tm → Tm
CONT T = DET (APP CCONT (LAM (LAM T)))
ccont : ∀ {A B Γ} → Γ ⊢ (A ▻ A ▻ B) ▻ A ▻ B
ccont = lam (lam (app (app v₁ v₀) v₀))
cont : ∀ {A B Γ} → Γ , A , A ⊢ B → Γ , A ⊢ B
cont t = det (app ccont (lam (lam t)))
-- Exchange, or Schönfinkel’s C combinator.
CEXCH : Tm
CEXCH = LAM (LAM (LAM (APP (APP V₂ V₀) V₁)))
EXCH : Tm → Tm
EXCH T = DET (DET (APP CEXCH (LAM (LAM T))))
cexch : ∀ {A B C Γ} → Γ ⊢ (A ▻ B ▻ C) ▻ B ▻ A ▻ C
cexch = lam (lam (lam (app (app v₂ v₀) v₁)))
exch : ∀ {A B C Γ} → Γ , A , B ⊢ C → Γ , B , A ⊢ C
exch t = det (det (app cexch (lam (lam t))))
-- Composition, or Schönfinkel’s B combinator.
CCOMP : Tm
CCOMP = LAM (LAM (LAM (APP V₂ (APP V₁ V₀))))
COMP : Tm → Tm → Tm
COMP T U = DET (APP (APP CCOMP (LAM T)) (LAM U))
ccomp : ∀ {A B C Γ} → Γ ⊢ (B ▻ C) ▻ (A ▻ B) ▻ A ▻ C
ccomp = lam (lam (lam (app v₂ (app v₁ v₀))))
comp : ∀ {A B C Γ} → Γ , B ⊢ C → Γ , A ⊢ B → Γ , A ⊢ C
comp t u = det (app (app ccomp (lam t)) (lam u))
-- Useful theorems in functional form.
DIST : Tm → Tm → Tm
DIST T U = APP (APP CDIST T) U
UP : Tm → Tm
UP T = APP CUP T
DOWN : Tm → Tm
DOWN T = APP CDOWN T
DISTUP : Tm → Tm → Tm
DISTUP T U = DIST T (UP U)
UNBOX : Tm → Tm → Tm
UNBOX T U = APP (LAM U) T
MULTIBOX : Cx Tm → Tm → Tm
MULTIBOX ∅ U = BOX U
MULTIBOX (TS , T) U = DISTUP (MULTIBOX TS (LAM U)) T
dist : ∀ {A B T U Γ} → Γ ⊢ T ⦂ (A ▻ B) → Γ ⊢ U ⦂ A → Γ ⊢ (APP T U) ⦂ B
dist t u = app (app cdist t) u
up : ∀ {A T Γ} → Γ ⊢ T ⦂ A → Γ ⊢ BOX T ⦂ T ⦂ A
up t = app cup t
down : ∀ {A T Γ} → Γ ⊢ T ⦂ A → Γ ⊢ A
down t = app cdown t
distup : ∀ {A B T U Γ} → Γ ⊢ T ⦂ (U ⦂ A ▻ B)
→ Γ ⊢ U ⦂ A → Γ ⊢ APP T (BOX U) ⦂ B
distup t u = dist t (up u)
unbox : ∀ {A C T U Γ} → Γ ⊢ T ⦂ A → Γ , T ⦂ A ⊢ U ⦂ C → Γ ⊢ U ⦂ C
unbox t u = app (lam u) t
-- FIXME ↓ FIXME ↓ FIXME -----------------------------------------------------
--
-- Do we need reduction on term representations?
--
-- Goal: Γ ⊢ [ u ] ⦂ A
-- Have: Γ ⊢ APP [ lam u ] (BOX S) ⦂ A
distup′ : ∀ {A B T U Γ} → Γ ⊢ LAM T ⦂ (U ⦂ A ▻ B) → Γ ⊢ U ⦂ A
→ Γ ⊢ APP (LAM T) (BOX U) ⦂ B
distup′ t u = dist t (up u)
-- multibox : ∀ {n A Γ} {SS : VCx Tm n} {Ξ : VCx (Ty Tm) n}
-- → Γ ⊢⋆ SS ⦂⋆ Ξ → (u : SS ⦂⋆ Ξ ⊢ A)
-- → Γ ⊢ [ u ] ⦂ A
-- multibox {SS = ∅} {∅} ∙ u = box u
-- multibox {SS = SS , S} {Ξ , B} (ts , t) u = {!distup (multibox ts (lam u)) t!}
-- FIXME ↑ FIXME ↑ FIXME -----------------------------------------------------
PAIR : Tm → Tm → Tm
PAIR T U = APP (APP CPAIR T) U
FST : Tm → Tm
FST T = APP CFST T
SND : Tm → Tm
SND T = APP CSND T
pair : ∀ {A B Γ} → Γ ⊢ A → Γ ⊢ B → Γ ⊢ A ∧ B
pair t u = app (app cpair t) u
fst : ∀ {A B Γ} → Γ ⊢ A ∧ B → Γ ⊢ A
fst t = app cfst t
snd : ∀ {A B Γ} → Γ ⊢ A ∧ B → Γ ⊢ B
snd t = app csnd t
-- Closure under context concatenation.
concat : ∀ {A B Γ} Γ′ → Γ , A ⊢ B → Γ′ ⊢ A → Γ ⧺ Γ′ ⊢ B
concat Γ′ t u = app (mono⊢ (weak⊆⧺₁ Γ′) (lam t)) (mono⊢ weak⊆⧺₂ u)
|
math.asm | MonstersGoBoom/Kickassembler-Modules | 16 | 100668 | <filename>math.asm<gh_stars>10-100
#if MATH16
.macro mov16i(value,output) {
lda #(value)&$ff
sta output+1
lda #(value>>8)&$ff
sta output
}
.macro mov16d(value,output) {
lda value
sta output
lda value+1
sta output+1
}
.macro add16i(input,value,output) {
clc
lda input
adc #(value)&$ff
sta output
lda input+1
adc #(value>>8)&$ff
sta output+1
}
.macro add16d(input,value,output){
clc
lda input
adc value
sta output
lda input+1
adc value+1
sta output+1
}
#endif
#if MATH24
.macro mov24i(value,output) {
lda #(value)&$ff
sta output+2
lda #(value>>8)&$ff
sta output+1
lda #(value>>16)&$ff
sta output
}
.macro mov24d(value,output) {
lda value
sta output
lda value+1
sta output+1
lda value+2
sta output+2
}
.macro add24i(input,value,output) {
clc
lda input
adc #(value)&$ff
sta output
lda input+1
adc #(value>>8)&$ff
sta output+1
lda input+2
adc #(value>>16)&$ff
sta output+2
}
.macro add24d(input,value,output){
clc
lda input
adc value
sta output
lda input+1
adc value+1
sta output+1
lda input+2
adc value+2
sta output+2
}
#endif
|
programs/oeis/085/A085250.asm | neoneye/loda | 22 | 244589 | ; A085250: 4 times hexagonal numbers: a(n) = 4*n*(2*n-1).
; 0,4,24,60,112,180,264,364,480,612,760,924,1104,1300,1512,1740,1984,2244,2520,2812,3120,3444,3784,4140,4512,4900,5304,5724,6160,6612,7080,7564,8064,8580,9112,9660,10224,10804,11400,12012,12640,13284,13944,14620,15312,16020,16744,17484,18240,19012,19800,20604,21424,22260,23112,23980,24864,25764,26680,27612,28560,29524,30504,31500,32512,33540,34584,35644,36720,37812,38920,40044,41184,42340,43512,44700,45904,47124,48360,49612,50880,52164,53464,54780,56112,57460,58824,60204,61600,63012,64440,65884,67344,68820,70312,71820,73344,74884,76440,78012
mul $0,2
bin $0,2
mul $0,4
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.