text stringlengths 1 1.05M |
|---|
// This file is part of Seir.
// Copyright (C) Sergei Blagodarin.
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <seir_data/writer.hpp>
namespace seir
{
class Buffer;
// A Writer that writes to a Buffer.
class BufferWriter final : public Writer
{
public:
//
constexpr explicit BufferWriter(Buffer&, uint64_t* bufferBytes = nullptr) noexcept;
bool flush() noexcept override;
private:
bool reserveImpl(uint64_t capacity) noexcept override;
bool writeImpl(uint64_t offset64, const void* data, size_t size) noexcept override;
private:
Buffer& _buffer;
uint64_t* const _bufferBytes;
};
}
constexpr seir::BufferWriter::BufferWriter(Buffer& buffer, uint64_t* bufferBytes) noexcept
: _buffer{ buffer }
, _bufferBytes{ bufferBytes }
{
if (bufferBytes)
*bufferBytes = 0;
}
|
rcr al, 1
rcr ah, 1
rcr bl, 1
rcr bh, 1
rcr cl, 1
rcr ch, 1
rcr dl, 1
rcr dh, 1
rcr byte [bx], 1
rcr byte [bx+si], 1h
rcr byte [bx+si+12h], 1b
rcr byte [bx+si+4142h], 1
rcr al, cl
rcr ah, cl
rcr bl, cl
rcr bh, cl
rcr cl, cl
rcr ch, cl
rcr dl, cl
rcr dh, cl
rcr byte [bx], cl
rcr byte [bx+di], cl
rcr byte [bx+di+12h], cl
rcr byte [bx+di+4142h], cl
rcr ax, 1
rcr bx, 1
rcr cx, 1
rcr dx, 1
rcr si, 1
rcr di, 1
rcr bp, 1
rcr word [bx], 1
rcr word [bx+si], 1h
rcr word [bx+si+12h], 1b
rcr word [bx+si+4142h], 1
rcr ax, cl
rcr bx, cl
rcr cx, cl
rcr dx, cl
rcr si, cl
rcr di, cl
rcr bp, cl
rcr word [bx], cl
rcr word [bx+di], cl
rcr word [bx+di+12h], cl
rcr word [bx+si+12h], cl
|
page ,132
subttl emlsint.asm - Load/Store 16/32-bit integers
;***
;emlsint.asm - Load/Store 16/32-bit integers
;
; Copyright (c) 1986-89, Microsoft Corporation
;
;Purpose:
; Load/Store 16/32-bit integers
;
; This Module contains Proprietary Information of Microsoft
; Corporation and should be treated as Confidential.
;
;Revision History:
; See emulator.hst
;
;*******************************************************************************
;*********************************************************************;
; ;
; Load Single (16 Bit) Integer ;
; ;
;*********************************************************************;
; ES:SI: memory address of 16 bit integer
ProfBegin LSINT
pub eFLDsi
LDUS2AX ; Fetch the integer
MOV DI,AX ; into DI:BP:BX:DX
OR DI,DI
JZ short LoadZero
XOR BP,BP
MOV BX,BP
MOV DX,BX
MOV AX,15 ; Exponent would be 15 if no shifts needed
PUSHST ; Get a new TOS
XOR CL,CL
MOV Tag[esi],CL ; Tag number as valid non-zero
MOV CX,DI ; Sign of Integer to CH
AND CH,Sign
if fastSP
OR CH,Single
endif
JNS short SETFLAG16 ; If positive integer set the flag
NEG DI ; Otherwise compliment the number first
pub SETFLAG16
MOV Flag[esi],CH
JMP IntegerToInternal
pub LoadZero
PUSHST ; Get a new TOS
XOR AX,AX
MOV MB0[esi],AX
MOV MB2[esi],AX
MOV MB4[esi],AX
MOV MB6[esi],AX
MOV Expon[esi],IexpMin - IexpBias
MOV Flag[esi],AH
MOV AH,ZROorINF
MOV Tag[esi],AH
RET
PAGE
;*********************************************************************;
; ;
; Store Single (16 Bit) Integer ;
; ;
;*********************************************************************;
;
; ES:SI: memory address of 16 bit integer
pub eFSTsi
PUSH esi ; Save memory address for store
MOV esi,[CURstk]
; Test for special conditions
TEST byte ptr Tag[esi],Special ; If number is not in range it is overflow
JNZ short IntegerOverflow16
TEST byte ptr Tag[esi],ZROorINF
JNZ short StoreIntegerZero16
; Fetch Exponent & test fo blatent overflow
MOV CX,Expon[esi]
CMP CX,15
JG short IntegerOverflow16
if fastSP
MOV BX,MB4[esi] ; Fetch mantissa to DI:BP:BX:DX
MOV DI,MB6[esi]
TEST byte ptr Flag[esi],Single
JZ SSID
XOR BL,BL
MOV BP,BX
XOR BX,BX
MOV DX,BX
SSI:
else
MOV BP,MB4[esi] ; Fetch mantissa to DI:BP:BX:DX
MOV DI,MB6[esi]
MOV DX,MB0[esi]
MOV BX,MB2[esi]
endif
CALL InternalToInteger
; Integer now in BX:DX (not yet 2's compliment)
OR BX,BX ; Test again for Overflow
JNZ short IntegerOverflow16
MOV AH,Flag[esi] ; See if we need to compliment
OR AH,AH
JNS short Int16in2sComp
NEG DX
JZ short Store16 ; Special case 0
pub Int16in2sComp
XOR AX,DX ; If Signs agree we did not overflow
JS short IntegerOverflow16
pub Store16
POP edi ; Restore Memory address
MOV AX,DX
STAX2US
RET
if fastSP
SSID:
MOV BP,BX
MOV DX,MB0[esi]
MOV BX,MB2[esi]
JMP SSI
endif
pub StoreIntegerZero16
XOR DX,DX
JMP Store16
pub IntegerOverflow16
OR [CURerr],Invalid
MOV DX,8000H ; Integer Indefinite
JMP Store16
page
;*********************************************************************;
; ;
; Load Double (32 Bit) Integer ;
; ;
;*********************************************************************;
;
; ES:SI: memory address of 32 bit integer
pub eFLDdi
LDUS2AX ; Fetch the integer
MOV BP,AX ; into DI:BP:BX:DX
LDUS2AX
MOV DI,AX
OR AX,BP
JZ short JMPLoadZeroBecauseThisLanguageHasNoFarConditionalJump
XOR BX,BX
MOV DX,BX
MOV AX,31 ; Exponent would be 31 if no shifts needed
PUSHST ; Get a new TOS
XOR CL,CL
MOV Tag[esi],CL ; Tag number as valid non-zero
MOV CX,DI ; Sign of Integer to CH
AND CH,Sign
JNS short SETFLAG32 ; If positive integer set the flag
XOR DI,0FFFFH ; Otherwise compliment the number first
XOR BP,0FFFFH
ADD BP,1
ADC DI,0
pub SETFLAG32
MOV Flag[esi],CH
OR DI,DI
JZ short SPEEDSHIFT32
JMP IntegerToInternal
JMPLoadZeroBecauseThisLanguageHasNoFarConditionalJump:
JMP LoadZero
pub SPEEDSHIFT32
MOV DI,BP
XOR BP,BP
SUB AX,16
JMP IntegerToInternal
page
;*********************************************************************;
; ;
; Store Double (32 Bit) Integer ;
; ;
;*********************************************************************;
;
; ES:SI: memory address of 32 bit integer
pub eFSTdi
PUSH esi
call TOSto32int ; convert TOS to 32-bit integer
POP edi ; Restore Memory address
MOV AX,DX
STAX2US
MOV AX,BX
STAX2US
RET
pub TOSto32int
MOV esi,[CURstk]
; Test for special conditions
TEST byte ptr Tag[esi],Special ; If number is not in range it is overflow
JNZ short IntegerOverflow32
TEST byte ptr Tag[esi],ZROorINF
JNZ short StoreIntegerZero32
; Fetch Exponent & test fo blatent overflow
MOV CX,Expon[esi]
CMP CX,31
JG short IntegerOverflow32
if fastSP
MOV BX,MB4[esi] ; Fetch mantissa to DI:BP:BX:DX
MOV DI,MB6[esi]
TEST byte ptr Flag[esi],Single
JZ SDID
XOR BL,BL
MOV BP,BX
XOR BX,BX
MOV DX,BX
SDI:
else
MOV BP,MB4[esi] ; Fetch mantissa to DI:BP:BX:DX
MOV DI,MB6[esi]
MOV DX,MB0[esi]
MOV BX,MB2[esi]
endif
CALL InternalToInteger
; Integer in BP:BX:DX (not yet 2's compliment)
OR BP,BP ; Test again for Overflow
JNZ short IntegerOverflow32
MOV AH,Flag[esi] ; See if we need to compliment
OR AH,AH
JNS short Int32in2sComp
XOR BX,0FFFFH ; 2's Compliment of BX:DX
XOR DX,0FFFFH
ADD DX,1
ADC BX,0
pub Int32in2sComp
XOR AX,BX ; If Signs agree we did not overflow
JS short IntOverOrZero32 ; Special case is -0 which we let pass
pub Store32
ret
if fastSP
SDID:
MOV BP,BX
MOV DX,MB0[esi]
MOV BX,MB2[esi]
JMP SDI
endif
pub StoreIntegerZero32
XOR DX,DX
MOV BX,DX
ret
pub IntOverOrZero32
OR BX,DX
JZ Store32
pub IntegerOverflow32
OR CURerr,Invalid
MOV BX,8000H ; Integer Indefinite
XOR DX,DX
ret
ProfEnd LSINT
|
/*
* Copyright (C) 2015-2021 Swift Navigation Inc.
* Contact: https://support.swiftnav.com
*
* This source is subject to the license found in the file 'LICENSE' which must
* be be distributed together with this source. All other rights reserved.
*
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
*/
// This file was auto-generated from
// spec/tests/yaml/swiftnav/sbp/observation/test_MsgEphemerisGPS.yaml by
// generate.py. Do not modify by hand!
#include <gtest/gtest.h>
#include <libsbp/cpp/message_handler.h>
#include <libsbp/cpp/message_traits.h>
#include <libsbp/cpp/state.h>
#include <cstring>
class Test_auto_check_sbp_observation_MsgEphemerisGPS0
: public ::testing::Test,
public sbp::State,
public sbp::IReader,
public sbp::IWriter,
sbp::MessageHandler<sbp_msg_ephemeris_gps_t> {
public:
Test_auto_check_sbp_observation_MsgEphemerisGPS0()
: ::testing::Test(),
sbp::State(),
sbp::IReader(),
sbp::IWriter(),
sbp::MessageHandler<sbp_msg_ephemeris_gps_t>(this),
last_msg_(),
last_msg_len_(),
last_sender_id_(),
n_callbacks_logged_(),
dummy_wr_(),
dummy_rd_(),
dummy_buff_() {
set_reader(this);
set_writer(this);
}
s32 read(uint8_t *buf, const uint32_t n) override {
uint32_t real_n = n;
memcpy(buf, dummy_buff_ + dummy_rd_, real_n);
dummy_rd_ += real_n;
return (s32)real_n;
}
s32 write(const uint8_t *buf, uint32_t n) override {
uint32_t real_n = n;
memcpy(dummy_buff_ + dummy_wr_, buf, real_n);
dummy_wr_ += real_n;
return (s32)real_n;
}
protected:
void handle_sbp_msg(uint16_t sender_id,
const sbp_msg_ephemeris_gps_t &msg) override {
last_msg_ = msg;
last_sender_id_ = sender_id;
n_callbacks_logged_++;
}
sbp_msg_ephemeris_gps_t last_msg_;
uint8_t last_msg_len_;
uint16_t last_sender_id_;
size_t n_callbacks_logged_;
uint32_t dummy_wr_;
uint32_t dummy_rd_;
uint8_t dummy_buff_[1024];
};
TEST_F(Test_auto_check_sbp_observation_MsgEphemerisGPS0, Test) {
uint8_t encoded_frame[] = {
85, 138, 0, 10, 9, 139, 22, 0, 176, 207, 6, 0, 106, 8, 0,
0, 0, 64, 64, 56, 0, 0, 1, 0, 0, 0, 152, 178, 0, 64,
81, 194, 0, 80, 154, 67, 0, 32, 56, 182, 0, 128, 82, 54, 0,
0, 0, 50, 0, 0, 248, 179, 114, 216, 96, 180, 49, 117, 56, 62,
142, 41, 5, 235, 95, 135, 150, 191, 0, 0, 0, 32, 191, 247, 124,
63, 0, 0, 192, 206, 140, 33, 180, 64, 41, 131, 179, 134, 141, 248,
253, 191, 227, 133, 81, 54, 204, 30, 67, 190, 216, 59, 199, 39, 96,
168, 239, 191, 71, 11, 217, 147, 145, 228, 237, 63, 221, 47, 100, 224,
255, 47, 198, 189, 96, 139, 37, 186, 0, 0, 30, 45, 0, 0, 0,
0, 176, 207, 6, 0, 106, 8, 45, 45, 0, 170, 4,
};
sbp_msg_ephemeris_gps_t test_msg{};
test_msg.af0 = -0.0006315018981695175;
test_msg.af1 = 8.981260180007666e-12;
test_msg.af2 = 0.0;
test_msg.c_ic = 7.450580596923828e-09;
test_msg.c_is = -1.1548399925231934e-07;
test_msg.c_rc = 308.625;
test_msg.c_rs = -52.3125;
test_msg.c_uc = -2.7436763048171997e-06;
test_msg.c_us = 3.1366944313049316e-06;
test_msg.common.fit_interval = 14400;
test_msg.common.health_bits = 0;
test_msg.common.sid.code = 0;
test_msg.common.sid.sat = 22;
test_msg.common.toe.tow = 446384;
test_msg.common.toe.wn = 2154;
test_msg.common.ura = 2.0;
test_msg.common.valid = 1;
test_msg.dn = 5.694522914022375e-09;
test_msg.ecc = 0.007072207052260637;
test_msg.inc = 0.9341514480259797;
test_msg.inc_dot = -4.035882396415757e-11;
test_msg.iodc = 45;
test_msg.iode = 45;
test_msg.m0 = -0.02200078842114688;
test_msg.omega0 = -1.8731818448797617;
test_msg.omegadot = -8.903585155774196e-09;
test_msg.sqrta = 5153.550029754639;
test_msg.tgd = -1.7695128917694092e-08;
test_msg.toc.tow = 446384;
test_msg.toc.wn = 2154;
test_msg.w = -0.9893036629599647;
EXPECT_EQ(send_message(2314, test_msg), SBP_OK);
EXPECT_EQ(dummy_wr_, sizeof(encoded_frame));
EXPECT_EQ(memcmp(dummy_buff_, encoded_frame, sizeof(encoded_frame)), 0);
while (dummy_rd_ < dummy_wr_) {
process();
}
EXPECT_EQ(n_callbacks_logged_, 1);
EXPECT_EQ(last_sender_id_, 2314);
EXPECT_EQ(last_msg_, test_msg);
EXPECT_LT((last_msg_.af0 * 100 - -0.00063150189817 * 100), 0.05)
<< "incorrect value for last_msg_.af0, expected -0.00063150189817, is "
<< last_msg_.af0;
EXPECT_LT((last_msg_.af1 * 100 - 8.98126018001e-12 * 100), 0.05)
<< "incorrect value for last_msg_.af1, expected 8.98126018001e-12, is "
<< last_msg_.af1;
EXPECT_LT((last_msg_.af2 * 100 - 0.0 * 100), 0.05)
<< "incorrect value for last_msg_.af2, expected 0.0, is "
<< last_msg_.af2;
EXPECT_LT((last_msg_.c_ic * 100 - 7.45058059692e-09 * 100), 0.05)
<< "incorrect value for last_msg_.c_ic, expected 7.45058059692e-09, is "
<< last_msg_.c_ic;
EXPECT_LT((last_msg_.c_is * 100 - -1.15483999252e-07 * 100), 0.05)
<< "incorrect value for last_msg_.c_is, expected -1.15483999252e-07, is "
<< last_msg_.c_is;
EXPECT_LT((last_msg_.c_rc * 100 - 308.625 * 100), 0.05)
<< "incorrect value for last_msg_.c_rc, expected 308.625, is "
<< last_msg_.c_rc;
EXPECT_LT((last_msg_.c_rs * 100 - -52.3125 * 100), 0.05)
<< "incorrect value for last_msg_.c_rs, expected -52.3125, is "
<< last_msg_.c_rs;
EXPECT_LT((last_msg_.c_uc * 100 - -2.74367630482e-06 * 100), 0.05)
<< "incorrect value for last_msg_.c_uc, expected -2.74367630482e-06, is "
<< last_msg_.c_uc;
EXPECT_LT((last_msg_.c_us * 100 - 3.1366944313e-06 * 100), 0.05)
<< "incorrect value for last_msg_.c_us, expected 3.1366944313e-06, is "
<< last_msg_.c_us;
EXPECT_EQ(last_msg_.common.fit_interval, 14400)
<< "incorrect value for last_msg_.common.fit_interval, expected 14400, "
"is "
<< last_msg_.common.fit_interval;
EXPECT_EQ(last_msg_.common.health_bits, 0)
<< "incorrect value for last_msg_.common.health_bits, expected 0, is "
<< last_msg_.common.health_bits;
EXPECT_EQ(last_msg_.common.sid.code, 0)
<< "incorrect value for last_msg_.common.sid.code, expected 0, is "
<< last_msg_.common.sid.code;
EXPECT_EQ(last_msg_.common.sid.sat, 22)
<< "incorrect value for last_msg_.common.sid.sat, expected 22, is "
<< last_msg_.common.sid.sat;
EXPECT_EQ(last_msg_.common.toe.tow, 446384)
<< "incorrect value for last_msg_.common.toe.tow, expected 446384, is "
<< last_msg_.common.toe.tow;
EXPECT_EQ(last_msg_.common.toe.wn, 2154)
<< "incorrect value for last_msg_.common.toe.wn, expected 2154, is "
<< last_msg_.common.toe.wn;
EXPECT_LT((last_msg_.common.ura * 100 - 2.0 * 100), 0.05)
<< "incorrect value for last_msg_.common.ura, expected 2.0, is "
<< last_msg_.common.ura;
EXPECT_EQ(last_msg_.common.valid, 1)
<< "incorrect value for last_msg_.common.valid, expected 1, is "
<< last_msg_.common.valid;
EXPECT_LT((last_msg_.dn * 100 - 5.69452291402e-09 * 100), 0.05)
<< "incorrect value for last_msg_.dn, expected 5.69452291402e-09, is "
<< last_msg_.dn;
EXPECT_LT((last_msg_.ecc * 100 - 0.00707220705226 * 100), 0.05)
<< "incorrect value for last_msg_.ecc, expected 0.00707220705226, is "
<< last_msg_.ecc;
EXPECT_LT((last_msg_.inc * 100 - 0.934151448026 * 100), 0.05)
<< "incorrect value for last_msg_.inc, expected 0.934151448026, is "
<< last_msg_.inc;
EXPECT_LT((last_msg_.inc_dot * 100 - -4.03588239642e-11 * 100), 0.05)
<< "incorrect value for last_msg_.inc_dot, expected -4.03588239642e-11, "
"is "
<< last_msg_.inc_dot;
EXPECT_EQ(last_msg_.iodc, 45)
<< "incorrect value for last_msg_.iodc, expected 45, is "
<< last_msg_.iodc;
EXPECT_EQ(last_msg_.iode, 45)
<< "incorrect value for last_msg_.iode, expected 45, is "
<< last_msg_.iode;
EXPECT_LT((last_msg_.m0 * 100 - -0.0220007884211 * 100), 0.05)
<< "incorrect value for last_msg_.m0, expected -0.0220007884211, is "
<< last_msg_.m0;
EXPECT_LT((last_msg_.omega0 * 100 - -1.87318184488 * 100), 0.05)
<< "incorrect value for last_msg_.omega0, expected -1.87318184488, is "
<< last_msg_.omega0;
EXPECT_LT((last_msg_.omegadot * 100 - -8.90358515577e-09 * 100), 0.05)
<< "incorrect value for last_msg_.omegadot, expected -8.90358515577e-09, "
"is "
<< last_msg_.omegadot;
EXPECT_LT((last_msg_.sqrta * 100 - 5153.55002975 * 100), 0.05)
<< "incorrect value for last_msg_.sqrta, expected 5153.55002975, is "
<< last_msg_.sqrta;
EXPECT_LT((last_msg_.tgd * 100 - -1.76951289177e-08 * 100), 0.05)
<< "incorrect value for last_msg_.tgd, expected -1.76951289177e-08, is "
<< last_msg_.tgd;
EXPECT_EQ(last_msg_.toc.tow, 446384)
<< "incorrect value for last_msg_.toc.tow, expected 446384, is "
<< last_msg_.toc.tow;
EXPECT_EQ(last_msg_.toc.wn, 2154)
<< "incorrect value for last_msg_.toc.wn, expected 2154, is "
<< last_msg_.toc.wn;
EXPECT_LT((last_msg_.w * 100 - -0.98930366296 * 100), 0.05)
<< "incorrect value for last_msg_.w, expected -0.98930366296, is "
<< last_msg_.w;
}
|
; double fabs (double d);
; -----------------------
; This function returns the absolute value of a real number.
section .code
global _fabs
_fabs push rbp
mov rbp, rsp
fld tword [rbp+16]
fabs
pop rbp
ret
|
; Small C+ Math Library
; fabs(x)
XLIB fabs
LIB minusfa
LIB sgn
XREF fa
;
.FABS CALL SGN
RET P
jp minusfa
|
;
; "Guess the number" example in picoVM assembly
;
LOAD16 question
CALL print_string
POP16
LOAD16 user_input
CALL read_input
POP16
LOAD 0 ; return value holder
LOAD16 user_input
CALL string_to_int
POP16
LOAD 2
CALLUSER ; get random number
LOAD 3
MOD
LOAD 1
ADD
SUB
JEQ success
LOAD16 fail_text
CALL print_string
POP16
HLT
success:
LOAD16 success_text
CALL print_string
POP16
HLT
;
; Prints a null terminated string
;
print_string:
LOAD16 0x0 ; Reserve and init index to 0
.loop: LOAD16 [SFP + 2] ; Load message address
LOAD16 [SFP - 4] ; Load message index
LOAD ; Fetch and load the char
JEQ .finish ; If zero the string terminated
LOAD 0 ; System func putc
CALLUSER ; print the character
POP16 ; pop the character the func id
LOAD 1 ; Increase the index
ADD ;
JMP .loop ; repeat
.finish: POP
POP16
RET
;
; Gets user input until change of line
;
read_input:
LOAD16 0 ; Reserve and init local index to 0
.loop: LOAD 1
CALLUSER
DUP
LOAD 0x0a ; end of line check
SUB
POP
JEQ .finish
LOAD16 [SFP + 2] ; save the read character
LOAD16 [SFP - 4] ;
DIG 4 ;
STORE ;
POP ;
LOAD 1 ; Increase the index
ADD
JMP .loop
.finish: POP ; Pop last read value
LOAD16 [SFP + 2] ; add null termination
LOAD16 [SFP - 4] ;
LOAD 0 ;
STORE ;
POP16 ; Pop local index
RET
;
; Converts a string to an 1 byte integer
;
string_to_int:
LOAD 0 ; Reserve the integer
LOAD16 0 ; Reserve and init index to 0
.loop: LOAD16 [SFP + 2] ; Load message address
LOAD16 [SFP - 5] ; Load message index
LOAD ; Fetch and load the char
JEQ .finish ; If zero the string terminated
LOAD [SFP - 3]
LOAD 10
MUL
DIG 1
LOAD 0x30
SUB
ADD
STORE [SFP - 3]
POP
LOAD16 1 ; Increase the index
ADD16 ;
JMP .loop ; repeat
.finish: POP
POP16
STORE [SFP + 4] ; Load the return value
RET
question: DB "Guess a number from 1 to 10 : "
DB 0x00
success_text: DB 0x0a
DB "Correct! You are very lucky!"
DB 0x00
fail_text: DB 0x0a
DB "I guess you will have to win an other time... :("
DB 0x00
user_input: RESB 0x16
dummy: DB "12"
DB 0x0 |
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x5bea, %r9
nop
nop
nop
nop
and $7529, %rbp
movl $0x61626364, (%r9)
nop
nop
nop
nop
cmp $56252, %r12
lea addresses_WT_ht+0xbb3, %rsi
lea addresses_normal_ht+0x10d53, %rdi
nop
cmp $38001, %r11
mov $69, %rcx
rep movsq
and $8789, %rcx
lea addresses_WC_ht+0xc733, %rsi
lea addresses_normal_ht+0x77d3, %rdi
clflush (%rdi)
nop
add %r12, %r12
mov $31, %rcx
rep movsw
nop
nop
nop
add $9989, %r11
lea addresses_A_ht+0x1b533, %rsi
lea addresses_UC_ht+0xaa31, %rdi
nop
cmp $15290, %r15
mov $57, %rcx
rep movsb
nop
nop
nop
nop
nop
and %rbp, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rbx
push %rsi
// Faulty Load
lea addresses_RW+0x125d3, %r8
clflush (%r8)
nop
nop
nop
nop
mfence
mov (%r8), %rbx
lea oracles, %r9
and $0xff, %rbx
shlq $12, %rbx
mov (%r9,%rbx,1), %rbx
pop %rsi
pop %rbx
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)
80100008: fe 4f 52 decb 0x52(%edi)
8010000b: e4 0f in $0xf,%al
8010000c <entry>:
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
8010000c: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
8010000f: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
80100012: 0f 22 e0 mov %eax,%cr4
# Set page directory
movl $(V2P_WO(entrypgdir)), %eax
80100015: b8 00 a0 10 00 mov $0x10a000,%eax
movl %eax, %cr3
8010001a: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
8010001d: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PG|CR0_WP), %eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
movl %eax, %cr0
80100025: 0f 22 c0 mov %eax,%cr0
# Set up the stack pointer.
movl $(stack + KSTACKSIZE), %esp
80100028: bc 50 c6 10 80 mov $0x8010c650,%esp
# Jump to main(), and switch to executing at
# high addresses. The indirect call is needed because
# the assembler produces a PC-relative instruction
# for a direct jump.
mov $main, %eax
8010002d: b8 b1 33 10 80 mov $0x801033b1,%eax
jmp *%eax
80100032: ff e0 jmp *%eax
80100034 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100034: 55 push %ebp
80100035: 89 e5 mov %esp,%ebp
80100037: 83 ec 28 sub $0x28,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010003a: c7 44 24 04 40 82 10 movl $0x80108240,0x4(%esp)
80100041: 80
80100042: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
80100049: e8 f3 49 00 00 call 80104a41 <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010004e: c7 05 90 db 10 80 84 movl $0x8010db84,0x8010db90
80100055: db 10 80
bcache.head.next = &bcache.head;
80100058: c7 05 94 db 10 80 84 movl $0x8010db84,0x8010db94
8010005f: db 10 80
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062: c7 45 f4 94 c6 10 80 movl $0x8010c694,-0xc(%ebp)
80100069: eb 3a jmp 801000a5 <binit+0x71>
b->next = bcache.head.next;
8010006b: 8b 15 94 db 10 80 mov 0x8010db94,%edx
80100071: 8b 45 f4 mov -0xc(%ebp),%eax
80100074: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
80100077: 8b 45 f4 mov -0xc(%ebp),%eax
8010007a: c7 40 0c 84 db 10 80 movl $0x8010db84,0xc(%eax)
b->dev = -1;
80100081: 8b 45 f4 mov -0xc(%ebp),%eax
80100084: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
bcache.head.next->prev = b;
8010008b: a1 94 db 10 80 mov 0x8010db94,%eax
80100090: 8b 55 f4 mov -0xc(%ebp),%edx
80100093: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
80100096: 8b 45 f4 mov -0xc(%ebp),%eax
80100099: a3 94 db 10 80 mov %eax,0x8010db94
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009e: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp)
801000a5: 81 7d f4 84 db 10 80 cmpl $0x8010db84,-0xc(%ebp)
801000ac: 72 bd jb 8010006b <binit+0x37>
b->prev = &bcache.head;
b->dev = -1;
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000ae: c9 leave
801000af: c3 ret
801000b0 <bget>:
// Look through buffer cache for sector on device dev.
// If not found, allocate fresh block.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint sector)
{
801000b0: 55 push %ebp
801000b1: 89 e5 mov %esp,%ebp
801000b3: 83 ec 28 sub $0x28,%esp
struct buf *b;
acquire(&bcache.lock);
801000b6: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
801000bd: e8 a0 49 00 00 call 80104a62 <acquire>
loop:
// Is the sector already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c2: a1 94 db 10 80 mov 0x8010db94,%eax
801000c7: 89 45 f4 mov %eax,-0xc(%ebp)
801000ca: eb 63 jmp 8010012f <bget+0x7f>
if(b->dev == dev && b->sector == sector){
801000cc: 8b 45 f4 mov -0xc(%ebp),%eax
801000cf: 8b 40 04 mov 0x4(%eax),%eax
801000d2: 3b 45 08 cmp 0x8(%ebp),%eax
801000d5: 75 4f jne 80100126 <bget+0x76>
801000d7: 8b 45 f4 mov -0xc(%ebp),%eax
801000da: 8b 40 08 mov 0x8(%eax),%eax
801000dd: 3b 45 0c cmp 0xc(%ebp),%eax
801000e0: 75 44 jne 80100126 <bget+0x76>
if(!(b->flags & B_BUSY)){
801000e2: 8b 45 f4 mov -0xc(%ebp),%eax
801000e5: 8b 00 mov (%eax),%eax
801000e7: 83 e0 01 and $0x1,%eax
801000ea: 85 c0 test %eax,%eax
801000ec: 75 23 jne 80100111 <bget+0x61>
b->flags |= B_BUSY;
801000ee: 8b 45 f4 mov -0xc(%ebp),%eax
801000f1: 8b 00 mov (%eax),%eax
801000f3: 83 c8 01 or $0x1,%eax
801000f6: 89 c2 mov %eax,%edx
801000f8: 8b 45 f4 mov -0xc(%ebp),%eax
801000fb: 89 10 mov %edx,(%eax)
release(&bcache.lock);
801000fd: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
80100104: e8 bb 49 00 00 call 80104ac4 <release>
return b;
80100109: 8b 45 f4 mov -0xc(%ebp),%eax
8010010c: e9 93 00 00 00 jmp 801001a4 <bget+0xf4>
}
sleep(b, &bcache.lock);
80100111: c7 44 24 04 60 c6 10 movl $0x8010c660,0x4(%esp)
80100118: 80
80100119: 8b 45 f4 mov -0xc(%ebp),%eax
8010011c: 89 04 24 mov %eax,(%esp)
8010011f: e8 74 46 00 00 call 80104798 <sleep>
goto loop;
80100124: eb 9c jmp 801000c2 <bget+0x12>
acquire(&bcache.lock);
loop:
// Is the sector already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100126: 8b 45 f4 mov -0xc(%ebp),%eax
80100129: 8b 40 10 mov 0x10(%eax),%eax
8010012c: 89 45 f4 mov %eax,-0xc(%ebp)
8010012f: 81 7d f4 84 db 10 80 cmpl $0x8010db84,-0xc(%ebp)
80100136: 75 94 jne 801000cc <bget+0x1c>
goto loop;
}
}
// Not cached; recycle some non-busy and clean buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100138: a1 90 db 10 80 mov 0x8010db90,%eax
8010013d: 89 45 f4 mov %eax,-0xc(%ebp)
80100140: eb 4d jmp 8010018f <bget+0xdf>
if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
80100142: 8b 45 f4 mov -0xc(%ebp),%eax
80100145: 8b 00 mov (%eax),%eax
80100147: 83 e0 01 and $0x1,%eax
8010014a: 85 c0 test %eax,%eax
8010014c: 75 38 jne 80100186 <bget+0xd6>
8010014e: 8b 45 f4 mov -0xc(%ebp),%eax
80100151: 8b 00 mov (%eax),%eax
80100153: 83 e0 04 and $0x4,%eax
80100156: 85 c0 test %eax,%eax
80100158: 75 2c jne 80100186 <bget+0xd6>
b->dev = dev;
8010015a: 8b 45 f4 mov -0xc(%ebp),%eax
8010015d: 8b 55 08 mov 0x8(%ebp),%edx
80100160: 89 50 04 mov %edx,0x4(%eax)
b->sector = sector;
80100163: 8b 45 f4 mov -0xc(%ebp),%eax
80100166: 8b 55 0c mov 0xc(%ebp),%edx
80100169: 89 50 08 mov %edx,0x8(%eax)
b->flags = B_BUSY;
8010016c: 8b 45 f4 mov -0xc(%ebp),%eax
8010016f: c7 00 01 00 00 00 movl $0x1,(%eax)
release(&bcache.lock);
80100175: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
8010017c: e8 43 49 00 00 call 80104ac4 <release>
return b;
80100181: 8b 45 f4 mov -0xc(%ebp),%eax
80100184: eb 1e jmp 801001a4 <bget+0xf4>
goto loop;
}
}
// Not cached; recycle some non-busy and clean buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100186: 8b 45 f4 mov -0xc(%ebp),%eax
80100189: 8b 40 0c mov 0xc(%eax),%eax
8010018c: 89 45 f4 mov %eax,-0xc(%ebp)
8010018f: 81 7d f4 84 db 10 80 cmpl $0x8010db84,-0xc(%ebp)
80100196: 75 aa jne 80100142 <bget+0x92>
b->flags = B_BUSY;
release(&bcache.lock);
return b;
}
}
panic("bget: no buffers");
80100198: c7 04 24 47 82 10 80 movl $0x80108247,(%esp)
8010019f: e8 96 03 00 00 call 8010053a <panic>
}
801001a4: c9 leave
801001a5: c3 ret
801001a6 <bread>:
// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
801001a6: 55 push %ebp
801001a7: 89 e5 mov %esp,%ebp
801001a9: 83 ec 28 sub $0x28,%esp
struct buf *b;
b = bget(dev, sector);
801001ac: 8b 45 0c mov 0xc(%ebp),%eax
801001af: 89 44 24 04 mov %eax,0x4(%esp)
801001b3: 8b 45 08 mov 0x8(%ebp),%eax
801001b6: 89 04 24 mov %eax,(%esp)
801001b9: e8 f2 fe ff ff call 801000b0 <bget>
801001be: 89 45 f4 mov %eax,-0xc(%ebp)
if(!(b->flags & B_VALID))
801001c1: 8b 45 f4 mov -0xc(%ebp),%eax
801001c4: 8b 00 mov (%eax),%eax
801001c6: 83 e0 02 and $0x2,%eax
801001c9: 85 c0 test %eax,%eax
801001cb: 75 0b jne 801001d8 <bread+0x32>
iderw(b);
801001cd: 8b 45 f4 mov -0xc(%ebp),%eax
801001d0: 89 04 24 mov %eax,(%esp)
801001d3: e8 b5 25 00 00 call 8010278d <iderw>
return b;
801001d8: 8b 45 f4 mov -0xc(%ebp),%eax
}
801001db: c9 leave
801001dc: c3 ret
801001dd <bwrite>:
// Write b's contents to disk. Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001dd: 55 push %ebp
801001de: 89 e5 mov %esp,%ebp
801001e0: 83 ec 18 sub $0x18,%esp
if((b->flags & B_BUSY) == 0)
801001e3: 8b 45 08 mov 0x8(%ebp),%eax
801001e6: 8b 00 mov (%eax),%eax
801001e8: 83 e0 01 and $0x1,%eax
801001eb: 85 c0 test %eax,%eax
801001ed: 75 0c jne 801001fb <bwrite+0x1e>
panic("bwrite");
801001ef: c7 04 24 58 82 10 80 movl $0x80108258,(%esp)
801001f6: e8 3f 03 00 00 call 8010053a <panic>
b->flags |= B_DIRTY;
801001fb: 8b 45 08 mov 0x8(%ebp),%eax
801001fe: 8b 00 mov (%eax),%eax
80100200: 83 c8 04 or $0x4,%eax
80100203: 89 c2 mov %eax,%edx
80100205: 8b 45 08 mov 0x8(%ebp),%eax
80100208: 89 10 mov %edx,(%eax)
iderw(b);
8010020a: 8b 45 08 mov 0x8(%ebp),%eax
8010020d: 89 04 24 mov %eax,(%esp)
80100210: e8 78 25 00 00 call 8010278d <iderw>
}
80100215: c9 leave
80100216: c3 ret
80100217 <brelse>:
// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
80100217: 55 push %ebp
80100218: 89 e5 mov %esp,%ebp
8010021a: 83 ec 18 sub $0x18,%esp
if((b->flags & B_BUSY) == 0)
8010021d: 8b 45 08 mov 0x8(%ebp),%eax
80100220: 8b 00 mov (%eax),%eax
80100222: 83 e0 01 and $0x1,%eax
80100225: 85 c0 test %eax,%eax
80100227: 75 0c jne 80100235 <brelse+0x1e>
panic("brelse");
80100229: c7 04 24 5f 82 10 80 movl $0x8010825f,(%esp)
80100230: e8 05 03 00 00 call 8010053a <panic>
acquire(&bcache.lock);
80100235: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
8010023c: e8 21 48 00 00 call 80104a62 <acquire>
b->next->prev = b->prev;
80100241: 8b 45 08 mov 0x8(%ebp),%eax
80100244: 8b 40 10 mov 0x10(%eax),%eax
80100247: 8b 55 08 mov 0x8(%ebp),%edx
8010024a: 8b 52 0c mov 0xc(%edx),%edx
8010024d: 89 50 0c mov %edx,0xc(%eax)
b->prev->next = b->next;
80100250: 8b 45 08 mov 0x8(%ebp),%eax
80100253: 8b 40 0c mov 0xc(%eax),%eax
80100256: 8b 55 08 mov 0x8(%ebp),%edx
80100259: 8b 52 10 mov 0x10(%edx),%edx
8010025c: 89 50 10 mov %edx,0x10(%eax)
b->next = bcache.head.next;
8010025f: 8b 15 94 db 10 80 mov 0x8010db94,%edx
80100265: 8b 45 08 mov 0x8(%ebp),%eax
80100268: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
8010026b: 8b 45 08 mov 0x8(%ebp),%eax
8010026e: c7 40 0c 84 db 10 80 movl $0x8010db84,0xc(%eax)
bcache.head.next->prev = b;
80100275: a1 94 db 10 80 mov 0x8010db94,%eax
8010027a: 8b 55 08 mov 0x8(%ebp),%edx
8010027d: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
80100280: 8b 45 08 mov 0x8(%ebp),%eax
80100283: a3 94 db 10 80 mov %eax,0x8010db94
b->flags &= ~B_BUSY;
80100288: 8b 45 08 mov 0x8(%ebp),%eax
8010028b: 8b 00 mov (%eax),%eax
8010028d: 83 e0 fe and $0xfffffffe,%eax
80100290: 89 c2 mov %eax,%edx
80100292: 8b 45 08 mov 0x8(%ebp),%eax
80100295: 89 10 mov %edx,(%eax)
wakeup(b);
80100297: 8b 45 08 mov 0x8(%ebp),%eax
8010029a: 89 04 24 mov %eax,(%esp)
8010029d: e8 cf 45 00 00 call 80104871 <wakeup>
release(&bcache.lock);
801002a2: c7 04 24 60 c6 10 80 movl $0x8010c660,(%esp)
801002a9: e8 16 48 00 00 call 80104ac4 <release>
}
801002ae: c9 leave
801002af: c3 ret
801002b0 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801002b0: 55 push %ebp
801002b1: 89 e5 mov %esp,%ebp
801002b3: 83 ec 14 sub $0x14,%esp
801002b6: 8b 45 08 mov 0x8(%ebp),%eax
801002b9: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002bd: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801002c1: 89 c2 mov %eax,%edx
801002c3: ec in (%dx),%al
801002c4: 88 45 ff mov %al,-0x1(%ebp)
return data;
801002c7: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
801002cb: c9 leave
801002cc: c3 ret
801002cd <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801002cd: 55 push %ebp
801002ce: 89 e5 mov %esp,%ebp
801002d0: 83 ec 08 sub $0x8,%esp
801002d3: 8b 55 08 mov 0x8(%ebp),%edx
801002d6: 8b 45 0c mov 0xc(%ebp),%eax
801002d9: 66 89 55 fc mov %dx,-0x4(%ebp)
801002dd: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002e0: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801002e4: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801002e8: ee out %al,(%dx)
}
801002e9: c9 leave
801002ea: c3 ret
801002eb <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
801002eb: 55 push %ebp
801002ec: 89 e5 mov %esp,%ebp
asm volatile("cli");
801002ee: fa cli
}
801002ef: 5d pop %ebp
801002f0: c3 ret
801002f1 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
801002f1: 55 push %ebp
801002f2: 89 e5 mov %esp,%ebp
801002f4: 56 push %esi
801002f5: 53 push %ebx
801002f6: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
801002f9: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801002fd: 74 1c je 8010031b <printint+0x2a>
801002ff: 8b 45 08 mov 0x8(%ebp),%eax
80100302: c1 e8 1f shr $0x1f,%eax
80100305: 0f b6 c0 movzbl %al,%eax
80100308: 89 45 10 mov %eax,0x10(%ebp)
8010030b: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010030f: 74 0a je 8010031b <printint+0x2a>
x = -xx;
80100311: 8b 45 08 mov 0x8(%ebp),%eax
80100314: f7 d8 neg %eax
80100316: 89 45 f0 mov %eax,-0x10(%ebp)
80100319: eb 06 jmp 80100321 <printint+0x30>
else
x = xx;
8010031b: 8b 45 08 mov 0x8(%ebp),%eax
8010031e: 89 45 f0 mov %eax,-0x10(%ebp)
i = 0;
80100321: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
80100328: 8b 4d f4 mov -0xc(%ebp),%ecx
8010032b: 8d 41 01 lea 0x1(%ecx),%eax
8010032e: 89 45 f4 mov %eax,-0xc(%ebp)
80100331: 8b 5d 0c mov 0xc(%ebp),%ebx
80100334: 8b 45 f0 mov -0x10(%ebp),%eax
80100337: ba 00 00 00 00 mov $0x0,%edx
8010033c: f7 f3 div %ebx
8010033e: 89 d0 mov %edx,%eax
80100340: 0f b6 80 04 90 10 80 movzbl -0x7fef6ffc(%eax),%eax
80100347: 88 44 0d e0 mov %al,-0x20(%ebp,%ecx,1)
}while((x /= base) != 0);
8010034b: 8b 75 0c mov 0xc(%ebp),%esi
8010034e: 8b 45 f0 mov -0x10(%ebp),%eax
80100351: ba 00 00 00 00 mov $0x0,%edx
80100356: f7 f6 div %esi
80100358: 89 45 f0 mov %eax,-0x10(%ebp)
8010035b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010035f: 75 c7 jne 80100328 <printint+0x37>
if(sign)
80100361: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100365: 74 10 je 80100377 <printint+0x86>
buf[i++] = '-';
80100367: 8b 45 f4 mov -0xc(%ebp),%eax
8010036a: 8d 50 01 lea 0x1(%eax),%edx
8010036d: 89 55 f4 mov %edx,-0xc(%ebp)
80100370: c6 44 05 e0 2d movb $0x2d,-0x20(%ebp,%eax,1)
while(--i >= 0)
80100375: eb 18 jmp 8010038f <printint+0x9e>
80100377: eb 16 jmp 8010038f <printint+0x9e>
consputc(buf[i]);
80100379: 8d 55 e0 lea -0x20(%ebp),%edx
8010037c: 8b 45 f4 mov -0xc(%ebp),%eax
8010037f: 01 d0 add %edx,%eax
80100381: 0f b6 00 movzbl (%eax),%eax
80100384: 0f be c0 movsbl %al,%eax
80100387: 89 04 24 mov %eax,(%esp)
8010038a: e8 c1 03 00 00 call 80100750 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
8010038f: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100393: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100397: 79 e0 jns 80100379 <printint+0x88>
consputc(buf[i]);
}
80100399: 83 c4 30 add $0x30,%esp
8010039c: 5b pop %ebx
8010039d: 5e pop %esi
8010039e: 5d pop %ebp
8010039f: c3 ret
801003a0 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003a0: 55 push %ebp
801003a1: 89 e5 mov %esp,%ebp
801003a3: 83 ec 38 sub $0x38,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
801003a6: a1 f4 b5 10 80 mov 0x8010b5f4,%eax
801003ab: 89 45 e8 mov %eax,-0x18(%ebp)
if(locking)
801003ae: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801003b2: 74 0c je 801003c0 <cprintf+0x20>
acquire(&cons.lock);
801003b4: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
801003bb: e8 a2 46 00 00 call 80104a62 <acquire>
if (fmt == 0)
801003c0: 8b 45 08 mov 0x8(%ebp),%eax
801003c3: 85 c0 test %eax,%eax
801003c5: 75 0c jne 801003d3 <cprintf+0x33>
panic("null fmt");
801003c7: c7 04 24 66 82 10 80 movl $0x80108266,(%esp)
801003ce: e8 67 01 00 00 call 8010053a <panic>
argp = (uint*)(void*)(&fmt + 1);
801003d3: 8d 45 0c lea 0xc(%ebp),%eax
801003d6: 89 45 f0 mov %eax,-0x10(%ebp)
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003d9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801003e0: e9 21 01 00 00 jmp 80100506 <cprintf+0x166>
if(c != '%'){
801003e5: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
801003e9: 74 10 je 801003fb <cprintf+0x5b>
consputc(c);
801003eb: 8b 45 e4 mov -0x1c(%ebp),%eax
801003ee: 89 04 24 mov %eax,(%esp)
801003f1: e8 5a 03 00 00 call 80100750 <consputc>
continue;
801003f6: e9 07 01 00 00 jmp 80100502 <cprintf+0x162>
}
c = fmt[++i] & 0xff;
801003fb: 8b 55 08 mov 0x8(%ebp),%edx
801003fe: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100402: 8b 45 f4 mov -0xc(%ebp),%eax
80100405: 01 d0 add %edx,%eax
80100407: 0f b6 00 movzbl (%eax),%eax
8010040a: 0f be c0 movsbl %al,%eax
8010040d: 25 ff 00 00 00 and $0xff,%eax
80100412: 89 45 e4 mov %eax,-0x1c(%ebp)
if(c == 0)
80100415: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100419: 75 05 jne 80100420 <cprintf+0x80>
break;
8010041b: e9 06 01 00 00 jmp 80100526 <cprintf+0x186>
switch(c){
80100420: 8b 45 e4 mov -0x1c(%ebp),%eax
80100423: 83 f8 70 cmp $0x70,%eax
80100426: 74 4f je 80100477 <cprintf+0xd7>
80100428: 83 f8 70 cmp $0x70,%eax
8010042b: 7f 13 jg 80100440 <cprintf+0xa0>
8010042d: 83 f8 25 cmp $0x25,%eax
80100430: 0f 84 a6 00 00 00 je 801004dc <cprintf+0x13c>
80100436: 83 f8 64 cmp $0x64,%eax
80100439: 74 14 je 8010044f <cprintf+0xaf>
8010043b: e9 aa 00 00 00 jmp 801004ea <cprintf+0x14a>
80100440: 83 f8 73 cmp $0x73,%eax
80100443: 74 57 je 8010049c <cprintf+0xfc>
80100445: 83 f8 78 cmp $0x78,%eax
80100448: 74 2d je 80100477 <cprintf+0xd7>
8010044a: e9 9b 00 00 00 jmp 801004ea <cprintf+0x14a>
case 'd':
printint(*argp++, 10, 1);
8010044f: 8b 45 f0 mov -0x10(%ebp),%eax
80100452: 8d 50 04 lea 0x4(%eax),%edx
80100455: 89 55 f0 mov %edx,-0x10(%ebp)
80100458: 8b 00 mov (%eax),%eax
8010045a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
80100461: 00
80100462: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80100469: 00
8010046a: 89 04 24 mov %eax,(%esp)
8010046d: e8 7f fe ff ff call 801002f1 <printint>
break;
80100472: e9 8b 00 00 00 jmp 80100502 <cprintf+0x162>
case 'x':
case 'p':
printint(*argp++, 16, 0);
80100477: 8b 45 f0 mov -0x10(%ebp),%eax
8010047a: 8d 50 04 lea 0x4(%eax),%edx
8010047d: 89 55 f0 mov %edx,-0x10(%ebp)
80100480: 8b 00 mov (%eax),%eax
80100482: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100489: 00
8010048a: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
80100491: 00
80100492: 89 04 24 mov %eax,(%esp)
80100495: e8 57 fe ff ff call 801002f1 <printint>
break;
8010049a: eb 66 jmp 80100502 <cprintf+0x162>
case 's':
if((s = (char*)*argp++) == 0)
8010049c: 8b 45 f0 mov -0x10(%ebp),%eax
8010049f: 8d 50 04 lea 0x4(%eax),%edx
801004a2: 89 55 f0 mov %edx,-0x10(%ebp)
801004a5: 8b 00 mov (%eax),%eax
801004a7: 89 45 ec mov %eax,-0x14(%ebp)
801004aa: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801004ae: 75 09 jne 801004b9 <cprintf+0x119>
s = "(null)";
801004b0: c7 45 ec 6f 82 10 80 movl $0x8010826f,-0x14(%ebp)
for(; *s; s++)
801004b7: eb 17 jmp 801004d0 <cprintf+0x130>
801004b9: eb 15 jmp 801004d0 <cprintf+0x130>
consputc(*s);
801004bb: 8b 45 ec mov -0x14(%ebp),%eax
801004be: 0f b6 00 movzbl (%eax),%eax
801004c1: 0f be c0 movsbl %al,%eax
801004c4: 89 04 24 mov %eax,(%esp)
801004c7: e8 84 02 00 00 call 80100750 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801004cc: 83 45 ec 01 addl $0x1,-0x14(%ebp)
801004d0: 8b 45 ec mov -0x14(%ebp),%eax
801004d3: 0f b6 00 movzbl (%eax),%eax
801004d6: 84 c0 test %al,%al
801004d8: 75 e1 jne 801004bb <cprintf+0x11b>
consputc(*s);
break;
801004da: eb 26 jmp 80100502 <cprintf+0x162>
case '%':
consputc('%');
801004dc: c7 04 24 25 00 00 00 movl $0x25,(%esp)
801004e3: e8 68 02 00 00 call 80100750 <consputc>
break;
801004e8: eb 18 jmp 80100502 <cprintf+0x162>
default:
// Print unknown % sequence to draw attention.
consputc('%');
801004ea: c7 04 24 25 00 00 00 movl $0x25,(%esp)
801004f1: e8 5a 02 00 00 call 80100750 <consputc>
consputc(c);
801004f6: 8b 45 e4 mov -0x1c(%ebp),%eax
801004f9: 89 04 24 mov %eax,(%esp)
801004fc: e8 4f 02 00 00 call 80100750 <consputc>
break;
80100501: 90 nop
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100502: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100506: 8b 55 08 mov 0x8(%ebp),%edx
80100509: 8b 45 f4 mov -0xc(%ebp),%eax
8010050c: 01 d0 add %edx,%eax
8010050e: 0f b6 00 movzbl (%eax),%eax
80100511: 0f be c0 movsbl %al,%eax
80100514: 25 ff 00 00 00 and $0xff,%eax
80100519: 89 45 e4 mov %eax,-0x1c(%ebp)
8010051c: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100520: 0f 85 bf fe ff ff jne 801003e5 <cprintf+0x45>
consputc(c);
break;
}
}
if(locking)
80100526: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010052a: 74 0c je 80100538 <cprintf+0x198>
release(&cons.lock);
8010052c: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
80100533: e8 8c 45 00 00 call 80104ac4 <release>
}
80100538: c9 leave
80100539: c3 ret
8010053a <panic>:
void
panic(char *s)
{
8010053a: 55 push %ebp
8010053b: 89 e5 mov %esp,%ebp
8010053d: 83 ec 48 sub $0x48,%esp
int i;
uint pcs[10];
cli();
80100540: e8 a6 fd ff ff call 801002eb <cli>
cons.locking = 0;
80100545: c7 05 f4 b5 10 80 00 movl $0x0,0x8010b5f4
8010054c: 00 00 00
cprintf("cpu%d: panic: ", cpu->id);
8010054f: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80100555: 0f b6 00 movzbl (%eax),%eax
80100558: 0f b6 c0 movzbl %al,%eax
8010055b: 89 44 24 04 mov %eax,0x4(%esp)
8010055f: c7 04 24 76 82 10 80 movl $0x80108276,(%esp)
80100566: e8 35 fe ff ff call 801003a0 <cprintf>
cprintf(s);
8010056b: 8b 45 08 mov 0x8(%ebp),%eax
8010056e: 89 04 24 mov %eax,(%esp)
80100571: e8 2a fe ff ff call 801003a0 <cprintf>
cprintf("\n");
80100576: c7 04 24 85 82 10 80 movl $0x80108285,(%esp)
8010057d: e8 1e fe ff ff call 801003a0 <cprintf>
getcallerpcs(&s, pcs);
80100582: 8d 45 cc lea -0x34(%ebp),%eax
80100585: 89 44 24 04 mov %eax,0x4(%esp)
80100589: 8d 45 08 lea 0x8(%ebp),%eax
8010058c: 89 04 24 mov %eax,(%esp)
8010058f: e8 7f 45 00 00 call 80104b13 <getcallerpcs>
for(i=0; i<10; i++)
80100594: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010059b: eb 1b jmp 801005b8 <panic+0x7e>
cprintf(" %p", pcs[i]);
8010059d: 8b 45 f4 mov -0xc(%ebp),%eax
801005a0: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax
801005a4: 89 44 24 04 mov %eax,0x4(%esp)
801005a8: c7 04 24 87 82 10 80 movl $0x80108287,(%esp)
801005af: e8 ec fd ff ff call 801003a0 <cprintf>
cons.locking = 0;
cprintf("cpu%d: panic: ", cpu->id);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801005b4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801005b8: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801005bc: 7e df jle 8010059d <panic+0x63>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801005be: c7 05 a0 b5 10 80 01 movl $0x1,0x8010b5a0
801005c5: 00 00 00
for(;;)
;
801005c8: eb fe jmp 801005c8 <panic+0x8e>
801005ca <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory
static void
cgaputc(int c)
{
801005ca: 55 push %ebp
801005cb: 89 e5 mov %esp,%ebp
801005cd: 83 ec 28 sub $0x28,%esp
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
801005d0: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp)
801005d7: 00
801005d8: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
801005df: e8 e9 fc ff ff call 801002cd <outb>
pos = inb(CRTPORT+1) << 8;
801005e4: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
801005eb: e8 c0 fc ff ff call 801002b0 <inb>
801005f0: 0f b6 c0 movzbl %al,%eax
801005f3: c1 e0 08 shl $0x8,%eax
801005f6: 89 45 f4 mov %eax,-0xc(%ebp)
outb(CRTPORT, 15);
801005f9: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80100600: 00
80100601: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
80100608: e8 c0 fc ff ff call 801002cd <outb>
pos |= inb(CRTPORT+1);
8010060d: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
80100614: e8 97 fc ff ff call 801002b0 <inb>
80100619: 0f b6 c0 movzbl %al,%eax
8010061c: 09 45 f4 or %eax,-0xc(%ebp)
if(c == '\n')
8010061f: 83 7d 08 0a cmpl $0xa,0x8(%ebp)
80100623: 75 30 jne 80100655 <cgaputc+0x8b>
pos += 80 - pos%80;
80100625: 8b 4d f4 mov -0xc(%ebp),%ecx
80100628: ba 67 66 66 66 mov $0x66666667,%edx
8010062d: 89 c8 mov %ecx,%eax
8010062f: f7 ea imul %edx
80100631: c1 fa 05 sar $0x5,%edx
80100634: 89 c8 mov %ecx,%eax
80100636: c1 f8 1f sar $0x1f,%eax
80100639: 29 c2 sub %eax,%edx
8010063b: 89 d0 mov %edx,%eax
8010063d: c1 e0 02 shl $0x2,%eax
80100640: 01 d0 add %edx,%eax
80100642: c1 e0 04 shl $0x4,%eax
80100645: 29 c1 sub %eax,%ecx
80100647: 89 ca mov %ecx,%edx
80100649: b8 50 00 00 00 mov $0x50,%eax
8010064e: 29 d0 sub %edx,%eax
80100650: 01 45 f4 add %eax,-0xc(%ebp)
80100653: eb 35 jmp 8010068a <cgaputc+0xc0>
else if(c == BACKSPACE){
80100655: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010065c: 75 0c jne 8010066a <cgaputc+0xa0>
if(pos > 0) --pos;
8010065e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100662: 7e 26 jle 8010068a <cgaputc+0xc0>
80100664: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100668: eb 20 jmp 8010068a <cgaputc+0xc0>
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
8010066a: 8b 0d 00 90 10 80 mov 0x80109000,%ecx
80100670: 8b 45 f4 mov -0xc(%ebp),%eax
80100673: 8d 50 01 lea 0x1(%eax),%edx
80100676: 89 55 f4 mov %edx,-0xc(%ebp)
80100679: 01 c0 add %eax,%eax
8010067b: 8d 14 01 lea (%ecx,%eax,1),%edx
8010067e: 8b 45 08 mov 0x8(%ebp),%eax
80100681: 0f b6 c0 movzbl %al,%eax
80100684: 80 cc 07 or $0x7,%ah
80100687: 66 89 02 mov %ax,(%edx)
if((pos/80) >= 24){ // Scroll up.
8010068a: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp)
80100691: 7e 53 jle 801006e6 <cgaputc+0x11c>
memmove(crt, crt+80, sizeof(crt[0])*23*80);
80100693: a1 00 90 10 80 mov 0x80109000,%eax
80100698: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx
8010069e: a1 00 90 10 80 mov 0x80109000,%eax
801006a3: c7 44 24 08 60 0e 00 movl $0xe60,0x8(%esp)
801006aa: 00
801006ab: 89 54 24 04 mov %edx,0x4(%esp)
801006af: 89 04 24 mov %eax,(%esp)
801006b2: e8 ce 46 00 00 call 80104d85 <memmove>
pos -= 80;
801006b7: 83 6d f4 50 subl $0x50,-0xc(%ebp)
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
801006bb: b8 80 07 00 00 mov $0x780,%eax
801006c0: 2b 45 f4 sub -0xc(%ebp),%eax
801006c3: 8d 14 00 lea (%eax,%eax,1),%edx
801006c6: a1 00 90 10 80 mov 0x80109000,%eax
801006cb: 8b 4d f4 mov -0xc(%ebp),%ecx
801006ce: 01 c9 add %ecx,%ecx
801006d0: 01 c8 add %ecx,%eax
801006d2: 89 54 24 08 mov %edx,0x8(%esp)
801006d6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801006dd: 00
801006de: 89 04 24 mov %eax,(%esp)
801006e1: e8 d0 45 00 00 call 80104cb6 <memset>
}
outb(CRTPORT, 14);
801006e6: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp)
801006ed: 00
801006ee: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
801006f5: e8 d3 fb ff ff call 801002cd <outb>
outb(CRTPORT+1, pos>>8);
801006fa: 8b 45 f4 mov -0xc(%ebp),%eax
801006fd: c1 f8 08 sar $0x8,%eax
80100700: 0f b6 c0 movzbl %al,%eax
80100703: 89 44 24 04 mov %eax,0x4(%esp)
80100707: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
8010070e: e8 ba fb ff ff call 801002cd <outb>
outb(CRTPORT, 15);
80100713: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
8010071a: 00
8010071b: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
80100722: e8 a6 fb ff ff call 801002cd <outb>
outb(CRTPORT+1, pos);
80100727: 8b 45 f4 mov -0xc(%ebp),%eax
8010072a: 0f b6 c0 movzbl %al,%eax
8010072d: 89 44 24 04 mov %eax,0x4(%esp)
80100731: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
80100738: e8 90 fb ff ff call 801002cd <outb>
crt[pos] = ' ' | 0x0700;
8010073d: a1 00 90 10 80 mov 0x80109000,%eax
80100742: 8b 55 f4 mov -0xc(%ebp),%edx
80100745: 01 d2 add %edx,%edx
80100747: 01 d0 add %edx,%eax
80100749: 66 c7 00 20 07 movw $0x720,(%eax)
}
8010074e: c9 leave
8010074f: c3 ret
80100750 <consputc>:
void
consputc(int c)
{
80100750: 55 push %ebp
80100751: 89 e5 mov %esp,%ebp
80100753: 83 ec 18 sub $0x18,%esp
if(panicked){
80100756: a1 a0 b5 10 80 mov 0x8010b5a0,%eax
8010075b: 85 c0 test %eax,%eax
8010075d: 74 07 je 80100766 <consputc+0x16>
cli();
8010075f: e8 87 fb ff ff call 801002eb <cli>
for(;;)
;
80100764: eb fe jmp 80100764 <consputc+0x14>
}
if(c == BACKSPACE){
80100766: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010076d: 75 26 jne 80100795 <consputc+0x45>
uartputc('\b'); uartputc(' '); uartputc('\b');
8010076f: c7 04 24 08 00 00 00 movl $0x8,(%esp)
80100776: e8 07 61 00 00 call 80106882 <uartputc>
8010077b: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80100782: e8 fb 60 00 00 call 80106882 <uartputc>
80100787: c7 04 24 08 00 00 00 movl $0x8,(%esp)
8010078e: e8 ef 60 00 00 call 80106882 <uartputc>
80100793: eb 0b jmp 801007a0 <consputc+0x50>
} else
uartputc(c);
80100795: 8b 45 08 mov 0x8(%ebp),%eax
80100798: 89 04 24 mov %eax,(%esp)
8010079b: e8 e2 60 00 00 call 80106882 <uartputc>
cgaputc(c);
801007a0: 8b 45 08 mov 0x8(%ebp),%eax
801007a3: 89 04 24 mov %eax,(%esp)
801007a6: e8 1f fe ff ff call 801005ca <cgaputc>
}
801007ab: c9 leave
801007ac: c3 ret
801007ad <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007ad: 55 push %ebp
801007ae: 89 e5 mov %esp,%ebp
801007b0: 83 ec 28 sub $0x28,%esp
int c;
acquire(&input.lock);
801007b3: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
801007ba: e8 a3 42 00 00 call 80104a62 <acquire>
while((c = getc()) >= 0){
801007bf: e9 37 01 00 00 jmp 801008fb <consoleintr+0x14e>
switch(c){
801007c4: 8b 45 f4 mov -0xc(%ebp),%eax
801007c7: 83 f8 10 cmp $0x10,%eax
801007ca: 74 1e je 801007ea <consoleintr+0x3d>
801007cc: 83 f8 10 cmp $0x10,%eax
801007cf: 7f 0a jg 801007db <consoleintr+0x2e>
801007d1: 83 f8 08 cmp $0x8,%eax
801007d4: 74 64 je 8010083a <consoleintr+0x8d>
801007d6: e9 91 00 00 00 jmp 8010086c <consoleintr+0xbf>
801007db: 83 f8 15 cmp $0x15,%eax
801007de: 74 2f je 8010080f <consoleintr+0x62>
801007e0: 83 f8 7f cmp $0x7f,%eax
801007e3: 74 55 je 8010083a <consoleintr+0x8d>
801007e5: e9 82 00 00 00 jmp 8010086c <consoleintr+0xbf>
case C('P'): // Process listing.
procdump();
801007ea: e8 25 41 00 00 call 80104914 <procdump>
break;
801007ef: e9 07 01 00 00 jmp 801008fb <consoleintr+0x14e>
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
801007f4: a1 5c de 10 80 mov 0x8010de5c,%eax
801007f9: 83 e8 01 sub $0x1,%eax
801007fc: a3 5c de 10 80 mov %eax,0x8010de5c
consputc(BACKSPACE);
80100801: c7 04 24 00 01 00 00 movl $0x100,(%esp)
80100808: e8 43 ff ff ff call 80100750 <consputc>
8010080d: eb 01 jmp 80100810 <consoleintr+0x63>
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e != input.w &&
8010080f: 90 nop
80100810: 8b 15 5c de 10 80 mov 0x8010de5c,%edx
80100816: a1 58 de 10 80 mov 0x8010de58,%eax
8010081b: 39 c2 cmp %eax,%edx
8010081d: 74 16 je 80100835 <consoleintr+0x88>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010081f: a1 5c de 10 80 mov 0x8010de5c,%eax
80100824: 83 e8 01 sub $0x1,%eax
80100827: 83 e0 7f and $0x7f,%eax
8010082a: 0f b6 80 d4 dd 10 80 movzbl -0x7fef222c(%eax),%eax
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100831: 3c 0a cmp $0xa,%al
80100833: 75 bf jne 801007f4 <consoleintr+0x47>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
consputc(BACKSPACE);
}
break;
80100835: e9 c1 00 00 00 jmp 801008fb <consoleintr+0x14e>
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
8010083a: 8b 15 5c de 10 80 mov 0x8010de5c,%edx
80100840: a1 58 de 10 80 mov 0x8010de58,%eax
80100845: 39 c2 cmp %eax,%edx
80100847: 74 1e je 80100867 <consoleintr+0xba>
input.e--;
80100849: a1 5c de 10 80 mov 0x8010de5c,%eax
8010084e: 83 e8 01 sub $0x1,%eax
80100851: a3 5c de 10 80 mov %eax,0x8010de5c
consputc(BACKSPACE);
80100856: c7 04 24 00 01 00 00 movl $0x100,(%esp)
8010085d: e8 ee fe ff ff call 80100750 <consputc>
}
break;
80100862: e9 94 00 00 00 jmp 801008fb <consoleintr+0x14e>
80100867: e9 8f 00 00 00 jmp 801008fb <consoleintr+0x14e>
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
8010086c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100870: 0f 84 84 00 00 00 je 801008fa <consoleintr+0x14d>
80100876: 8b 15 5c de 10 80 mov 0x8010de5c,%edx
8010087c: a1 54 de 10 80 mov 0x8010de54,%eax
80100881: 29 c2 sub %eax,%edx
80100883: 89 d0 mov %edx,%eax
80100885: 83 f8 7f cmp $0x7f,%eax
80100888: 77 70 ja 801008fa <consoleintr+0x14d>
c = (c == '\r') ? '\n' : c;
8010088a: 83 7d f4 0d cmpl $0xd,-0xc(%ebp)
8010088e: 74 05 je 80100895 <consoleintr+0xe8>
80100890: 8b 45 f4 mov -0xc(%ebp),%eax
80100893: eb 05 jmp 8010089a <consoleintr+0xed>
80100895: b8 0a 00 00 00 mov $0xa,%eax
8010089a: 89 45 f4 mov %eax,-0xc(%ebp)
input.buf[input.e++ % INPUT_BUF] = c;
8010089d: a1 5c de 10 80 mov 0x8010de5c,%eax
801008a2: 8d 50 01 lea 0x1(%eax),%edx
801008a5: 89 15 5c de 10 80 mov %edx,0x8010de5c
801008ab: 83 e0 7f and $0x7f,%eax
801008ae: 89 c2 mov %eax,%edx
801008b0: 8b 45 f4 mov -0xc(%ebp),%eax
801008b3: 88 82 d4 dd 10 80 mov %al,-0x7fef222c(%edx)
consputc(c);
801008b9: 8b 45 f4 mov -0xc(%ebp),%eax
801008bc: 89 04 24 mov %eax,(%esp)
801008bf: e8 8c fe ff ff call 80100750 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008c4: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
801008c8: 74 18 je 801008e2 <consoleintr+0x135>
801008ca: 83 7d f4 04 cmpl $0x4,-0xc(%ebp)
801008ce: 74 12 je 801008e2 <consoleintr+0x135>
801008d0: a1 5c de 10 80 mov 0x8010de5c,%eax
801008d5: 8b 15 54 de 10 80 mov 0x8010de54,%edx
801008db: 83 ea 80 sub $0xffffff80,%edx
801008de: 39 d0 cmp %edx,%eax
801008e0: 75 18 jne 801008fa <consoleintr+0x14d>
input.w = input.e;
801008e2: a1 5c de 10 80 mov 0x8010de5c,%eax
801008e7: a3 58 de 10 80 mov %eax,0x8010de58
wakeup(&input.r);
801008ec: c7 04 24 54 de 10 80 movl $0x8010de54,(%esp)
801008f3: e8 79 3f 00 00 call 80104871 <wakeup>
}
}
break;
801008f8: eb 00 jmp 801008fa <consoleintr+0x14d>
801008fa: 90 nop
consoleintr(int (*getc)(void))
{
int c;
acquire(&input.lock);
while((c = getc()) >= 0){
801008fb: 8b 45 08 mov 0x8(%ebp),%eax
801008fe: ff d0 call *%eax
80100900: 89 45 f4 mov %eax,-0xc(%ebp)
80100903: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100907: 0f 89 b7 fe ff ff jns 801007c4 <consoleintr+0x17>
}
}
break;
}
}
release(&input.lock);
8010090d: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
80100914: e8 ab 41 00 00 call 80104ac4 <release>
}
80100919: c9 leave
8010091a: c3 ret
8010091b <consoleread>:
int
consoleread(struct inode *ip, char *dst, int n)
{
8010091b: 55 push %ebp
8010091c: 89 e5 mov %esp,%ebp
8010091e: 83 ec 28 sub $0x28,%esp
uint target;
int c;
iunlock(ip);
80100921: 8b 45 08 mov 0x8(%ebp),%eax
80100924: 89 04 24 mov %eax,(%esp)
80100927: e8 69 10 00 00 call 80101995 <iunlock>
target = n;
8010092c: 8b 45 10 mov 0x10(%ebp),%eax
8010092f: 89 45 f4 mov %eax,-0xc(%ebp)
acquire(&input.lock);
80100932: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
80100939: e8 24 41 00 00 call 80104a62 <acquire>
while(n > 0){
8010093e: e9 aa 00 00 00 jmp 801009ed <consoleread+0xd2>
while(input.r == input.w){
80100943: eb 42 jmp 80100987 <consoleread+0x6c>
if(proc->killed){
80100945: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010094b: 8b 40 24 mov 0x24(%eax),%eax
8010094e: 85 c0 test %eax,%eax
80100950: 74 21 je 80100973 <consoleread+0x58>
release(&input.lock);
80100952: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
80100959: e8 66 41 00 00 call 80104ac4 <release>
ilock(ip);
8010095e: 8b 45 08 mov 0x8(%ebp),%eax
80100961: 89 04 24 mov %eax,(%esp)
80100964: e8 de 0e 00 00 call 80101847 <ilock>
return -1;
80100969: b8 ff ff ff ff mov $0xffffffff,%eax
8010096e: e9 a5 00 00 00 jmp 80100a18 <consoleread+0xfd>
}
sleep(&input.r, &input.lock);
80100973: c7 44 24 04 a0 dd 10 movl $0x8010dda0,0x4(%esp)
8010097a: 80
8010097b: c7 04 24 54 de 10 80 movl $0x8010de54,(%esp)
80100982: e8 11 3e 00 00 call 80104798 <sleep>
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
while(input.r == input.w){
80100987: 8b 15 54 de 10 80 mov 0x8010de54,%edx
8010098d: a1 58 de 10 80 mov 0x8010de58,%eax
80100992: 39 c2 cmp %eax,%edx
80100994: 74 af je 80100945 <consoleread+0x2a>
ilock(ip);
return -1;
}
sleep(&input.r, &input.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
80100996: a1 54 de 10 80 mov 0x8010de54,%eax
8010099b: 8d 50 01 lea 0x1(%eax),%edx
8010099e: 89 15 54 de 10 80 mov %edx,0x8010de54
801009a4: 83 e0 7f and $0x7f,%eax
801009a7: 0f b6 80 d4 dd 10 80 movzbl -0x7fef222c(%eax),%eax
801009ae: 0f be c0 movsbl %al,%eax
801009b1: 89 45 f0 mov %eax,-0x10(%ebp)
if(c == C('D')){ // EOF
801009b4: 83 7d f0 04 cmpl $0x4,-0x10(%ebp)
801009b8: 75 19 jne 801009d3 <consoleread+0xb8>
if(n < target){
801009ba: 8b 45 10 mov 0x10(%ebp),%eax
801009bd: 3b 45 f4 cmp -0xc(%ebp),%eax
801009c0: 73 0f jae 801009d1 <consoleread+0xb6>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
801009c2: a1 54 de 10 80 mov 0x8010de54,%eax
801009c7: 83 e8 01 sub $0x1,%eax
801009ca: a3 54 de 10 80 mov %eax,0x8010de54
}
break;
801009cf: eb 26 jmp 801009f7 <consoleread+0xdc>
801009d1: eb 24 jmp 801009f7 <consoleread+0xdc>
}
*dst++ = c;
801009d3: 8b 45 0c mov 0xc(%ebp),%eax
801009d6: 8d 50 01 lea 0x1(%eax),%edx
801009d9: 89 55 0c mov %edx,0xc(%ebp)
801009dc: 8b 55 f0 mov -0x10(%ebp),%edx
801009df: 88 10 mov %dl,(%eax)
--n;
801009e1: 83 6d 10 01 subl $0x1,0x10(%ebp)
if(c == '\n')
801009e5: 83 7d f0 0a cmpl $0xa,-0x10(%ebp)
801009e9: 75 02 jne 801009ed <consoleread+0xd2>
break;
801009eb: eb 0a jmp 801009f7 <consoleread+0xdc>
int c;
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
801009ed: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801009f1: 0f 8f 4c ff ff ff jg 80100943 <consoleread+0x28>
*dst++ = c;
--n;
if(c == '\n')
break;
}
release(&input.lock);
801009f7: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
801009fe: e8 c1 40 00 00 call 80104ac4 <release>
ilock(ip);
80100a03: 8b 45 08 mov 0x8(%ebp),%eax
80100a06: 89 04 24 mov %eax,(%esp)
80100a09: e8 39 0e 00 00 call 80101847 <ilock>
return target - n;
80100a0e: 8b 45 10 mov 0x10(%ebp),%eax
80100a11: 8b 55 f4 mov -0xc(%ebp),%edx
80100a14: 29 c2 sub %eax,%edx
80100a16: 89 d0 mov %edx,%eax
}
80100a18: c9 leave
80100a19: c3 ret
80100a1a <consolewrite>:
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a1a: 55 push %ebp
80100a1b: 89 e5 mov %esp,%ebp
80100a1d: 83 ec 28 sub $0x28,%esp
int i;
iunlock(ip);
80100a20: 8b 45 08 mov 0x8(%ebp),%eax
80100a23: 89 04 24 mov %eax,(%esp)
80100a26: e8 6a 0f 00 00 call 80101995 <iunlock>
acquire(&cons.lock);
80100a2b: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
80100a32: e8 2b 40 00 00 call 80104a62 <acquire>
for(i = 0; i < n; i++)
80100a37: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80100a3e: eb 1d jmp 80100a5d <consolewrite+0x43>
consputc(buf[i] & 0xff);
80100a40: 8b 55 f4 mov -0xc(%ebp),%edx
80100a43: 8b 45 0c mov 0xc(%ebp),%eax
80100a46: 01 d0 add %edx,%eax
80100a48: 0f b6 00 movzbl (%eax),%eax
80100a4b: 0f be c0 movsbl %al,%eax
80100a4e: 0f b6 c0 movzbl %al,%eax
80100a51: 89 04 24 mov %eax,(%esp)
80100a54: e8 f7 fc ff ff call 80100750 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
80100a59: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100a5d: 8b 45 f4 mov -0xc(%ebp),%eax
80100a60: 3b 45 10 cmp 0x10(%ebp),%eax
80100a63: 7c db jl 80100a40 <consolewrite+0x26>
consputc(buf[i] & 0xff);
release(&cons.lock);
80100a65: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
80100a6c: e8 53 40 00 00 call 80104ac4 <release>
ilock(ip);
80100a71: 8b 45 08 mov 0x8(%ebp),%eax
80100a74: 89 04 24 mov %eax,(%esp)
80100a77: e8 cb 0d 00 00 call 80101847 <ilock>
return n;
80100a7c: 8b 45 10 mov 0x10(%ebp),%eax
}
80100a7f: c9 leave
80100a80: c3 ret
80100a81 <consoleinit>:
void
consoleinit(void)
{
80100a81: 55 push %ebp
80100a82: 89 e5 mov %esp,%ebp
80100a84: 83 ec 18 sub $0x18,%esp
initlock(&cons.lock, "console");
80100a87: c7 44 24 04 8b 82 10 movl $0x8010828b,0x4(%esp)
80100a8e: 80
80100a8f: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp)
80100a96: e8 a6 3f 00 00 call 80104a41 <initlock>
initlock(&input.lock, "input");
80100a9b: c7 44 24 04 93 82 10 movl $0x80108293,0x4(%esp)
80100aa2: 80
80100aa3: c7 04 24 a0 dd 10 80 movl $0x8010dda0,(%esp)
80100aaa: e8 92 3f 00 00 call 80104a41 <initlock>
devsw[CONSOLE].write = consolewrite;
80100aaf: c7 05 0c e8 10 80 1a movl $0x80100a1a,0x8010e80c
80100ab6: 0a 10 80
devsw[CONSOLE].read = consoleread;
80100ab9: c7 05 08 e8 10 80 1b movl $0x8010091b,0x8010e808
80100ac0: 09 10 80
cons.locking = 1;
80100ac3: c7 05 f4 b5 10 80 01 movl $0x1,0x8010b5f4
80100aca: 00 00 00
picenable(IRQ_KBD);
80100acd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100ad4: e8 75 2f 00 00 call 80103a4e <picenable>
ioapicenable(IRQ_KBD, 0);
80100ad9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80100ae0: 00
80100ae1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100ae8: e8 5c 1e 00 00 call 80102949 <ioapicenable>
}
80100aed: c9 leave
80100aee: c3 ret
80100aef <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
80100aef: 55 push %ebp
80100af0: 89 e5 mov %esp,%ebp
80100af2: 81 ec 38 01 00 00 sub $0x138,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
if((ip = namei(path)) == 0)
80100af8: 8b 45 08 mov 0x8(%ebp),%eax
80100afb: 89 04 24 mov %eax,(%esp)
80100afe: e8 ef 18 00 00 call 801023f2 <namei>
80100b03: 89 45 d8 mov %eax,-0x28(%ebp)
80100b06: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100b0a: 75 0a jne 80100b16 <exec+0x27>
return -1;
80100b0c: b8 ff ff ff ff mov $0xffffffff,%eax
80100b11: e9 de 03 00 00 jmp 80100ef4 <exec+0x405>
ilock(ip);
80100b16: 8b 45 d8 mov -0x28(%ebp),%eax
80100b19: 89 04 24 mov %eax,(%esp)
80100b1c: e8 26 0d 00 00 call 80101847 <ilock>
pgdir = 0;
80100b21: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b28: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
80100b2f: 00
80100b30: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100b37: 00
80100b38: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax
80100b3e: 89 44 24 04 mov %eax,0x4(%esp)
80100b42: 8b 45 d8 mov -0x28(%ebp),%eax
80100b45: 89 04 24 mov %eax,(%esp)
80100b48: e8 07 12 00 00 call 80101d54 <readi>
80100b4d: 83 f8 33 cmp $0x33,%eax
80100b50: 77 05 ja 80100b57 <exec+0x68>
goto bad;
80100b52: e9 76 03 00 00 jmp 80100ecd <exec+0x3de>
if(elf.magic != ELF_MAGIC)
80100b57: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100b5d: 3d 7f 45 4c 46 cmp $0x464c457f,%eax
80100b62: 74 05 je 80100b69 <exec+0x7a>
goto bad;
80100b64: e9 64 03 00 00 jmp 80100ecd <exec+0x3de>
if((pgdir = setupkvm()) == 0)
80100b69: e8 65 6e 00 00 call 801079d3 <setupkvm>
80100b6e: 89 45 d4 mov %eax,-0x2c(%ebp)
80100b71: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100b75: 75 05 jne 80100b7c <exec+0x8d>
goto bad;
80100b77: e9 51 03 00 00 jmp 80100ecd <exec+0x3de>
// Load program into memory.
sz = 0;
80100b7c: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100b83: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
80100b8a: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax
80100b90: 89 45 e8 mov %eax,-0x18(%ebp)
80100b93: e9 cb 00 00 00 jmp 80100c63 <exec+0x174>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100b98: 8b 45 e8 mov -0x18(%ebp),%eax
80100b9b: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
80100ba2: 00
80100ba3: 89 44 24 08 mov %eax,0x8(%esp)
80100ba7: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax
80100bad: 89 44 24 04 mov %eax,0x4(%esp)
80100bb1: 8b 45 d8 mov -0x28(%ebp),%eax
80100bb4: 89 04 24 mov %eax,(%esp)
80100bb7: e8 98 11 00 00 call 80101d54 <readi>
80100bbc: 83 f8 20 cmp $0x20,%eax
80100bbf: 74 05 je 80100bc6 <exec+0xd7>
goto bad;
80100bc1: e9 07 03 00 00 jmp 80100ecd <exec+0x3de>
if(ph.type != ELF_PROG_LOAD)
80100bc6: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
80100bcc: 83 f8 01 cmp $0x1,%eax
80100bcf: 74 05 je 80100bd6 <exec+0xe7>
continue;
80100bd1: e9 80 00 00 00 jmp 80100c56 <exec+0x167>
if(ph.memsz < ph.filesz)
80100bd6: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx
80100bdc: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax
80100be2: 39 c2 cmp %eax,%edx
80100be4: 73 05 jae 80100beb <exec+0xfc>
goto bad;
80100be6: e9 e2 02 00 00 jmp 80100ecd <exec+0x3de>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100beb: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx
80100bf1: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax
80100bf7: 01 d0 add %edx,%eax
80100bf9: 89 44 24 08 mov %eax,0x8(%esp)
80100bfd: 8b 45 e0 mov -0x20(%ebp),%eax
80100c00: 89 44 24 04 mov %eax,0x4(%esp)
80100c04: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c07: 89 04 24 mov %eax,(%esp)
80100c0a: e8 92 71 00 00 call 80107da1 <allocuvm>
80100c0f: 89 45 e0 mov %eax,-0x20(%ebp)
80100c12: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100c16: 75 05 jne 80100c1d <exec+0x12e>
goto bad;
80100c18: e9 b0 02 00 00 jmp 80100ecd <exec+0x3de>
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c1d: 8b 8d fc fe ff ff mov -0x104(%ebp),%ecx
80100c23: 8b 95 f0 fe ff ff mov -0x110(%ebp),%edx
80100c29: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c2f: 89 4c 24 10 mov %ecx,0x10(%esp)
80100c33: 89 54 24 0c mov %edx,0xc(%esp)
80100c37: 8b 55 d8 mov -0x28(%ebp),%edx
80100c3a: 89 54 24 08 mov %edx,0x8(%esp)
80100c3e: 89 44 24 04 mov %eax,0x4(%esp)
80100c42: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c45: 89 04 24 mov %eax,(%esp)
80100c48: e8 69 70 00 00 call 80107cb6 <loaduvm>
80100c4d: 85 c0 test %eax,%eax
80100c4f: 79 05 jns 80100c56 <exec+0x167>
goto bad;
80100c51: e9 77 02 00 00 jmp 80100ecd <exec+0x3de>
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c56: 83 45 ec 01 addl $0x1,-0x14(%ebp)
80100c5a: 8b 45 e8 mov -0x18(%ebp),%eax
80100c5d: 83 c0 20 add $0x20,%eax
80100c60: 89 45 e8 mov %eax,-0x18(%ebp)
80100c63: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax
80100c6a: 0f b7 c0 movzwl %ax,%eax
80100c6d: 3b 45 ec cmp -0x14(%ebp),%eax
80100c70: 0f 8f 22 ff ff ff jg 80100b98 <exec+0xa9>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100c76: 8b 45 d8 mov -0x28(%ebp),%eax
80100c79: 89 04 24 mov %eax,(%esp)
80100c7c: e8 4a 0e 00 00 call 80101acb <iunlockput>
ip = 0;
80100c81: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100c88: 8b 45 e0 mov -0x20(%ebp),%eax
80100c8b: 05 ff 0f 00 00 add $0xfff,%eax
80100c90: 25 00 f0 ff ff and $0xfffff000,%eax
80100c95: 89 45 e0 mov %eax,-0x20(%ebp)
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100c98: 8b 45 e0 mov -0x20(%ebp),%eax
80100c9b: 05 00 20 00 00 add $0x2000,%eax
80100ca0: 89 44 24 08 mov %eax,0x8(%esp)
80100ca4: 8b 45 e0 mov -0x20(%ebp),%eax
80100ca7: 89 44 24 04 mov %eax,0x4(%esp)
80100cab: 8b 45 d4 mov -0x2c(%ebp),%eax
80100cae: 89 04 24 mov %eax,(%esp)
80100cb1: e8 eb 70 00 00 call 80107da1 <allocuvm>
80100cb6: 89 45 e0 mov %eax,-0x20(%ebp)
80100cb9: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100cbd: 75 05 jne 80100cc4 <exec+0x1d5>
goto bad;
80100cbf: e9 09 02 00 00 jmp 80100ecd <exec+0x3de>
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cc4: 8b 45 e0 mov -0x20(%ebp),%eax
80100cc7: 2d 00 20 00 00 sub $0x2000,%eax
80100ccc: 89 44 24 04 mov %eax,0x4(%esp)
80100cd0: 8b 45 d4 mov -0x2c(%ebp),%eax
80100cd3: 89 04 24 mov %eax,(%esp)
80100cd6: e8 f6 72 00 00 call 80107fd1 <clearpteu>
sp = sz;
80100cdb: 8b 45 e0 mov -0x20(%ebp),%eax
80100cde: 89 45 dc mov %eax,-0x24(%ebp)
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100ce1: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80100ce8: e9 9a 00 00 00 jmp 80100d87 <exec+0x298>
if(argc >= MAXARG)
80100ced: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp)
80100cf1: 76 05 jbe 80100cf8 <exec+0x209>
goto bad;
80100cf3: e9 d5 01 00 00 jmp 80100ecd <exec+0x3de>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100cf8: 8b 45 e4 mov -0x1c(%ebp),%eax
80100cfb: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d02: 8b 45 0c mov 0xc(%ebp),%eax
80100d05: 01 d0 add %edx,%eax
80100d07: 8b 00 mov (%eax),%eax
80100d09: 89 04 24 mov %eax,(%esp)
80100d0c: e8 0f 42 00 00 call 80104f20 <strlen>
80100d11: 8b 55 dc mov -0x24(%ebp),%edx
80100d14: 29 c2 sub %eax,%edx
80100d16: 89 d0 mov %edx,%eax
80100d18: 83 e8 01 sub $0x1,%eax
80100d1b: 83 e0 fc and $0xfffffffc,%eax
80100d1e: 89 45 dc mov %eax,-0x24(%ebp)
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d21: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d24: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d2b: 8b 45 0c mov 0xc(%ebp),%eax
80100d2e: 01 d0 add %edx,%eax
80100d30: 8b 00 mov (%eax),%eax
80100d32: 89 04 24 mov %eax,(%esp)
80100d35: e8 e6 41 00 00 call 80104f20 <strlen>
80100d3a: 83 c0 01 add $0x1,%eax
80100d3d: 89 c2 mov %eax,%edx
80100d3f: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d42: 8d 0c 85 00 00 00 00 lea 0x0(,%eax,4),%ecx
80100d49: 8b 45 0c mov 0xc(%ebp),%eax
80100d4c: 01 c8 add %ecx,%eax
80100d4e: 8b 00 mov (%eax),%eax
80100d50: 89 54 24 0c mov %edx,0xc(%esp)
80100d54: 89 44 24 08 mov %eax,0x8(%esp)
80100d58: 8b 45 dc mov -0x24(%ebp),%eax
80100d5b: 89 44 24 04 mov %eax,0x4(%esp)
80100d5f: 8b 45 d4 mov -0x2c(%ebp),%eax
80100d62: 89 04 24 mov %eax,(%esp)
80100d65: e8 2c 74 00 00 call 80108196 <copyout>
80100d6a: 85 c0 test %eax,%eax
80100d6c: 79 05 jns 80100d73 <exec+0x284>
goto bad;
80100d6e: e9 5a 01 00 00 jmp 80100ecd <exec+0x3de>
ustack[3+argc] = sp;
80100d73: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d76: 8d 50 03 lea 0x3(%eax),%edx
80100d79: 8b 45 dc mov -0x24(%ebp),%eax
80100d7c: 89 84 95 40 ff ff ff mov %eax,-0xc0(%ebp,%edx,4)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100d83: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
80100d87: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d8a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d91: 8b 45 0c mov 0xc(%ebp),%eax
80100d94: 01 d0 add %edx,%eax
80100d96: 8b 00 mov (%eax),%eax
80100d98: 85 c0 test %eax,%eax
80100d9a: 0f 85 4d ff ff ff jne 80100ced <exec+0x1fe>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
80100da0: 8b 45 e4 mov -0x1c(%ebp),%eax
80100da3: 83 c0 03 add $0x3,%eax
80100da6: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4)
80100dad: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100db1: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp)
80100db8: ff ff ff
ustack[1] = argc;
80100dbb: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dbe: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100dc4: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dc7: 83 c0 01 add $0x1,%eax
80100dca: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100dd1: 8b 45 dc mov -0x24(%ebp),%eax
80100dd4: 29 d0 sub %edx,%eax
80100dd6: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp)
sp -= (3+argc+1) * 4;
80100ddc: 8b 45 e4 mov -0x1c(%ebp),%eax
80100ddf: 83 c0 04 add $0x4,%eax
80100de2: c1 e0 02 shl $0x2,%eax
80100de5: 29 45 dc sub %eax,-0x24(%ebp)
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100de8: 8b 45 e4 mov -0x1c(%ebp),%eax
80100deb: 83 c0 04 add $0x4,%eax
80100dee: c1 e0 02 shl $0x2,%eax
80100df1: 89 44 24 0c mov %eax,0xc(%esp)
80100df5: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax
80100dfb: 89 44 24 08 mov %eax,0x8(%esp)
80100dff: 8b 45 dc mov -0x24(%ebp),%eax
80100e02: 89 44 24 04 mov %eax,0x4(%esp)
80100e06: 8b 45 d4 mov -0x2c(%ebp),%eax
80100e09: 89 04 24 mov %eax,(%esp)
80100e0c: e8 85 73 00 00 call 80108196 <copyout>
80100e11: 85 c0 test %eax,%eax
80100e13: 79 05 jns 80100e1a <exec+0x32b>
goto bad;
80100e15: e9 b3 00 00 00 jmp 80100ecd <exec+0x3de>
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e1a: 8b 45 08 mov 0x8(%ebp),%eax
80100e1d: 89 45 f4 mov %eax,-0xc(%ebp)
80100e20: 8b 45 f4 mov -0xc(%ebp),%eax
80100e23: 89 45 f0 mov %eax,-0x10(%ebp)
80100e26: eb 17 jmp 80100e3f <exec+0x350>
if(*s == '/')
80100e28: 8b 45 f4 mov -0xc(%ebp),%eax
80100e2b: 0f b6 00 movzbl (%eax),%eax
80100e2e: 3c 2f cmp $0x2f,%al
80100e30: 75 09 jne 80100e3b <exec+0x34c>
last = s+1;
80100e32: 8b 45 f4 mov -0xc(%ebp),%eax
80100e35: 83 c0 01 add $0x1,%eax
80100e38: 89 45 f0 mov %eax,-0x10(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e3b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100e3f: 8b 45 f4 mov -0xc(%ebp),%eax
80100e42: 0f b6 00 movzbl (%eax),%eax
80100e45: 84 c0 test %al,%al
80100e47: 75 df jne 80100e28 <exec+0x339>
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100e49: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e4f: 8d 50 6c lea 0x6c(%eax),%edx
80100e52: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80100e59: 00
80100e5a: 8b 45 f0 mov -0x10(%ebp),%eax
80100e5d: 89 44 24 04 mov %eax,0x4(%esp)
80100e61: 89 14 24 mov %edx,(%esp)
80100e64: e8 6d 40 00 00 call 80104ed6 <safestrcpy>
// Commit to the user image.
oldpgdir = proc->pgdir;
80100e69: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e6f: 8b 40 04 mov 0x4(%eax),%eax
80100e72: 89 45 d0 mov %eax,-0x30(%ebp)
proc->pgdir = pgdir;
80100e75: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e7b: 8b 55 d4 mov -0x2c(%ebp),%edx
80100e7e: 89 50 04 mov %edx,0x4(%eax)
proc->sz = sz;
80100e81: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e87: 8b 55 e0 mov -0x20(%ebp),%edx
80100e8a: 89 10 mov %edx,(%eax)
proc->tf->eip = elf.entry; // main
80100e8c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e92: 8b 40 18 mov 0x18(%eax),%eax
80100e95: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx
80100e9b: 89 50 38 mov %edx,0x38(%eax)
proc->tf->esp = sp;
80100e9e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ea4: 8b 40 18 mov 0x18(%eax),%eax
80100ea7: 8b 55 dc mov -0x24(%ebp),%edx
80100eaa: 89 50 44 mov %edx,0x44(%eax)
switchuvm(proc);
80100ead: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100eb3: 89 04 24 mov %eax,(%esp)
80100eb6: e8 09 6c 00 00 call 80107ac4 <switchuvm>
freevm(oldpgdir);
80100ebb: 8b 45 d0 mov -0x30(%ebp),%eax
80100ebe: 89 04 24 mov %eax,(%esp)
80100ec1: e8 71 70 00 00 call 80107f37 <freevm>
return 0;
80100ec6: b8 00 00 00 00 mov $0x0,%eax
80100ecb: eb 27 jmp 80100ef4 <exec+0x405>
bad:
if(pgdir)
80100ecd: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100ed1: 74 0b je 80100ede <exec+0x3ef>
freevm(pgdir);
80100ed3: 8b 45 d4 mov -0x2c(%ebp),%eax
80100ed6: 89 04 24 mov %eax,(%esp)
80100ed9: e8 59 70 00 00 call 80107f37 <freevm>
if(ip)
80100ede: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100ee2: 74 0b je 80100eef <exec+0x400>
iunlockput(ip);
80100ee4: 8b 45 d8 mov -0x28(%ebp),%eax
80100ee7: 89 04 24 mov %eax,(%esp)
80100eea: e8 dc 0b 00 00 call 80101acb <iunlockput>
return -1;
80100eef: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100ef4: c9 leave
80100ef5: c3 ret
80100ef6 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100ef6: 55 push %ebp
80100ef7: 89 e5 mov %esp,%ebp
80100ef9: 83 ec 18 sub $0x18,%esp
initlock(&ftable.lock, "ftable");
80100efc: c7 44 24 04 99 82 10 movl $0x80108299,0x4(%esp)
80100f03: 80
80100f04: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100f0b: e8 31 3b 00 00 call 80104a41 <initlock>
}
80100f10: c9 leave
80100f11: c3 ret
80100f12 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100f12: 55 push %ebp
80100f13: 89 e5 mov %esp,%ebp
80100f15: 83 ec 28 sub $0x28,%esp
struct file *f;
acquire(&ftable.lock);
80100f18: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100f1f: e8 3e 3b 00 00 call 80104a62 <acquire>
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f24: c7 45 f4 94 de 10 80 movl $0x8010de94,-0xc(%ebp)
80100f2b: eb 29 jmp 80100f56 <filealloc+0x44>
if(f->ref == 0){
80100f2d: 8b 45 f4 mov -0xc(%ebp),%eax
80100f30: 8b 40 04 mov 0x4(%eax),%eax
80100f33: 85 c0 test %eax,%eax
80100f35: 75 1b jne 80100f52 <filealloc+0x40>
f->ref = 1;
80100f37: 8b 45 f4 mov -0xc(%ebp),%eax
80100f3a: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax)
release(&ftable.lock);
80100f41: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100f48: e8 77 3b 00 00 call 80104ac4 <release>
return f;
80100f4d: 8b 45 f4 mov -0xc(%ebp),%eax
80100f50: eb 1e jmp 80100f70 <filealloc+0x5e>
filealloc(void)
{
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f52: 83 45 f4 18 addl $0x18,-0xc(%ebp)
80100f56: 81 7d f4 f4 e7 10 80 cmpl $0x8010e7f4,-0xc(%ebp)
80100f5d: 72 ce jb 80100f2d <filealloc+0x1b>
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100f5f: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100f66: e8 59 3b 00 00 call 80104ac4 <release>
return 0;
80100f6b: b8 00 00 00 00 mov $0x0,%eax
}
80100f70: c9 leave
80100f71: c3 ret
80100f72 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100f72: 55 push %ebp
80100f73: 89 e5 mov %esp,%ebp
80100f75: 83 ec 18 sub $0x18,%esp
acquire(&ftable.lock);
80100f78: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100f7f: e8 de 3a 00 00 call 80104a62 <acquire>
if(f->ref < 1)
80100f84: 8b 45 08 mov 0x8(%ebp),%eax
80100f87: 8b 40 04 mov 0x4(%eax),%eax
80100f8a: 85 c0 test %eax,%eax
80100f8c: 7f 0c jg 80100f9a <filedup+0x28>
panic("filedup");
80100f8e: c7 04 24 a0 82 10 80 movl $0x801082a0,(%esp)
80100f95: e8 a0 f5 ff ff call 8010053a <panic>
f->ref++;
80100f9a: 8b 45 08 mov 0x8(%ebp),%eax
80100f9d: 8b 40 04 mov 0x4(%eax),%eax
80100fa0: 8d 50 01 lea 0x1(%eax),%edx
80100fa3: 8b 45 08 mov 0x8(%ebp),%eax
80100fa6: 89 50 04 mov %edx,0x4(%eax)
release(&ftable.lock);
80100fa9: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100fb0: e8 0f 3b 00 00 call 80104ac4 <release>
return f;
80100fb5: 8b 45 08 mov 0x8(%ebp),%eax
}
80100fb8: c9 leave
80100fb9: c3 ret
80100fba <fileclose>:
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fba: 55 push %ebp
80100fbb: 89 e5 mov %esp,%ebp
80100fbd: 83 ec 38 sub $0x38,%esp
struct file ff;
acquire(&ftable.lock);
80100fc0: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80100fc7: e8 96 3a 00 00 call 80104a62 <acquire>
if(f->ref < 1)
80100fcc: 8b 45 08 mov 0x8(%ebp),%eax
80100fcf: 8b 40 04 mov 0x4(%eax),%eax
80100fd2: 85 c0 test %eax,%eax
80100fd4: 7f 0c jg 80100fe2 <fileclose+0x28>
panic("fileclose");
80100fd6: c7 04 24 a8 82 10 80 movl $0x801082a8,(%esp)
80100fdd: e8 58 f5 ff ff call 8010053a <panic>
if(--f->ref > 0){
80100fe2: 8b 45 08 mov 0x8(%ebp),%eax
80100fe5: 8b 40 04 mov 0x4(%eax),%eax
80100fe8: 8d 50 ff lea -0x1(%eax),%edx
80100feb: 8b 45 08 mov 0x8(%ebp),%eax
80100fee: 89 50 04 mov %edx,0x4(%eax)
80100ff1: 8b 45 08 mov 0x8(%ebp),%eax
80100ff4: 8b 40 04 mov 0x4(%eax),%eax
80100ff7: 85 c0 test %eax,%eax
80100ff9: 7e 11 jle 8010100c <fileclose+0x52>
release(&ftable.lock);
80100ffb: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
80101002: e8 bd 3a 00 00 call 80104ac4 <release>
80101007: e9 82 00 00 00 jmp 8010108e <fileclose+0xd4>
return;
}
ff = *f;
8010100c: 8b 45 08 mov 0x8(%ebp),%eax
8010100f: 8b 10 mov (%eax),%edx
80101011: 89 55 e0 mov %edx,-0x20(%ebp)
80101014: 8b 50 04 mov 0x4(%eax),%edx
80101017: 89 55 e4 mov %edx,-0x1c(%ebp)
8010101a: 8b 50 08 mov 0x8(%eax),%edx
8010101d: 89 55 e8 mov %edx,-0x18(%ebp)
80101020: 8b 50 0c mov 0xc(%eax),%edx
80101023: 89 55 ec mov %edx,-0x14(%ebp)
80101026: 8b 50 10 mov 0x10(%eax),%edx
80101029: 89 55 f0 mov %edx,-0x10(%ebp)
8010102c: 8b 40 14 mov 0x14(%eax),%eax
8010102f: 89 45 f4 mov %eax,-0xc(%ebp)
f->ref = 0;
80101032: 8b 45 08 mov 0x8(%ebp),%eax
80101035: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
f->type = FD_NONE;
8010103c: 8b 45 08 mov 0x8(%ebp),%eax
8010103f: c7 00 00 00 00 00 movl $0x0,(%eax)
release(&ftable.lock);
80101045: c7 04 24 60 de 10 80 movl $0x8010de60,(%esp)
8010104c: e8 73 3a 00 00 call 80104ac4 <release>
if(ff.type == FD_PIPE)
80101051: 8b 45 e0 mov -0x20(%ebp),%eax
80101054: 83 f8 01 cmp $0x1,%eax
80101057: 75 18 jne 80101071 <fileclose+0xb7>
pipeclose(ff.pipe, ff.writable);
80101059: 0f b6 45 e9 movzbl -0x17(%ebp),%eax
8010105d: 0f be d0 movsbl %al,%edx
80101060: 8b 45 ec mov -0x14(%ebp),%eax
80101063: 89 54 24 04 mov %edx,0x4(%esp)
80101067: 89 04 24 mov %eax,(%esp)
8010106a: e8 8f 2c 00 00 call 80103cfe <pipeclose>
8010106f: eb 1d jmp 8010108e <fileclose+0xd4>
else if(ff.type == FD_INODE){
80101071: 8b 45 e0 mov -0x20(%ebp),%eax
80101074: 83 f8 02 cmp $0x2,%eax
80101077: 75 15 jne 8010108e <fileclose+0xd4>
begin_trans();
80101079: e8 53 21 00 00 call 801031d1 <begin_trans>
iput(ff.ip);
8010107e: 8b 45 f0 mov -0x10(%ebp),%eax
80101081: 89 04 24 mov %eax,(%esp)
80101084: e8 71 09 00 00 call 801019fa <iput>
commit_trans();
80101089: e8 8c 21 00 00 call 8010321a <commit_trans>
}
}
8010108e: c9 leave
8010108f: c3 ret
80101090 <filestat>:
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80101090: 55 push %ebp
80101091: 89 e5 mov %esp,%ebp
80101093: 83 ec 18 sub $0x18,%esp
if(f->type == FD_INODE){
80101096: 8b 45 08 mov 0x8(%ebp),%eax
80101099: 8b 00 mov (%eax),%eax
8010109b: 83 f8 02 cmp $0x2,%eax
8010109e: 75 38 jne 801010d8 <filestat+0x48>
ilock(f->ip);
801010a0: 8b 45 08 mov 0x8(%ebp),%eax
801010a3: 8b 40 10 mov 0x10(%eax),%eax
801010a6: 89 04 24 mov %eax,(%esp)
801010a9: e8 99 07 00 00 call 80101847 <ilock>
stati(f->ip, st);
801010ae: 8b 45 08 mov 0x8(%ebp),%eax
801010b1: 8b 40 10 mov 0x10(%eax),%eax
801010b4: 8b 55 0c mov 0xc(%ebp),%edx
801010b7: 89 54 24 04 mov %edx,0x4(%esp)
801010bb: 89 04 24 mov %eax,(%esp)
801010be: e8 4c 0c 00 00 call 80101d0f <stati>
iunlock(f->ip);
801010c3: 8b 45 08 mov 0x8(%ebp),%eax
801010c6: 8b 40 10 mov 0x10(%eax),%eax
801010c9: 89 04 24 mov %eax,(%esp)
801010cc: e8 c4 08 00 00 call 80101995 <iunlock>
return 0;
801010d1: b8 00 00 00 00 mov $0x0,%eax
801010d6: eb 05 jmp 801010dd <filestat+0x4d>
}
return -1;
801010d8: b8 ff ff ff ff mov $0xffffffff,%eax
}
801010dd: c9 leave
801010de: c3 ret
801010df <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
801010df: 55 push %ebp
801010e0: 89 e5 mov %esp,%ebp
801010e2: 83 ec 28 sub $0x28,%esp
int r;
if(f->readable == 0)
801010e5: 8b 45 08 mov 0x8(%ebp),%eax
801010e8: 0f b6 40 08 movzbl 0x8(%eax),%eax
801010ec: 84 c0 test %al,%al
801010ee: 75 0a jne 801010fa <fileread+0x1b>
return -1;
801010f0: b8 ff ff ff ff mov $0xffffffff,%eax
801010f5: e9 9f 00 00 00 jmp 80101199 <fileread+0xba>
if(f->type == FD_PIPE)
801010fa: 8b 45 08 mov 0x8(%ebp),%eax
801010fd: 8b 00 mov (%eax),%eax
801010ff: 83 f8 01 cmp $0x1,%eax
80101102: 75 1e jne 80101122 <fileread+0x43>
return piperead(f->pipe, addr, n);
80101104: 8b 45 08 mov 0x8(%ebp),%eax
80101107: 8b 40 0c mov 0xc(%eax),%eax
8010110a: 8b 55 10 mov 0x10(%ebp),%edx
8010110d: 89 54 24 08 mov %edx,0x8(%esp)
80101111: 8b 55 0c mov 0xc(%ebp),%edx
80101114: 89 54 24 04 mov %edx,0x4(%esp)
80101118: 89 04 24 mov %eax,(%esp)
8010111b: e8 5f 2d 00 00 call 80103e7f <piperead>
80101120: eb 77 jmp 80101199 <fileread+0xba>
if(f->type == FD_INODE){
80101122: 8b 45 08 mov 0x8(%ebp),%eax
80101125: 8b 00 mov (%eax),%eax
80101127: 83 f8 02 cmp $0x2,%eax
8010112a: 75 61 jne 8010118d <fileread+0xae>
ilock(f->ip);
8010112c: 8b 45 08 mov 0x8(%ebp),%eax
8010112f: 8b 40 10 mov 0x10(%eax),%eax
80101132: 89 04 24 mov %eax,(%esp)
80101135: e8 0d 07 00 00 call 80101847 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
8010113a: 8b 4d 10 mov 0x10(%ebp),%ecx
8010113d: 8b 45 08 mov 0x8(%ebp),%eax
80101140: 8b 50 14 mov 0x14(%eax),%edx
80101143: 8b 45 08 mov 0x8(%ebp),%eax
80101146: 8b 40 10 mov 0x10(%eax),%eax
80101149: 89 4c 24 0c mov %ecx,0xc(%esp)
8010114d: 89 54 24 08 mov %edx,0x8(%esp)
80101151: 8b 55 0c mov 0xc(%ebp),%edx
80101154: 89 54 24 04 mov %edx,0x4(%esp)
80101158: 89 04 24 mov %eax,(%esp)
8010115b: e8 f4 0b 00 00 call 80101d54 <readi>
80101160: 89 45 f4 mov %eax,-0xc(%ebp)
80101163: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101167: 7e 11 jle 8010117a <fileread+0x9b>
f->off += r;
80101169: 8b 45 08 mov 0x8(%ebp),%eax
8010116c: 8b 50 14 mov 0x14(%eax),%edx
8010116f: 8b 45 f4 mov -0xc(%ebp),%eax
80101172: 01 c2 add %eax,%edx
80101174: 8b 45 08 mov 0x8(%ebp),%eax
80101177: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
8010117a: 8b 45 08 mov 0x8(%ebp),%eax
8010117d: 8b 40 10 mov 0x10(%eax),%eax
80101180: 89 04 24 mov %eax,(%esp)
80101183: e8 0d 08 00 00 call 80101995 <iunlock>
return r;
80101188: 8b 45 f4 mov -0xc(%ebp),%eax
8010118b: eb 0c jmp 80101199 <fileread+0xba>
}
panic("fileread");
8010118d: c7 04 24 b2 82 10 80 movl $0x801082b2,(%esp)
80101194: e8 a1 f3 ff ff call 8010053a <panic>
}
80101199: c9 leave
8010119a: c3 ret
8010119b <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
8010119b: 55 push %ebp
8010119c: 89 e5 mov %esp,%ebp
8010119e: 53 push %ebx
8010119f: 83 ec 24 sub $0x24,%esp
int r;
if(f->writable == 0)
801011a2: 8b 45 08 mov 0x8(%ebp),%eax
801011a5: 0f b6 40 09 movzbl 0x9(%eax),%eax
801011a9: 84 c0 test %al,%al
801011ab: 75 0a jne 801011b7 <filewrite+0x1c>
return -1;
801011ad: b8 ff ff ff ff mov $0xffffffff,%eax
801011b2: e9 20 01 00 00 jmp 801012d7 <filewrite+0x13c>
if(f->type == FD_PIPE)
801011b7: 8b 45 08 mov 0x8(%ebp),%eax
801011ba: 8b 00 mov (%eax),%eax
801011bc: 83 f8 01 cmp $0x1,%eax
801011bf: 75 21 jne 801011e2 <filewrite+0x47>
return pipewrite(f->pipe, addr, n);
801011c1: 8b 45 08 mov 0x8(%ebp),%eax
801011c4: 8b 40 0c mov 0xc(%eax),%eax
801011c7: 8b 55 10 mov 0x10(%ebp),%edx
801011ca: 89 54 24 08 mov %edx,0x8(%esp)
801011ce: 8b 55 0c mov 0xc(%ebp),%edx
801011d1: 89 54 24 04 mov %edx,0x4(%esp)
801011d5: 89 04 24 mov %eax,(%esp)
801011d8: e8 b3 2b 00 00 call 80103d90 <pipewrite>
801011dd: e9 f5 00 00 00 jmp 801012d7 <filewrite+0x13c>
if(f->type == FD_INODE){
801011e2: 8b 45 08 mov 0x8(%ebp),%eax
801011e5: 8b 00 mov (%eax),%eax
801011e7: 83 f8 02 cmp $0x2,%eax
801011ea: 0f 85 db 00 00 00 jne 801012cb <filewrite+0x130>
// the maximum log transaction size, including
// i-node, indirect block, allocation blocks,
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
801011f0: c7 45 ec 00 06 00 00 movl $0x600,-0x14(%ebp)
int i = 0;
801011f7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while(i < n){
801011fe: e9 a8 00 00 00 jmp 801012ab <filewrite+0x110>
int n1 = n - i;
80101203: 8b 45 f4 mov -0xc(%ebp),%eax
80101206: 8b 55 10 mov 0x10(%ebp),%edx
80101209: 29 c2 sub %eax,%edx
8010120b: 89 d0 mov %edx,%eax
8010120d: 89 45 f0 mov %eax,-0x10(%ebp)
if(n1 > max)
80101210: 8b 45 f0 mov -0x10(%ebp),%eax
80101213: 3b 45 ec cmp -0x14(%ebp),%eax
80101216: 7e 06 jle 8010121e <filewrite+0x83>
n1 = max;
80101218: 8b 45 ec mov -0x14(%ebp),%eax
8010121b: 89 45 f0 mov %eax,-0x10(%ebp)
begin_trans();
8010121e: e8 ae 1f 00 00 call 801031d1 <begin_trans>
ilock(f->ip);
80101223: 8b 45 08 mov 0x8(%ebp),%eax
80101226: 8b 40 10 mov 0x10(%eax),%eax
80101229: 89 04 24 mov %eax,(%esp)
8010122c: e8 16 06 00 00 call 80101847 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101231: 8b 4d f0 mov -0x10(%ebp),%ecx
80101234: 8b 45 08 mov 0x8(%ebp),%eax
80101237: 8b 50 14 mov 0x14(%eax),%edx
8010123a: 8b 5d f4 mov -0xc(%ebp),%ebx
8010123d: 8b 45 0c mov 0xc(%ebp),%eax
80101240: 01 c3 add %eax,%ebx
80101242: 8b 45 08 mov 0x8(%ebp),%eax
80101245: 8b 40 10 mov 0x10(%eax),%eax
80101248: 89 4c 24 0c mov %ecx,0xc(%esp)
8010124c: 89 54 24 08 mov %edx,0x8(%esp)
80101250: 89 5c 24 04 mov %ebx,0x4(%esp)
80101254: 89 04 24 mov %eax,(%esp)
80101257: e8 5c 0c 00 00 call 80101eb8 <writei>
8010125c: 89 45 e8 mov %eax,-0x18(%ebp)
8010125f: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80101263: 7e 11 jle 80101276 <filewrite+0xdb>
f->off += r;
80101265: 8b 45 08 mov 0x8(%ebp),%eax
80101268: 8b 50 14 mov 0x14(%eax),%edx
8010126b: 8b 45 e8 mov -0x18(%ebp),%eax
8010126e: 01 c2 add %eax,%edx
80101270: 8b 45 08 mov 0x8(%ebp),%eax
80101273: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
80101276: 8b 45 08 mov 0x8(%ebp),%eax
80101279: 8b 40 10 mov 0x10(%eax),%eax
8010127c: 89 04 24 mov %eax,(%esp)
8010127f: e8 11 07 00 00 call 80101995 <iunlock>
commit_trans();
80101284: e8 91 1f 00 00 call 8010321a <commit_trans>
if(r < 0)
80101289: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010128d: 79 02 jns 80101291 <filewrite+0xf6>
break;
8010128f: eb 26 jmp 801012b7 <filewrite+0x11c>
if(r != n1)
80101291: 8b 45 e8 mov -0x18(%ebp),%eax
80101294: 3b 45 f0 cmp -0x10(%ebp),%eax
80101297: 74 0c je 801012a5 <filewrite+0x10a>
panic("short filewrite");
80101299: c7 04 24 bb 82 10 80 movl $0x801082bb,(%esp)
801012a0: e8 95 f2 ff ff call 8010053a <panic>
i += r;
801012a5: 8b 45 e8 mov -0x18(%ebp),%eax
801012a8: 01 45 f4 add %eax,-0xc(%ebp)
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
801012ab: 8b 45 f4 mov -0xc(%ebp),%eax
801012ae: 3b 45 10 cmp 0x10(%ebp),%eax
801012b1: 0f 8c 4c ff ff ff jl 80101203 <filewrite+0x68>
break;
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801012b7: 8b 45 f4 mov -0xc(%ebp),%eax
801012ba: 3b 45 10 cmp 0x10(%ebp),%eax
801012bd: 75 05 jne 801012c4 <filewrite+0x129>
801012bf: 8b 45 10 mov 0x10(%ebp),%eax
801012c2: eb 05 jmp 801012c9 <filewrite+0x12e>
801012c4: b8 ff ff ff ff mov $0xffffffff,%eax
801012c9: eb 0c jmp 801012d7 <filewrite+0x13c>
}
panic("filewrite");
801012cb: c7 04 24 cb 82 10 80 movl $0x801082cb,(%esp)
801012d2: e8 63 f2 ff ff call 8010053a <panic>
}
801012d7: 83 c4 24 add $0x24,%esp
801012da: 5b pop %ebx
801012db: 5d pop %ebp
801012dc: c3 ret
801012dd <readsb>:
static void itrunc(struct inode*);
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801012dd: 55 push %ebp
801012de: 89 e5 mov %esp,%ebp
801012e0: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, 1);
801012e3: 8b 45 08 mov 0x8(%ebp),%eax
801012e6: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801012ed: 00
801012ee: 89 04 24 mov %eax,(%esp)
801012f1: e8 b0 ee ff ff call 801001a6 <bread>
801012f6: 89 45 f4 mov %eax,-0xc(%ebp)
memmove(sb, bp->data, sizeof(*sb));
801012f9: 8b 45 f4 mov -0xc(%ebp),%eax
801012fc: 83 c0 18 add $0x18,%eax
801012ff: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80101306: 00
80101307: 89 44 24 04 mov %eax,0x4(%esp)
8010130b: 8b 45 0c mov 0xc(%ebp),%eax
8010130e: 89 04 24 mov %eax,(%esp)
80101311: e8 6f 3a 00 00 call 80104d85 <memmove>
brelse(bp);
80101316: 8b 45 f4 mov -0xc(%ebp),%eax
80101319: 89 04 24 mov %eax,(%esp)
8010131c: e8 f6 ee ff ff call 80100217 <brelse>
}
80101321: c9 leave
80101322: c3 ret
80101323 <bzero>:
// Zero a block.
static void
bzero(int dev, int bno)
{
80101323: 55 push %ebp
80101324: 89 e5 mov %esp,%ebp
80101326: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, bno);
80101329: 8b 55 0c mov 0xc(%ebp),%edx
8010132c: 8b 45 08 mov 0x8(%ebp),%eax
8010132f: 89 54 24 04 mov %edx,0x4(%esp)
80101333: 89 04 24 mov %eax,(%esp)
80101336: e8 6b ee ff ff call 801001a6 <bread>
8010133b: 89 45 f4 mov %eax,-0xc(%ebp)
memset(bp->data, 0, BSIZE);
8010133e: 8b 45 f4 mov -0xc(%ebp),%eax
80101341: 83 c0 18 add $0x18,%eax
80101344: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
8010134b: 00
8010134c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80101353: 00
80101354: 89 04 24 mov %eax,(%esp)
80101357: e8 5a 39 00 00 call 80104cb6 <memset>
log_write(bp);
8010135c: 8b 45 f4 mov -0xc(%ebp),%eax
8010135f: 89 04 24 mov %eax,(%esp)
80101362: e8 0b 1f 00 00 call 80103272 <log_write>
brelse(bp);
80101367: 8b 45 f4 mov -0xc(%ebp),%eax
8010136a: 89 04 24 mov %eax,(%esp)
8010136d: e8 a5 ee ff ff call 80100217 <brelse>
}
80101372: c9 leave
80101373: c3 ret
80101374 <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
80101374: 55 push %ebp
80101375: 89 e5 mov %esp,%ebp
80101377: 83 ec 38 sub $0x38,%esp
int b, bi, m;
struct buf *bp;
struct superblock sb;
bp = 0;
8010137a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
readsb(dev, &sb);
80101381: 8b 45 08 mov 0x8(%ebp),%eax
80101384: 8d 55 d8 lea -0x28(%ebp),%edx
80101387: 89 54 24 04 mov %edx,0x4(%esp)
8010138b: 89 04 24 mov %eax,(%esp)
8010138e: e8 4a ff ff ff call 801012dd <readsb>
for(b = 0; b < sb.size; b += BPB){
80101393: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010139a: e9 07 01 00 00 jmp 801014a6 <balloc+0x132>
bp = bread(dev, BBLOCK(b, sb.ninodes));
8010139f: 8b 45 f4 mov -0xc(%ebp),%eax
801013a2: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
801013a8: 85 c0 test %eax,%eax
801013aa: 0f 48 c2 cmovs %edx,%eax
801013ad: c1 f8 0c sar $0xc,%eax
801013b0: 8b 55 e0 mov -0x20(%ebp),%edx
801013b3: c1 ea 03 shr $0x3,%edx
801013b6: 01 d0 add %edx,%eax
801013b8: 83 c0 03 add $0x3,%eax
801013bb: 89 44 24 04 mov %eax,0x4(%esp)
801013bf: 8b 45 08 mov 0x8(%ebp),%eax
801013c2: 89 04 24 mov %eax,(%esp)
801013c5: e8 dc ed ff ff call 801001a6 <bread>
801013ca: 89 45 ec mov %eax,-0x14(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801013cd: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
801013d4: e9 9d 00 00 00 jmp 80101476 <balloc+0x102>
m = 1 << (bi % 8);
801013d9: 8b 45 f0 mov -0x10(%ebp),%eax
801013dc: 99 cltd
801013dd: c1 ea 1d shr $0x1d,%edx
801013e0: 01 d0 add %edx,%eax
801013e2: 83 e0 07 and $0x7,%eax
801013e5: 29 d0 sub %edx,%eax
801013e7: ba 01 00 00 00 mov $0x1,%edx
801013ec: 89 c1 mov %eax,%ecx
801013ee: d3 e2 shl %cl,%edx
801013f0: 89 d0 mov %edx,%eax
801013f2: 89 45 e8 mov %eax,-0x18(%ebp)
if((bp->data[bi/8] & m) == 0){ // Is block free?
801013f5: 8b 45 f0 mov -0x10(%ebp),%eax
801013f8: 8d 50 07 lea 0x7(%eax),%edx
801013fb: 85 c0 test %eax,%eax
801013fd: 0f 48 c2 cmovs %edx,%eax
80101400: c1 f8 03 sar $0x3,%eax
80101403: 8b 55 ec mov -0x14(%ebp),%edx
80101406: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
8010140b: 0f b6 c0 movzbl %al,%eax
8010140e: 23 45 e8 and -0x18(%ebp),%eax
80101411: 85 c0 test %eax,%eax
80101413: 75 5d jne 80101472 <balloc+0xfe>
bp->data[bi/8] |= m; // Mark block in use.
80101415: 8b 45 f0 mov -0x10(%ebp),%eax
80101418: 8d 50 07 lea 0x7(%eax),%edx
8010141b: 85 c0 test %eax,%eax
8010141d: 0f 48 c2 cmovs %edx,%eax
80101420: c1 f8 03 sar $0x3,%eax
80101423: 8b 55 ec mov -0x14(%ebp),%edx
80101426: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
8010142b: 89 d1 mov %edx,%ecx
8010142d: 8b 55 e8 mov -0x18(%ebp),%edx
80101430: 09 ca or %ecx,%edx
80101432: 89 d1 mov %edx,%ecx
80101434: 8b 55 ec mov -0x14(%ebp),%edx
80101437: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
8010143b: 8b 45 ec mov -0x14(%ebp),%eax
8010143e: 89 04 24 mov %eax,(%esp)
80101441: e8 2c 1e 00 00 call 80103272 <log_write>
brelse(bp);
80101446: 8b 45 ec mov -0x14(%ebp),%eax
80101449: 89 04 24 mov %eax,(%esp)
8010144c: e8 c6 ed ff ff call 80100217 <brelse>
bzero(dev, b + bi);
80101451: 8b 45 f0 mov -0x10(%ebp),%eax
80101454: 8b 55 f4 mov -0xc(%ebp),%edx
80101457: 01 c2 add %eax,%edx
80101459: 8b 45 08 mov 0x8(%ebp),%eax
8010145c: 89 54 24 04 mov %edx,0x4(%esp)
80101460: 89 04 24 mov %eax,(%esp)
80101463: e8 bb fe ff ff call 80101323 <bzero>
return b + bi;
80101468: 8b 45 f0 mov -0x10(%ebp),%eax
8010146b: 8b 55 f4 mov -0xc(%ebp),%edx
8010146e: 01 d0 add %edx,%eax
80101470: eb 4e jmp 801014c0 <balloc+0x14c>
bp = 0;
readsb(dev, &sb);
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb.ninodes));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
80101472: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101476: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp)
8010147d: 7f 15 jg 80101494 <balloc+0x120>
8010147f: 8b 45 f0 mov -0x10(%ebp),%eax
80101482: 8b 55 f4 mov -0xc(%ebp),%edx
80101485: 01 d0 add %edx,%eax
80101487: 89 c2 mov %eax,%edx
80101489: 8b 45 d8 mov -0x28(%ebp),%eax
8010148c: 39 c2 cmp %eax,%edx
8010148e: 0f 82 45 ff ff ff jb 801013d9 <balloc+0x65>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
80101494: 8b 45 ec mov -0x14(%ebp),%eax
80101497: 89 04 24 mov %eax,(%esp)
8010149a: e8 78 ed ff ff call 80100217 <brelse>
struct buf *bp;
struct superblock sb;
bp = 0;
readsb(dev, &sb);
for(b = 0; b < sb.size; b += BPB){
8010149f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801014a6: 8b 55 f4 mov -0xc(%ebp),%edx
801014a9: 8b 45 d8 mov -0x28(%ebp),%eax
801014ac: 39 c2 cmp %eax,%edx
801014ae: 0f 82 eb fe ff ff jb 8010139f <balloc+0x2b>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
801014b4: c7 04 24 d5 82 10 80 movl $0x801082d5,(%esp)
801014bb: e8 7a f0 ff ff call 8010053a <panic>
}
801014c0: c9 leave
801014c1: c3 ret
801014c2 <bfree>:
// Free a disk block.
static void
bfree(int dev, uint b)
{
801014c2: 55 push %ebp
801014c3: 89 e5 mov %esp,%ebp
801014c5: 83 ec 38 sub $0x38,%esp
struct buf *bp;
struct superblock sb;
int bi, m;
readsb(dev, &sb);
801014c8: 8d 45 dc lea -0x24(%ebp),%eax
801014cb: 89 44 24 04 mov %eax,0x4(%esp)
801014cf: 8b 45 08 mov 0x8(%ebp),%eax
801014d2: 89 04 24 mov %eax,(%esp)
801014d5: e8 03 fe ff ff call 801012dd <readsb>
bp = bread(dev, BBLOCK(b, sb.ninodes));
801014da: 8b 45 0c mov 0xc(%ebp),%eax
801014dd: c1 e8 0c shr $0xc,%eax
801014e0: 89 c2 mov %eax,%edx
801014e2: 8b 45 e4 mov -0x1c(%ebp),%eax
801014e5: c1 e8 03 shr $0x3,%eax
801014e8: 01 d0 add %edx,%eax
801014ea: 8d 50 03 lea 0x3(%eax),%edx
801014ed: 8b 45 08 mov 0x8(%ebp),%eax
801014f0: 89 54 24 04 mov %edx,0x4(%esp)
801014f4: 89 04 24 mov %eax,(%esp)
801014f7: e8 aa ec ff ff call 801001a6 <bread>
801014fc: 89 45 f4 mov %eax,-0xc(%ebp)
bi = b % BPB;
801014ff: 8b 45 0c mov 0xc(%ebp),%eax
80101502: 25 ff 0f 00 00 and $0xfff,%eax
80101507: 89 45 f0 mov %eax,-0x10(%ebp)
m = 1 << (bi % 8);
8010150a: 8b 45 f0 mov -0x10(%ebp),%eax
8010150d: 99 cltd
8010150e: c1 ea 1d shr $0x1d,%edx
80101511: 01 d0 add %edx,%eax
80101513: 83 e0 07 and $0x7,%eax
80101516: 29 d0 sub %edx,%eax
80101518: ba 01 00 00 00 mov $0x1,%edx
8010151d: 89 c1 mov %eax,%ecx
8010151f: d3 e2 shl %cl,%edx
80101521: 89 d0 mov %edx,%eax
80101523: 89 45 ec mov %eax,-0x14(%ebp)
if((bp->data[bi/8] & m) == 0)
80101526: 8b 45 f0 mov -0x10(%ebp),%eax
80101529: 8d 50 07 lea 0x7(%eax),%edx
8010152c: 85 c0 test %eax,%eax
8010152e: 0f 48 c2 cmovs %edx,%eax
80101531: c1 f8 03 sar $0x3,%eax
80101534: 8b 55 f4 mov -0xc(%ebp),%edx
80101537: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
8010153c: 0f b6 c0 movzbl %al,%eax
8010153f: 23 45 ec and -0x14(%ebp),%eax
80101542: 85 c0 test %eax,%eax
80101544: 75 0c jne 80101552 <bfree+0x90>
panic("freeing free block");
80101546: c7 04 24 eb 82 10 80 movl $0x801082eb,(%esp)
8010154d: e8 e8 ef ff ff call 8010053a <panic>
bp->data[bi/8] &= ~m;
80101552: 8b 45 f0 mov -0x10(%ebp),%eax
80101555: 8d 50 07 lea 0x7(%eax),%edx
80101558: 85 c0 test %eax,%eax
8010155a: 0f 48 c2 cmovs %edx,%eax
8010155d: c1 f8 03 sar $0x3,%eax
80101560: 8b 55 f4 mov -0xc(%ebp),%edx
80101563: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
80101568: 8b 4d ec mov -0x14(%ebp),%ecx
8010156b: f7 d1 not %ecx
8010156d: 21 ca and %ecx,%edx
8010156f: 89 d1 mov %edx,%ecx
80101571: 8b 55 f4 mov -0xc(%ebp),%edx
80101574: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
80101578: 8b 45 f4 mov -0xc(%ebp),%eax
8010157b: 89 04 24 mov %eax,(%esp)
8010157e: e8 ef 1c 00 00 call 80103272 <log_write>
brelse(bp);
80101583: 8b 45 f4 mov -0xc(%ebp),%eax
80101586: 89 04 24 mov %eax,(%esp)
80101589: e8 89 ec ff ff call 80100217 <brelse>
}
8010158e: c9 leave
8010158f: c3 ret
80101590 <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(void)
{
80101590: 55 push %ebp
80101591: 89 e5 mov %esp,%ebp
80101593: 83 ec 18 sub $0x18,%esp
initlock(&icache.lock, "icache");
80101596: c7 44 24 04 fe 82 10 movl $0x801082fe,0x4(%esp)
8010159d: 80
8010159e: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
801015a5: e8 97 34 00 00 call 80104a41 <initlock>
}
801015aa: c9 leave
801015ab: c3 ret
801015ac <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801015ac: 55 push %ebp
801015ad: 89 e5 mov %esp,%ebp
801015af: 83 ec 38 sub $0x38,%esp
801015b2: 8b 45 0c mov 0xc(%ebp),%eax
801015b5: 66 89 45 d4 mov %ax,-0x2c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
801015b9: 8b 45 08 mov 0x8(%ebp),%eax
801015bc: 8d 55 dc lea -0x24(%ebp),%edx
801015bf: 89 54 24 04 mov %edx,0x4(%esp)
801015c3: 89 04 24 mov %eax,(%esp)
801015c6: e8 12 fd ff ff call 801012dd <readsb>
for(inum = 1; inum < sb.ninodes; inum++){
801015cb: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
801015d2: e9 98 00 00 00 jmp 8010166f <ialloc+0xc3>
bp = bread(dev, IBLOCK(inum));
801015d7: 8b 45 f4 mov -0xc(%ebp),%eax
801015da: c1 e8 03 shr $0x3,%eax
801015dd: 83 c0 02 add $0x2,%eax
801015e0: 89 44 24 04 mov %eax,0x4(%esp)
801015e4: 8b 45 08 mov 0x8(%ebp),%eax
801015e7: 89 04 24 mov %eax,(%esp)
801015ea: e8 b7 eb ff ff call 801001a6 <bread>
801015ef: 89 45 f0 mov %eax,-0x10(%ebp)
dip = (struct dinode*)bp->data + inum%IPB;
801015f2: 8b 45 f0 mov -0x10(%ebp),%eax
801015f5: 8d 50 18 lea 0x18(%eax),%edx
801015f8: 8b 45 f4 mov -0xc(%ebp),%eax
801015fb: 83 e0 07 and $0x7,%eax
801015fe: c1 e0 06 shl $0x6,%eax
80101601: 01 d0 add %edx,%eax
80101603: 89 45 ec mov %eax,-0x14(%ebp)
if(dip->type == 0){ // a free inode
80101606: 8b 45 ec mov -0x14(%ebp),%eax
80101609: 0f b7 00 movzwl (%eax),%eax
8010160c: 66 85 c0 test %ax,%ax
8010160f: 75 4f jne 80101660 <ialloc+0xb4>
memset(dip, 0, sizeof(*dip));
80101611: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
80101618: 00
80101619: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80101620: 00
80101621: 8b 45 ec mov -0x14(%ebp),%eax
80101624: 89 04 24 mov %eax,(%esp)
80101627: e8 8a 36 00 00 call 80104cb6 <memset>
dip->type = type;
8010162c: 8b 45 ec mov -0x14(%ebp),%eax
8010162f: 0f b7 55 d4 movzwl -0x2c(%ebp),%edx
80101633: 66 89 10 mov %dx,(%eax)
log_write(bp); // mark it allocated on the disk
80101636: 8b 45 f0 mov -0x10(%ebp),%eax
80101639: 89 04 24 mov %eax,(%esp)
8010163c: e8 31 1c 00 00 call 80103272 <log_write>
brelse(bp);
80101641: 8b 45 f0 mov -0x10(%ebp),%eax
80101644: 89 04 24 mov %eax,(%esp)
80101647: e8 cb eb ff ff call 80100217 <brelse>
return iget(dev, inum);
8010164c: 8b 45 f4 mov -0xc(%ebp),%eax
8010164f: 89 44 24 04 mov %eax,0x4(%esp)
80101653: 8b 45 08 mov 0x8(%ebp),%eax
80101656: 89 04 24 mov %eax,(%esp)
80101659: e8 e5 00 00 00 call 80101743 <iget>
8010165e: eb 29 jmp 80101689 <ialloc+0xdd>
}
brelse(bp);
80101660: 8b 45 f0 mov -0x10(%ebp),%eax
80101663: 89 04 24 mov %eax,(%esp)
80101666: e8 ac eb ff ff call 80100217 <brelse>
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
for(inum = 1; inum < sb.ninodes; inum++){
8010166b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010166f: 8b 55 f4 mov -0xc(%ebp),%edx
80101672: 8b 45 e4 mov -0x1c(%ebp),%eax
80101675: 39 c2 cmp %eax,%edx
80101677: 0f 82 5a ff ff ff jb 801015d7 <ialloc+0x2b>
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
8010167d: c7 04 24 05 83 10 80 movl $0x80108305,(%esp)
80101684: e8 b1 ee ff ff call 8010053a <panic>
}
80101689: c9 leave
8010168a: c3 ret
8010168b <iupdate>:
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
8010168b: 55 push %ebp
8010168c: 89 e5 mov %esp,%ebp
8010168e: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
80101691: 8b 45 08 mov 0x8(%ebp),%eax
80101694: 8b 40 04 mov 0x4(%eax),%eax
80101697: c1 e8 03 shr $0x3,%eax
8010169a: 8d 50 02 lea 0x2(%eax),%edx
8010169d: 8b 45 08 mov 0x8(%ebp),%eax
801016a0: 8b 00 mov (%eax),%eax
801016a2: 89 54 24 04 mov %edx,0x4(%esp)
801016a6: 89 04 24 mov %eax,(%esp)
801016a9: e8 f8 ea ff ff call 801001a6 <bread>
801016ae: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
801016b1: 8b 45 f4 mov -0xc(%ebp),%eax
801016b4: 8d 50 18 lea 0x18(%eax),%edx
801016b7: 8b 45 08 mov 0x8(%ebp),%eax
801016ba: 8b 40 04 mov 0x4(%eax),%eax
801016bd: 83 e0 07 and $0x7,%eax
801016c0: c1 e0 06 shl $0x6,%eax
801016c3: 01 d0 add %edx,%eax
801016c5: 89 45 f0 mov %eax,-0x10(%ebp)
dip->type = ip->type;
801016c8: 8b 45 08 mov 0x8(%ebp),%eax
801016cb: 0f b7 50 10 movzwl 0x10(%eax),%edx
801016cf: 8b 45 f0 mov -0x10(%ebp),%eax
801016d2: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
801016d5: 8b 45 08 mov 0x8(%ebp),%eax
801016d8: 0f b7 50 12 movzwl 0x12(%eax),%edx
801016dc: 8b 45 f0 mov -0x10(%ebp),%eax
801016df: 66 89 50 02 mov %dx,0x2(%eax)
dip->minor = ip->minor;
801016e3: 8b 45 08 mov 0x8(%ebp),%eax
801016e6: 0f b7 50 14 movzwl 0x14(%eax),%edx
801016ea: 8b 45 f0 mov -0x10(%ebp),%eax
801016ed: 66 89 50 04 mov %dx,0x4(%eax)
dip->nlink = ip->nlink;
801016f1: 8b 45 08 mov 0x8(%ebp),%eax
801016f4: 0f b7 50 16 movzwl 0x16(%eax),%edx
801016f8: 8b 45 f0 mov -0x10(%ebp),%eax
801016fb: 66 89 50 06 mov %dx,0x6(%eax)
dip->size = ip->size;
801016ff: 8b 45 08 mov 0x8(%ebp),%eax
80101702: 8b 50 18 mov 0x18(%eax),%edx
80101705: 8b 45 f0 mov -0x10(%ebp),%eax
80101708: 89 50 08 mov %edx,0x8(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
8010170b: 8b 45 08 mov 0x8(%ebp),%eax
8010170e: 8d 50 1c lea 0x1c(%eax),%edx
80101711: 8b 45 f0 mov -0x10(%ebp),%eax
80101714: 83 c0 0c add $0xc,%eax
80101717: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010171e: 00
8010171f: 89 54 24 04 mov %edx,0x4(%esp)
80101723: 89 04 24 mov %eax,(%esp)
80101726: e8 5a 36 00 00 call 80104d85 <memmove>
log_write(bp);
8010172b: 8b 45 f4 mov -0xc(%ebp),%eax
8010172e: 89 04 24 mov %eax,(%esp)
80101731: e8 3c 1b 00 00 call 80103272 <log_write>
brelse(bp);
80101736: 8b 45 f4 mov -0xc(%ebp),%eax
80101739: 89 04 24 mov %eax,(%esp)
8010173c: e8 d6 ea ff ff call 80100217 <brelse>
}
80101741: c9 leave
80101742: c3 ret
80101743 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101743: 55 push %ebp
80101744: 89 e5 mov %esp,%ebp
80101746: 83 ec 28 sub $0x28,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101749: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101750: e8 0d 33 00 00 call 80104a62 <acquire>
// Is the inode already cached?
empty = 0;
80101755: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010175c: c7 45 f4 94 e8 10 80 movl $0x8010e894,-0xc(%ebp)
80101763: eb 59 jmp 801017be <iget+0x7b>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101765: 8b 45 f4 mov -0xc(%ebp),%eax
80101768: 8b 40 08 mov 0x8(%eax),%eax
8010176b: 85 c0 test %eax,%eax
8010176d: 7e 35 jle 801017a4 <iget+0x61>
8010176f: 8b 45 f4 mov -0xc(%ebp),%eax
80101772: 8b 00 mov (%eax),%eax
80101774: 3b 45 08 cmp 0x8(%ebp),%eax
80101777: 75 2b jne 801017a4 <iget+0x61>
80101779: 8b 45 f4 mov -0xc(%ebp),%eax
8010177c: 8b 40 04 mov 0x4(%eax),%eax
8010177f: 3b 45 0c cmp 0xc(%ebp),%eax
80101782: 75 20 jne 801017a4 <iget+0x61>
ip->ref++;
80101784: 8b 45 f4 mov -0xc(%ebp),%eax
80101787: 8b 40 08 mov 0x8(%eax),%eax
8010178a: 8d 50 01 lea 0x1(%eax),%edx
8010178d: 8b 45 f4 mov -0xc(%ebp),%eax
80101790: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101793: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
8010179a: e8 25 33 00 00 call 80104ac4 <release>
return ip;
8010179f: 8b 45 f4 mov -0xc(%ebp),%eax
801017a2: eb 6f jmp 80101813 <iget+0xd0>
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
801017a4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017a8: 75 10 jne 801017ba <iget+0x77>
801017aa: 8b 45 f4 mov -0xc(%ebp),%eax
801017ad: 8b 40 08 mov 0x8(%eax),%eax
801017b0: 85 c0 test %eax,%eax
801017b2: 75 06 jne 801017ba <iget+0x77>
empty = ip;
801017b4: 8b 45 f4 mov -0xc(%ebp),%eax
801017b7: 89 45 f0 mov %eax,-0x10(%ebp)
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801017ba: 83 45 f4 50 addl $0x50,-0xc(%ebp)
801017be: 81 7d f4 34 f8 10 80 cmpl $0x8010f834,-0xc(%ebp)
801017c5: 72 9e jb 80101765 <iget+0x22>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801017c7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017cb: 75 0c jne 801017d9 <iget+0x96>
panic("iget: no inodes");
801017cd: c7 04 24 17 83 10 80 movl $0x80108317,(%esp)
801017d4: e8 61 ed ff ff call 8010053a <panic>
ip = empty;
801017d9: 8b 45 f0 mov -0x10(%ebp),%eax
801017dc: 89 45 f4 mov %eax,-0xc(%ebp)
ip->dev = dev;
801017df: 8b 45 f4 mov -0xc(%ebp),%eax
801017e2: 8b 55 08 mov 0x8(%ebp),%edx
801017e5: 89 10 mov %edx,(%eax)
ip->inum = inum;
801017e7: 8b 45 f4 mov -0xc(%ebp),%eax
801017ea: 8b 55 0c mov 0xc(%ebp),%edx
801017ed: 89 50 04 mov %edx,0x4(%eax)
ip->ref = 1;
801017f0: 8b 45 f4 mov -0xc(%ebp),%eax
801017f3: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
ip->flags = 0;
801017fa: 8b 45 f4 mov -0xc(%ebp),%eax
801017fd: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
release(&icache.lock);
80101804: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
8010180b: e8 b4 32 00 00 call 80104ac4 <release>
return ip;
80101810: 8b 45 f4 mov -0xc(%ebp),%eax
}
80101813: c9 leave
80101814: c3 ret
80101815 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101815: 55 push %ebp
80101816: 89 e5 mov %esp,%ebp
80101818: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
8010181b: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101822: e8 3b 32 00 00 call 80104a62 <acquire>
ip->ref++;
80101827: 8b 45 08 mov 0x8(%ebp),%eax
8010182a: 8b 40 08 mov 0x8(%eax),%eax
8010182d: 8d 50 01 lea 0x1(%eax),%edx
80101830: 8b 45 08 mov 0x8(%ebp),%eax
80101833: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101836: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
8010183d: e8 82 32 00 00 call 80104ac4 <release>
return ip;
80101842: 8b 45 08 mov 0x8(%ebp),%eax
}
80101845: c9 leave
80101846: c3 ret
80101847 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101847: 55 push %ebp
80101848: 89 e5 mov %esp,%ebp
8010184a: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
8010184d: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80101851: 74 0a je 8010185d <ilock+0x16>
80101853: 8b 45 08 mov 0x8(%ebp),%eax
80101856: 8b 40 08 mov 0x8(%eax),%eax
80101859: 85 c0 test %eax,%eax
8010185b: 7f 0c jg 80101869 <ilock+0x22>
panic("ilock");
8010185d: c7 04 24 27 83 10 80 movl $0x80108327,(%esp)
80101864: e8 d1 ec ff ff call 8010053a <panic>
acquire(&icache.lock);
80101869: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101870: e8 ed 31 00 00 call 80104a62 <acquire>
while(ip->flags & I_BUSY)
80101875: eb 13 jmp 8010188a <ilock+0x43>
sleep(ip, &icache.lock);
80101877: c7 44 24 04 60 e8 10 movl $0x8010e860,0x4(%esp)
8010187e: 80
8010187f: 8b 45 08 mov 0x8(%ebp),%eax
80101882: 89 04 24 mov %eax,(%esp)
80101885: e8 0e 2f 00 00 call 80104798 <sleep>
if(ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(ip->flags & I_BUSY)
8010188a: 8b 45 08 mov 0x8(%ebp),%eax
8010188d: 8b 40 0c mov 0xc(%eax),%eax
80101890: 83 e0 01 and $0x1,%eax
80101893: 85 c0 test %eax,%eax
80101895: 75 e0 jne 80101877 <ilock+0x30>
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
80101897: 8b 45 08 mov 0x8(%ebp),%eax
8010189a: 8b 40 0c mov 0xc(%eax),%eax
8010189d: 83 c8 01 or $0x1,%eax
801018a0: 89 c2 mov %eax,%edx
801018a2: 8b 45 08 mov 0x8(%ebp),%eax
801018a5: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
801018a8: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
801018af: e8 10 32 00 00 call 80104ac4 <release>
if(!(ip->flags & I_VALID)){
801018b4: 8b 45 08 mov 0x8(%ebp),%eax
801018b7: 8b 40 0c mov 0xc(%eax),%eax
801018ba: 83 e0 02 and $0x2,%eax
801018bd: 85 c0 test %eax,%eax
801018bf: 0f 85 ce 00 00 00 jne 80101993 <ilock+0x14c>
bp = bread(ip->dev, IBLOCK(ip->inum));
801018c5: 8b 45 08 mov 0x8(%ebp),%eax
801018c8: 8b 40 04 mov 0x4(%eax),%eax
801018cb: c1 e8 03 shr $0x3,%eax
801018ce: 8d 50 02 lea 0x2(%eax),%edx
801018d1: 8b 45 08 mov 0x8(%ebp),%eax
801018d4: 8b 00 mov (%eax),%eax
801018d6: 89 54 24 04 mov %edx,0x4(%esp)
801018da: 89 04 24 mov %eax,(%esp)
801018dd: e8 c4 e8 ff ff call 801001a6 <bread>
801018e2: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
801018e5: 8b 45 f4 mov -0xc(%ebp),%eax
801018e8: 8d 50 18 lea 0x18(%eax),%edx
801018eb: 8b 45 08 mov 0x8(%ebp),%eax
801018ee: 8b 40 04 mov 0x4(%eax),%eax
801018f1: 83 e0 07 and $0x7,%eax
801018f4: c1 e0 06 shl $0x6,%eax
801018f7: 01 d0 add %edx,%eax
801018f9: 89 45 f0 mov %eax,-0x10(%ebp)
ip->type = dip->type;
801018fc: 8b 45 f0 mov -0x10(%ebp),%eax
801018ff: 0f b7 10 movzwl (%eax),%edx
80101902: 8b 45 08 mov 0x8(%ebp),%eax
80101905: 66 89 50 10 mov %dx,0x10(%eax)
ip->major = dip->major;
80101909: 8b 45 f0 mov -0x10(%ebp),%eax
8010190c: 0f b7 50 02 movzwl 0x2(%eax),%edx
80101910: 8b 45 08 mov 0x8(%ebp),%eax
80101913: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = dip->minor;
80101917: 8b 45 f0 mov -0x10(%ebp),%eax
8010191a: 0f b7 50 04 movzwl 0x4(%eax),%edx
8010191e: 8b 45 08 mov 0x8(%ebp),%eax
80101921: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = dip->nlink;
80101925: 8b 45 f0 mov -0x10(%ebp),%eax
80101928: 0f b7 50 06 movzwl 0x6(%eax),%edx
8010192c: 8b 45 08 mov 0x8(%ebp),%eax
8010192f: 66 89 50 16 mov %dx,0x16(%eax)
ip->size = dip->size;
80101933: 8b 45 f0 mov -0x10(%ebp),%eax
80101936: 8b 50 08 mov 0x8(%eax),%edx
80101939: 8b 45 08 mov 0x8(%ebp),%eax
8010193c: 89 50 18 mov %edx,0x18(%eax)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010193f: 8b 45 f0 mov -0x10(%ebp),%eax
80101942: 8d 50 0c lea 0xc(%eax),%edx
80101945: 8b 45 08 mov 0x8(%ebp),%eax
80101948: 83 c0 1c add $0x1c,%eax
8010194b: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
80101952: 00
80101953: 89 54 24 04 mov %edx,0x4(%esp)
80101957: 89 04 24 mov %eax,(%esp)
8010195a: e8 26 34 00 00 call 80104d85 <memmove>
brelse(bp);
8010195f: 8b 45 f4 mov -0xc(%ebp),%eax
80101962: 89 04 24 mov %eax,(%esp)
80101965: e8 ad e8 ff ff call 80100217 <brelse>
ip->flags |= I_VALID;
8010196a: 8b 45 08 mov 0x8(%ebp),%eax
8010196d: 8b 40 0c mov 0xc(%eax),%eax
80101970: 83 c8 02 or $0x2,%eax
80101973: 89 c2 mov %eax,%edx
80101975: 8b 45 08 mov 0x8(%ebp),%eax
80101978: 89 50 0c mov %edx,0xc(%eax)
if(ip->type == 0)
8010197b: 8b 45 08 mov 0x8(%ebp),%eax
8010197e: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101982: 66 85 c0 test %ax,%ax
80101985: 75 0c jne 80101993 <ilock+0x14c>
panic("ilock: no type");
80101987: c7 04 24 2d 83 10 80 movl $0x8010832d,(%esp)
8010198e: e8 a7 eb ff ff call 8010053a <panic>
}
}
80101993: c9 leave
80101994: c3 ret
80101995 <iunlock>:
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101995: 55 push %ebp
80101996: 89 e5 mov %esp,%ebp
80101998: 83 ec 18 sub $0x18,%esp
if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
8010199b: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
8010199f: 74 17 je 801019b8 <iunlock+0x23>
801019a1: 8b 45 08 mov 0x8(%ebp),%eax
801019a4: 8b 40 0c mov 0xc(%eax),%eax
801019a7: 83 e0 01 and $0x1,%eax
801019aa: 85 c0 test %eax,%eax
801019ac: 74 0a je 801019b8 <iunlock+0x23>
801019ae: 8b 45 08 mov 0x8(%ebp),%eax
801019b1: 8b 40 08 mov 0x8(%eax),%eax
801019b4: 85 c0 test %eax,%eax
801019b6: 7f 0c jg 801019c4 <iunlock+0x2f>
panic("iunlock");
801019b8: c7 04 24 3c 83 10 80 movl $0x8010833c,(%esp)
801019bf: e8 76 eb ff ff call 8010053a <panic>
acquire(&icache.lock);
801019c4: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
801019cb: e8 92 30 00 00 call 80104a62 <acquire>
ip->flags &= ~I_BUSY;
801019d0: 8b 45 08 mov 0x8(%ebp),%eax
801019d3: 8b 40 0c mov 0xc(%eax),%eax
801019d6: 83 e0 fe and $0xfffffffe,%eax
801019d9: 89 c2 mov %eax,%edx
801019db: 8b 45 08 mov 0x8(%ebp),%eax
801019de: 89 50 0c mov %edx,0xc(%eax)
wakeup(ip);
801019e1: 8b 45 08 mov 0x8(%ebp),%eax
801019e4: 89 04 24 mov %eax,(%esp)
801019e7: e8 85 2e 00 00 call 80104871 <wakeup>
release(&icache.lock);
801019ec: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
801019f3: e8 cc 30 00 00 call 80104ac4 <release>
}
801019f8: c9 leave
801019f9: c3 ret
801019fa <iput>:
// be recycled.
// If that was the last reference and the inode has no links
// to it, free the inode (and its content) on disk.
void
iput(struct inode *ip)
{
801019fa: 55 push %ebp
801019fb: 89 e5 mov %esp,%ebp
801019fd: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
80101a00: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101a07: e8 56 30 00 00 call 80104a62 <acquire>
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a0c: 8b 45 08 mov 0x8(%ebp),%eax
80101a0f: 8b 40 08 mov 0x8(%eax),%eax
80101a12: 83 f8 01 cmp $0x1,%eax
80101a15: 0f 85 93 00 00 00 jne 80101aae <iput+0xb4>
80101a1b: 8b 45 08 mov 0x8(%ebp),%eax
80101a1e: 8b 40 0c mov 0xc(%eax),%eax
80101a21: 83 e0 02 and $0x2,%eax
80101a24: 85 c0 test %eax,%eax
80101a26: 0f 84 82 00 00 00 je 80101aae <iput+0xb4>
80101a2c: 8b 45 08 mov 0x8(%ebp),%eax
80101a2f: 0f b7 40 16 movzwl 0x16(%eax),%eax
80101a33: 66 85 c0 test %ax,%ax
80101a36: 75 76 jne 80101aae <iput+0xb4>
// inode has no links: truncate and free inode.
if(ip->flags & I_BUSY)
80101a38: 8b 45 08 mov 0x8(%ebp),%eax
80101a3b: 8b 40 0c mov 0xc(%eax),%eax
80101a3e: 83 e0 01 and $0x1,%eax
80101a41: 85 c0 test %eax,%eax
80101a43: 74 0c je 80101a51 <iput+0x57>
panic("iput busy");
80101a45: c7 04 24 44 83 10 80 movl $0x80108344,(%esp)
80101a4c: e8 e9 ea ff ff call 8010053a <panic>
ip->flags |= I_BUSY;
80101a51: 8b 45 08 mov 0x8(%ebp),%eax
80101a54: 8b 40 0c mov 0xc(%eax),%eax
80101a57: 83 c8 01 or $0x1,%eax
80101a5a: 89 c2 mov %eax,%edx
80101a5c: 8b 45 08 mov 0x8(%ebp),%eax
80101a5f: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
80101a62: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101a69: e8 56 30 00 00 call 80104ac4 <release>
itrunc(ip);
80101a6e: 8b 45 08 mov 0x8(%ebp),%eax
80101a71: 89 04 24 mov %eax,(%esp)
80101a74: e8 7d 01 00 00 call 80101bf6 <itrunc>
ip->type = 0;
80101a79: 8b 45 08 mov 0x8(%ebp),%eax
80101a7c: 66 c7 40 10 00 00 movw $0x0,0x10(%eax)
iupdate(ip);
80101a82: 8b 45 08 mov 0x8(%ebp),%eax
80101a85: 89 04 24 mov %eax,(%esp)
80101a88: e8 fe fb ff ff call 8010168b <iupdate>
acquire(&icache.lock);
80101a8d: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101a94: e8 c9 2f 00 00 call 80104a62 <acquire>
ip->flags = 0;
80101a99: 8b 45 08 mov 0x8(%ebp),%eax
80101a9c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
wakeup(ip);
80101aa3: 8b 45 08 mov 0x8(%ebp),%eax
80101aa6: 89 04 24 mov %eax,(%esp)
80101aa9: e8 c3 2d 00 00 call 80104871 <wakeup>
}
ip->ref--;
80101aae: 8b 45 08 mov 0x8(%ebp),%eax
80101ab1: 8b 40 08 mov 0x8(%eax),%eax
80101ab4: 8d 50 ff lea -0x1(%eax),%edx
80101ab7: 8b 45 08 mov 0x8(%ebp),%eax
80101aba: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101abd: c7 04 24 60 e8 10 80 movl $0x8010e860,(%esp)
80101ac4: e8 fb 2f 00 00 call 80104ac4 <release>
}
80101ac9: c9 leave
80101aca: c3 ret
80101acb <iunlockput>:
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101acb: 55 push %ebp
80101acc: 89 e5 mov %esp,%ebp
80101ace: 83 ec 18 sub $0x18,%esp
iunlock(ip);
80101ad1: 8b 45 08 mov 0x8(%ebp),%eax
80101ad4: 89 04 24 mov %eax,(%esp)
80101ad7: e8 b9 fe ff ff call 80101995 <iunlock>
iput(ip);
80101adc: 8b 45 08 mov 0x8(%ebp),%eax
80101adf: 89 04 24 mov %eax,(%esp)
80101ae2: e8 13 ff ff ff call 801019fa <iput>
}
80101ae7: c9 leave
80101ae8: c3 ret
80101ae9 <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101ae9: 55 push %ebp
80101aea: 89 e5 mov %esp,%ebp
80101aec: 53 push %ebx
80101aed: 83 ec 24 sub $0x24,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
80101af0: 83 7d 0c 0b cmpl $0xb,0xc(%ebp)
80101af4: 77 3e ja 80101b34 <bmap+0x4b>
if((addr = ip->addrs[bn]) == 0)
80101af6: 8b 45 08 mov 0x8(%ebp),%eax
80101af9: 8b 55 0c mov 0xc(%ebp),%edx
80101afc: 83 c2 04 add $0x4,%edx
80101aff: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101b03: 89 45 f4 mov %eax,-0xc(%ebp)
80101b06: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b0a: 75 20 jne 80101b2c <bmap+0x43>
ip->addrs[bn] = addr = balloc(ip->dev);
80101b0c: 8b 45 08 mov 0x8(%ebp),%eax
80101b0f: 8b 00 mov (%eax),%eax
80101b11: 89 04 24 mov %eax,(%esp)
80101b14: e8 5b f8 ff ff call 80101374 <balloc>
80101b19: 89 45 f4 mov %eax,-0xc(%ebp)
80101b1c: 8b 45 08 mov 0x8(%ebp),%eax
80101b1f: 8b 55 0c mov 0xc(%ebp),%edx
80101b22: 8d 4a 04 lea 0x4(%edx),%ecx
80101b25: 8b 55 f4 mov -0xc(%ebp),%edx
80101b28: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4)
return addr;
80101b2c: 8b 45 f4 mov -0xc(%ebp),%eax
80101b2f: e9 bc 00 00 00 jmp 80101bf0 <bmap+0x107>
}
bn -= NDIRECT;
80101b34: 83 6d 0c 0c subl $0xc,0xc(%ebp)
if(bn < NINDIRECT){
80101b38: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp)
80101b3c: 0f 87 a2 00 00 00 ja 80101be4 <bmap+0xfb>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101b42: 8b 45 08 mov 0x8(%ebp),%eax
80101b45: 8b 40 4c mov 0x4c(%eax),%eax
80101b48: 89 45 f4 mov %eax,-0xc(%ebp)
80101b4b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b4f: 75 19 jne 80101b6a <bmap+0x81>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b51: 8b 45 08 mov 0x8(%ebp),%eax
80101b54: 8b 00 mov (%eax),%eax
80101b56: 89 04 24 mov %eax,(%esp)
80101b59: e8 16 f8 ff ff call 80101374 <balloc>
80101b5e: 89 45 f4 mov %eax,-0xc(%ebp)
80101b61: 8b 45 08 mov 0x8(%ebp),%eax
80101b64: 8b 55 f4 mov -0xc(%ebp),%edx
80101b67: 89 50 4c mov %edx,0x4c(%eax)
bp = bread(ip->dev, addr);
80101b6a: 8b 45 08 mov 0x8(%ebp),%eax
80101b6d: 8b 00 mov (%eax),%eax
80101b6f: 8b 55 f4 mov -0xc(%ebp),%edx
80101b72: 89 54 24 04 mov %edx,0x4(%esp)
80101b76: 89 04 24 mov %eax,(%esp)
80101b79: e8 28 e6 ff ff call 801001a6 <bread>
80101b7e: 89 45 f0 mov %eax,-0x10(%ebp)
a = (uint*)bp->data;
80101b81: 8b 45 f0 mov -0x10(%ebp),%eax
80101b84: 83 c0 18 add $0x18,%eax
80101b87: 89 45 ec mov %eax,-0x14(%ebp)
if((addr = a[bn]) == 0){
80101b8a: 8b 45 0c mov 0xc(%ebp),%eax
80101b8d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101b94: 8b 45 ec mov -0x14(%ebp),%eax
80101b97: 01 d0 add %edx,%eax
80101b99: 8b 00 mov (%eax),%eax
80101b9b: 89 45 f4 mov %eax,-0xc(%ebp)
80101b9e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101ba2: 75 30 jne 80101bd4 <bmap+0xeb>
a[bn] = addr = balloc(ip->dev);
80101ba4: 8b 45 0c mov 0xc(%ebp),%eax
80101ba7: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101bae: 8b 45 ec mov -0x14(%ebp),%eax
80101bb1: 8d 1c 02 lea (%edx,%eax,1),%ebx
80101bb4: 8b 45 08 mov 0x8(%ebp),%eax
80101bb7: 8b 00 mov (%eax),%eax
80101bb9: 89 04 24 mov %eax,(%esp)
80101bbc: e8 b3 f7 ff ff call 80101374 <balloc>
80101bc1: 89 45 f4 mov %eax,-0xc(%ebp)
80101bc4: 8b 45 f4 mov -0xc(%ebp),%eax
80101bc7: 89 03 mov %eax,(%ebx)
log_write(bp);
80101bc9: 8b 45 f0 mov -0x10(%ebp),%eax
80101bcc: 89 04 24 mov %eax,(%esp)
80101bcf: e8 9e 16 00 00 call 80103272 <log_write>
}
brelse(bp);
80101bd4: 8b 45 f0 mov -0x10(%ebp),%eax
80101bd7: 89 04 24 mov %eax,(%esp)
80101bda: e8 38 e6 ff ff call 80100217 <brelse>
return addr;
80101bdf: 8b 45 f4 mov -0xc(%ebp),%eax
80101be2: eb 0c jmp 80101bf0 <bmap+0x107>
}
panic("bmap: out of range");
80101be4: c7 04 24 4e 83 10 80 movl $0x8010834e,(%esp)
80101beb: e8 4a e9 ff ff call 8010053a <panic>
}
80101bf0: 83 c4 24 add $0x24,%esp
80101bf3: 5b pop %ebx
80101bf4: 5d pop %ebp
80101bf5: c3 ret
80101bf6 <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101bf6: 55 push %ebp
80101bf7: 89 e5 mov %esp,%ebp
80101bf9: 83 ec 28 sub $0x28,%esp
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101bfc: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101c03: eb 44 jmp 80101c49 <itrunc+0x53>
if(ip->addrs[i]){
80101c05: 8b 45 08 mov 0x8(%ebp),%eax
80101c08: 8b 55 f4 mov -0xc(%ebp),%edx
80101c0b: 83 c2 04 add $0x4,%edx
80101c0e: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101c12: 85 c0 test %eax,%eax
80101c14: 74 2f je 80101c45 <itrunc+0x4f>
bfree(ip->dev, ip->addrs[i]);
80101c16: 8b 45 08 mov 0x8(%ebp),%eax
80101c19: 8b 55 f4 mov -0xc(%ebp),%edx
80101c1c: 83 c2 04 add $0x4,%edx
80101c1f: 8b 54 90 0c mov 0xc(%eax,%edx,4),%edx
80101c23: 8b 45 08 mov 0x8(%ebp),%eax
80101c26: 8b 00 mov (%eax),%eax
80101c28: 89 54 24 04 mov %edx,0x4(%esp)
80101c2c: 89 04 24 mov %eax,(%esp)
80101c2f: e8 8e f8 ff ff call 801014c2 <bfree>
ip->addrs[i] = 0;
80101c34: 8b 45 08 mov 0x8(%ebp),%eax
80101c37: 8b 55 f4 mov -0xc(%ebp),%edx
80101c3a: 83 c2 04 add $0x4,%edx
80101c3d: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4)
80101c44: 00
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101c45: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80101c49: 83 7d f4 0b cmpl $0xb,-0xc(%ebp)
80101c4d: 7e b6 jle 80101c05 <itrunc+0xf>
bfree(ip->dev, ip->addrs[i]);
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
80101c4f: 8b 45 08 mov 0x8(%ebp),%eax
80101c52: 8b 40 4c mov 0x4c(%eax),%eax
80101c55: 85 c0 test %eax,%eax
80101c57: 0f 84 9b 00 00 00 je 80101cf8 <itrunc+0x102>
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101c5d: 8b 45 08 mov 0x8(%ebp),%eax
80101c60: 8b 50 4c mov 0x4c(%eax),%edx
80101c63: 8b 45 08 mov 0x8(%ebp),%eax
80101c66: 8b 00 mov (%eax),%eax
80101c68: 89 54 24 04 mov %edx,0x4(%esp)
80101c6c: 89 04 24 mov %eax,(%esp)
80101c6f: e8 32 e5 ff ff call 801001a6 <bread>
80101c74: 89 45 ec mov %eax,-0x14(%ebp)
a = (uint*)bp->data;
80101c77: 8b 45 ec mov -0x14(%ebp),%eax
80101c7a: 83 c0 18 add $0x18,%eax
80101c7d: 89 45 e8 mov %eax,-0x18(%ebp)
for(j = 0; j < NINDIRECT; j++){
80101c80: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101c87: eb 3b jmp 80101cc4 <itrunc+0xce>
if(a[j])
80101c89: 8b 45 f0 mov -0x10(%ebp),%eax
80101c8c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101c93: 8b 45 e8 mov -0x18(%ebp),%eax
80101c96: 01 d0 add %edx,%eax
80101c98: 8b 00 mov (%eax),%eax
80101c9a: 85 c0 test %eax,%eax
80101c9c: 74 22 je 80101cc0 <itrunc+0xca>
bfree(ip->dev, a[j]);
80101c9e: 8b 45 f0 mov -0x10(%ebp),%eax
80101ca1: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101ca8: 8b 45 e8 mov -0x18(%ebp),%eax
80101cab: 01 d0 add %edx,%eax
80101cad: 8b 10 mov (%eax),%edx
80101caf: 8b 45 08 mov 0x8(%ebp),%eax
80101cb2: 8b 00 mov (%eax),%eax
80101cb4: 89 54 24 04 mov %edx,0x4(%esp)
80101cb8: 89 04 24 mov %eax,(%esp)
80101cbb: e8 02 f8 ff ff call 801014c2 <bfree>
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
80101cc0: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101cc4: 8b 45 f0 mov -0x10(%ebp),%eax
80101cc7: 83 f8 7f cmp $0x7f,%eax
80101cca: 76 bd jbe 80101c89 <itrunc+0x93>
if(a[j])
bfree(ip->dev, a[j]);
}
brelse(bp);
80101ccc: 8b 45 ec mov -0x14(%ebp),%eax
80101ccf: 89 04 24 mov %eax,(%esp)
80101cd2: e8 40 e5 ff ff call 80100217 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
80101cd7: 8b 45 08 mov 0x8(%ebp),%eax
80101cda: 8b 50 4c mov 0x4c(%eax),%edx
80101cdd: 8b 45 08 mov 0x8(%ebp),%eax
80101ce0: 8b 00 mov (%eax),%eax
80101ce2: 89 54 24 04 mov %edx,0x4(%esp)
80101ce6: 89 04 24 mov %eax,(%esp)
80101ce9: e8 d4 f7 ff ff call 801014c2 <bfree>
ip->addrs[NDIRECT] = 0;
80101cee: 8b 45 08 mov 0x8(%ebp),%eax
80101cf1: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax)
}
ip->size = 0;
80101cf8: 8b 45 08 mov 0x8(%ebp),%eax
80101cfb: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax)
iupdate(ip);
80101d02: 8b 45 08 mov 0x8(%ebp),%eax
80101d05: 89 04 24 mov %eax,(%esp)
80101d08: e8 7e f9 ff ff call 8010168b <iupdate>
}
80101d0d: c9 leave
80101d0e: c3 ret
80101d0f <stati>:
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d0f: 55 push %ebp
80101d10: 89 e5 mov %esp,%ebp
st->dev = ip->dev;
80101d12: 8b 45 08 mov 0x8(%ebp),%eax
80101d15: 8b 00 mov (%eax),%eax
80101d17: 89 c2 mov %eax,%edx
80101d19: 8b 45 0c mov 0xc(%ebp),%eax
80101d1c: 89 50 04 mov %edx,0x4(%eax)
st->ino = ip->inum;
80101d1f: 8b 45 08 mov 0x8(%ebp),%eax
80101d22: 8b 50 04 mov 0x4(%eax),%edx
80101d25: 8b 45 0c mov 0xc(%ebp),%eax
80101d28: 89 50 08 mov %edx,0x8(%eax)
st->type = ip->type;
80101d2b: 8b 45 08 mov 0x8(%ebp),%eax
80101d2e: 0f b7 50 10 movzwl 0x10(%eax),%edx
80101d32: 8b 45 0c mov 0xc(%ebp),%eax
80101d35: 66 89 10 mov %dx,(%eax)
st->nlink = ip->nlink;
80101d38: 8b 45 08 mov 0x8(%ebp),%eax
80101d3b: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101d3f: 8b 45 0c mov 0xc(%ebp),%eax
80101d42: 66 89 50 0c mov %dx,0xc(%eax)
st->size = ip->size;
80101d46: 8b 45 08 mov 0x8(%ebp),%eax
80101d49: 8b 50 18 mov 0x18(%eax),%edx
80101d4c: 8b 45 0c mov 0xc(%ebp),%eax
80101d4f: 89 50 10 mov %edx,0x10(%eax)
}
80101d52: 5d pop %ebp
80101d53: c3 ret
80101d54 <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101d54: 55 push %ebp
80101d55: 89 e5 mov %esp,%ebp
80101d57: 83 ec 28 sub $0x28,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101d5a: 8b 45 08 mov 0x8(%ebp),%eax
80101d5d: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101d61: 66 83 f8 03 cmp $0x3,%ax
80101d65: 75 60 jne 80101dc7 <readi+0x73>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101d67: 8b 45 08 mov 0x8(%ebp),%eax
80101d6a: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d6e: 66 85 c0 test %ax,%ax
80101d71: 78 20 js 80101d93 <readi+0x3f>
80101d73: 8b 45 08 mov 0x8(%ebp),%eax
80101d76: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d7a: 66 83 f8 09 cmp $0x9,%ax
80101d7e: 7f 13 jg 80101d93 <readi+0x3f>
80101d80: 8b 45 08 mov 0x8(%ebp),%eax
80101d83: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d87: 98 cwtl
80101d88: 8b 04 c5 00 e8 10 80 mov -0x7fef1800(,%eax,8),%eax
80101d8f: 85 c0 test %eax,%eax
80101d91: 75 0a jne 80101d9d <readi+0x49>
return -1;
80101d93: b8 ff ff ff ff mov $0xffffffff,%eax
80101d98: e9 19 01 00 00 jmp 80101eb6 <readi+0x162>
return devsw[ip->major].read(ip, dst, n);
80101d9d: 8b 45 08 mov 0x8(%ebp),%eax
80101da0: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101da4: 98 cwtl
80101da5: 8b 04 c5 00 e8 10 80 mov -0x7fef1800(,%eax,8),%eax
80101dac: 8b 55 14 mov 0x14(%ebp),%edx
80101daf: 89 54 24 08 mov %edx,0x8(%esp)
80101db3: 8b 55 0c mov 0xc(%ebp),%edx
80101db6: 89 54 24 04 mov %edx,0x4(%esp)
80101dba: 8b 55 08 mov 0x8(%ebp),%edx
80101dbd: 89 14 24 mov %edx,(%esp)
80101dc0: ff d0 call *%eax
80101dc2: e9 ef 00 00 00 jmp 80101eb6 <readi+0x162>
}
if(off > ip->size || off + n < off)
80101dc7: 8b 45 08 mov 0x8(%ebp),%eax
80101dca: 8b 40 18 mov 0x18(%eax),%eax
80101dcd: 3b 45 10 cmp 0x10(%ebp),%eax
80101dd0: 72 0d jb 80101ddf <readi+0x8b>
80101dd2: 8b 45 14 mov 0x14(%ebp),%eax
80101dd5: 8b 55 10 mov 0x10(%ebp),%edx
80101dd8: 01 d0 add %edx,%eax
80101dda: 3b 45 10 cmp 0x10(%ebp),%eax
80101ddd: 73 0a jae 80101de9 <readi+0x95>
return -1;
80101ddf: b8 ff ff ff ff mov $0xffffffff,%eax
80101de4: e9 cd 00 00 00 jmp 80101eb6 <readi+0x162>
if(off + n > ip->size)
80101de9: 8b 45 14 mov 0x14(%ebp),%eax
80101dec: 8b 55 10 mov 0x10(%ebp),%edx
80101def: 01 c2 add %eax,%edx
80101df1: 8b 45 08 mov 0x8(%ebp),%eax
80101df4: 8b 40 18 mov 0x18(%eax),%eax
80101df7: 39 c2 cmp %eax,%edx
80101df9: 76 0c jbe 80101e07 <readi+0xb3>
n = ip->size - off;
80101dfb: 8b 45 08 mov 0x8(%ebp),%eax
80101dfe: 8b 40 18 mov 0x18(%eax),%eax
80101e01: 2b 45 10 sub 0x10(%ebp),%eax
80101e04: 89 45 14 mov %eax,0x14(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e07: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101e0e: e9 94 00 00 00 jmp 80101ea7 <readi+0x153>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e13: 8b 45 10 mov 0x10(%ebp),%eax
80101e16: c1 e8 09 shr $0x9,%eax
80101e19: 89 44 24 04 mov %eax,0x4(%esp)
80101e1d: 8b 45 08 mov 0x8(%ebp),%eax
80101e20: 89 04 24 mov %eax,(%esp)
80101e23: e8 c1 fc ff ff call 80101ae9 <bmap>
80101e28: 8b 55 08 mov 0x8(%ebp),%edx
80101e2b: 8b 12 mov (%edx),%edx
80101e2d: 89 44 24 04 mov %eax,0x4(%esp)
80101e31: 89 14 24 mov %edx,(%esp)
80101e34: e8 6d e3 ff ff call 801001a6 <bread>
80101e39: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101e3c: 8b 45 10 mov 0x10(%ebp),%eax
80101e3f: 25 ff 01 00 00 and $0x1ff,%eax
80101e44: 89 c2 mov %eax,%edx
80101e46: b8 00 02 00 00 mov $0x200,%eax
80101e4b: 29 d0 sub %edx,%eax
80101e4d: 89 c2 mov %eax,%edx
80101e4f: 8b 45 f4 mov -0xc(%ebp),%eax
80101e52: 8b 4d 14 mov 0x14(%ebp),%ecx
80101e55: 29 c1 sub %eax,%ecx
80101e57: 89 c8 mov %ecx,%eax
80101e59: 39 c2 cmp %eax,%edx
80101e5b: 0f 46 c2 cmovbe %edx,%eax
80101e5e: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dst, bp->data + off%BSIZE, m);
80101e61: 8b 45 10 mov 0x10(%ebp),%eax
80101e64: 25 ff 01 00 00 and $0x1ff,%eax
80101e69: 8d 50 10 lea 0x10(%eax),%edx
80101e6c: 8b 45 f0 mov -0x10(%ebp),%eax
80101e6f: 01 d0 add %edx,%eax
80101e71: 8d 50 08 lea 0x8(%eax),%edx
80101e74: 8b 45 ec mov -0x14(%ebp),%eax
80101e77: 89 44 24 08 mov %eax,0x8(%esp)
80101e7b: 89 54 24 04 mov %edx,0x4(%esp)
80101e7f: 8b 45 0c mov 0xc(%ebp),%eax
80101e82: 89 04 24 mov %eax,(%esp)
80101e85: e8 fb 2e 00 00 call 80104d85 <memmove>
brelse(bp);
80101e8a: 8b 45 f0 mov -0x10(%ebp),%eax
80101e8d: 89 04 24 mov %eax,(%esp)
80101e90: e8 82 e3 ff ff call 80100217 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e95: 8b 45 ec mov -0x14(%ebp),%eax
80101e98: 01 45 f4 add %eax,-0xc(%ebp)
80101e9b: 8b 45 ec mov -0x14(%ebp),%eax
80101e9e: 01 45 10 add %eax,0x10(%ebp)
80101ea1: 8b 45 ec mov -0x14(%ebp),%eax
80101ea4: 01 45 0c add %eax,0xc(%ebp)
80101ea7: 8b 45 f4 mov -0xc(%ebp),%eax
80101eaa: 3b 45 14 cmp 0x14(%ebp),%eax
80101ead: 0f 82 60 ff ff ff jb 80101e13 <readi+0xbf>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
80101eb3: 8b 45 14 mov 0x14(%ebp),%eax
}
80101eb6: c9 leave
80101eb7: c3 ret
80101eb8 <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101eb8: 55 push %ebp
80101eb9: 89 e5 mov %esp,%ebp
80101ebb: 83 ec 28 sub $0x28,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101ebe: 8b 45 08 mov 0x8(%ebp),%eax
80101ec1: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101ec5: 66 83 f8 03 cmp $0x3,%ax
80101ec9: 75 60 jne 80101f2b <writei+0x73>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101ecb: 8b 45 08 mov 0x8(%ebp),%eax
80101ece: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101ed2: 66 85 c0 test %ax,%ax
80101ed5: 78 20 js 80101ef7 <writei+0x3f>
80101ed7: 8b 45 08 mov 0x8(%ebp),%eax
80101eda: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101ede: 66 83 f8 09 cmp $0x9,%ax
80101ee2: 7f 13 jg 80101ef7 <writei+0x3f>
80101ee4: 8b 45 08 mov 0x8(%ebp),%eax
80101ee7: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101eeb: 98 cwtl
80101eec: 8b 04 c5 04 e8 10 80 mov -0x7fef17fc(,%eax,8),%eax
80101ef3: 85 c0 test %eax,%eax
80101ef5: 75 0a jne 80101f01 <writei+0x49>
return -1;
80101ef7: b8 ff ff ff ff mov $0xffffffff,%eax
80101efc: e9 44 01 00 00 jmp 80102045 <writei+0x18d>
return devsw[ip->major].write(ip, src, n);
80101f01: 8b 45 08 mov 0x8(%ebp),%eax
80101f04: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f08: 98 cwtl
80101f09: 8b 04 c5 04 e8 10 80 mov -0x7fef17fc(,%eax,8),%eax
80101f10: 8b 55 14 mov 0x14(%ebp),%edx
80101f13: 89 54 24 08 mov %edx,0x8(%esp)
80101f17: 8b 55 0c mov 0xc(%ebp),%edx
80101f1a: 89 54 24 04 mov %edx,0x4(%esp)
80101f1e: 8b 55 08 mov 0x8(%ebp),%edx
80101f21: 89 14 24 mov %edx,(%esp)
80101f24: ff d0 call *%eax
80101f26: e9 1a 01 00 00 jmp 80102045 <writei+0x18d>
}
if(off > ip->size || off + n < off)
80101f2b: 8b 45 08 mov 0x8(%ebp),%eax
80101f2e: 8b 40 18 mov 0x18(%eax),%eax
80101f31: 3b 45 10 cmp 0x10(%ebp),%eax
80101f34: 72 0d jb 80101f43 <writei+0x8b>
80101f36: 8b 45 14 mov 0x14(%ebp),%eax
80101f39: 8b 55 10 mov 0x10(%ebp),%edx
80101f3c: 01 d0 add %edx,%eax
80101f3e: 3b 45 10 cmp 0x10(%ebp),%eax
80101f41: 73 0a jae 80101f4d <writei+0x95>
return -1;
80101f43: b8 ff ff ff ff mov $0xffffffff,%eax
80101f48: e9 f8 00 00 00 jmp 80102045 <writei+0x18d>
if(off + n > MAXFILE*BSIZE)
80101f4d: 8b 45 14 mov 0x14(%ebp),%eax
80101f50: 8b 55 10 mov 0x10(%ebp),%edx
80101f53: 01 d0 add %edx,%eax
80101f55: 3d 00 18 01 00 cmp $0x11800,%eax
80101f5a: 76 0a jbe 80101f66 <writei+0xae>
return -1;
80101f5c: b8 ff ff ff ff mov $0xffffffff,%eax
80101f61: e9 df 00 00 00 jmp 80102045 <writei+0x18d>
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101f66: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101f6d: e9 9f 00 00 00 jmp 80102011 <writei+0x159>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101f72: 8b 45 10 mov 0x10(%ebp),%eax
80101f75: c1 e8 09 shr $0x9,%eax
80101f78: 89 44 24 04 mov %eax,0x4(%esp)
80101f7c: 8b 45 08 mov 0x8(%ebp),%eax
80101f7f: 89 04 24 mov %eax,(%esp)
80101f82: e8 62 fb ff ff call 80101ae9 <bmap>
80101f87: 8b 55 08 mov 0x8(%ebp),%edx
80101f8a: 8b 12 mov (%edx),%edx
80101f8c: 89 44 24 04 mov %eax,0x4(%esp)
80101f90: 89 14 24 mov %edx,(%esp)
80101f93: e8 0e e2 ff ff call 801001a6 <bread>
80101f98: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101f9b: 8b 45 10 mov 0x10(%ebp),%eax
80101f9e: 25 ff 01 00 00 and $0x1ff,%eax
80101fa3: 89 c2 mov %eax,%edx
80101fa5: b8 00 02 00 00 mov $0x200,%eax
80101faa: 29 d0 sub %edx,%eax
80101fac: 89 c2 mov %eax,%edx
80101fae: 8b 45 f4 mov -0xc(%ebp),%eax
80101fb1: 8b 4d 14 mov 0x14(%ebp),%ecx
80101fb4: 29 c1 sub %eax,%ecx
80101fb6: 89 c8 mov %ecx,%eax
80101fb8: 39 c2 cmp %eax,%edx
80101fba: 0f 46 c2 cmovbe %edx,%eax
80101fbd: 89 45 ec mov %eax,-0x14(%ebp)
memmove(bp->data + off%BSIZE, src, m);
80101fc0: 8b 45 10 mov 0x10(%ebp),%eax
80101fc3: 25 ff 01 00 00 and $0x1ff,%eax
80101fc8: 8d 50 10 lea 0x10(%eax),%edx
80101fcb: 8b 45 f0 mov -0x10(%ebp),%eax
80101fce: 01 d0 add %edx,%eax
80101fd0: 8d 50 08 lea 0x8(%eax),%edx
80101fd3: 8b 45 ec mov -0x14(%ebp),%eax
80101fd6: 89 44 24 08 mov %eax,0x8(%esp)
80101fda: 8b 45 0c mov 0xc(%ebp),%eax
80101fdd: 89 44 24 04 mov %eax,0x4(%esp)
80101fe1: 89 14 24 mov %edx,(%esp)
80101fe4: e8 9c 2d 00 00 call 80104d85 <memmove>
log_write(bp);
80101fe9: 8b 45 f0 mov -0x10(%ebp),%eax
80101fec: 89 04 24 mov %eax,(%esp)
80101fef: e8 7e 12 00 00 call 80103272 <log_write>
brelse(bp);
80101ff4: 8b 45 f0 mov -0x10(%ebp),%eax
80101ff7: 89 04 24 mov %eax,(%esp)
80101ffa: e8 18 e2 ff ff call 80100217 <brelse>
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101fff: 8b 45 ec mov -0x14(%ebp),%eax
80102002: 01 45 f4 add %eax,-0xc(%ebp)
80102005: 8b 45 ec mov -0x14(%ebp),%eax
80102008: 01 45 10 add %eax,0x10(%ebp)
8010200b: 8b 45 ec mov -0x14(%ebp),%eax
8010200e: 01 45 0c add %eax,0xc(%ebp)
80102011: 8b 45 f4 mov -0xc(%ebp),%eax
80102014: 3b 45 14 cmp 0x14(%ebp),%eax
80102017: 0f 82 55 ff ff ff jb 80101f72 <writei+0xba>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
8010201d: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80102021: 74 1f je 80102042 <writei+0x18a>
80102023: 8b 45 08 mov 0x8(%ebp),%eax
80102026: 8b 40 18 mov 0x18(%eax),%eax
80102029: 3b 45 10 cmp 0x10(%ebp),%eax
8010202c: 73 14 jae 80102042 <writei+0x18a>
ip->size = off;
8010202e: 8b 45 08 mov 0x8(%ebp),%eax
80102031: 8b 55 10 mov 0x10(%ebp),%edx
80102034: 89 50 18 mov %edx,0x18(%eax)
iupdate(ip);
80102037: 8b 45 08 mov 0x8(%ebp),%eax
8010203a: 89 04 24 mov %eax,(%esp)
8010203d: e8 49 f6 ff ff call 8010168b <iupdate>
}
return n;
80102042: 8b 45 14 mov 0x14(%ebp),%eax
}
80102045: c9 leave
80102046: c3 ret
80102047 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
80102047: 55 push %ebp
80102048: 89 e5 mov %esp,%ebp
8010204a: 83 ec 18 sub $0x18,%esp
return strncmp(s, t, DIRSIZ);
8010204d: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80102054: 00
80102055: 8b 45 0c mov 0xc(%ebp),%eax
80102058: 89 44 24 04 mov %eax,0x4(%esp)
8010205c: 8b 45 08 mov 0x8(%ebp),%eax
8010205f: 89 04 24 mov %eax,(%esp)
80102062: e8 c1 2d 00 00 call 80104e28 <strncmp>
}
80102067: c9 leave
80102068: c3 ret
80102069 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
80102069: 55 push %ebp
8010206a: 89 e5 mov %esp,%ebp
8010206c: 83 ec 38 sub $0x38,%esp
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
8010206f: 8b 45 08 mov 0x8(%ebp),%eax
80102072: 0f b7 40 10 movzwl 0x10(%eax),%eax
80102076: 66 83 f8 01 cmp $0x1,%ax
8010207a: 74 0c je 80102088 <dirlookup+0x1f>
panic("dirlookup not DIR");
8010207c: c7 04 24 61 83 10 80 movl $0x80108361,(%esp)
80102083: e8 b2 e4 ff ff call 8010053a <panic>
for(off = 0; off < dp->size; off += sizeof(de)){
80102088: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010208f: e9 88 00 00 00 jmp 8010211c <dirlookup+0xb3>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102094: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
8010209b: 00
8010209c: 8b 45 f4 mov -0xc(%ebp),%eax
8010209f: 89 44 24 08 mov %eax,0x8(%esp)
801020a3: 8d 45 e0 lea -0x20(%ebp),%eax
801020a6: 89 44 24 04 mov %eax,0x4(%esp)
801020aa: 8b 45 08 mov 0x8(%ebp),%eax
801020ad: 89 04 24 mov %eax,(%esp)
801020b0: e8 9f fc ff ff call 80101d54 <readi>
801020b5: 83 f8 10 cmp $0x10,%eax
801020b8: 74 0c je 801020c6 <dirlookup+0x5d>
panic("dirlink read");
801020ba: c7 04 24 73 83 10 80 movl $0x80108373,(%esp)
801020c1: e8 74 e4 ff ff call 8010053a <panic>
if(de.inum == 0)
801020c6: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801020ca: 66 85 c0 test %ax,%ax
801020cd: 75 02 jne 801020d1 <dirlookup+0x68>
continue;
801020cf: eb 47 jmp 80102118 <dirlookup+0xaf>
if(namecmp(name, de.name) == 0){
801020d1: 8d 45 e0 lea -0x20(%ebp),%eax
801020d4: 83 c0 02 add $0x2,%eax
801020d7: 89 44 24 04 mov %eax,0x4(%esp)
801020db: 8b 45 0c mov 0xc(%ebp),%eax
801020de: 89 04 24 mov %eax,(%esp)
801020e1: e8 61 ff ff ff call 80102047 <namecmp>
801020e6: 85 c0 test %eax,%eax
801020e8: 75 2e jne 80102118 <dirlookup+0xaf>
// entry matches path element
if(poff)
801020ea: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801020ee: 74 08 je 801020f8 <dirlookup+0x8f>
*poff = off;
801020f0: 8b 45 10 mov 0x10(%ebp),%eax
801020f3: 8b 55 f4 mov -0xc(%ebp),%edx
801020f6: 89 10 mov %edx,(%eax)
inum = de.inum;
801020f8: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801020fc: 0f b7 c0 movzwl %ax,%eax
801020ff: 89 45 f0 mov %eax,-0x10(%ebp)
return iget(dp->dev, inum);
80102102: 8b 45 08 mov 0x8(%ebp),%eax
80102105: 8b 00 mov (%eax),%eax
80102107: 8b 55 f0 mov -0x10(%ebp),%edx
8010210a: 89 54 24 04 mov %edx,0x4(%esp)
8010210e: 89 04 24 mov %eax,(%esp)
80102111: e8 2d f6 ff ff call 80101743 <iget>
80102116: eb 18 jmp 80102130 <dirlookup+0xc7>
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80102118: 83 45 f4 10 addl $0x10,-0xc(%ebp)
8010211c: 8b 45 08 mov 0x8(%ebp),%eax
8010211f: 8b 40 18 mov 0x18(%eax),%eax
80102122: 3b 45 f4 cmp -0xc(%ebp),%eax
80102125: 0f 87 69 ff ff ff ja 80102094 <dirlookup+0x2b>
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
8010212b: b8 00 00 00 00 mov $0x0,%eax
}
80102130: c9 leave
80102131: c3 ret
80102132 <dirlink>:
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80102132: 55 push %ebp
80102133: 89 e5 mov %esp,%ebp
80102135: 83 ec 38 sub $0x38,%esp
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80102138: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010213f: 00
80102140: 8b 45 0c mov 0xc(%ebp),%eax
80102143: 89 44 24 04 mov %eax,0x4(%esp)
80102147: 8b 45 08 mov 0x8(%ebp),%eax
8010214a: 89 04 24 mov %eax,(%esp)
8010214d: e8 17 ff ff ff call 80102069 <dirlookup>
80102152: 89 45 f0 mov %eax,-0x10(%ebp)
80102155: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80102159: 74 15 je 80102170 <dirlink+0x3e>
iput(ip);
8010215b: 8b 45 f0 mov -0x10(%ebp),%eax
8010215e: 89 04 24 mov %eax,(%esp)
80102161: e8 94 f8 ff ff call 801019fa <iput>
return -1;
80102166: b8 ff ff ff ff mov $0xffffffff,%eax
8010216b: e9 b7 00 00 00 jmp 80102227 <dirlink+0xf5>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80102170: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102177: eb 46 jmp 801021bf <dirlink+0x8d>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102179: 8b 45 f4 mov -0xc(%ebp),%eax
8010217c: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80102183: 00
80102184: 89 44 24 08 mov %eax,0x8(%esp)
80102188: 8d 45 e0 lea -0x20(%ebp),%eax
8010218b: 89 44 24 04 mov %eax,0x4(%esp)
8010218f: 8b 45 08 mov 0x8(%ebp),%eax
80102192: 89 04 24 mov %eax,(%esp)
80102195: e8 ba fb ff ff call 80101d54 <readi>
8010219a: 83 f8 10 cmp $0x10,%eax
8010219d: 74 0c je 801021ab <dirlink+0x79>
panic("dirlink read");
8010219f: c7 04 24 73 83 10 80 movl $0x80108373,(%esp)
801021a6: e8 8f e3 ff ff call 8010053a <panic>
if(de.inum == 0)
801021ab: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801021af: 66 85 c0 test %ax,%ax
801021b2: 75 02 jne 801021b6 <dirlink+0x84>
break;
801021b4: eb 16 jmp 801021cc <dirlink+0x9a>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
801021b6: 8b 45 f4 mov -0xc(%ebp),%eax
801021b9: 83 c0 10 add $0x10,%eax
801021bc: 89 45 f4 mov %eax,-0xc(%ebp)
801021bf: 8b 55 f4 mov -0xc(%ebp),%edx
801021c2: 8b 45 08 mov 0x8(%ebp),%eax
801021c5: 8b 40 18 mov 0x18(%eax),%eax
801021c8: 39 c2 cmp %eax,%edx
801021ca: 72 ad jb 80102179 <dirlink+0x47>
panic("dirlink read");
if(de.inum == 0)
break;
}
strncpy(de.name, name, DIRSIZ);
801021cc: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
801021d3: 00
801021d4: 8b 45 0c mov 0xc(%ebp),%eax
801021d7: 89 44 24 04 mov %eax,0x4(%esp)
801021db: 8d 45 e0 lea -0x20(%ebp),%eax
801021de: 83 c0 02 add $0x2,%eax
801021e1: 89 04 24 mov %eax,(%esp)
801021e4: e8 95 2c 00 00 call 80104e7e <strncpy>
de.inum = inum;
801021e9: 8b 45 10 mov 0x10(%ebp),%eax
801021ec: 66 89 45 e0 mov %ax,-0x20(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021f0: 8b 45 f4 mov -0xc(%ebp),%eax
801021f3: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801021fa: 00
801021fb: 89 44 24 08 mov %eax,0x8(%esp)
801021ff: 8d 45 e0 lea -0x20(%ebp),%eax
80102202: 89 44 24 04 mov %eax,0x4(%esp)
80102206: 8b 45 08 mov 0x8(%ebp),%eax
80102209: 89 04 24 mov %eax,(%esp)
8010220c: e8 a7 fc ff ff call 80101eb8 <writei>
80102211: 83 f8 10 cmp $0x10,%eax
80102214: 74 0c je 80102222 <dirlink+0xf0>
panic("dirlink");
80102216: c7 04 24 80 83 10 80 movl $0x80108380,(%esp)
8010221d: e8 18 e3 ff ff call 8010053a <panic>
return 0;
80102222: b8 00 00 00 00 mov $0x0,%eax
}
80102227: c9 leave
80102228: c3 ret
80102229 <skipelem>:
// skipelem("a", name) = "", setting name = "a"
// skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
80102229: 55 push %ebp
8010222a: 89 e5 mov %esp,%ebp
8010222c: 83 ec 28 sub $0x28,%esp
char *s;
int len;
while(*path == '/')
8010222f: eb 04 jmp 80102235 <skipelem+0xc>
path++;
80102231: 83 45 08 01 addl $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80102235: 8b 45 08 mov 0x8(%ebp),%eax
80102238: 0f b6 00 movzbl (%eax),%eax
8010223b: 3c 2f cmp $0x2f,%al
8010223d: 74 f2 je 80102231 <skipelem+0x8>
path++;
if(*path == 0)
8010223f: 8b 45 08 mov 0x8(%ebp),%eax
80102242: 0f b6 00 movzbl (%eax),%eax
80102245: 84 c0 test %al,%al
80102247: 75 0a jne 80102253 <skipelem+0x2a>
return 0;
80102249: b8 00 00 00 00 mov $0x0,%eax
8010224e: e9 86 00 00 00 jmp 801022d9 <skipelem+0xb0>
s = path;
80102253: 8b 45 08 mov 0x8(%ebp),%eax
80102256: 89 45 f4 mov %eax,-0xc(%ebp)
while(*path != '/' && *path != 0)
80102259: eb 04 jmp 8010225f <skipelem+0x36>
path++;
8010225b: 83 45 08 01 addl $0x1,0x8(%ebp)
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
8010225f: 8b 45 08 mov 0x8(%ebp),%eax
80102262: 0f b6 00 movzbl (%eax),%eax
80102265: 3c 2f cmp $0x2f,%al
80102267: 74 0a je 80102273 <skipelem+0x4a>
80102269: 8b 45 08 mov 0x8(%ebp),%eax
8010226c: 0f b6 00 movzbl (%eax),%eax
8010226f: 84 c0 test %al,%al
80102271: 75 e8 jne 8010225b <skipelem+0x32>
path++;
len = path - s;
80102273: 8b 55 08 mov 0x8(%ebp),%edx
80102276: 8b 45 f4 mov -0xc(%ebp),%eax
80102279: 29 c2 sub %eax,%edx
8010227b: 89 d0 mov %edx,%eax
8010227d: 89 45 f0 mov %eax,-0x10(%ebp)
if(len >= DIRSIZ)
80102280: 83 7d f0 0d cmpl $0xd,-0x10(%ebp)
80102284: 7e 1c jle 801022a2 <skipelem+0x79>
memmove(name, s, DIRSIZ);
80102286: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
8010228d: 00
8010228e: 8b 45 f4 mov -0xc(%ebp),%eax
80102291: 89 44 24 04 mov %eax,0x4(%esp)
80102295: 8b 45 0c mov 0xc(%ebp),%eax
80102298: 89 04 24 mov %eax,(%esp)
8010229b: e8 e5 2a 00 00 call 80104d85 <memmove>
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022a0: eb 2a jmp 801022cc <skipelem+0xa3>
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
801022a2: 8b 45 f0 mov -0x10(%ebp),%eax
801022a5: 89 44 24 08 mov %eax,0x8(%esp)
801022a9: 8b 45 f4 mov -0xc(%ebp),%eax
801022ac: 89 44 24 04 mov %eax,0x4(%esp)
801022b0: 8b 45 0c mov 0xc(%ebp),%eax
801022b3: 89 04 24 mov %eax,(%esp)
801022b6: e8 ca 2a 00 00 call 80104d85 <memmove>
name[len] = 0;
801022bb: 8b 55 f0 mov -0x10(%ebp),%edx
801022be: 8b 45 0c mov 0xc(%ebp),%eax
801022c1: 01 d0 add %edx,%eax
801022c3: c6 00 00 movb $0x0,(%eax)
}
while(*path == '/')
801022c6: eb 04 jmp 801022cc <skipelem+0xa3>
path++;
801022c8: 83 45 08 01 addl $0x1,0x8(%ebp)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022cc: 8b 45 08 mov 0x8(%ebp),%eax
801022cf: 0f b6 00 movzbl (%eax),%eax
801022d2: 3c 2f cmp $0x2f,%al
801022d4: 74 f2 je 801022c8 <skipelem+0x9f>
path++;
return path;
801022d6: 8b 45 08 mov 0x8(%ebp),%eax
}
801022d9: c9 leave
801022da: c3 ret
801022db <namex>:
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
801022db: 55 push %ebp
801022dc: 89 e5 mov %esp,%ebp
801022de: 83 ec 28 sub $0x28,%esp
struct inode *ip, *next;
if(*path == '/')
801022e1: 8b 45 08 mov 0x8(%ebp),%eax
801022e4: 0f b6 00 movzbl (%eax),%eax
801022e7: 3c 2f cmp $0x2f,%al
801022e9: 75 1c jne 80102307 <namex+0x2c>
ip = iget(ROOTDEV, ROOTINO);
801022eb: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801022f2: 00
801022f3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801022fa: e8 44 f4 ff ff call 80101743 <iget>
801022ff: 89 45 f4 mov %eax,-0xc(%ebp)
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
80102302: e9 af 00 00 00 jmp 801023b6 <namex+0xdb>
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
80102307: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010230d: 8b 40 68 mov 0x68(%eax),%eax
80102310: 89 04 24 mov %eax,(%esp)
80102313: e8 fd f4 ff ff call 80101815 <idup>
80102318: 89 45 f4 mov %eax,-0xc(%ebp)
while((path = skipelem(path, name)) != 0){
8010231b: e9 96 00 00 00 jmp 801023b6 <namex+0xdb>
ilock(ip);
80102320: 8b 45 f4 mov -0xc(%ebp),%eax
80102323: 89 04 24 mov %eax,(%esp)
80102326: e8 1c f5 ff ff call 80101847 <ilock>
if(ip->type != T_DIR){
8010232b: 8b 45 f4 mov -0xc(%ebp),%eax
8010232e: 0f b7 40 10 movzwl 0x10(%eax),%eax
80102332: 66 83 f8 01 cmp $0x1,%ax
80102336: 74 15 je 8010234d <namex+0x72>
iunlockput(ip);
80102338: 8b 45 f4 mov -0xc(%ebp),%eax
8010233b: 89 04 24 mov %eax,(%esp)
8010233e: e8 88 f7 ff ff call 80101acb <iunlockput>
return 0;
80102343: b8 00 00 00 00 mov $0x0,%eax
80102348: e9 a3 00 00 00 jmp 801023f0 <namex+0x115>
}
if(nameiparent && *path == '\0'){
8010234d: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80102351: 74 1d je 80102370 <namex+0x95>
80102353: 8b 45 08 mov 0x8(%ebp),%eax
80102356: 0f b6 00 movzbl (%eax),%eax
80102359: 84 c0 test %al,%al
8010235b: 75 13 jne 80102370 <namex+0x95>
// Stop one level early.
iunlock(ip);
8010235d: 8b 45 f4 mov -0xc(%ebp),%eax
80102360: 89 04 24 mov %eax,(%esp)
80102363: e8 2d f6 ff ff call 80101995 <iunlock>
return ip;
80102368: 8b 45 f4 mov -0xc(%ebp),%eax
8010236b: e9 80 00 00 00 jmp 801023f0 <namex+0x115>
}
if((next = dirlookup(ip, name, 0)) == 0){
80102370: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80102377: 00
80102378: 8b 45 10 mov 0x10(%ebp),%eax
8010237b: 89 44 24 04 mov %eax,0x4(%esp)
8010237f: 8b 45 f4 mov -0xc(%ebp),%eax
80102382: 89 04 24 mov %eax,(%esp)
80102385: e8 df fc ff ff call 80102069 <dirlookup>
8010238a: 89 45 f0 mov %eax,-0x10(%ebp)
8010238d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80102391: 75 12 jne 801023a5 <namex+0xca>
iunlockput(ip);
80102393: 8b 45 f4 mov -0xc(%ebp),%eax
80102396: 89 04 24 mov %eax,(%esp)
80102399: e8 2d f7 ff ff call 80101acb <iunlockput>
return 0;
8010239e: b8 00 00 00 00 mov $0x0,%eax
801023a3: eb 4b jmp 801023f0 <namex+0x115>
}
iunlockput(ip);
801023a5: 8b 45 f4 mov -0xc(%ebp),%eax
801023a8: 89 04 24 mov %eax,(%esp)
801023ab: e8 1b f7 ff ff call 80101acb <iunlockput>
ip = next;
801023b0: 8b 45 f0 mov -0x10(%ebp),%eax
801023b3: 89 45 f4 mov %eax,-0xc(%ebp)
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
801023b6: 8b 45 10 mov 0x10(%ebp),%eax
801023b9: 89 44 24 04 mov %eax,0x4(%esp)
801023bd: 8b 45 08 mov 0x8(%ebp),%eax
801023c0: 89 04 24 mov %eax,(%esp)
801023c3: e8 61 fe ff ff call 80102229 <skipelem>
801023c8: 89 45 08 mov %eax,0x8(%ebp)
801023cb: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801023cf: 0f 85 4b ff ff ff jne 80102320 <namex+0x45>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
801023d5: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801023d9: 74 12 je 801023ed <namex+0x112>
iput(ip);
801023db: 8b 45 f4 mov -0xc(%ebp),%eax
801023de: 89 04 24 mov %eax,(%esp)
801023e1: e8 14 f6 ff ff call 801019fa <iput>
return 0;
801023e6: b8 00 00 00 00 mov $0x0,%eax
801023eb: eb 03 jmp 801023f0 <namex+0x115>
}
return ip;
801023ed: 8b 45 f4 mov -0xc(%ebp),%eax
}
801023f0: c9 leave
801023f1: c3 ret
801023f2 <namei>:
struct inode*
namei(char *path)
{
801023f2: 55 push %ebp
801023f3: 89 e5 mov %esp,%ebp
801023f5: 83 ec 28 sub $0x28,%esp
char name[DIRSIZ];
return namex(path, 0, name);
801023f8: 8d 45 ea lea -0x16(%ebp),%eax
801023fb: 89 44 24 08 mov %eax,0x8(%esp)
801023ff: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102406: 00
80102407: 8b 45 08 mov 0x8(%ebp),%eax
8010240a: 89 04 24 mov %eax,(%esp)
8010240d: e8 c9 fe ff ff call 801022db <namex>
}
80102412: c9 leave
80102413: c3 ret
80102414 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80102414: 55 push %ebp
80102415: 89 e5 mov %esp,%ebp
80102417: 83 ec 18 sub $0x18,%esp
return namex(path, 1, name);
8010241a: 8b 45 0c mov 0xc(%ebp),%eax
8010241d: 89 44 24 08 mov %eax,0x8(%esp)
80102421: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102428: 00
80102429: 8b 45 08 mov 0x8(%ebp),%eax
8010242c: 89 04 24 mov %eax,(%esp)
8010242f: e8 a7 fe ff ff call 801022db <namex>
}
80102434: c9 leave
80102435: c3 ret
80102436 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102436: 55 push %ebp
80102437: 89 e5 mov %esp,%ebp
80102439: 83 ec 14 sub $0x14,%esp
8010243c: 8b 45 08 mov 0x8(%ebp),%eax
8010243f: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102443: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102447: 89 c2 mov %eax,%edx
80102449: ec in (%dx),%al
8010244a: 88 45 ff mov %al,-0x1(%ebp)
return data;
8010244d: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102451: c9 leave
80102452: c3 ret
80102453 <insl>:
static inline void
insl(int port, void *addr, int cnt)
{
80102453: 55 push %ebp
80102454: 89 e5 mov %esp,%ebp
80102456: 57 push %edi
80102457: 53 push %ebx
asm volatile("cld; rep insl" :
80102458: 8b 55 08 mov 0x8(%ebp),%edx
8010245b: 8b 4d 0c mov 0xc(%ebp),%ecx
8010245e: 8b 45 10 mov 0x10(%ebp),%eax
80102461: 89 cb mov %ecx,%ebx
80102463: 89 df mov %ebx,%edi
80102465: 89 c1 mov %eax,%ecx
80102467: fc cld
80102468: f3 6d rep insl (%dx),%es:(%edi)
8010246a: 89 c8 mov %ecx,%eax
8010246c: 89 fb mov %edi,%ebx
8010246e: 89 5d 0c mov %ebx,0xc(%ebp)
80102471: 89 45 10 mov %eax,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"memory", "cc");
}
80102474: 5b pop %ebx
80102475: 5f pop %edi
80102476: 5d pop %ebp
80102477: c3 ret
80102478 <outb>:
static inline void
outb(ushort port, uchar data)
{
80102478: 55 push %ebp
80102479: 89 e5 mov %esp,%ebp
8010247b: 83 ec 08 sub $0x8,%esp
8010247e: 8b 55 08 mov 0x8(%ebp),%edx
80102481: 8b 45 0c mov 0xc(%ebp),%eax
80102484: 66 89 55 fc mov %dx,-0x4(%ebp)
80102488: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
8010248b: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
8010248f: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80102493: ee out %al,(%dx)
}
80102494: c9 leave
80102495: c3 ret
80102496 <outsl>:
asm volatile("out %0,%1" : : "a" (data), "d" (port));
}
static inline void
outsl(int port, const void *addr, int cnt)
{
80102496: 55 push %ebp
80102497: 89 e5 mov %esp,%ebp
80102499: 56 push %esi
8010249a: 53 push %ebx
asm volatile("cld; rep outsl" :
8010249b: 8b 55 08 mov 0x8(%ebp),%edx
8010249e: 8b 4d 0c mov 0xc(%ebp),%ecx
801024a1: 8b 45 10 mov 0x10(%ebp),%eax
801024a4: 89 cb mov %ecx,%ebx
801024a6: 89 de mov %ebx,%esi
801024a8: 89 c1 mov %eax,%ecx
801024aa: fc cld
801024ab: f3 6f rep outsl %ds:(%esi),(%dx)
801024ad: 89 c8 mov %ecx,%eax
801024af: 89 f3 mov %esi,%ebx
801024b1: 89 5d 0c mov %ebx,0xc(%ebp)
801024b4: 89 45 10 mov %eax,0x10(%ebp)
"=S" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
801024b7: 5b pop %ebx
801024b8: 5e pop %esi
801024b9: 5d pop %ebp
801024ba: c3 ret
801024bb <idewait>:
static void idestart(struct buf*);
// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
801024bb: 55 push %ebp
801024bc: 89 e5 mov %esp,%ebp
801024be: 83 ec 14 sub $0x14,%esp
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801024c1: 90 nop
801024c2: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801024c9: e8 68 ff ff ff call 80102436 <inb>
801024ce: 0f b6 c0 movzbl %al,%eax
801024d1: 89 45 fc mov %eax,-0x4(%ebp)
801024d4: 8b 45 fc mov -0x4(%ebp),%eax
801024d7: 25 c0 00 00 00 and $0xc0,%eax
801024dc: 83 f8 40 cmp $0x40,%eax
801024df: 75 e1 jne 801024c2 <idewait+0x7>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
801024e1: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801024e5: 74 11 je 801024f8 <idewait+0x3d>
801024e7: 8b 45 fc mov -0x4(%ebp),%eax
801024ea: 83 e0 21 and $0x21,%eax
801024ed: 85 c0 test %eax,%eax
801024ef: 74 07 je 801024f8 <idewait+0x3d>
return -1;
801024f1: b8 ff ff ff ff mov $0xffffffff,%eax
801024f6: eb 05 jmp 801024fd <idewait+0x42>
return 0;
801024f8: b8 00 00 00 00 mov $0x0,%eax
}
801024fd: c9 leave
801024fe: c3 ret
801024ff <ideinit>:
void
ideinit(void)
{
801024ff: 55 push %ebp
80102500: 89 e5 mov %esp,%ebp
80102502: 83 ec 28 sub $0x28,%esp
int i;
initlock(&idelock, "ide");
80102505: c7 44 24 04 88 83 10 movl $0x80108388,0x4(%esp)
8010250c: 80
8010250d: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
80102514: e8 28 25 00 00 call 80104a41 <initlock>
picenable(IRQ_IDE);
80102519: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102520: e8 29 15 00 00 call 80103a4e <picenable>
ioapicenable(IRQ_IDE, ncpu - 1);
80102525: a1 00 ff 10 80 mov 0x8010ff00,%eax
8010252a: 83 e8 01 sub $0x1,%eax
8010252d: 89 44 24 04 mov %eax,0x4(%esp)
80102531: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102538: e8 0c 04 00 00 call 80102949 <ioapicenable>
idewait(0);
8010253d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80102544: e8 72 ff ff ff call 801024bb <idewait>
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
80102549: c7 44 24 04 f0 00 00 movl $0xf0,0x4(%esp)
80102550: 00
80102551: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
80102558: e8 1b ff ff ff call 80102478 <outb>
for(i=0; i<1000; i++){
8010255d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102564: eb 20 jmp 80102586 <ideinit+0x87>
if(inb(0x1f7) != 0){
80102566: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
8010256d: e8 c4 fe ff ff call 80102436 <inb>
80102572: 84 c0 test %al,%al
80102574: 74 0c je 80102582 <ideinit+0x83>
havedisk1 = 1;
80102576: c7 05 38 b6 10 80 01 movl $0x1,0x8010b638
8010257d: 00 00 00
break;
80102580: eb 0d jmp 8010258f <ideinit+0x90>
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
80102582: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80102586: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
8010258d: 7e d7 jle 80102566 <ideinit+0x67>
break;
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
8010258f: c7 44 24 04 e0 00 00 movl $0xe0,0x4(%esp)
80102596: 00
80102597: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
8010259e: e8 d5 fe ff ff call 80102478 <outb>
}
801025a3: c9 leave
801025a4: c3 ret
801025a5 <idestart>:
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
801025a5: 55 push %ebp
801025a6: 89 e5 mov %esp,%ebp
801025a8: 83 ec 18 sub $0x18,%esp
if(b == 0)
801025ab: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801025af: 75 0c jne 801025bd <idestart+0x18>
panic("idestart");
801025b1: c7 04 24 8c 83 10 80 movl $0x8010838c,(%esp)
801025b8: e8 7d df ff ff call 8010053a <panic>
idewait(0);
801025bd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801025c4: e8 f2 fe ff ff call 801024bb <idewait>
outb(0x3f6, 0); // generate interrupt
801025c9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801025d0: 00
801025d1: c7 04 24 f6 03 00 00 movl $0x3f6,(%esp)
801025d8: e8 9b fe ff ff call 80102478 <outb>
outb(0x1f2, 1); // number of sectors
801025dd: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801025e4: 00
801025e5: c7 04 24 f2 01 00 00 movl $0x1f2,(%esp)
801025ec: e8 87 fe ff ff call 80102478 <outb>
outb(0x1f3, b->sector & 0xff);
801025f1: 8b 45 08 mov 0x8(%ebp),%eax
801025f4: 8b 40 08 mov 0x8(%eax),%eax
801025f7: 0f b6 c0 movzbl %al,%eax
801025fa: 89 44 24 04 mov %eax,0x4(%esp)
801025fe: c7 04 24 f3 01 00 00 movl $0x1f3,(%esp)
80102605: e8 6e fe ff ff call 80102478 <outb>
outb(0x1f4, (b->sector >> 8) & 0xff);
8010260a: 8b 45 08 mov 0x8(%ebp),%eax
8010260d: 8b 40 08 mov 0x8(%eax),%eax
80102610: c1 e8 08 shr $0x8,%eax
80102613: 0f b6 c0 movzbl %al,%eax
80102616: 89 44 24 04 mov %eax,0x4(%esp)
8010261a: c7 04 24 f4 01 00 00 movl $0x1f4,(%esp)
80102621: e8 52 fe ff ff call 80102478 <outb>
outb(0x1f5, (b->sector >> 16) & 0xff);
80102626: 8b 45 08 mov 0x8(%ebp),%eax
80102629: 8b 40 08 mov 0x8(%eax),%eax
8010262c: c1 e8 10 shr $0x10,%eax
8010262f: 0f b6 c0 movzbl %al,%eax
80102632: 89 44 24 04 mov %eax,0x4(%esp)
80102636: c7 04 24 f5 01 00 00 movl $0x1f5,(%esp)
8010263d: e8 36 fe ff ff call 80102478 <outb>
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
80102642: 8b 45 08 mov 0x8(%ebp),%eax
80102645: 8b 40 04 mov 0x4(%eax),%eax
80102648: 83 e0 01 and $0x1,%eax
8010264b: c1 e0 04 shl $0x4,%eax
8010264e: 89 c2 mov %eax,%edx
80102650: 8b 45 08 mov 0x8(%ebp),%eax
80102653: 8b 40 08 mov 0x8(%eax),%eax
80102656: c1 e8 18 shr $0x18,%eax
80102659: 83 e0 0f and $0xf,%eax
8010265c: 09 d0 or %edx,%eax
8010265e: 83 c8 e0 or $0xffffffe0,%eax
80102661: 0f b6 c0 movzbl %al,%eax
80102664: 89 44 24 04 mov %eax,0x4(%esp)
80102668: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
8010266f: e8 04 fe ff ff call 80102478 <outb>
if(b->flags & B_DIRTY){
80102674: 8b 45 08 mov 0x8(%ebp),%eax
80102677: 8b 00 mov (%eax),%eax
80102679: 83 e0 04 and $0x4,%eax
8010267c: 85 c0 test %eax,%eax
8010267e: 74 34 je 801026b4 <idestart+0x10f>
outb(0x1f7, IDE_CMD_WRITE);
80102680: c7 44 24 04 30 00 00 movl $0x30,0x4(%esp)
80102687: 00
80102688: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
8010268f: e8 e4 fd ff ff call 80102478 <outb>
outsl(0x1f0, b->data, 512/4);
80102694: 8b 45 08 mov 0x8(%ebp),%eax
80102697: 83 c0 18 add $0x18,%eax
8010269a: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
801026a1: 00
801026a2: 89 44 24 04 mov %eax,0x4(%esp)
801026a6: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
801026ad: e8 e4 fd ff ff call 80102496 <outsl>
801026b2: eb 14 jmp 801026c8 <idestart+0x123>
} else {
outb(0x1f7, IDE_CMD_READ);
801026b4: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
801026bb: 00
801026bc: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801026c3: e8 b0 fd ff ff call 80102478 <outb>
}
}
801026c8: c9 leave
801026c9: c3 ret
801026ca <ideintr>:
// Interrupt handler.
void
ideintr(void)
{
801026ca: 55 push %ebp
801026cb: 89 e5 mov %esp,%ebp
801026cd: 83 ec 28 sub $0x28,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
801026d0: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
801026d7: e8 86 23 00 00 call 80104a62 <acquire>
if((b = idequeue) == 0){
801026dc: a1 34 b6 10 80 mov 0x8010b634,%eax
801026e1: 89 45 f4 mov %eax,-0xc(%ebp)
801026e4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801026e8: 75 11 jne 801026fb <ideintr+0x31>
release(&idelock);
801026ea: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
801026f1: e8 ce 23 00 00 call 80104ac4 <release>
// cprintf("spurious IDE interrupt\n");
return;
801026f6: e9 90 00 00 00 jmp 8010278b <ideintr+0xc1>
}
idequeue = b->qnext;
801026fb: 8b 45 f4 mov -0xc(%ebp),%eax
801026fe: 8b 40 14 mov 0x14(%eax),%eax
80102701: a3 34 b6 10 80 mov %eax,0x8010b634
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102706: 8b 45 f4 mov -0xc(%ebp),%eax
80102709: 8b 00 mov (%eax),%eax
8010270b: 83 e0 04 and $0x4,%eax
8010270e: 85 c0 test %eax,%eax
80102710: 75 2e jne 80102740 <ideintr+0x76>
80102712: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80102719: e8 9d fd ff ff call 801024bb <idewait>
8010271e: 85 c0 test %eax,%eax
80102720: 78 1e js 80102740 <ideintr+0x76>
insl(0x1f0, b->data, 512/4);
80102722: 8b 45 f4 mov -0xc(%ebp),%eax
80102725: 83 c0 18 add $0x18,%eax
80102728: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
8010272f: 00
80102730: 89 44 24 04 mov %eax,0x4(%esp)
80102734: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
8010273b: e8 13 fd ff ff call 80102453 <insl>
// Wake process waiting for this buf.
b->flags |= B_VALID;
80102740: 8b 45 f4 mov -0xc(%ebp),%eax
80102743: 8b 00 mov (%eax),%eax
80102745: 83 c8 02 or $0x2,%eax
80102748: 89 c2 mov %eax,%edx
8010274a: 8b 45 f4 mov -0xc(%ebp),%eax
8010274d: 89 10 mov %edx,(%eax)
b->flags &= ~B_DIRTY;
8010274f: 8b 45 f4 mov -0xc(%ebp),%eax
80102752: 8b 00 mov (%eax),%eax
80102754: 83 e0 fb and $0xfffffffb,%eax
80102757: 89 c2 mov %eax,%edx
80102759: 8b 45 f4 mov -0xc(%ebp),%eax
8010275c: 89 10 mov %edx,(%eax)
wakeup(b);
8010275e: 8b 45 f4 mov -0xc(%ebp),%eax
80102761: 89 04 24 mov %eax,(%esp)
80102764: e8 08 21 00 00 call 80104871 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
80102769: a1 34 b6 10 80 mov 0x8010b634,%eax
8010276e: 85 c0 test %eax,%eax
80102770: 74 0d je 8010277f <ideintr+0xb5>
idestart(idequeue);
80102772: a1 34 b6 10 80 mov 0x8010b634,%eax
80102777: 89 04 24 mov %eax,(%esp)
8010277a: e8 26 fe ff ff call 801025a5 <idestart>
release(&idelock);
8010277f: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
80102786: e8 39 23 00 00 call 80104ac4 <release>
}
8010278b: c9 leave
8010278c: c3 ret
8010278d <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
8010278d: 55 push %ebp
8010278e: 89 e5 mov %esp,%ebp
80102790: 83 ec 28 sub $0x28,%esp
struct buf **pp;
if(!(b->flags & B_BUSY))
80102793: 8b 45 08 mov 0x8(%ebp),%eax
80102796: 8b 00 mov (%eax),%eax
80102798: 83 e0 01 and $0x1,%eax
8010279b: 85 c0 test %eax,%eax
8010279d: 75 0c jne 801027ab <iderw+0x1e>
panic("iderw: buf not busy");
8010279f: c7 04 24 95 83 10 80 movl $0x80108395,(%esp)
801027a6: e8 8f dd ff ff call 8010053a <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801027ab: 8b 45 08 mov 0x8(%ebp),%eax
801027ae: 8b 00 mov (%eax),%eax
801027b0: 83 e0 06 and $0x6,%eax
801027b3: 83 f8 02 cmp $0x2,%eax
801027b6: 75 0c jne 801027c4 <iderw+0x37>
panic("iderw: nothing to do");
801027b8: c7 04 24 a9 83 10 80 movl $0x801083a9,(%esp)
801027bf: e8 76 dd ff ff call 8010053a <panic>
if(b->dev != 0 && !havedisk1)
801027c4: 8b 45 08 mov 0x8(%ebp),%eax
801027c7: 8b 40 04 mov 0x4(%eax),%eax
801027ca: 85 c0 test %eax,%eax
801027cc: 74 15 je 801027e3 <iderw+0x56>
801027ce: a1 38 b6 10 80 mov 0x8010b638,%eax
801027d3: 85 c0 test %eax,%eax
801027d5: 75 0c jne 801027e3 <iderw+0x56>
panic("iderw: ide disk 1 not present");
801027d7: c7 04 24 be 83 10 80 movl $0x801083be,(%esp)
801027de: e8 57 dd ff ff call 8010053a <panic>
acquire(&idelock); //DOC:acquire-lock
801027e3: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
801027ea: e8 73 22 00 00 call 80104a62 <acquire>
// Append b to idequeue.
b->qnext = 0;
801027ef: 8b 45 08 mov 0x8(%ebp),%eax
801027f2: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
801027f9: c7 45 f4 34 b6 10 80 movl $0x8010b634,-0xc(%ebp)
80102800: eb 0b jmp 8010280d <iderw+0x80>
80102802: 8b 45 f4 mov -0xc(%ebp),%eax
80102805: 8b 00 mov (%eax),%eax
80102807: 83 c0 14 add $0x14,%eax
8010280a: 89 45 f4 mov %eax,-0xc(%ebp)
8010280d: 8b 45 f4 mov -0xc(%ebp),%eax
80102810: 8b 00 mov (%eax),%eax
80102812: 85 c0 test %eax,%eax
80102814: 75 ec jne 80102802 <iderw+0x75>
;
*pp = b;
80102816: 8b 45 f4 mov -0xc(%ebp),%eax
80102819: 8b 55 08 mov 0x8(%ebp),%edx
8010281c: 89 10 mov %edx,(%eax)
// Start disk if necessary.
if(idequeue == b)
8010281e: a1 34 b6 10 80 mov 0x8010b634,%eax
80102823: 3b 45 08 cmp 0x8(%ebp),%eax
80102826: 75 0d jne 80102835 <iderw+0xa8>
idestart(b);
80102828: 8b 45 08 mov 0x8(%ebp),%eax
8010282b: 89 04 24 mov %eax,(%esp)
8010282e: e8 72 fd ff ff call 801025a5 <idestart>
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102833: eb 15 jmp 8010284a <iderw+0xbd>
80102835: eb 13 jmp 8010284a <iderw+0xbd>
sleep(b, &idelock);
80102837: c7 44 24 04 00 b6 10 movl $0x8010b600,0x4(%esp)
8010283e: 80
8010283f: 8b 45 08 mov 0x8(%ebp),%eax
80102842: 89 04 24 mov %eax,(%esp)
80102845: e8 4e 1f 00 00 call 80104798 <sleep>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010284a: 8b 45 08 mov 0x8(%ebp),%eax
8010284d: 8b 00 mov (%eax),%eax
8010284f: 83 e0 06 and $0x6,%eax
80102852: 83 f8 02 cmp $0x2,%eax
80102855: 75 e0 jne 80102837 <iderw+0xaa>
sleep(b, &idelock);
}
release(&idelock);
80102857: c7 04 24 00 b6 10 80 movl $0x8010b600,(%esp)
8010285e: e8 61 22 00 00 call 80104ac4 <release>
}
80102863: c9 leave
80102864: c3 ret
80102865 <ioapicread>:
uint data;
};
static uint
ioapicread(int reg)
{
80102865: 55 push %ebp
80102866: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
80102868: a1 34 f8 10 80 mov 0x8010f834,%eax
8010286d: 8b 55 08 mov 0x8(%ebp),%edx
80102870: 89 10 mov %edx,(%eax)
return ioapic->data;
80102872: a1 34 f8 10 80 mov 0x8010f834,%eax
80102877: 8b 40 10 mov 0x10(%eax),%eax
}
8010287a: 5d pop %ebp
8010287b: c3 ret
8010287c <ioapicwrite>:
static void
ioapicwrite(int reg, uint data)
{
8010287c: 55 push %ebp
8010287d: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
8010287f: a1 34 f8 10 80 mov 0x8010f834,%eax
80102884: 8b 55 08 mov 0x8(%ebp),%edx
80102887: 89 10 mov %edx,(%eax)
ioapic->data = data;
80102889: a1 34 f8 10 80 mov 0x8010f834,%eax
8010288e: 8b 55 0c mov 0xc(%ebp),%edx
80102891: 89 50 10 mov %edx,0x10(%eax)
}
80102894: 5d pop %ebp
80102895: c3 ret
80102896 <ioapicinit>:
void
ioapicinit(void)
{
80102896: 55 push %ebp
80102897: 89 e5 mov %esp,%ebp
80102899: 83 ec 28 sub $0x28,%esp
int i, id, maxintr;
if(!ismp)
8010289c: a1 04 f9 10 80 mov 0x8010f904,%eax
801028a1: 85 c0 test %eax,%eax
801028a3: 75 05 jne 801028aa <ioapicinit+0x14>
return;
801028a5: e9 9d 00 00 00 jmp 80102947 <ioapicinit+0xb1>
ioapic = (volatile struct ioapic*)IOAPIC;
801028aa: c7 05 34 f8 10 80 00 movl $0xfec00000,0x8010f834
801028b1: 00 c0 fe
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801028b4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801028bb: e8 a5 ff ff ff call 80102865 <ioapicread>
801028c0: c1 e8 10 shr $0x10,%eax
801028c3: 25 ff 00 00 00 and $0xff,%eax
801028c8: 89 45 f0 mov %eax,-0x10(%ebp)
id = ioapicread(REG_ID) >> 24;
801028cb: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801028d2: e8 8e ff ff ff call 80102865 <ioapicread>
801028d7: c1 e8 18 shr $0x18,%eax
801028da: 89 45 ec mov %eax,-0x14(%ebp)
if(id != ioapicid)
801028dd: 0f b6 05 00 f9 10 80 movzbl 0x8010f900,%eax
801028e4: 0f b6 c0 movzbl %al,%eax
801028e7: 3b 45 ec cmp -0x14(%ebp),%eax
801028ea: 74 0c je 801028f8 <ioapicinit+0x62>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
801028ec: c7 04 24 dc 83 10 80 movl $0x801083dc,(%esp)
801028f3: e8 a8 da ff ff call 801003a0 <cprintf>
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
801028f8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801028ff: eb 3e jmp 8010293f <ioapicinit+0xa9>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102901: 8b 45 f4 mov -0xc(%ebp),%eax
80102904: 83 c0 20 add $0x20,%eax
80102907: 0d 00 00 01 00 or $0x10000,%eax
8010290c: 8b 55 f4 mov -0xc(%ebp),%edx
8010290f: 83 c2 08 add $0x8,%edx
80102912: 01 d2 add %edx,%edx
80102914: 89 44 24 04 mov %eax,0x4(%esp)
80102918: 89 14 24 mov %edx,(%esp)
8010291b: e8 5c ff ff ff call 8010287c <ioapicwrite>
ioapicwrite(REG_TABLE+2*i+1, 0);
80102920: 8b 45 f4 mov -0xc(%ebp),%eax
80102923: 83 c0 08 add $0x8,%eax
80102926: 01 c0 add %eax,%eax
80102928: 83 c0 01 add $0x1,%eax
8010292b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102932: 00
80102933: 89 04 24 mov %eax,(%esp)
80102936: e8 41 ff ff ff call 8010287c <ioapicwrite>
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
8010293b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010293f: 8b 45 f4 mov -0xc(%ebp),%eax
80102942: 3b 45 f0 cmp -0x10(%ebp),%eax
80102945: 7e ba jle 80102901 <ioapicinit+0x6b>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
80102947: c9 leave
80102948: c3 ret
80102949 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102949: 55 push %ebp
8010294a: 89 e5 mov %esp,%ebp
8010294c: 83 ec 08 sub $0x8,%esp
if(!ismp)
8010294f: a1 04 f9 10 80 mov 0x8010f904,%eax
80102954: 85 c0 test %eax,%eax
80102956: 75 02 jne 8010295a <ioapicenable+0x11>
return;
80102958: eb 37 jmp 80102991 <ioapicenable+0x48>
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
8010295a: 8b 45 08 mov 0x8(%ebp),%eax
8010295d: 83 c0 20 add $0x20,%eax
80102960: 8b 55 08 mov 0x8(%ebp),%edx
80102963: 83 c2 08 add $0x8,%edx
80102966: 01 d2 add %edx,%edx
80102968: 89 44 24 04 mov %eax,0x4(%esp)
8010296c: 89 14 24 mov %edx,(%esp)
8010296f: e8 08 ff ff ff call 8010287c <ioapicwrite>
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
80102974: 8b 45 0c mov 0xc(%ebp),%eax
80102977: c1 e0 18 shl $0x18,%eax
8010297a: 8b 55 08 mov 0x8(%ebp),%edx
8010297d: 83 c2 08 add $0x8,%edx
80102980: 01 d2 add %edx,%edx
80102982: 83 c2 01 add $0x1,%edx
80102985: 89 44 24 04 mov %eax,0x4(%esp)
80102989: 89 14 24 mov %edx,(%esp)
8010298c: e8 eb fe ff ff call 8010287c <ioapicwrite>
}
80102991: c9 leave
80102992: c3 ret
80102993 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
80102993: 55 push %ebp
80102994: 89 e5 mov %esp,%ebp
80102996: 8b 45 08 mov 0x8(%ebp),%eax
80102999: 05 00 00 00 80 add $0x80000000,%eax
8010299e: 5d pop %ebp
8010299f: c3 ret
801029a0 <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
801029a0: 55 push %ebp
801029a1: 89 e5 mov %esp,%ebp
801029a3: 83 ec 18 sub $0x18,%esp
initlock(&kmem.lock, "kmem");
801029a6: c7 44 24 04 0e 84 10 movl $0x8010840e,0x4(%esp)
801029ad: 80
801029ae: c7 04 24 40 f8 10 80 movl $0x8010f840,(%esp)
801029b5: e8 87 20 00 00 call 80104a41 <initlock>
kmem.use_lock = 0;
801029ba: c7 05 74 f8 10 80 00 movl $0x0,0x8010f874
801029c1: 00 00 00
freerange(vstart, vend);
801029c4: 8b 45 0c mov 0xc(%ebp),%eax
801029c7: 89 44 24 04 mov %eax,0x4(%esp)
801029cb: 8b 45 08 mov 0x8(%ebp),%eax
801029ce: 89 04 24 mov %eax,(%esp)
801029d1: e8 26 00 00 00 call 801029fc <freerange>
}
801029d6: c9 leave
801029d7: c3 ret
801029d8 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
801029d8: 55 push %ebp
801029d9: 89 e5 mov %esp,%ebp
801029db: 83 ec 18 sub $0x18,%esp
freerange(vstart, vend);
801029de: 8b 45 0c mov 0xc(%ebp),%eax
801029e1: 89 44 24 04 mov %eax,0x4(%esp)
801029e5: 8b 45 08 mov 0x8(%ebp),%eax
801029e8: 89 04 24 mov %eax,(%esp)
801029eb: e8 0c 00 00 00 call 801029fc <freerange>
kmem.use_lock = 1;
801029f0: c7 05 74 f8 10 80 01 movl $0x1,0x8010f874
801029f7: 00 00 00
}
801029fa: c9 leave
801029fb: c3 ret
801029fc <freerange>:
void
freerange(void *vstart, void *vend)
{
801029fc: 55 push %ebp
801029fd: 89 e5 mov %esp,%ebp
801029ff: 83 ec 28 sub $0x28,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102a02: 8b 45 08 mov 0x8(%ebp),%eax
80102a05: 05 ff 0f 00 00 add $0xfff,%eax
80102a0a: 25 00 f0 ff ff and $0xfffff000,%eax
80102a0f: 89 45 f4 mov %eax,-0xc(%ebp)
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a12: eb 12 jmp 80102a26 <freerange+0x2a>
kfree(p);
80102a14: 8b 45 f4 mov -0xc(%ebp),%eax
80102a17: 89 04 24 mov %eax,(%esp)
80102a1a: e8 16 00 00 00 call 80102a35 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a1f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80102a26: 8b 45 f4 mov -0xc(%ebp),%eax
80102a29: 05 00 10 00 00 add $0x1000,%eax
80102a2e: 3b 45 0c cmp 0xc(%ebp),%eax
80102a31: 76 e1 jbe 80102a14 <freerange+0x18>
kfree(p);
}
80102a33: c9 leave
80102a34: c3 ret
80102a35 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102a35: 55 push %ebp
80102a36: 89 e5 mov %esp,%ebp
80102a38: 83 ec 28 sub $0x28,%esp
struct run *r;
if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102a3b: 8b 45 08 mov 0x8(%ebp),%eax
80102a3e: 25 ff 0f 00 00 and $0xfff,%eax
80102a43: 85 c0 test %eax,%eax
80102a45: 75 1b jne 80102a62 <kfree+0x2d>
80102a47: 81 7d 08 fc 26 11 80 cmpl $0x801126fc,0x8(%ebp)
80102a4e: 72 12 jb 80102a62 <kfree+0x2d>
80102a50: 8b 45 08 mov 0x8(%ebp),%eax
80102a53: 89 04 24 mov %eax,(%esp)
80102a56: e8 38 ff ff ff call 80102993 <v2p>
80102a5b: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102a60: 76 0c jbe 80102a6e <kfree+0x39>
panic("kfree");
80102a62: c7 04 24 13 84 10 80 movl $0x80108413,(%esp)
80102a69: e8 cc da ff ff call 8010053a <panic>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102a6e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80102a75: 00
80102a76: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102a7d: 00
80102a7e: 8b 45 08 mov 0x8(%ebp),%eax
80102a81: 89 04 24 mov %eax,(%esp)
80102a84: e8 2d 22 00 00 call 80104cb6 <memset>
if(kmem.use_lock)
80102a89: a1 74 f8 10 80 mov 0x8010f874,%eax
80102a8e: 85 c0 test %eax,%eax
80102a90: 74 0c je 80102a9e <kfree+0x69>
acquire(&kmem.lock);
80102a92: c7 04 24 40 f8 10 80 movl $0x8010f840,(%esp)
80102a99: e8 c4 1f 00 00 call 80104a62 <acquire>
r = (struct run*)v;
80102a9e: 8b 45 08 mov 0x8(%ebp),%eax
80102aa1: 89 45 f4 mov %eax,-0xc(%ebp)
r->next = kmem.freelist;
80102aa4: 8b 15 78 f8 10 80 mov 0x8010f878,%edx
80102aaa: 8b 45 f4 mov -0xc(%ebp),%eax
80102aad: 89 10 mov %edx,(%eax)
kmem.freelist = r;
80102aaf: 8b 45 f4 mov -0xc(%ebp),%eax
80102ab2: a3 78 f8 10 80 mov %eax,0x8010f878
if(kmem.use_lock)
80102ab7: a1 74 f8 10 80 mov 0x8010f874,%eax
80102abc: 85 c0 test %eax,%eax
80102abe: 74 0c je 80102acc <kfree+0x97>
release(&kmem.lock);
80102ac0: c7 04 24 40 f8 10 80 movl $0x8010f840,(%esp)
80102ac7: e8 f8 1f 00 00 call 80104ac4 <release>
}
80102acc: c9 leave
80102acd: c3 ret
80102ace <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102ace: 55 push %ebp
80102acf: 89 e5 mov %esp,%ebp
80102ad1: 83 ec 28 sub $0x28,%esp
struct run *r;
if(kmem.use_lock)
80102ad4: a1 74 f8 10 80 mov 0x8010f874,%eax
80102ad9: 85 c0 test %eax,%eax
80102adb: 74 0c je 80102ae9 <kalloc+0x1b>
acquire(&kmem.lock);
80102add: c7 04 24 40 f8 10 80 movl $0x8010f840,(%esp)
80102ae4: e8 79 1f 00 00 call 80104a62 <acquire>
r = kmem.freelist;
80102ae9: a1 78 f8 10 80 mov 0x8010f878,%eax
80102aee: 89 45 f4 mov %eax,-0xc(%ebp)
if(r)
80102af1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80102af5: 74 0a je 80102b01 <kalloc+0x33>
kmem.freelist = r->next;
80102af7: 8b 45 f4 mov -0xc(%ebp),%eax
80102afa: 8b 00 mov (%eax),%eax
80102afc: a3 78 f8 10 80 mov %eax,0x8010f878
if(kmem.use_lock)
80102b01: a1 74 f8 10 80 mov 0x8010f874,%eax
80102b06: 85 c0 test %eax,%eax
80102b08: 74 0c je 80102b16 <kalloc+0x48>
release(&kmem.lock);
80102b0a: c7 04 24 40 f8 10 80 movl $0x8010f840,(%esp)
80102b11: e8 ae 1f 00 00 call 80104ac4 <release>
return (char*)r;
80102b16: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102b19: c9 leave
80102b1a: c3 ret
80102b1b <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102b1b: 55 push %ebp
80102b1c: 89 e5 mov %esp,%ebp
80102b1e: 83 ec 14 sub $0x14,%esp
80102b21: 8b 45 08 mov 0x8(%ebp),%eax
80102b24: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102b28: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102b2c: 89 c2 mov %eax,%edx
80102b2e: ec in (%dx),%al
80102b2f: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102b32: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102b36: c9 leave
80102b37: c3 ret
80102b38 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102b38: 55 push %ebp
80102b39: 89 e5 mov %esp,%ebp
80102b3b: 83 ec 14 sub $0x14,%esp
static uchar *charcode[4] = {
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
80102b3e: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102b45: e8 d1 ff ff ff call 80102b1b <inb>
80102b4a: 0f b6 c0 movzbl %al,%eax
80102b4d: 89 45 f4 mov %eax,-0xc(%ebp)
if((st & KBS_DIB) == 0)
80102b50: 8b 45 f4 mov -0xc(%ebp),%eax
80102b53: 83 e0 01 and $0x1,%eax
80102b56: 85 c0 test %eax,%eax
80102b58: 75 0a jne 80102b64 <kbdgetc+0x2c>
return -1;
80102b5a: b8 ff ff ff ff mov $0xffffffff,%eax
80102b5f: e9 25 01 00 00 jmp 80102c89 <kbdgetc+0x151>
data = inb(KBDATAP);
80102b64: c7 04 24 60 00 00 00 movl $0x60,(%esp)
80102b6b: e8 ab ff ff ff call 80102b1b <inb>
80102b70: 0f b6 c0 movzbl %al,%eax
80102b73: 89 45 fc mov %eax,-0x4(%ebp)
if(data == 0xE0){
80102b76: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp)
80102b7d: 75 17 jne 80102b96 <kbdgetc+0x5e>
shift |= E0ESC;
80102b7f: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102b84: 83 c8 40 or $0x40,%eax
80102b87: a3 3c b6 10 80 mov %eax,0x8010b63c
return 0;
80102b8c: b8 00 00 00 00 mov $0x0,%eax
80102b91: e9 f3 00 00 00 jmp 80102c89 <kbdgetc+0x151>
} else if(data & 0x80){
80102b96: 8b 45 fc mov -0x4(%ebp),%eax
80102b99: 25 80 00 00 00 and $0x80,%eax
80102b9e: 85 c0 test %eax,%eax
80102ba0: 74 45 je 80102be7 <kbdgetc+0xaf>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102ba2: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102ba7: 83 e0 40 and $0x40,%eax
80102baa: 85 c0 test %eax,%eax
80102bac: 75 08 jne 80102bb6 <kbdgetc+0x7e>
80102bae: 8b 45 fc mov -0x4(%ebp),%eax
80102bb1: 83 e0 7f and $0x7f,%eax
80102bb4: eb 03 jmp 80102bb9 <kbdgetc+0x81>
80102bb6: 8b 45 fc mov -0x4(%ebp),%eax
80102bb9: 89 45 fc mov %eax,-0x4(%ebp)
shift &= ~(shiftcode[data] | E0ESC);
80102bbc: 8b 45 fc mov -0x4(%ebp),%eax
80102bbf: 05 20 90 10 80 add $0x80109020,%eax
80102bc4: 0f b6 00 movzbl (%eax),%eax
80102bc7: 83 c8 40 or $0x40,%eax
80102bca: 0f b6 c0 movzbl %al,%eax
80102bcd: f7 d0 not %eax
80102bcf: 89 c2 mov %eax,%edx
80102bd1: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102bd6: 21 d0 and %edx,%eax
80102bd8: a3 3c b6 10 80 mov %eax,0x8010b63c
return 0;
80102bdd: b8 00 00 00 00 mov $0x0,%eax
80102be2: e9 a2 00 00 00 jmp 80102c89 <kbdgetc+0x151>
} else if(shift & E0ESC){
80102be7: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102bec: 83 e0 40 and $0x40,%eax
80102bef: 85 c0 test %eax,%eax
80102bf1: 74 14 je 80102c07 <kbdgetc+0xcf>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102bf3: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp)
shift &= ~E0ESC;
80102bfa: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102bff: 83 e0 bf and $0xffffffbf,%eax
80102c02: a3 3c b6 10 80 mov %eax,0x8010b63c
}
shift |= shiftcode[data];
80102c07: 8b 45 fc mov -0x4(%ebp),%eax
80102c0a: 05 20 90 10 80 add $0x80109020,%eax
80102c0f: 0f b6 00 movzbl (%eax),%eax
80102c12: 0f b6 d0 movzbl %al,%edx
80102c15: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102c1a: 09 d0 or %edx,%eax
80102c1c: a3 3c b6 10 80 mov %eax,0x8010b63c
shift ^= togglecode[data];
80102c21: 8b 45 fc mov -0x4(%ebp),%eax
80102c24: 05 20 91 10 80 add $0x80109120,%eax
80102c29: 0f b6 00 movzbl (%eax),%eax
80102c2c: 0f b6 d0 movzbl %al,%edx
80102c2f: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102c34: 31 d0 xor %edx,%eax
80102c36: a3 3c b6 10 80 mov %eax,0x8010b63c
c = charcode[shift & (CTL | SHIFT)][data];
80102c3b: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102c40: 83 e0 03 and $0x3,%eax
80102c43: 8b 14 85 20 95 10 80 mov -0x7fef6ae0(,%eax,4),%edx
80102c4a: 8b 45 fc mov -0x4(%ebp),%eax
80102c4d: 01 d0 add %edx,%eax
80102c4f: 0f b6 00 movzbl (%eax),%eax
80102c52: 0f b6 c0 movzbl %al,%eax
80102c55: 89 45 f8 mov %eax,-0x8(%ebp)
if(shift & CAPSLOCK){
80102c58: a1 3c b6 10 80 mov 0x8010b63c,%eax
80102c5d: 83 e0 08 and $0x8,%eax
80102c60: 85 c0 test %eax,%eax
80102c62: 74 22 je 80102c86 <kbdgetc+0x14e>
if('a' <= c && c <= 'z')
80102c64: 83 7d f8 60 cmpl $0x60,-0x8(%ebp)
80102c68: 76 0c jbe 80102c76 <kbdgetc+0x13e>
80102c6a: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp)
80102c6e: 77 06 ja 80102c76 <kbdgetc+0x13e>
c += 'A' - 'a';
80102c70: 83 6d f8 20 subl $0x20,-0x8(%ebp)
80102c74: eb 10 jmp 80102c86 <kbdgetc+0x14e>
else if('A' <= c && c <= 'Z')
80102c76: 83 7d f8 40 cmpl $0x40,-0x8(%ebp)
80102c7a: 76 0a jbe 80102c86 <kbdgetc+0x14e>
80102c7c: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp)
80102c80: 77 04 ja 80102c86 <kbdgetc+0x14e>
c += 'a' - 'A';
80102c82: 83 45 f8 20 addl $0x20,-0x8(%ebp)
}
return c;
80102c86: 8b 45 f8 mov -0x8(%ebp),%eax
}
80102c89: c9 leave
80102c8a: c3 ret
80102c8b <kbdintr>:
void
kbdintr(void)
{
80102c8b: 55 push %ebp
80102c8c: 89 e5 mov %esp,%ebp
80102c8e: 83 ec 18 sub $0x18,%esp
consoleintr(kbdgetc);
80102c91: c7 04 24 38 2b 10 80 movl $0x80102b38,(%esp)
80102c98: e8 10 db ff ff call 801007ad <consoleintr>
}
80102c9d: c9 leave
80102c9e: c3 ret
80102c9f <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80102c9f: 55 push %ebp
80102ca0: 89 e5 mov %esp,%ebp
80102ca2: 83 ec 08 sub $0x8,%esp
80102ca5: 8b 55 08 mov 0x8(%ebp),%edx
80102ca8: 8b 45 0c mov 0xc(%ebp),%eax
80102cab: 66 89 55 fc mov %dx,-0x4(%ebp)
80102caf: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102cb2: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80102cb6: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80102cba: ee out %al,(%dx)
}
80102cbb: c9 leave
80102cbc: c3 ret
80102cbd <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80102cbd: 55 push %ebp
80102cbe: 89 e5 mov %esp,%ebp
80102cc0: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102cc3: 9c pushf
80102cc4: 58 pop %eax
80102cc5: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80102cc8: 8b 45 fc mov -0x4(%ebp),%eax
}
80102ccb: c9 leave
80102ccc: c3 ret
80102ccd <lapicw>:
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
80102ccd: 55 push %ebp
80102cce: 89 e5 mov %esp,%ebp
lapic[index] = value;
80102cd0: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102cd5: 8b 55 08 mov 0x8(%ebp),%edx
80102cd8: c1 e2 02 shl $0x2,%edx
80102cdb: 01 c2 add %eax,%edx
80102cdd: 8b 45 0c mov 0xc(%ebp),%eax
80102ce0: 89 02 mov %eax,(%edx)
lapic[ID]; // wait for write to finish, by reading
80102ce2: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102ce7: 83 c0 20 add $0x20,%eax
80102cea: 8b 00 mov (%eax),%eax
}
80102cec: 5d pop %ebp
80102ced: c3 ret
80102cee <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
80102cee: 55 push %ebp
80102cef: 89 e5 mov %esp,%ebp
80102cf1: 83 ec 08 sub $0x8,%esp
if(!lapic)
80102cf4: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102cf9: 85 c0 test %eax,%eax
80102cfb: 75 05 jne 80102d02 <lapicinit+0x14>
return;
80102cfd: e9 43 01 00 00 jmp 80102e45 <lapicinit+0x157>
// Enable local APIC; set spurious interrupt vector.
lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102d02: c7 44 24 04 3f 01 00 movl $0x13f,0x4(%esp)
80102d09: 00
80102d0a: c7 04 24 3c 00 00 00 movl $0x3c,(%esp)
80102d11: e8 b7 ff ff ff call 80102ccd <lapicw>
// The timer repeatedly counts down at bus frequency
// from lapic[TICR] and then issues an interrupt.
// If xv6 cared more about precise timekeeping,
// TICR would be calibrated using an external time source.
lapicw(TDCR, X1);
80102d16: c7 44 24 04 0b 00 00 movl $0xb,0x4(%esp)
80102d1d: 00
80102d1e: c7 04 24 f8 00 00 00 movl $0xf8,(%esp)
80102d25: e8 a3 ff ff ff call 80102ccd <lapicw>
lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102d2a: c7 44 24 04 20 00 02 movl $0x20020,0x4(%esp)
80102d31: 00
80102d32: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102d39: e8 8f ff ff ff call 80102ccd <lapicw>
lapicw(TICR, 10000000);
80102d3e: c7 44 24 04 80 96 98 movl $0x989680,0x4(%esp)
80102d45: 00
80102d46: c7 04 24 e0 00 00 00 movl $0xe0,(%esp)
80102d4d: e8 7b ff ff ff call 80102ccd <lapicw>
// Disable logical interrupt lines.
lapicw(LINT0, MASKED);
80102d52: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102d59: 00
80102d5a: c7 04 24 d4 00 00 00 movl $0xd4,(%esp)
80102d61: e8 67 ff ff ff call 80102ccd <lapicw>
lapicw(LINT1, MASKED);
80102d66: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102d6d: 00
80102d6e: c7 04 24 d8 00 00 00 movl $0xd8,(%esp)
80102d75: e8 53 ff ff ff call 80102ccd <lapicw>
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
80102d7a: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102d7f: 83 c0 30 add $0x30,%eax
80102d82: 8b 00 mov (%eax),%eax
80102d84: c1 e8 10 shr $0x10,%eax
80102d87: 0f b6 c0 movzbl %al,%eax
80102d8a: 83 f8 03 cmp $0x3,%eax
80102d8d: 76 14 jbe 80102da3 <lapicinit+0xb5>
lapicw(PCINT, MASKED);
80102d8f: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102d96: 00
80102d97: c7 04 24 d0 00 00 00 movl $0xd0,(%esp)
80102d9e: e8 2a ff ff ff call 80102ccd <lapicw>
// Map error interrupt to IRQ_ERROR.
lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102da3: c7 44 24 04 33 00 00 movl $0x33,0x4(%esp)
80102daa: 00
80102dab: c7 04 24 dc 00 00 00 movl $0xdc,(%esp)
80102db2: e8 16 ff ff ff call 80102ccd <lapicw>
// Clear error status register (requires back-to-back writes).
lapicw(ESR, 0);
80102db7: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102dbe: 00
80102dbf: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102dc6: e8 02 ff ff ff call 80102ccd <lapicw>
lapicw(ESR, 0);
80102dcb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102dd2: 00
80102dd3: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102dda: e8 ee fe ff ff call 80102ccd <lapicw>
// Ack any outstanding interrupts.
lapicw(EOI, 0);
80102ddf: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102de6: 00
80102de7: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102dee: e8 da fe ff ff call 80102ccd <lapicw>
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
80102df3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102dfa: 00
80102dfb: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102e02: e8 c6 fe ff ff call 80102ccd <lapicw>
lapicw(ICRLO, BCAST | INIT | LEVEL);
80102e07: c7 44 24 04 00 85 08 movl $0x88500,0x4(%esp)
80102e0e: 00
80102e0f: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102e16: e8 b2 fe ff ff call 80102ccd <lapicw>
while(lapic[ICRLO] & DELIVS)
80102e1b: 90 nop
80102e1c: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102e21: 05 00 03 00 00 add $0x300,%eax
80102e26: 8b 00 mov (%eax),%eax
80102e28: 25 00 10 00 00 and $0x1000,%eax
80102e2d: 85 c0 test %eax,%eax
80102e2f: 75 eb jne 80102e1c <lapicinit+0x12e>
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
80102e31: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e38: 00
80102e39: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80102e40: e8 88 fe ff ff call 80102ccd <lapicw>
}
80102e45: c9 leave
80102e46: c3 ret
80102e47 <cpunum>:
int
cpunum(void)
{
80102e47: 55 push %ebp
80102e48: 89 e5 mov %esp,%ebp
80102e4a: 83 ec 18 sub $0x18,%esp
// Cannot call cpu when interrupts are enabled:
// result not guaranteed to last long enough to be used!
// Would prefer to panic but even printing is chancy here:
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
80102e4d: e8 6b fe ff ff call 80102cbd <readeflags>
80102e52: 25 00 02 00 00 and $0x200,%eax
80102e57: 85 c0 test %eax,%eax
80102e59: 74 25 je 80102e80 <cpunum+0x39>
static int n;
if(n++ == 0)
80102e5b: a1 40 b6 10 80 mov 0x8010b640,%eax
80102e60: 8d 50 01 lea 0x1(%eax),%edx
80102e63: 89 15 40 b6 10 80 mov %edx,0x8010b640
80102e69: 85 c0 test %eax,%eax
80102e6b: 75 13 jne 80102e80 <cpunum+0x39>
cprintf("cpu called from %x with interrupts enabled\n",
80102e6d: 8b 45 04 mov 0x4(%ebp),%eax
80102e70: 89 44 24 04 mov %eax,0x4(%esp)
80102e74: c7 04 24 1c 84 10 80 movl $0x8010841c,(%esp)
80102e7b: e8 20 d5 ff ff call 801003a0 <cprintf>
__builtin_return_address(0));
}
if(lapic)
80102e80: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102e85: 85 c0 test %eax,%eax
80102e87: 74 0f je 80102e98 <cpunum+0x51>
return lapic[ID]>>24;
80102e89: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102e8e: 83 c0 20 add $0x20,%eax
80102e91: 8b 00 mov (%eax),%eax
80102e93: c1 e8 18 shr $0x18,%eax
80102e96: eb 05 jmp 80102e9d <cpunum+0x56>
return 0;
80102e98: b8 00 00 00 00 mov $0x0,%eax
}
80102e9d: c9 leave
80102e9e: c3 ret
80102e9f <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102e9f: 55 push %ebp
80102ea0: 89 e5 mov %esp,%ebp
80102ea2: 83 ec 08 sub $0x8,%esp
if(lapic)
80102ea5: a1 7c f8 10 80 mov 0x8010f87c,%eax
80102eaa: 85 c0 test %eax,%eax
80102eac: 74 14 je 80102ec2 <lapiceoi+0x23>
lapicw(EOI, 0);
80102eae: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102eb5: 00
80102eb6: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102ebd: e8 0b fe ff ff call 80102ccd <lapicw>
}
80102ec2: c9 leave
80102ec3: c3 ret
80102ec4 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102ec4: 55 push %ebp
80102ec5: 89 e5 mov %esp,%ebp
}
80102ec7: 5d pop %ebp
80102ec8: c3 ret
80102ec9 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102ec9: 55 push %ebp
80102eca: 89 e5 mov %esp,%ebp
80102ecc: 83 ec 1c sub $0x1c,%esp
80102ecf: 8b 45 08 mov 0x8(%ebp),%eax
80102ed2: 88 45 ec mov %al,-0x14(%ebp)
ushort *wrv;
// "The BSP must initialize CMOS shutdown code to 0AH
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb(IO_RTC, 0xF); // offset 0xF is shutdown code
80102ed5: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80102edc: 00
80102edd: c7 04 24 70 00 00 00 movl $0x70,(%esp)
80102ee4: e8 b6 fd ff ff call 80102c9f <outb>
outb(IO_RTC+1, 0x0A);
80102ee9: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80102ef0: 00
80102ef1: c7 04 24 71 00 00 00 movl $0x71,(%esp)
80102ef8: e8 a2 fd ff ff call 80102c9f <outb>
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
80102efd: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp)
wrv[0] = 0;
80102f04: 8b 45 f8 mov -0x8(%ebp),%eax
80102f07: 66 c7 00 00 00 movw $0x0,(%eax)
wrv[1] = addr >> 4;
80102f0c: 8b 45 f8 mov -0x8(%ebp),%eax
80102f0f: 8d 50 02 lea 0x2(%eax),%edx
80102f12: 8b 45 0c mov 0xc(%ebp),%eax
80102f15: c1 e8 04 shr $0x4,%eax
80102f18: 66 89 02 mov %ax,(%edx)
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80102f1b: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102f1f: c1 e0 18 shl $0x18,%eax
80102f22: 89 44 24 04 mov %eax,0x4(%esp)
80102f26: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102f2d: e8 9b fd ff ff call 80102ccd <lapicw>
lapicw(ICRLO, INIT | LEVEL | ASSERT);
80102f32: c7 44 24 04 00 c5 00 movl $0xc500,0x4(%esp)
80102f39: 00
80102f3a: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102f41: e8 87 fd ff ff call 80102ccd <lapicw>
microdelay(200);
80102f46: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102f4d: e8 72 ff ff ff call 80102ec4 <microdelay>
lapicw(ICRLO, INIT | LEVEL);
80102f52: c7 44 24 04 00 85 00 movl $0x8500,0x4(%esp)
80102f59: 00
80102f5a: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102f61: e8 67 fd ff ff call 80102ccd <lapicw>
microdelay(100); // should be 10ms, but too slow in Bochs!
80102f66: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102f6d: e8 52 ff ff ff call 80102ec4 <microdelay>
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
80102f72: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80102f79: eb 40 jmp 80102fbb <lapicstartap+0xf2>
lapicw(ICRHI, apicid<<24);
80102f7b: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102f7f: c1 e0 18 shl $0x18,%eax
80102f82: 89 44 24 04 mov %eax,0x4(%esp)
80102f86: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102f8d: e8 3b fd ff ff call 80102ccd <lapicw>
lapicw(ICRLO, STARTUP | (addr>>12));
80102f92: 8b 45 0c mov 0xc(%ebp),%eax
80102f95: c1 e8 0c shr $0xc,%eax
80102f98: 80 cc 06 or $0x6,%ah
80102f9b: 89 44 24 04 mov %eax,0x4(%esp)
80102f9f: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102fa6: e8 22 fd ff ff call 80102ccd <lapicw>
microdelay(200);
80102fab: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102fb2: e8 0d ff ff ff call 80102ec4 <microdelay>
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
80102fb7: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80102fbb: 83 7d fc 01 cmpl $0x1,-0x4(%ebp)
80102fbf: 7e ba jle 80102f7b <lapicstartap+0xb2>
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
80102fc1: c9 leave
80102fc2: c3 ret
80102fc3 <initlog>:
static void recover_from_log(void);
void
initlog(void)
{
80102fc3: 55 push %ebp
80102fc4: 89 e5 mov %esp,%ebp
80102fc6: 83 ec 28 sub $0x28,%esp
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80102fc9: c7 44 24 04 48 84 10 movl $0x80108448,0x4(%esp)
80102fd0: 80
80102fd1: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
80102fd8: e8 64 1a 00 00 call 80104a41 <initlock>
readsb(ROOTDEV, &sb);
80102fdd: 8d 45 e8 lea -0x18(%ebp),%eax
80102fe0: 89 44 24 04 mov %eax,0x4(%esp)
80102fe4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80102feb: e8 ed e2 ff ff call 801012dd <readsb>
log.start = sb.size - sb.nlog;
80102ff0: 8b 55 e8 mov -0x18(%ebp),%edx
80102ff3: 8b 45 f4 mov -0xc(%ebp),%eax
80102ff6: 29 c2 sub %eax,%edx
80102ff8: 89 d0 mov %edx,%eax
80102ffa: a3 b4 f8 10 80 mov %eax,0x8010f8b4
log.size = sb.nlog;
80102fff: 8b 45 f4 mov -0xc(%ebp),%eax
80103002: a3 b8 f8 10 80 mov %eax,0x8010f8b8
log.dev = ROOTDEV;
80103007: c7 05 c0 f8 10 80 01 movl $0x1,0x8010f8c0
8010300e: 00 00 00
recover_from_log();
80103011: e8 9a 01 00 00 call 801031b0 <recover_from_log>
}
80103016: c9 leave
80103017: c3 ret
80103018 <install_trans>:
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
80103018: 55 push %ebp
80103019: 89 e5 mov %esp,%ebp
8010301b: 83 ec 28 sub $0x28,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
8010301e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103025: e9 8c 00 00 00 jmp 801030b6 <install_trans+0x9e>
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
8010302a: 8b 15 b4 f8 10 80 mov 0x8010f8b4,%edx
80103030: 8b 45 f4 mov -0xc(%ebp),%eax
80103033: 01 d0 add %edx,%eax
80103035: 83 c0 01 add $0x1,%eax
80103038: 89 c2 mov %eax,%edx
8010303a: a1 c0 f8 10 80 mov 0x8010f8c0,%eax
8010303f: 89 54 24 04 mov %edx,0x4(%esp)
80103043: 89 04 24 mov %eax,(%esp)
80103046: e8 5b d1 ff ff call 801001a6 <bread>
8010304b: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
8010304e: 8b 45 f4 mov -0xc(%ebp),%eax
80103051: 83 c0 10 add $0x10,%eax
80103054: 8b 04 85 88 f8 10 80 mov -0x7fef0778(,%eax,4),%eax
8010305b: 89 c2 mov %eax,%edx
8010305d: a1 c0 f8 10 80 mov 0x8010f8c0,%eax
80103062: 89 54 24 04 mov %edx,0x4(%esp)
80103066: 89 04 24 mov %eax,(%esp)
80103069: e8 38 d1 ff ff call 801001a6 <bread>
8010306e: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80103071: 8b 45 f0 mov -0x10(%ebp),%eax
80103074: 8d 50 18 lea 0x18(%eax),%edx
80103077: 8b 45 ec mov -0x14(%ebp),%eax
8010307a: 83 c0 18 add $0x18,%eax
8010307d: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80103084: 00
80103085: 89 54 24 04 mov %edx,0x4(%esp)
80103089: 89 04 24 mov %eax,(%esp)
8010308c: e8 f4 1c 00 00 call 80104d85 <memmove>
bwrite(dbuf); // write dst to disk
80103091: 8b 45 ec mov -0x14(%ebp),%eax
80103094: 89 04 24 mov %eax,(%esp)
80103097: e8 41 d1 ff ff call 801001dd <bwrite>
brelse(lbuf);
8010309c: 8b 45 f0 mov -0x10(%ebp),%eax
8010309f: 89 04 24 mov %eax,(%esp)
801030a2: e8 70 d1 ff ff call 80100217 <brelse>
brelse(dbuf);
801030a7: 8b 45 ec mov -0x14(%ebp),%eax
801030aa: 89 04 24 mov %eax,(%esp)
801030ad: e8 65 d1 ff ff call 80100217 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801030b2: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801030b6: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
801030bb: 3b 45 f4 cmp -0xc(%ebp),%eax
801030be: 0f 8f 66 ff ff ff jg 8010302a <install_trans+0x12>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
801030c4: c9 leave
801030c5: c3 ret
801030c6 <read_head>:
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
801030c6: 55 push %ebp
801030c7: 89 e5 mov %esp,%ebp
801030c9: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
801030cc: a1 b4 f8 10 80 mov 0x8010f8b4,%eax
801030d1: 89 c2 mov %eax,%edx
801030d3: a1 c0 f8 10 80 mov 0x8010f8c0,%eax
801030d8: 89 54 24 04 mov %edx,0x4(%esp)
801030dc: 89 04 24 mov %eax,(%esp)
801030df: e8 c2 d0 ff ff call 801001a6 <bread>
801030e4: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *lh = (struct logheader *) (buf->data);
801030e7: 8b 45 f0 mov -0x10(%ebp),%eax
801030ea: 83 c0 18 add $0x18,%eax
801030ed: 89 45 ec mov %eax,-0x14(%ebp)
int i;
log.lh.n = lh->n;
801030f0: 8b 45 ec mov -0x14(%ebp),%eax
801030f3: 8b 00 mov (%eax),%eax
801030f5: a3 c4 f8 10 80 mov %eax,0x8010f8c4
for (i = 0; i < log.lh.n; i++) {
801030fa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103101: eb 1b jmp 8010311e <read_head+0x58>
log.lh.sector[i] = lh->sector[i];
80103103: 8b 45 ec mov -0x14(%ebp),%eax
80103106: 8b 55 f4 mov -0xc(%ebp),%edx
80103109: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax
8010310d: 8b 55 f4 mov -0xc(%ebp),%edx
80103110: 83 c2 10 add $0x10,%edx
80103113: 89 04 95 88 f8 10 80 mov %eax,-0x7fef0778(,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
8010311a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010311e: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
80103123: 3b 45 f4 cmp -0xc(%ebp),%eax
80103126: 7f db jg 80103103 <read_head+0x3d>
log.lh.sector[i] = lh->sector[i];
}
brelse(buf);
80103128: 8b 45 f0 mov -0x10(%ebp),%eax
8010312b: 89 04 24 mov %eax,(%esp)
8010312e: e8 e4 d0 ff ff call 80100217 <brelse>
}
80103133: c9 leave
80103134: c3 ret
80103135 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
80103135: 55 push %ebp
80103136: 89 e5 mov %esp,%ebp
80103138: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
8010313b: a1 b4 f8 10 80 mov 0x8010f8b4,%eax
80103140: 89 c2 mov %eax,%edx
80103142: a1 c0 f8 10 80 mov 0x8010f8c0,%eax
80103147: 89 54 24 04 mov %edx,0x4(%esp)
8010314b: 89 04 24 mov %eax,(%esp)
8010314e: e8 53 d0 ff ff call 801001a6 <bread>
80103153: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *hb = (struct logheader *) (buf->data);
80103156: 8b 45 f0 mov -0x10(%ebp),%eax
80103159: 83 c0 18 add $0x18,%eax
8010315c: 89 45 ec mov %eax,-0x14(%ebp)
int i;
hb->n = log.lh.n;
8010315f: 8b 15 c4 f8 10 80 mov 0x8010f8c4,%edx
80103165: 8b 45 ec mov -0x14(%ebp),%eax
80103168: 89 10 mov %edx,(%eax)
for (i = 0; i < log.lh.n; i++) {
8010316a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103171: eb 1b jmp 8010318e <write_head+0x59>
hb->sector[i] = log.lh.sector[i];
80103173: 8b 45 f4 mov -0xc(%ebp),%eax
80103176: 83 c0 10 add $0x10,%eax
80103179: 8b 0c 85 88 f8 10 80 mov -0x7fef0778(,%eax,4),%ecx
80103180: 8b 45 ec mov -0x14(%ebp),%eax
80103183: 8b 55 f4 mov -0xc(%ebp),%edx
80103186: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
8010318a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010318e: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
80103193: 3b 45 f4 cmp -0xc(%ebp),%eax
80103196: 7f db jg 80103173 <write_head+0x3e>
hb->sector[i] = log.lh.sector[i];
}
bwrite(buf);
80103198: 8b 45 f0 mov -0x10(%ebp),%eax
8010319b: 89 04 24 mov %eax,(%esp)
8010319e: e8 3a d0 ff ff call 801001dd <bwrite>
brelse(buf);
801031a3: 8b 45 f0 mov -0x10(%ebp),%eax
801031a6: 89 04 24 mov %eax,(%esp)
801031a9: e8 69 d0 ff ff call 80100217 <brelse>
}
801031ae: c9 leave
801031af: c3 ret
801031b0 <recover_from_log>:
static void
recover_from_log(void)
{
801031b0: 55 push %ebp
801031b1: 89 e5 mov %esp,%ebp
801031b3: 83 ec 08 sub $0x8,%esp
read_head();
801031b6: e8 0b ff ff ff call 801030c6 <read_head>
install_trans(); // if committed, copy from log to disk
801031bb: e8 58 fe ff ff call 80103018 <install_trans>
log.lh.n = 0;
801031c0: c7 05 c4 f8 10 80 00 movl $0x0,0x8010f8c4
801031c7: 00 00 00
write_head(); // clear the log
801031ca: e8 66 ff ff ff call 80103135 <write_head>
}
801031cf: c9 leave
801031d0: c3 ret
801031d1 <begin_trans>:
void
begin_trans(void)
{
801031d1: 55 push %ebp
801031d2: 89 e5 mov %esp,%ebp
801031d4: 83 ec 18 sub $0x18,%esp
acquire(&log.lock);
801031d7: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
801031de: e8 7f 18 00 00 call 80104a62 <acquire>
while (log.busy) {
801031e3: eb 14 jmp 801031f9 <begin_trans+0x28>
sleep(&log, &log.lock);
801031e5: c7 44 24 04 80 f8 10 movl $0x8010f880,0x4(%esp)
801031ec: 80
801031ed: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
801031f4: e8 9f 15 00 00 call 80104798 <sleep>
void
begin_trans(void)
{
acquire(&log.lock);
while (log.busy) {
801031f9: a1 bc f8 10 80 mov 0x8010f8bc,%eax
801031fe: 85 c0 test %eax,%eax
80103200: 75 e3 jne 801031e5 <begin_trans+0x14>
sleep(&log, &log.lock);
}
log.busy = 1;
80103202: c7 05 bc f8 10 80 01 movl $0x1,0x8010f8bc
80103209: 00 00 00
release(&log.lock);
8010320c: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
80103213: e8 ac 18 00 00 call 80104ac4 <release>
}
80103218: c9 leave
80103219: c3 ret
8010321a <commit_trans>:
void
commit_trans(void)
{
8010321a: 55 push %ebp
8010321b: 89 e5 mov %esp,%ebp
8010321d: 83 ec 18 sub $0x18,%esp
if (log.lh.n > 0) {
80103220: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
80103225: 85 c0 test %eax,%eax
80103227: 7e 19 jle 80103242 <commit_trans+0x28>
write_head(); // Write header to disk -- the real commit
80103229: e8 07 ff ff ff call 80103135 <write_head>
install_trans(); // Now install writes to home locations
8010322e: e8 e5 fd ff ff call 80103018 <install_trans>
log.lh.n = 0;
80103233: c7 05 c4 f8 10 80 00 movl $0x0,0x8010f8c4
8010323a: 00 00 00
write_head(); // Erase the transaction from the log
8010323d: e8 f3 fe ff ff call 80103135 <write_head>
}
acquire(&log.lock);
80103242: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
80103249: e8 14 18 00 00 call 80104a62 <acquire>
log.busy = 0;
8010324e: c7 05 bc f8 10 80 00 movl $0x0,0x8010f8bc
80103255: 00 00 00
wakeup(&log);
80103258: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
8010325f: e8 0d 16 00 00 call 80104871 <wakeup>
release(&log.lock);
80103264: c7 04 24 80 f8 10 80 movl $0x8010f880,(%esp)
8010326b: e8 54 18 00 00 call 80104ac4 <release>
}
80103270: c9 leave
80103271: c3 ret
80103272 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80103272: 55 push %ebp
80103273: 89 e5 mov %esp,%ebp
80103275: 83 ec 28 sub $0x28,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
80103278: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
8010327d: 83 f8 09 cmp $0x9,%eax
80103280: 7f 12 jg 80103294 <log_write+0x22>
80103282: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
80103287: 8b 15 b8 f8 10 80 mov 0x8010f8b8,%edx
8010328d: 83 ea 01 sub $0x1,%edx
80103290: 39 d0 cmp %edx,%eax
80103292: 7c 0c jl 801032a0 <log_write+0x2e>
panic("too big a transaction");
80103294: c7 04 24 4c 84 10 80 movl $0x8010844c,(%esp)
8010329b: e8 9a d2 ff ff call 8010053a <panic>
if (!log.busy)
801032a0: a1 bc f8 10 80 mov 0x8010f8bc,%eax
801032a5: 85 c0 test %eax,%eax
801032a7: 75 0c jne 801032b5 <log_write+0x43>
panic("write outside of trans");
801032a9: c7 04 24 62 84 10 80 movl $0x80108462,(%esp)
801032b0: e8 85 d2 ff ff call 8010053a <panic>
for (i = 0; i < log.lh.n; i++) {
801032b5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801032bc: eb 1f jmp 801032dd <log_write+0x6b>
if (log.lh.sector[i] == b->sector) // log absorbtion?
801032be: 8b 45 f4 mov -0xc(%ebp),%eax
801032c1: 83 c0 10 add $0x10,%eax
801032c4: 8b 04 85 88 f8 10 80 mov -0x7fef0778(,%eax,4),%eax
801032cb: 89 c2 mov %eax,%edx
801032cd: 8b 45 08 mov 0x8(%ebp),%eax
801032d0: 8b 40 08 mov 0x8(%eax),%eax
801032d3: 39 c2 cmp %eax,%edx
801032d5: 75 02 jne 801032d9 <log_write+0x67>
break;
801032d7: eb 0e jmp 801032e7 <log_write+0x75>
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
if (!log.busy)
panic("write outside of trans");
for (i = 0; i < log.lh.n; i++) {
801032d9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801032dd: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
801032e2: 3b 45 f4 cmp -0xc(%ebp),%eax
801032e5: 7f d7 jg 801032be <log_write+0x4c>
if (log.lh.sector[i] == b->sector) // log absorbtion?
break;
}
log.lh.sector[i] = b->sector;
801032e7: 8b 45 08 mov 0x8(%ebp),%eax
801032ea: 8b 40 08 mov 0x8(%eax),%eax
801032ed: 8b 55 f4 mov -0xc(%ebp),%edx
801032f0: 83 c2 10 add $0x10,%edx
801032f3: 89 04 95 88 f8 10 80 mov %eax,-0x7fef0778(,%edx,4)
struct buf *lbuf = bread(b->dev, log.start+i+1);
801032fa: 8b 15 b4 f8 10 80 mov 0x8010f8b4,%edx
80103300: 8b 45 f4 mov -0xc(%ebp),%eax
80103303: 01 d0 add %edx,%eax
80103305: 83 c0 01 add $0x1,%eax
80103308: 89 c2 mov %eax,%edx
8010330a: 8b 45 08 mov 0x8(%ebp),%eax
8010330d: 8b 40 04 mov 0x4(%eax),%eax
80103310: 89 54 24 04 mov %edx,0x4(%esp)
80103314: 89 04 24 mov %eax,(%esp)
80103317: e8 8a ce ff ff call 801001a6 <bread>
8010331c: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(lbuf->data, b->data, BSIZE);
8010331f: 8b 45 08 mov 0x8(%ebp),%eax
80103322: 8d 50 18 lea 0x18(%eax),%edx
80103325: 8b 45 f0 mov -0x10(%ebp),%eax
80103328: 83 c0 18 add $0x18,%eax
8010332b: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80103332: 00
80103333: 89 54 24 04 mov %edx,0x4(%esp)
80103337: 89 04 24 mov %eax,(%esp)
8010333a: e8 46 1a 00 00 call 80104d85 <memmove>
bwrite(lbuf);
8010333f: 8b 45 f0 mov -0x10(%ebp),%eax
80103342: 89 04 24 mov %eax,(%esp)
80103345: e8 93 ce ff ff call 801001dd <bwrite>
brelse(lbuf);
8010334a: 8b 45 f0 mov -0x10(%ebp),%eax
8010334d: 89 04 24 mov %eax,(%esp)
80103350: e8 c2 ce ff ff call 80100217 <brelse>
if (i == log.lh.n)
80103355: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
8010335a: 3b 45 f4 cmp -0xc(%ebp),%eax
8010335d: 75 0d jne 8010336c <log_write+0xfa>
log.lh.n++;
8010335f: a1 c4 f8 10 80 mov 0x8010f8c4,%eax
80103364: 83 c0 01 add $0x1,%eax
80103367: a3 c4 f8 10 80 mov %eax,0x8010f8c4
b->flags |= B_DIRTY; // XXX prevent eviction
8010336c: 8b 45 08 mov 0x8(%ebp),%eax
8010336f: 8b 00 mov (%eax),%eax
80103371: 83 c8 04 or $0x4,%eax
80103374: 89 c2 mov %eax,%edx
80103376: 8b 45 08 mov 0x8(%ebp),%eax
80103379: 89 10 mov %edx,(%eax)
}
8010337b: c9 leave
8010337c: c3 ret
8010337d <v2p>:
8010337d: 55 push %ebp
8010337e: 89 e5 mov %esp,%ebp
80103380: 8b 45 08 mov 0x8(%ebp),%eax
80103383: 05 00 00 00 80 add $0x80000000,%eax
80103388: 5d pop %ebp
80103389: c3 ret
8010338a <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
8010338a: 55 push %ebp
8010338b: 89 e5 mov %esp,%ebp
8010338d: 8b 45 08 mov 0x8(%ebp),%eax
80103390: 05 00 00 00 80 add $0x80000000,%eax
80103395: 5d pop %ebp
80103396: c3 ret
80103397 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
80103397: 55 push %ebp
80103398: 89 e5 mov %esp,%ebp
8010339a: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
8010339d: 8b 55 08 mov 0x8(%ebp),%edx
801033a0: 8b 45 0c mov 0xc(%ebp),%eax
801033a3: 8b 4d 08 mov 0x8(%ebp),%ecx
801033a6: f0 87 02 lock xchg %eax,(%edx)
801033a9: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
801033ac: 8b 45 fc mov -0x4(%ebp),%eax
}
801033af: c9 leave
801033b0: c3 ret
801033b1 <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
801033b1: 55 push %ebp
801033b2: 89 e5 mov %esp,%ebp
801033b4: 83 e4 f0 and $0xfffffff0,%esp
801033b7: 83 ec 10 sub $0x10,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
801033ba: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp)
801033c1: 80
801033c2: c7 04 24 fc 26 11 80 movl $0x801126fc,(%esp)
801033c9: e8 d2 f5 ff ff call 801029a0 <kinit1>
kvmalloc(); // kernel page table
801033ce: e8 bd 46 00 00 call 80107a90 <kvmalloc>
mpinit(); // collect info about this machine
801033d3: e8 46 04 00 00 call 8010381e <mpinit>
lapicinit();
801033d8: e8 11 f9 ff ff call 80102cee <lapicinit>
seginit(); // set up segments
801033dd: e8 41 40 00 00 call 80107423 <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
801033e2: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801033e8: 0f b6 00 movzbl (%eax),%eax
801033eb: 0f b6 c0 movzbl %al,%eax
801033ee: 89 44 24 04 mov %eax,0x4(%esp)
801033f2: c7 04 24 79 84 10 80 movl $0x80108479,(%esp)
801033f9: e8 a2 cf ff ff call 801003a0 <cprintf>
picinit(); // interrupt controller
801033fe: e8 79 06 00 00 call 80103a7c <picinit>
ioapicinit(); // another interrupt controller
80103403: e8 8e f4 ff ff call 80102896 <ioapicinit>
consoleinit(); // I/O devices & their interrupts
80103408: e8 74 d6 ff ff call 80100a81 <consoleinit>
uartinit(); // serial port
8010340d: e8 60 33 00 00 call 80106772 <uartinit>
pinit(); // process table
80103412: e8 6f 0b 00 00 call 80103f86 <pinit>
tvinit(); // trap vectors
80103417: e8 08 2f 00 00 call 80106324 <tvinit>
binit(); // buffer cache
8010341c: e8 13 cc ff ff call 80100034 <binit>
fileinit(); // file table
80103421: e8 d0 da ff ff call 80100ef6 <fileinit>
iinit(); // inode cache
80103426: e8 65 e1 ff ff call 80101590 <iinit>
ideinit(); // disk
8010342b: e8 cf f0 ff ff call 801024ff <ideinit>
if(!ismp)
80103430: a1 04 f9 10 80 mov 0x8010f904,%eax
80103435: 85 c0 test %eax,%eax
80103437: 75 05 jne 8010343e <main+0x8d>
timerinit(); // uniprocessor timer
80103439: e8 31 2e 00 00 call 8010626f <timerinit>
startothers(); // start other processors
8010343e: e8 7f 00 00 00 call 801034c2 <startothers>
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80103443: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp)
8010344a: 8e
8010344b: c7 04 24 00 00 40 80 movl $0x80400000,(%esp)
80103452: e8 81 f5 ff ff call 801029d8 <kinit2>
userinit(); // first user process
80103457: e8 45 0c 00 00 call 801040a1 <userinit>
// Finish setting up this processor in mpmain.
mpmain();
8010345c: e8 1a 00 00 00 call 8010347b <mpmain>
80103461 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103461: 55 push %ebp
80103462: 89 e5 mov %esp,%ebp
80103464: 83 ec 08 sub $0x8,%esp
switchkvm();
80103467: e8 3b 46 00 00 call 80107aa7 <switchkvm>
seginit();
8010346c: e8 b2 3f 00 00 call 80107423 <seginit>
lapicinit();
80103471: e8 78 f8 ff ff call 80102cee <lapicinit>
mpmain();
80103476: e8 00 00 00 00 call 8010347b <mpmain>
8010347b <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
8010347b: 55 push %ebp
8010347c: 89 e5 mov %esp,%ebp
8010347e: 83 ec 18 sub $0x18,%esp
cprintf("cpu%d: starting\n", cpu->id);
80103481: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80103487: 0f b6 00 movzbl (%eax),%eax
8010348a: 0f b6 c0 movzbl %al,%eax
8010348d: 89 44 24 04 mov %eax,0x4(%esp)
80103491: c7 04 24 90 84 10 80 movl $0x80108490,(%esp)
80103498: e8 03 cf ff ff call 801003a0 <cprintf>
idtinit(); // load idt register
8010349d: e8 f6 2f 00 00 call 80106498 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
801034a2: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801034a8: 05 a8 00 00 00 add $0xa8,%eax
801034ad: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801034b4: 00
801034b5: 89 04 24 mov %eax,(%esp)
801034b8: e8 da fe ff ff call 80103397 <xchg>
scheduler(); // start running processes
801034bd: e8 2e 11 00 00 call 801045f0 <scheduler>
801034c2 <startothers>:
pde_t entrypgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
startothers(void)
{
801034c2: 55 push %ebp
801034c3: 89 e5 mov %esp,%ebp
801034c5: 53 push %ebx
801034c6: 83 ec 24 sub $0x24,%esp
char *stack;
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = p2v(0x7000);
801034c9: c7 04 24 00 70 00 00 movl $0x7000,(%esp)
801034d0: e8 b5 fe ff ff call 8010338a <p2v>
801034d5: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
801034d8: b8 8a 00 00 00 mov $0x8a,%eax
801034dd: 89 44 24 08 mov %eax,0x8(%esp)
801034e1: c7 44 24 04 0c b5 10 movl $0x8010b50c,0x4(%esp)
801034e8: 80
801034e9: 8b 45 f0 mov -0x10(%ebp),%eax
801034ec: 89 04 24 mov %eax,(%esp)
801034ef: e8 91 18 00 00 call 80104d85 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
801034f4: c7 45 f4 20 f9 10 80 movl $0x8010f920,-0xc(%ebp)
801034fb: e9 85 00 00 00 jmp 80103585 <startothers+0xc3>
if(c == cpus+cpunum()) // We've started already.
80103500: e8 42 f9 ff ff call 80102e47 <cpunum>
80103505: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
8010350b: 05 20 f9 10 80 add $0x8010f920,%eax
80103510: 3b 45 f4 cmp -0xc(%ebp),%eax
80103513: 75 02 jne 80103517 <startothers+0x55>
continue;
80103515: eb 67 jmp 8010357e <startothers+0xbc>
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
80103517: e8 b2 f5 ff ff call 80102ace <kalloc>
8010351c: 89 45 ec mov %eax,-0x14(%ebp)
*(void**)(code-4) = stack + KSTACKSIZE;
8010351f: 8b 45 f0 mov -0x10(%ebp),%eax
80103522: 83 e8 04 sub $0x4,%eax
80103525: 8b 55 ec mov -0x14(%ebp),%edx
80103528: 81 c2 00 10 00 00 add $0x1000,%edx
8010352e: 89 10 mov %edx,(%eax)
*(void**)(code-8) = mpenter;
80103530: 8b 45 f0 mov -0x10(%ebp),%eax
80103533: 83 e8 08 sub $0x8,%eax
80103536: c7 00 61 34 10 80 movl $0x80103461,(%eax)
*(int**)(code-12) = (void *) v2p(entrypgdir);
8010353c: 8b 45 f0 mov -0x10(%ebp),%eax
8010353f: 8d 58 f4 lea -0xc(%eax),%ebx
80103542: c7 04 24 00 a0 10 80 movl $0x8010a000,(%esp)
80103549: e8 2f fe ff ff call 8010337d <v2p>
8010354e: 89 03 mov %eax,(%ebx)
lapicstartap(c->id, v2p(code));
80103550: 8b 45 f0 mov -0x10(%ebp),%eax
80103553: 89 04 24 mov %eax,(%esp)
80103556: e8 22 fe ff ff call 8010337d <v2p>
8010355b: 8b 55 f4 mov -0xc(%ebp),%edx
8010355e: 0f b6 12 movzbl (%edx),%edx
80103561: 0f b6 d2 movzbl %dl,%edx
80103564: 89 44 24 04 mov %eax,0x4(%esp)
80103568: 89 14 24 mov %edx,(%esp)
8010356b: e8 59 f9 ff ff call 80102ec9 <lapicstartap>
// wait for cpu to finish mpmain()
while(c->started == 0)
80103570: 90 nop
80103571: 8b 45 f4 mov -0xc(%ebp),%eax
80103574: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
8010357a: 85 c0 test %eax,%eax
8010357c: 74 f3 je 80103571 <startothers+0xaf>
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = p2v(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
8010357e: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp)
80103585: a1 00 ff 10 80 mov 0x8010ff00,%eax
8010358a: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103590: 05 20 f9 10 80 add $0x8010f920,%eax
80103595: 3b 45 f4 cmp -0xc(%ebp),%eax
80103598: 0f 87 62 ff ff ff ja 80103500 <startothers+0x3e>
// wait for cpu to finish mpmain()
while(c->started == 0)
;
}
}
8010359e: 83 c4 24 add $0x24,%esp
801035a1: 5b pop %ebx
801035a2: 5d pop %ebp
801035a3: c3 ret
801035a4 <p2v>:
801035a4: 55 push %ebp
801035a5: 89 e5 mov %esp,%ebp
801035a7: 8b 45 08 mov 0x8(%ebp),%eax
801035aa: 05 00 00 00 80 add $0x80000000,%eax
801035af: 5d pop %ebp
801035b0: c3 ret
801035b1 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801035b1: 55 push %ebp
801035b2: 89 e5 mov %esp,%ebp
801035b4: 83 ec 14 sub $0x14,%esp
801035b7: 8b 45 08 mov 0x8(%ebp),%eax
801035ba: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801035be: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801035c2: 89 c2 mov %eax,%edx
801035c4: ec in (%dx),%al
801035c5: 88 45 ff mov %al,-0x1(%ebp)
return data;
801035c8: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
801035cc: c9 leave
801035cd: c3 ret
801035ce <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801035ce: 55 push %ebp
801035cf: 89 e5 mov %esp,%ebp
801035d1: 83 ec 08 sub $0x8,%esp
801035d4: 8b 55 08 mov 0x8(%ebp),%edx
801035d7: 8b 45 0c mov 0xc(%ebp),%eax
801035da: 66 89 55 fc mov %dx,-0x4(%ebp)
801035de: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801035e1: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801035e5: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801035e9: ee out %al,(%dx)
}
801035ea: c9 leave
801035eb: c3 ret
801035ec <mpbcpu>:
int ncpu;
uchar ioapicid;
int
mpbcpu(void)
{
801035ec: 55 push %ebp
801035ed: 89 e5 mov %esp,%ebp
return bcpu-cpus;
801035ef: a1 44 b6 10 80 mov 0x8010b644,%eax
801035f4: 89 c2 mov %eax,%edx
801035f6: b8 20 f9 10 80 mov $0x8010f920,%eax
801035fb: 29 c2 sub %eax,%edx
801035fd: 89 d0 mov %edx,%eax
801035ff: c1 f8 02 sar $0x2,%eax
80103602: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax
}
80103608: 5d pop %ebp
80103609: c3 ret
8010360a <sum>:
static uchar
sum(uchar *addr, int len)
{
8010360a: 55 push %ebp
8010360b: 89 e5 mov %esp,%ebp
8010360d: 83 ec 10 sub $0x10,%esp
int i, sum;
sum = 0;
80103610: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
for(i=0; i<len; i++)
80103617: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
8010361e: eb 15 jmp 80103635 <sum+0x2b>
sum += addr[i];
80103620: 8b 55 fc mov -0x4(%ebp),%edx
80103623: 8b 45 08 mov 0x8(%ebp),%eax
80103626: 01 d0 add %edx,%eax
80103628: 0f b6 00 movzbl (%eax),%eax
8010362b: 0f b6 c0 movzbl %al,%eax
8010362e: 01 45 f8 add %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103631: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80103635: 8b 45 fc mov -0x4(%ebp),%eax
80103638: 3b 45 0c cmp 0xc(%ebp),%eax
8010363b: 7c e3 jl 80103620 <sum+0x16>
sum += addr[i];
return sum;
8010363d: 8b 45 f8 mov -0x8(%ebp),%eax
}
80103640: c9 leave
80103641: c3 ret
80103642 <mpsearch1>:
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103642: 55 push %ebp
80103643: 89 e5 mov %esp,%ebp
80103645: 83 ec 28 sub $0x28,%esp
uchar *e, *p, *addr;
addr = p2v(a);
80103648: 8b 45 08 mov 0x8(%ebp),%eax
8010364b: 89 04 24 mov %eax,(%esp)
8010364e: e8 51 ff ff ff call 801035a4 <p2v>
80103653: 89 45 f0 mov %eax,-0x10(%ebp)
e = addr+len;
80103656: 8b 55 0c mov 0xc(%ebp),%edx
80103659: 8b 45 f0 mov -0x10(%ebp),%eax
8010365c: 01 d0 add %edx,%eax
8010365e: 89 45 ec mov %eax,-0x14(%ebp)
for(p = addr; p < e; p += sizeof(struct mp))
80103661: 8b 45 f0 mov -0x10(%ebp),%eax
80103664: 89 45 f4 mov %eax,-0xc(%ebp)
80103667: eb 3f jmp 801036a8 <mpsearch1+0x66>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103669: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80103670: 00
80103671: c7 44 24 04 a4 84 10 movl $0x801084a4,0x4(%esp)
80103678: 80
80103679: 8b 45 f4 mov -0xc(%ebp),%eax
8010367c: 89 04 24 mov %eax,(%esp)
8010367f: e8 a9 16 00 00 call 80104d2d <memcmp>
80103684: 85 c0 test %eax,%eax
80103686: 75 1c jne 801036a4 <mpsearch1+0x62>
80103688: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
8010368f: 00
80103690: 8b 45 f4 mov -0xc(%ebp),%eax
80103693: 89 04 24 mov %eax,(%esp)
80103696: e8 6f ff ff ff call 8010360a <sum>
8010369b: 84 c0 test %al,%al
8010369d: 75 05 jne 801036a4 <mpsearch1+0x62>
return (struct mp*)p;
8010369f: 8b 45 f4 mov -0xc(%ebp),%eax
801036a2: eb 11 jmp 801036b5 <mpsearch1+0x73>
{
uchar *e, *p, *addr;
addr = p2v(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
801036a4: 83 45 f4 10 addl $0x10,-0xc(%ebp)
801036a8: 8b 45 f4 mov -0xc(%ebp),%eax
801036ab: 3b 45 ec cmp -0x14(%ebp),%eax
801036ae: 72 b9 jb 80103669 <mpsearch1+0x27>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
801036b0: b8 00 00 00 00 mov $0x0,%eax
}
801036b5: c9 leave
801036b6: c3 ret
801036b7 <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
801036b7: 55 push %ebp
801036b8: 89 e5 mov %esp,%ebp
801036ba: 83 ec 28 sub $0x28,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
801036bd: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp)
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
801036c4: 8b 45 f4 mov -0xc(%ebp),%eax
801036c7: 83 c0 0f add $0xf,%eax
801036ca: 0f b6 00 movzbl (%eax),%eax
801036cd: 0f b6 c0 movzbl %al,%eax
801036d0: c1 e0 08 shl $0x8,%eax
801036d3: 89 c2 mov %eax,%edx
801036d5: 8b 45 f4 mov -0xc(%ebp),%eax
801036d8: 83 c0 0e add $0xe,%eax
801036db: 0f b6 00 movzbl (%eax),%eax
801036de: 0f b6 c0 movzbl %al,%eax
801036e1: 09 d0 or %edx,%eax
801036e3: c1 e0 04 shl $0x4,%eax
801036e6: 89 45 f0 mov %eax,-0x10(%ebp)
801036e9: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801036ed: 74 21 je 80103710 <mpsearch+0x59>
if((mp = mpsearch1(p, 1024)))
801036ef: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
801036f6: 00
801036f7: 8b 45 f0 mov -0x10(%ebp),%eax
801036fa: 89 04 24 mov %eax,(%esp)
801036fd: e8 40 ff ff ff call 80103642 <mpsearch1>
80103702: 89 45 ec mov %eax,-0x14(%ebp)
80103705: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103709: 74 50 je 8010375b <mpsearch+0xa4>
return mp;
8010370b: 8b 45 ec mov -0x14(%ebp),%eax
8010370e: eb 5f jmp 8010376f <mpsearch+0xb8>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103710: 8b 45 f4 mov -0xc(%ebp),%eax
80103713: 83 c0 14 add $0x14,%eax
80103716: 0f b6 00 movzbl (%eax),%eax
80103719: 0f b6 c0 movzbl %al,%eax
8010371c: c1 e0 08 shl $0x8,%eax
8010371f: 89 c2 mov %eax,%edx
80103721: 8b 45 f4 mov -0xc(%ebp),%eax
80103724: 83 c0 13 add $0x13,%eax
80103727: 0f b6 00 movzbl (%eax),%eax
8010372a: 0f b6 c0 movzbl %al,%eax
8010372d: 09 d0 or %edx,%eax
8010372f: c1 e0 0a shl $0xa,%eax
80103732: 89 45 f0 mov %eax,-0x10(%ebp)
if((mp = mpsearch1(p-1024, 1024)))
80103735: 8b 45 f0 mov -0x10(%ebp),%eax
80103738: 2d 00 04 00 00 sub $0x400,%eax
8010373d: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
80103744: 00
80103745: 89 04 24 mov %eax,(%esp)
80103748: e8 f5 fe ff ff call 80103642 <mpsearch1>
8010374d: 89 45 ec mov %eax,-0x14(%ebp)
80103750: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103754: 74 05 je 8010375b <mpsearch+0xa4>
return mp;
80103756: 8b 45 ec mov -0x14(%ebp),%eax
80103759: eb 14 jmp 8010376f <mpsearch+0xb8>
}
return mpsearch1(0xF0000, 0x10000);
8010375b: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80103762: 00
80103763: c7 04 24 00 00 0f 00 movl $0xf0000,(%esp)
8010376a: e8 d3 fe ff ff call 80103642 <mpsearch1>
}
8010376f: c9 leave
80103770: c3 ret
80103771 <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103771: 55 push %ebp
80103772: 89 e5 mov %esp,%ebp
80103774: 83 ec 28 sub $0x28,%esp
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103777: e8 3b ff ff ff call 801036b7 <mpsearch>
8010377c: 89 45 f4 mov %eax,-0xc(%ebp)
8010377f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103783: 74 0a je 8010378f <mpconfig+0x1e>
80103785: 8b 45 f4 mov -0xc(%ebp),%eax
80103788: 8b 40 04 mov 0x4(%eax),%eax
8010378b: 85 c0 test %eax,%eax
8010378d: 75 0a jne 80103799 <mpconfig+0x28>
return 0;
8010378f: b8 00 00 00 00 mov $0x0,%eax
80103794: e9 83 00 00 00 jmp 8010381c <mpconfig+0xab>
conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103799: 8b 45 f4 mov -0xc(%ebp),%eax
8010379c: 8b 40 04 mov 0x4(%eax),%eax
8010379f: 89 04 24 mov %eax,(%esp)
801037a2: e8 fd fd ff ff call 801035a4 <p2v>
801037a7: 89 45 f0 mov %eax,-0x10(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
801037aa: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
801037b1: 00
801037b2: c7 44 24 04 a9 84 10 movl $0x801084a9,0x4(%esp)
801037b9: 80
801037ba: 8b 45 f0 mov -0x10(%ebp),%eax
801037bd: 89 04 24 mov %eax,(%esp)
801037c0: e8 68 15 00 00 call 80104d2d <memcmp>
801037c5: 85 c0 test %eax,%eax
801037c7: 74 07 je 801037d0 <mpconfig+0x5f>
return 0;
801037c9: b8 00 00 00 00 mov $0x0,%eax
801037ce: eb 4c jmp 8010381c <mpconfig+0xab>
if(conf->version != 1 && conf->version != 4)
801037d0: 8b 45 f0 mov -0x10(%ebp),%eax
801037d3: 0f b6 40 06 movzbl 0x6(%eax),%eax
801037d7: 3c 01 cmp $0x1,%al
801037d9: 74 12 je 801037ed <mpconfig+0x7c>
801037db: 8b 45 f0 mov -0x10(%ebp),%eax
801037de: 0f b6 40 06 movzbl 0x6(%eax),%eax
801037e2: 3c 04 cmp $0x4,%al
801037e4: 74 07 je 801037ed <mpconfig+0x7c>
return 0;
801037e6: b8 00 00 00 00 mov $0x0,%eax
801037eb: eb 2f jmp 8010381c <mpconfig+0xab>
if(sum((uchar*)conf, conf->length) != 0)
801037ed: 8b 45 f0 mov -0x10(%ebp),%eax
801037f0: 0f b7 40 04 movzwl 0x4(%eax),%eax
801037f4: 0f b7 c0 movzwl %ax,%eax
801037f7: 89 44 24 04 mov %eax,0x4(%esp)
801037fb: 8b 45 f0 mov -0x10(%ebp),%eax
801037fe: 89 04 24 mov %eax,(%esp)
80103801: e8 04 fe ff ff call 8010360a <sum>
80103806: 84 c0 test %al,%al
80103808: 74 07 je 80103811 <mpconfig+0xa0>
return 0;
8010380a: b8 00 00 00 00 mov $0x0,%eax
8010380f: eb 0b jmp 8010381c <mpconfig+0xab>
*pmp = mp;
80103811: 8b 45 08 mov 0x8(%ebp),%eax
80103814: 8b 55 f4 mov -0xc(%ebp),%edx
80103817: 89 10 mov %edx,(%eax)
return conf;
80103819: 8b 45 f0 mov -0x10(%ebp),%eax
}
8010381c: c9 leave
8010381d: c3 ret
8010381e <mpinit>:
void
mpinit(void)
{
8010381e: 55 push %ebp
8010381f: 89 e5 mov %esp,%ebp
80103821: 83 ec 38 sub $0x38,%esp
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
80103824: c7 05 44 b6 10 80 20 movl $0x8010f920,0x8010b644
8010382b: f9 10 80
if((conf = mpconfig(&mp)) == 0)
8010382e: 8d 45 e0 lea -0x20(%ebp),%eax
80103831: 89 04 24 mov %eax,(%esp)
80103834: e8 38 ff ff ff call 80103771 <mpconfig>
80103839: 89 45 f0 mov %eax,-0x10(%ebp)
8010383c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103840: 75 05 jne 80103847 <mpinit+0x29>
return;
80103842: e9 9c 01 00 00 jmp 801039e3 <mpinit+0x1c5>
ismp = 1;
80103847: c7 05 04 f9 10 80 01 movl $0x1,0x8010f904
8010384e: 00 00 00
lapic = (uint*)conf->lapicaddr;
80103851: 8b 45 f0 mov -0x10(%ebp),%eax
80103854: 8b 40 24 mov 0x24(%eax),%eax
80103857: a3 7c f8 10 80 mov %eax,0x8010f87c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
8010385c: 8b 45 f0 mov -0x10(%ebp),%eax
8010385f: 83 c0 2c add $0x2c,%eax
80103862: 89 45 f4 mov %eax,-0xc(%ebp)
80103865: 8b 45 f0 mov -0x10(%ebp),%eax
80103868: 0f b7 40 04 movzwl 0x4(%eax),%eax
8010386c: 0f b7 d0 movzwl %ax,%edx
8010386f: 8b 45 f0 mov -0x10(%ebp),%eax
80103872: 01 d0 add %edx,%eax
80103874: 89 45 ec mov %eax,-0x14(%ebp)
80103877: e9 f4 00 00 00 jmp 80103970 <mpinit+0x152>
switch(*p){
8010387c: 8b 45 f4 mov -0xc(%ebp),%eax
8010387f: 0f b6 00 movzbl (%eax),%eax
80103882: 0f b6 c0 movzbl %al,%eax
80103885: 83 f8 04 cmp $0x4,%eax
80103888: 0f 87 bf 00 00 00 ja 8010394d <mpinit+0x12f>
8010388e: 8b 04 85 ec 84 10 80 mov -0x7fef7b14(,%eax,4),%eax
80103895: ff e0 jmp *%eax
case MPPROC:
proc = (struct mpproc*)p;
80103897: 8b 45 f4 mov -0xc(%ebp),%eax
8010389a: 89 45 e8 mov %eax,-0x18(%ebp)
if(ncpu != proc->apicid){
8010389d: 8b 45 e8 mov -0x18(%ebp),%eax
801038a0: 0f b6 40 01 movzbl 0x1(%eax),%eax
801038a4: 0f b6 d0 movzbl %al,%edx
801038a7: a1 00 ff 10 80 mov 0x8010ff00,%eax
801038ac: 39 c2 cmp %eax,%edx
801038ae: 74 2d je 801038dd <mpinit+0xbf>
cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
801038b0: 8b 45 e8 mov -0x18(%ebp),%eax
801038b3: 0f b6 40 01 movzbl 0x1(%eax),%eax
801038b7: 0f b6 d0 movzbl %al,%edx
801038ba: a1 00 ff 10 80 mov 0x8010ff00,%eax
801038bf: 89 54 24 08 mov %edx,0x8(%esp)
801038c3: 89 44 24 04 mov %eax,0x4(%esp)
801038c7: c7 04 24 ae 84 10 80 movl $0x801084ae,(%esp)
801038ce: e8 cd ca ff ff call 801003a0 <cprintf>
ismp = 0;
801038d3: c7 05 04 f9 10 80 00 movl $0x0,0x8010f904
801038da: 00 00 00
}
if(proc->flags & MPBOOT)
801038dd: 8b 45 e8 mov -0x18(%ebp),%eax
801038e0: 0f b6 40 03 movzbl 0x3(%eax),%eax
801038e4: 0f b6 c0 movzbl %al,%eax
801038e7: 83 e0 02 and $0x2,%eax
801038ea: 85 c0 test %eax,%eax
801038ec: 74 15 je 80103903 <mpinit+0xe5>
bcpu = &cpus[ncpu];
801038ee: a1 00 ff 10 80 mov 0x8010ff00,%eax
801038f3: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
801038f9: 05 20 f9 10 80 add $0x8010f920,%eax
801038fe: a3 44 b6 10 80 mov %eax,0x8010b644
cpus[ncpu].id = ncpu;
80103903: 8b 15 00 ff 10 80 mov 0x8010ff00,%edx
80103909: a1 00 ff 10 80 mov 0x8010ff00,%eax
8010390e: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx
80103914: 81 c2 20 f9 10 80 add $0x8010f920,%edx
8010391a: 88 02 mov %al,(%edx)
ncpu++;
8010391c: a1 00 ff 10 80 mov 0x8010ff00,%eax
80103921: 83 c0 01 add $0x1,%eax
80103924: a3 00 ff 10 80 mov %eax,0x8010ff00
p += sizeof(struct mpproc);
80103929: 83 45 f4 14 addl $0x14,-0xc(%ebp)
continue;
8010392d: eb 41 jmp 80103970 <mpinit+0x152>
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
8010392f: 8b 45 f4 mov -0xc(%ebp),%eax
80103932: 89 45 e4 mov %eax,-0x1c(%ebp)
ioapicid = ioapic->apicno;
80103935: 8b 45 e4 mov -0x1c(%ebp),%eax
80103938: 0f b6 40 01 movzbl 0x1(%eax),%eax
8010393c: a2 00 f9 10 80 mov %al,0x8010f900
p += sizeof(struct mpioapic);
80103941: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103945: eb 29 jmp 80103970 <mpinit+0x152>
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103947: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
8010394b: eb 23 jmp 80103970 <mpinit+0x152>
default:
cprintf("mpinit: unknown config type %x\n", *p);
8010394d: 8b 45 f4 mov -0xc(%ebp),%eax
80103950: 0f b6 00 movzbl (%eax),%eax
80103953: 0f b6 c0 movzbl %al,%eax
80103956: 89 44 24 04 mov %eax,0x4(%esp)
8010395a: c7 04 24 cc 84 10 80 movl $0x801084cc,(%esp)
80103961: e8 3a ca ff ff call 801003a0 <cprintf>
ismp = 0;
80103966: c7 05 04 f9 10 80 00 movl $0x0,0x8010f904
8010396d: 00 00 00
bcpu = &cpus[0];
if((conf = mpconfig(&mp)) == 0)
return;
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103970: 8b 45 f4 mov -0xc(%ebp),%eax
80103973: 3b 45 ec cmp -0x14(%ebp),%eax
80103976: 0f 82 00 ff ff ff jb 8010387c <mpinit+0x5e>
default:
cprintf("mpinit: unknown config type %x\n", *p);
ismp = 0;
}
}
if(!ismp){
8010397c: a1 04 f9 10 80 mov 0x8010f904,%eax
80103981: 85 c0 test %eax,%eax
80103983: 75 1d jne 801039a2 <mpinit+0x184>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103985: c7 05 00 ff 10 80 01 movl $0x1,0x8010ff00
8010398c: 00 00 00
lapic = 0;
8010398f: c7 05 7c f8 10 80 00 movl $0x0,0x8010f87c
80103996: 00 00 00
ioapicid = 0;
80103999: c6 05 00 f9 10 80 00 movb $0x0,0x8010f900
return;
801039a0: eb 41 jmp 801039e3 <mpinit+0x1c5>
}
if(mp->imcrp){
801039a2: 8b 45 e0 mov -0x20(%ebp),%eax
801039a5: 0f b6 40 0c movzbl 0xc(%eax),%eax
801039a9: 84 c0 test %al,%al
801039ab: 74 36 je 801039e3 <mpinit+0x1c5>
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
801039ad: c7 44 24 04 70 00 00 movl $0x70,0x4(%esp)
801039b4: 00
801039b5: c7 04 24 22 00 00 00 movl $0x22,(%esp)
801039bc: e8 0d fc ff ff call 801035ce <outb>
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
801039c1: c7 04 24 23 00 00 00 movl $0x23,(%esp)
801039c8: e8 e4 fb ff ff call 801035b1 <inb>
801039cd: 83 c8 01 or $0x1,%eax
801039d0: 0f b6 c0 movzbl %al,%eax
801039d3: 89 44 24 04 mov %eax,0x4(%esp)
801039d7: c7 04 24 23 00 00 00 movl $0x23,(%esp)
801039de: e8 eb fb ff ff call 801035ce <outb>
}
}
801039e3: c9 leave
801039e4: c3 ret
801039e5 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801039e5: 55 push %ebp
801039e6: 89 e5 mov %esp,%ebp
801039e8: 83 ec 08 sub $0x8,%esp
801039eb: 8b 55 08 mov 0x8(%ebp),%edx
801039ee: 8b 45 0c mov 0xc(%ebp),%eax
801039f1: 66 89 55 fc mov %dx,-0x4(%ebp)
801039f5: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801039f8: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801039fc: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103a00: ee out %al,(%dx)
}
80103a01: c9 leave
80103a02: c3 ret
80103a03 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
static void
picsetmask(ushort mask)
{
80103a03: 55 push %ebp
80103a04: 89 e5 mov %esp,%ebp
80103a06: 83 ec 0c sub $0xc,%esp
80103a09: 8b 45 08 mov 0x8(%ebp),%eax
80103a0c: 66 89 45 fc mov %ax,-0x4(%ebp)
irqmask = mask;
80103a10: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103a14: 66 a3 00 b0 10 80 mov %ax,0x8010b000
outb(IO_PIC1+1, mask);
80103a1a: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103a1e: 0f b6 c0 movzbl %al,%eax
80103a21: 89 44 24 04 mov %eax,0x4(%esp)
80103a25: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103a2c: e8 b4 ff ff ff call 801039e5 <outb>
outb(IO_PIC2+1, mask >> 8);
80103a31: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103a35: 66 c1 e8 08 shr $0x8,%ax
80103a39: 0f b6 c0 movzbl %al,%eax
80103a3c: 89 44 24 04 mov %eax,0x4(%esp)
80103a40: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103a47: e8 99 ff ff ff call 801039e5 <outb>
}
80103a4c: c9 leave
80103a4d: c3 ret
80103a4e <picenable>:
void
picenable(int irq)
{
80103a4e: 55 push %ebp
80103a4f: 89 e5 mov %esp,%ebp
80103a51: 83 ec 04 sub $0x4,%esp
picsetmask(irqmask & ~(1<<irq));
80103a54: 8b 45 08 mov 0x8(%ebp),%eax
80103a57: ba 01 00 00 00 mov $0x1,%edx
80103a5c: 89 c1 mov %eax,%ecx
80103a5e: d3 e2 shl %cl,%edx
80103a60: 89 d0 mov %edx,%eax
80103a62: f7 d0 not %eax
80103a64: 89 c2 mov %eax,%edx
80103a66: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103a6d: 21 d0 and %edx,%eax
80103a6f: 0f b7 c0 movzwl %ax,%eax
80103a72: 89 04 24 mov %eax,(%esp)
80103a75: e8 89 ff ff ff call 80103a03 <picsetmask>
}
80103a7a: c9 leave
80103a7b: c3 ret
80103a7c <picinit>:
// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103a7c: 55 push %ebp
80103a7d: 89 e5 mov %esp,%ebp
80103a7f: 83 ec 08 sub $0x8,%esp
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
80103a82: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103a89: 00
80103a8a: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103a91: e8 4f ff ff ff call 801039e5 <outb>
outb(IO_PIC2+1, 0xFF);
80103a96: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103a9d: 00
80103a9e: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103aa5: e8 3b ff ff ff call 801039e5 <outb>
// ICW1: 0001g0hi
// g: 0 = edge triggering, 1 = level triggering
// h: 0 = cascaded PICs, 1 = master only
// i: 0 = no ICW4, 1 = ICW4 required
outb(IO_PIC1, 0x11);
80103aaa: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103ab1: 00
80103ab2: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103ab9: e8 27 ff ff ff call 801039e5 <outb>
// ICW2: Vector offset
outb(IO_PIC1+1, T_IRQ0);
80103abe: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
80103ac5: 00
80103ac6: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103acd: e8 13 ff ff ff call 801039e5 <outb>
// ICW3: (master PIC) bit mask of IR lines connected to slaves
// (slave PIC) 3-bit # of slave's connection to master
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103ad2: c7 44 24 04 04 00 00 movl $0x4,0x4(%esp)
80103ad9: 00
80103ada: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103ae1: e8 ff fe ff ff call 801039e5 <outb>
// m: 0 = slave PIC, 1 = master PIC
// (ignored when b is 0, as the master/slave role
// can be hardwired).
// a: 1 = Automatic EOI mode
// p: 0 = MCS-80/85 mode, 1 = intel x86 mode
outb(IO_PIC1+1, 0x3);
80103ae6: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103aed: 00
80103aee: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103af5: e8 eb fe ff ff call 801039e5 <outb>
// Set up slave (8259A-2)
outb(IO_PIC2, 0x11); // ICW1
80103afa: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103b01: 00
80103b02: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103b09: e8 d7 fe ff ff call 801039e5 <outb>
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
80103b0e: c7 44 24 04 28 00 00 movl $0x28,0x4(%esp)
80103b15: 00
80103b16: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103b1d: e8 c3 fe ff ff call 801039e5 <outb>
outb(IO_PIC2+1, IRQ_SLAVE); // ICW3
80103b22: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
80103b29: 00
80103b2a: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103b31: e8 af fe ff ff call 801039e5 <outb>
// NB Automatic EOI mode doesn't tend to work on the slave.
// Linux source code says it's "to be investigated".
outb(IO_PIC2+1, 0x3); // ICW4
80103b36: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103b3d: 00
80103b3e: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103b45: e8 9b fe ff ff call 801039e5 <outb>
// OCW3: 0ef01prs
// ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask
// p: 0 = no polling, 1 = polling mode
// rs: 0x = NOP, 10 = read IRR, 11 = read ISR
outb(IO_PIC1, 0x68); // clear specific mask
80103b4a: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103b51: 00
80103b52: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103b59: e8 87 fe ff ff call 801039e5 <outb>
outb(IO_PIC1, 0x0a); // read IRR by default
80103b5e: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103b65: 00
80103b66: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103b6d: e8 73 fe ff ff call 801039e5 <outb>
outb(IO_PIC2, 0x68); // OCW3
80103b72: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103b79: 00
80103b7a: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103b81: e8 5f fe ff ff call 801039e5 <outb>
outb(IO_PIC2, 0x0a); // OCW3
80103b86: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103b8d: 00
80103b8e: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103b95: e8 4b fe ff ff call 801039e5 <outb>
if(irqmask != 0xFFFF)
80103b9a: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103ba1: 66 83 f8 ff cmp $0xffff,%ax
80103ba5: 74 12 je 80103bb9 <picinit+0x13d>
picsetmask(irqmask);
80103ba7: 0f b7 05 00 b0 10 80 movzwl 0x8010b000,%eax
80103bae: 0f b7 c0 movzwl %ax,%eax
80103bb1: 89 04 24 mov %eax,(%esp)
80103bb4: e8 4a fe ff ff call 80103a03 <picsetmask>
}
80103bb9: c9 leave
80103bba: c3 ret
80103bbb <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80103bbb: 55 push %ebp
80103bbc: 89 e5 mov %esp,%ebp
80103bbe: 83 ec 28 sub $0x28,%esp
struct pipe *p;
p = 0;
80103bc1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
*f0 = *f1 = 0;
80103bc8: 8b 45 0c mov 0xc(%ebp),%eax
80103bcb: c7 00 00 00 00 00 movl $0x0,(%eax)
80103bd1: 8b 45 0c mov 0xc(%ebp),%eax
80103bd4: 8b 10 mov (%eax),%edx
80103bd6: 8b 45 08 mov 0x8(%ebp),%eax
80103bd9: 89 10 mov %edx,(%eax)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103bdb: e8 32 d3 ff ff call 80100f12 <filealloc>
80103be0: 8b 55 08 mov 0x8(%ebp),%edx
80103be3: 89 02 mov %eax,(%edx)
80103be5: 8b 45 08 mov 0x8(%ebp),%eax
80103be8: 8b 00 mov (%eax),%eax
80103bea: 85 c0 test %eax,%eax
80103bec: 0f 84 c8 00 00 00 je 80103cba <pipealloc+0xff>
80103bf2: e8 1b d3 ff ff call 80100f12 <filealloc>
80103bf7: 8b 55 0c mov 0xc(%ebp),%edx
80103bfa: 89 02 mov %eax,(%edx)
80103bfc: 8b 45 0c mov 0xc(%ebp),%eax
80103bff: 8b 00 mov (%eax),%eax
80103c01: 85 c0 test %eax,%eax
80103c03: 0f 84 b1 00 00 00 je 80103cba <pipealloc+0xff>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103c09: e8 c0 ee ff ff call 80102ace <kalloc>
80103c0e: 89 45 f4 mov %eax,-0xc(%ebp)
80103c11: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103c15: 75 05 jne 80103c1c <pipealloc+0x61>
goto bad;
80103c17: e9 9e 00 00 00 jmp 80103cba <pipealloc+0xff>
p->readopen = 1;
80103c1c: 8b 45 f4 mov -0xc(%ebp),%eax
80103c1f: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
80103c26: 00 00 00
p->writeopen = 1;
80103c29: 8b 45 f4 mov -0xc(%ebp),%eax
80103c2c: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
80103c33: 00 00 00
p->nwrite = 0;
80103c36: 8b 45 f4 mov -0xc(%ebp),%eax
80103c39: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
80103c40: 00 00 00
p->nread = 0;
80103c43: 8b 45 f4 mov -0xc(%ebp),%eax
80103c46: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80103c4d: 00 00 00
initlock(&p->lock, "pipe");
80103c50: 8b 45 f4 mov -0xc(%ebp),%eax
80103c53: c7 44 24 04 00 85 10 movl $0x80108500,0x4(%esp)
80103c5a: 80
80103c5b: 89 04 24 mov %eax,(%esp)
80103c5e: e8 de 0d 00 00 call 80104a41 <initlock>
(*f0)->type = FD_PIPE;
80103c63: 8b 45 08 mov 0x8(%ebp),%eax
80103c66: 8b 00 mov (%eax),%eax
80103c68: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
80103c6e: 8b 45 08 mov 0x8(%ebp),%eax
80103c71: 8b 00 mov (%eax),%eax
80103c73: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
80103c77: 8b 45 08 mov 0x8(%ebp),%eax
80103c7a: 8b 00 mov (%eax),%eax
80103c7c: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
80103c80: 8b 45 08 mov 0x8(%ebp),%eax
80103c83: 8b 00 mov (%eax),%eax
80103c85: 8b 55 f4 mov -0xc(%ebp),%edx
80103c88: 89 50 0c mov %edx,0xc(%eax)
(*f1)->type = FD_PIPE;
80103c8b: 8b 45 0c mov 0xc(%ebp),%eax
80103c8e: 8b 00 mov (%eax),%eax
80103c90: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80103c96: 8b 45 0c mov 0xc(%ebp),%eax
80103c99: 8b 00 mov (%eax),%eax
80103c9b: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80103c9f: 8b 45 0c mov 0xc(%ebp),%eax
80103ca2: 8b 00 mov (%eax),%eax
80103ca4: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80103ca8: 8b 45 0c mov 0xc(%ebp),%eax
80103cab: 8b 00 mov (%eax),%eax
80103cad: 8b 55 f4 mov -0xc(%ebp),%edx
80103cb0: 89 50 0c mov %edx,0xc(%eax)
return 0;
80103cb3: b8 00 00 00 00 mov $0x0,%eax
80103cb8: eb 42 jmp 80103cfc <pipealloc+0x141>
//PAGEBREAK: 20
bad:
if(p)
80103cba: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103cbe: 74 0b je 80103ccb <pipealloc+0x110>
kfree((char*)p);
80103cc0: 8b 45 f4 mov -0xc(%ebp),%eax
80103cc3: 89 04 24 mov %eax,(%esp)
80103cc6: e8 6a ed ff ff call 80102a35 <kfree>
if(*f0)
80103ccb: 8b 45 08 mov 0x8(%ebp),%eax
80103cce: 8b 00 mov (%eax),%eax
80103cd0: 85 c0 test %eax,%eax
80103cd2: 74 0d je 80103ce1 <pipealloc+0x126>
fileclose(*f0);
80103cd4: 8b 45 08 mov 0x8(%ebp),%eax
80103cd7: 8b 00 mov (%eax),%eax
80103cd9: 89 04 24 mov %eax,(%esp)
80103cdc: e8 d9 d2 ff ff call 80100fba <fileclose>
if(*f1)
80103ce1: 8b 45 0c mov 0xc(%ebp),%eax
80103ce4: 8b 00 mov (%eax),%eax
80103ce6: 85 c0 test %eax,%eax
80103ce8: 74 0d je 80103cf7 <pipealloc+0x13c>
fileclose(*f1);
80103cea: 8b 45 0c mov 0xc(%ebp),%eax
80103ced: 8b 00 mov (%eax),%eax
80103cef: 89 04 24 mov %eax,(%esp)
80103cf2: e8 c3 d2 ff ff call 80100fba <fileclose>
return -1;
80103cf7: b8 ff ff ff ff mov $0xffffffff,%eax
}
80103cfc: c9 leave
80103cfd: c3 ret
80103cfe <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
80103cfe: 55 push %ebp
80103cff: 89 e5 mov %esp,%ebp
80103d01: 83 ec 18 sub $0x18,%esp
acquire(&p->lock);
80103d04: 8b 45 08 mov 0x8(%ebp),%eax
80103d07: 89 04 24 mov %eax,(%esp)
80103d0a: e8 53 0d 00 00 call 80104a62 <acquire>
if(writable){
80103d0f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80103d13: 74 1f je 80103d34 <pipeclose+0x36>
p->writeopen = 0;
80103d15: 8b 45 08 mov 0x8(%ebp),%eax
80103d18: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax)
80103d1f: 00 00 00
wakeup(&p->nread);
80103d22: 8b 45 08 mov 0x8(%ebp),%eax
80103d25: 05 34 02 00 00 add $0x234,%eax
80103d2a: 89 04 24 mov %eax,(%esp)
80103d2d: e8 3f 0b 00 00 call 80104871 <wakeup>
80103d32: eb 1d jmp 80103d51 <pipeclose+0x53>
} else {
p->readopen = 0;
80103d34: 8b 45 08 mov 0x8(%ebp),%eax
80103d37: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax)
80103d3e: 00 00 00
wakeup(&p->nwrite);
80103d41: 8b 45 08 mov 0x8(%ebp),%eax
80103d44: 05 38 02 00 00 add $0x238,%eax
80103d49: 89 04 24 mov %eax,(%esp)
80103d4c: e8 20 0b 00 00 call 80104871 <wakeup>
}
if(p->readopen == 0 && p->writeopen == 0){
80103d51: 8b 45 08 mov 0x8(%ebp),%eax
80103d54: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80103d5a: 85 c0 test %eax,%eax
80103d5c: 75 25 jne 80103d83 <pipeclose+0x85>
80103d5e: 8b 45 08 mov 0x8(%ebp),%eax
80103d61: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
80103d67: 85 c0 test %eax,%eax
80103d69: 75 18 jne 80103d83 <pipeclose+0x85>
release(&p->lock);
80103d6b: 8b 45 08 mov 0x8(%ebp),%eax
80103d6e: 89 04 24 mov %eax,(%esp)
80103d71: e8 4e 0d 00 00 call 80104ac4 <release>
kfree((char*)p);
80103d76: 8b 45 08 mov 0x8(%ebp),%eax
80103d79: 89 04 24 mov %eax,(%esp)
80103d7c: e8 b4 ec ff ff call 80102a35 <kfree>
80103d81: eb 0b jmp 80103d8e <pipeclose+0x90>
} else
release(&p->lock);
80103d83: 8b 45 08 mov 0x8(%ebp),%eax
80103d86: 89 04 24 mov %eax,(%esp)
80103d89: e8 36 0d 00 00 call 80104ac4 <release>
}
80103d8e: c9 leave
80103d8f: c3 ret
80103d90 <pipewrite>:
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
80103d90: 55 push %ebp
80103d91: 89 e5 mov %esp,%ebp
80103d93: 83 ec 28 sub $0x28,%esp
int i;
acquire(&p->lock);
80103d96: 8b 45 08 mov 0x8(%ebp),%eax
80103d99: 89 04 24 mov %eax,(%esp)
80103d9c: e8 c1 0c 00 00 call 80104a62 <acquire>
for(i = 0; i < n; i++){
80103da1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103da8: e9 a6 00 00 00 jmp 80103e53 <pipewrite+0xc3>
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80103dad: eb 57 jmp 80103e06 <pipewrite+0x76>
if(p->readopen == 0 || proc->killed){
80103daf: 8b 45 08 mov 0x8(%ebp),%eax
80103db2: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80103db8: 85 c0 test %eax,%eax
80103dba: 74 0d je 80103dc9 <pipewrite+0x39>
80103dbc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103dc2: 8b 40 24 mov 0x24(%eax),%eax
80103dc5: 85 c0 test %eax,%eax
80103dc7: 74 15 je 80103dde <pipewrite+0x4e>
release(&p->lock);
80103dc9: 8b 45 08 mov 0x8(%ebp),%eax
80103dcc: 89 04 24 mov %eax,(%esp)
80103dcf: e8 f0 0c 00 00 call 80104ac4 <release>
return -1;
80103dd4: b8 ff ff ff ff mov $0xffffffff,%eax
80103dd9: e9 9f 00 00 00 jmp 80103e7d <pipewrite+0xed>
}
wakeup(&p->nread);
80103dde: 8b 45 08 mov 0x8(%ebp),%eax
80103de1: 05 34 02 00 00 add $0x234,%eax
80103de6: 89 04 24 mov %eax,(%esp)
80103de9: e8 83 0a 00 00 call 80104871 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
80103dee: 8b 45 08 mov 0x8(%ebp),%eax
80103df1: 8b 55 08 mov 0x8(%ebp),%edx
80103df4: 81 c2 38 02 00 00 add $0x238,%edx
80103dfa: 89 44 24 04 mov %eax,0x4(%esp)
80103dfe: 89 14 24 mov %edx,(%esp)
80103e01: e8 92 09 00 00 call 80104798 <sleep>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
80103e06: 8b 45 08 mov 0x8(%ebp),%eax
80103e09: 8b 90 38 02 00 00 mov 0x238(%eax),%edx
80103e0f: 8b 45 08 mov 0x8(%ebp),%eax
80103e12: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
80103e18: 05 00 02 00 00 add $0x200,%eax
80103e1d: 39 c2 cmp %eax,%edx
80103e1f: 74 8e je 80103daf <pipewrite+0x1f>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
80103e21: 8b 45 08 mov 0x8(%ebp),%eax
80103e24: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80103e2a: 8d 48 01 lea 0x1(%eax),%ecx
80103e2d: 8b 55 08 mov 0x8(%ebp),%edx
80103e30: 89 8a 38 02 00 00 mov %ecx,0x238(%edx)
80103e36: 25 ff 01 00 00 and $0x1ff,%eax
80103e3b: 89 c1 mov %eax,%ecx
80103e3d: 8b 55 f4 mov -0xc(%ebp),%edx
80103e40: 8b 45 0c mov 0xc(%ebp),%eax
80103e43: 01 d0 add %edx,%eax
80103e45: 0f b6 10 movzbl (%eax),%edx
80103e48: 8b 45 08 mov 0x8(%ebp),%eax
80103e4b: 88 54 08 34 mov %dl,0x34(%eax,%ecx,1)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
80103e4f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103e53: 8b 45 f4 mov -0xc(%ebp),%eax
80103e56: 3b 45 10 cmp 0x10(%ebp),%eax
80103e59: 0f 8c 4e ff ff ff jl 80103dad <pipewrite+0x1d>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80103e5f: 8b 45 08 mov 0x8(%ebp),%eax
80103e62: 05 34 02 00 00 add $0x234,%eax
80103e67: 89 04 24 mov %eax,(%esp)
80103e6a: e8 02 0a 00 00 call 80104871 <wakeup>
release(&p->lock);
80103e6f: 8b 45 08 mov 0x8(%ebp),%eax
80103e72: 89 04 24 mov %eax,(%esp)
80103e75: e8 4a 0c 00 00 call 80104ac4 <release>
return n;
80103e7a: 8b 45 10 mov 0x10(%ebp),%eax
}
80103e7d: c9 leave
80103e7e: c3 ret
80103e7f <piperead>:
int
piperead(struct pipe *p, char *addr, int n)
{
80103e7f: 55 push %ebp
80103e80: 89 e5 mov %esp,%ebp
80103e82: 53 push %ebx
80103e83: 83 ec 24 sub $0x24,%esp
int i;
acquire(&p->lock);
80103e86: 8b 45 08 mov 0x8(%ebp),%eax
80103e89: 89 04 24 mov %eax,(%esp)
80103e8c: e8 d1 0b 00 00 call 80104a62 <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103e91: eb 3a jmp 80103ecd <piperead+0x4e>
if(proc->killed){
80103e93: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80103e99: 8b 40 24 mov 0x24(%eax),%eax
80103e9c: 85 c0 test %eax,%eax
80103e9e: 74 15 je 80103eb5 <piperead+0x36>
release(&p->lock);
80103ea0: 8b 45 08 mov 0x8(%ebp),%eax
80103ea3: 89 04 24 mov %eax,(%esp)
80103ea6: e8 19 0c 00 00 call 80104ac4 <release>
return -1;
80103eab: b8 ff ff ff ff mov $0xffffffff,%eax
80103eb0: e9 b5 00 00 00 jmp 80103f6a <piperead+0xeb>
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80103eb5: 8b 45 08 mov 0x8(%ebp),%eax
80103eb8: 8b 55 08 mov 0x8(%ebp),%edx
80103ebb: 81 c2 34 02 00 00 add $0x234,%edx
80103ec1: 89 44 24 04 mov %eax,0x4(%esp)
80103ec5: 89 14 24 mov %edx,(%esp)
80103ec8: e8 cb 08 00 00 call 80104798 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80103ecd: 8b 45 08 mov 0x8(%ebp),%eax
80103ed0: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
80103ed6: 8b 45 08 mov 0x8(%ebp),%eax
80103ed9: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80103edf: 39 c2 cmp %eax,%edx
80103ee1: 75 0d jne 80103ef0 <piperead+0x71>
80103ee3: 8b 45 08 mov 0x8(%ebp),%eax
80103ee6: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
80103eec: 85 c0 test %eax,%eax
80103eee: 75 a3 jne 80103e93 <piperead+0x14>
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103ef0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103ef7: eb 4b jmp 80103f44 <piperead+0xc5>
if(p->nread == p->nwrite)
80103ef9: 8b 45 08 mov 0x8(%ebp),%eax
80103efc: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
80103f02: 8b 45 08 mov 0x8(%ebp),%eax
80103f05: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
80103f0b: 39 c2 cmp %eax,%edx
80103f0d: 75 02 jne 80103f11 <piperead+0x92>
break;
80103f0f: eb 3b jmp 80103f4c <piperead+0xcd>
addr[i] = p->data[p->nread++ % PIPESIZE];
80103f11: 8b 55 f4 mov -0xc(%ebp),%edx
80103f14: 8b 45 0c mov 0xc(%ebp),%eax
80103f17: 8d 1c 02 lea (%edx,%eax,1),%ebx
80103f1a: 8b 45 08 mov 0x8(%ebp),%eax
80103f1d: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
80103f23: 8d 48 01 lea 0x1(%eax),%ecx
80103f26: 8b 55 08 mov 0x8(%ebp),%edx
80103f29: 89 8a 34 02 00 00 mov %ecx,0x234(%edx)
80103f2f: 25 ff 01 00 00 and $0x1ff,%eax
80103f34: 89 c2 mov %eax,%edx
80103f36: 8b 45 08 mov 0x8(%ebp),%eax
80103f39: 0f b6 44 10 34 movzbl 0x34(%eax,%edx,1),%eax
80103f3e: 88 03 mov %al,(%ebx)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80103f40: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103f44: 8b 45 f4 mov -0xc(%ebp),%eax
80103f47: 3b 45 10 cmp 0x10(%ebp),%eax
80103f4a: 7c ad jl 80103ef9 <piperead+0x7a>
if(p->nread == p->nwrite)
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
80103f4c: 8b 45 08 mov 0x8(%ebp),%eax
80103f4f: 05 38 02 00 00 add $0x238,%eax
80103f54: 89 04 24 mov %eax,(%esp)
80103f57: e8 15 09 00 00 call 80104871 <wakeup>
release(&p->lock);
80103f5c: 8b 45 08 mov 0x8(%ebp),%eax
80103f5f: 89 04 24 mov %eax,(%esp)
80103f62: e8 5d 0b 00 00 call 80104ac4 <release>
return i;
80103f67: 8b 45 f4 mov -0xc(%ebp),%eax
}
80103f6a: 83 c4 24 add $0x24,%esp
80103f6d: 5b pop %ebx
80103f6e: 5d pop %ebp
80103f6f: c3 ret
80103f70 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80103f70: 55 push %ebp
80103f71: 89 e5 mov %esp,%ebp
80103f73: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80103f76: 9c pushf
80103f77: 58 pop %eax
80103f78: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80103f7b: 8b 45 fc mov -0x4(%ebp),%eax
}
80103f7e: c9 leave
80103f7f: c3 ret
80103f80 <sti>:
asm volatile("cli");
}
static inline void
sti(void)
{
80103f80: 55 push %ebp
80103f81: 89 e5 mov %esp,%ebp
asm volatile("sti");
80103f83: fb sti
}
80103f84: 5d pop %ebp
80103f85: c3 ret
80103f86 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
80103f86: 55 push %ebp
80103f87: 89 e5 mov %esp,%ebp
80103f89: 83 ec 18 sub $0x18,%esp
initlock(&ptable.lock, "ptable");
80103f8c: c7 44 24 04 05 85 10 movl $0x80108505,0x4(%esp)
80103f93: 80
80103f94: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80103f9b: e8 a1 0a 00 00 call 80104a41 <initlock>
}
80103fa0: c9 leave
80103fa1: c3 ret
80103fa2 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80103fa2: 55 push %ebp
80103fa3: 89 e5 mov %esp,%ebp
80103fa5: 83 ec 28 sub $0x28,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
80103fa8: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80103faf: e8 ae 0a 00 00 call 80104a62 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80103fb4: c7 45 f4 54 ff 10 80 movl $0x8010ff54,-0xc(%ebp)
80103fbb: eb 50 jmp 8010400d <allocproc+0x6b>
if(p->state == UNUSED)
80103fbd: 8b 45 f4 mov -0xc(%ebp),%eax
80103fc0: 8b 40 0c mov 0xc(%eax),%eax
80103fc3: 85 c0 test %eax,%eax
80103fc5: 75 42 jne 80104009 <allocproc+0x67>
goto found;
80103fc7: 90 nop
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
80103fc8: 8b 45 f4 mov -0xc(%ebp),%eax
80103fcb: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax)
p->pid = nextpid++;
80103fd2: a1 04 b0 10 80 mov 0x8010b004,%eax
80103fd7: 8d 50 01 lea 0x1(%eax),%edx
80103fda: 89 15 04 b0 10 80 mov %edx,0x8010b004
80103fe0: 8b 55 f4 mov -0xc(%ebp),%edx
80103fe3: 89 42 10 mov %eax,0x10(%edx)
release(&ptable.lock);
80103fe6: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80103fed: e8 d2 0a 00 00 call 80104ac4 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
80103ff2: e8 d7 ea ff ff call 80102ace <kalloc>
80103ff7: 8b 55 f4 mov -0xc(%ebp),%edx
80103ffa: 89 42 08 mov %eax,0x8(%edx)
80103ffd: 8b 45 f4 mov -0xc(%ebp),%eax
80104000: 8b 40 08 mov 0x8(%eax),%eax
80104003: 85 c0 test %eax,%eax
80104005: 75 33 jne 8010403a <allocproc+0x98>
80104007: eb 20 jmp 80104029 <allocproc+0x87>
{
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104009: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
8010400d: 81 7d f4 54 1e 11 80 cmpl $0x80111e54,-0xc(%ebp)
80104014: 72 a7 jb 80103fbd <allocproc+0x1b>
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
80104016: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
8010401d: e8 a2 0a 00 00 call 80104ac4 <release>
return 0;
80104022: b8 00 00 00 00 mov $0x0,%eax
80104027: eb 76 jmp 8010409f <allocproc+0xfd>
p->pid = nextpid++;
release(&ptable.lock);
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
p->state = UNUSED;
80104029: 8b 45 f4 mov -0xc(%ebp),%eax
8010402c: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return 0;
80104033: b8 00 00 00 00 mov $0x0,%eax
80104038: eb 65 jmp 8010409f <allocproc+0xfd>
}
sp = p->kstack + KSTACKSIZE;
8010403a: 8b 45 f4 mov -0xc(%ebp),%eax
8010403d: 8b 40 08 mov 0x8(%eax),%eax
80104040: 05 00 10 00 00 add $0x1000,%eax
80104045: 89 45 f0 mov %eax,-0x10(%ebp)
// Leave room for trap frame.
sp -= sizeof *p->tf;
80104048: 83 6d f0 4c subl $0x4c,-0x10(%ebp)
p->tf = (struct trapframe*)sp;
8010404c: 8b 45 f4 mov -0xc(%ebp),%eax
8010404f: 8b 55 f0 mov -0x10(%ebp),%edx
80104052: 89 50 18 mov %edx,0x18(%eax)
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
80104055: 83 6d f0 04 subl $0x4,-0x10(%ebp)
*(uint*)sp = (uint)trapret;
80104059: ba df 62 10 80 mov $0x801062df,%edx
8010405e: 8b 45 f0 mov -0x10(%ebp),%eax
80104061: 89 10 mov %edx,(%eax)
sp -= sizeof *p->context;
80104063: 83 6d f0 14 subl $0x14,-0x10(%ebp)
p->context = (struct context*)sp;
80104067: 8b 45 f4 mov -0xc(%ebp),%eax
8010406a: 8b 55 f0 mov -0x10(%ebp),%edx
8010406d: 89 50 1c mov %edx,0x1c(%eax)
memset(p->context, 0, sizeof *p->context);
80104070: 8b 45 f4 mov -0xc(%ebp),%eax
80104073: 8b 40 1c mov 0x1c(%eax),%eax
80104076: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
8010407d: 00
8010407e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104085: 00
80104086: 89 04 24 mov %eax,(%esp)
80104089: e8 28 0c 00 00 call 80104cb6 <memset>
p->context->eip = (uint)forkret;
8010408e: 8b 45 f4 mov -0xc(%ebp),%eax
80104091: 8b 40 1c mov 0x1c(%eax),%eax
80104094: ba 6c 47 10 80 mov $0x8010476c,%edx
80104099: 89 50 10 mov %edx,0x10(%eax)
return p;
8010409c: 8b 45 f4 mov -0xc(%ebp),%eax
}
8010409f: c9 leave
801040a0: c3 ret
801040a1 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801040a1: 55 push %ebp
801040a2: 89 e5 mov %esp,%ebp
801040a4: 83 ec 28 sub $0x28,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
801040a7: e8 f6 fe ff ff call 80103fa2 <allocproc>
801040ac: 89 45 f4 mov %eax,-0xc(%ebp)
initproc = p;
801040af: 8b 45 f4 mov -0xc(%ebp),%eax
801040b2: a3 48 b6 10 80 mov %eax,0x8010b648
if((p->pgdir = setupkvm()) == 0)
801040b7: e8 17 39 00 00 call 801079d3 <setupkvm>
801040bc: 8b 55 f4 mov -0xc(%ebp),%edx
801040bf: 89 42 04 mov %eax,0x4(%edx)
801040c2: 8b 45 f4 mov -0xc(%ebp),%eax
801040c5: 8b 40 04 mov 0x4(%eax),%eax
801040c8: 85 c0 test %eax,%eax
801040ca: 75 0c jne 801040d8 <userinit+0x37>
panic("userinit: out of memory?");
801040cc: c7 04 24 0c 85 10 80 movl $0x8010850c,(%esp)
801040d3: e8 62 c4 ff ff call 8010053a <panic>
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801040d8: ba 2c 00 00 00 mov $0x2c,%edx
801040dd: 8b 45 f4 mov -0xc(%ebp),%eax
801040e0: 8b 40 04 mov 0x4(%eax),%eax
801040e3: 89 54 24 08 mov %edx,0x8(%esp)
801040e7: c7 44 24 04 e0 b4 10 movl $0x8010b4e0,0x4(%esp)
801040ee: 80
801040ef: 89 04 24 mov %eax,(%esp)
801040f2: e8 34 3b 00 00 call 80107c2b <inituvm>
p->sz = PGSIZE;
801040f7: 8b 45 f4 mov -0xc(%ebp),%eax
801040fa: c7 00 00 10 00 00 movl $0x1000,(%eax)
memset(p->tf, 0, sizeof(*p->tf));
80104100: 8b 45 f4 mov -0xc(%ebp),%eax
80104103: 8b 40 18 mov 0x18(%eax),%eax
80104106: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp)
8010410d: 00
8010410e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104115: 00
80104116: 89 04 24 mov %eax,(%esp)
80104119: e8 98 0b 00 00 call 80104cb6 <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010411e: 8b 45 f4 mov -0xc(%ebp),%eax
80104121: 8b 40 18 mov 0x18(%eax),%eax
80104124: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
8010412a: 8b 45 f4 mov -0xc(%ebp),%eax
8010412d: 8b 40 18 mov 0x18(%eax),%eax
80104130: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax)
p->tf->es = p->tf->ds;
80104136: 8b 45 f4 mov -0xc(%ebp),%eax
80104139: 8b 40 18 mov 0x18(%eax),%eax
8010413c: 8b 55 f4 mov -0xc(%ebp),%edx
8010413f: 8b 52 18 mov 0x18(%edx),%edx
80104142: 0f b7 52 2c movzwl 0x2c(%edx),%edx
80104146: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
8010414a: 8b 45 f4 mov -0xc(%ebp),%eax
8010414d: 8b 40 18 mov 0x18(%eax),%eax
80104150: 8b 55 f4 mov -0xc(%ebp),%edx
80104153: 8b 52 18 mov 0x18(%edx),%edx
80104156: 0f b7 52 2c movzwl 0x2c(%edx),%edx
8010415a: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
8010415e: 8b 45 f4 mov -0xc(%ebp),%eax
80104161: 8b 40 18 mov 0x18(%eax),%eax
80104164: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
8010416b: 8b 45 f4 mov -0xc(%ebp),%eax
8010416e: 8b 40 18 mov 0x18(%eax),%eax
80104171: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
80104178: 8b 45 f4 mov -0xc(%ebp),%eax
8010417b: 8b 40 18 mov 0x18(%eax),%eax
8010417e: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
80104185: 8b 45 f4 mov -0xc(%ebp),%eax
80104188: 83 c0 6c add $0x6c,%eax
8010418b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80104192: 00
80104193: c7 44 24 04 25 85 10 movl $0x80108525,0x4(%esp)
8010419a: 80
8010419b: 89 04 24 mov %eax,(%esp)
8010419e: e8 33 0d 00 00 call 80104ed6 <safestrcpy>
p->cwd = namei("/");
801041a3: c7 04 24 2e 85 10 80 movl $0x8010852e,(%esp)
801041aa: e8 43 e2 ff ff call 801023f2 <namei>
801041af: 8b 55 f4 mov -0xc(%ebp),%edx
801041b2: 89 42 68 mov %eax,0x68(%edx)
p->state = RUNNABLE;
801041b5: 8b 45 f4 mov -0xc(%ebp),%eax
801041b8: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
}
801041bf: c9 leave
801041c0: c3 ret
801041c1 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801041c1: 55 push %ebp
801041c2: 89 e5 mov %esp,%ebp
801041c4: 83 ec 28 sub $0x28,%esp
uint sz;
sz = proc->sz;
801041c7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801041cd: 8b 00 mov (%eax),%eax
801041cf: 89 45 f4 mov %eax,-0xc(%ebp)
if(n > 0){
801041d2: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801041d6: 7e 34 jle 8010420c <growproc+0x4b>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
801041d8: 8b 55 08 mov 0x8(%ebp),%edx
801041db: 8b 45 f4 mov -0xc(%ebp),%eax
801041de: 01 c2 add %eax,%edx
801041e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801041e6: 8b 40 04 mov 0x4(%eax),%eax
801041e9: 89 54 24 08 mov %edx,0x8(%esp)
801041ed: 8b 55 f4 mov -0xc(%ebp),%edx
801041f0: 89 54 24 04 mov %edx,0x4(%esp)
801041f4: 89 04 24 mov %eax,(%esp)
801041f7: e8 a5 3b 00 00 call 80107da1 <allocuvm>
801041fc: 89 45 f4 mov %eax,-0xc(%ebp)
801041ff: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104203: 75 41 jne 80104246 <growproc+0x85>
return -1;
80104205: b8 ff ff ff ff mov $0xffffffff,%eax
8010420a: eb 58 jmp 80104264 <growproc+0xa3>
} else if(n < 0){
8010420c: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80104210: 79 34 jns 80104246 <growproc+0x85>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
80104212: 8b 55 08 mov 0x8(%ebp),%edx
80104215: 8b 45 f4 mov -0xc(%ebp),%eax
80104218: 01 c2 add %eax,%edx
8010421a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104220: 8b 40 04 mov 0x4(%eax),%eax
80104223: 89 54 24 08 mov %edx,0x8(%esp)
80104227: 8b 55 f4 mov -0xc(%ebp),%edx
8010422a: 89 54 24 04 mov %edx,0x4(%esp)
8010422e: 89 04 24 mov %eax,(%esp)
80104231: e8 45 3c 00 00 call 80107e7b <deallocuvm>
80104236: 89 45 f4 mov %eax,-0xc(%ebp)
80104239: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010423d: 75 07 jne 80104246 <growproc+0x85>
return -1;
8010423f: b8 ff ff ff ff mov $0xffffffff,%eax
80104244: eb 1e jmp 80104264 <growproc+0xa3>
}
proc->sz = sz;
80104246: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010424c: 8b 55 f4 mov -0xc(%ebp),%edx
8010424f: 89 10 mov %edx,(%eax)
switchuvm(proc);
80104251: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104257: 89 04 24 mov %eax,(%esp)
8010425a: e8 65 38 00 00 call 80107ac4 <switchuvm>
return 0;
8010425f: b8 00 00 00 00 mov $0x0,%eax
}
80104264: c9 leave
80104265: c3 ret
80104266 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
80104266: 55 push %ebp
80104267: 89 e5 mov %esp,%ebp
80104269: 57 push %edi
8010426a: 56 push %esi
8010426b: 53 push %ebx
8010426c: 83 ec 2c sub $0x2c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0)
8010426f: e8 2e fd ff ff call 80103fa2 <allocproc>
80104274: 89 45 e0 mov %eax,-0x20(%ebp)
80104277: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
8010427b: 75 0a jne 80104287 <fork+0x21>
return -1;
8010427d: b8 ff ff ff ff mov $0xffffffff,%eax
80104282: e9 3a 01 00 00 jmp 801043c1 <fork+0x15b>
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
80104287: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010428d: 8b 10 mov (%eax),%edx
8010428f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104295: 8b 40 04 mov 0x4(%eax),%eax
80104298: 89 54 24 04 mov %edx,0x4(%esp)
8010429c: 89 04 24 mov %eax,(%esp)
8010429f: e8 73 3d 00 00 call 80108017 <copyuvm>
801042a4: 8b 55 e0 mov -0x20(%ebp),%edx
801042a7: 89 42 04 mov %eax,0x4(%edx)
801042aa: 8b 45 e0 mov -0x20(%ebp),%eax
801042ad: 8b 40 04 mov 0x4(%eax),%eax
801042b0: 85 c0 test %eax,%eax
801042b2: 75 2c jne 801042e0 <fork+0x7a>
kfree(np->kstack);
801042b4: 8b 45 e0 mov -0x20(%ebp),%eax
801042b7: 8b 40 08 mov 0x8(%eax),%eax
801042ba: 89 04 24 mov %eax,(%esp)
801042bd: e8 73 e7 ff ff call 80102a35 <kfree>
np->kstack = 0;
801042c2: 8b 45 e0 mov -0x20(%ebp),%eax
801042c5: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
np->state = UNUSED;
801042cc: 8b 45 e0 mov -0x20(%ebp),%eax
801042cf: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return -1;
801042d6: b8 ff ff ff ff mov $0xffffffff,%eax
801042db: e9 e1 00 00 00 jmp 801043c1 <fork+0x15b>
}
np->sz = proc->sz;
801042e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801042e6: 8b 10 mov (%eax),%edx
801042e8: 8b 45 e0 mov -0x20(%ebp),%eax
801042eb: 89 10 mov %edx,(%eax)
np->parent = proc;
801042ed: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801042f4: 8b 45 e0 mov -0x20(%ebp),%eax
801042f7: 89 50 14 mov %edx,0x14(%eax)
*np->tf = *proc->tf;
801042fa: 8b 45 e0 mov -0x20(%ebp),%eax
801042fd: 8b 50 18 mov 0x18(%eax),%edx
80104300: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104306: 8b 40 18 mov 0x18(%eax),%eax
80104309: 89 c3 mov %eax,%ebx
8010430b: b8 13 00 00 00 mov $0x13,%eax
80104310: 89 d7 mov %edx,%edi
80104312: 89 de mov %ebx,%esi
80104314: 89 c1 mov %eax,%ecx
80104316: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
80104318: 8b 45 e0 mov -0x20(%ebp),%eax
8010431b: 8b 40 18 mov 0x18(%eax),%eax
8010431e: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
80104325: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
8010432c: eb 3d jmp 8010436b <fork+0x105>
if(proc->ofile[i])
8010432e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104334: 8b 55 e4 mov -0x1c(%ebp),%edx
80104337: 83 c2 08 add $0x8,%edx
8010433a: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
8010433e: 85 c0 test %eax,%eax
80104340: 74 25 je 80104367 <fork+0x101>
np->ofile[i] = filedup(proc->ofile[i]);
80104342: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104348: 8b 55 e4 mov -0x1c(%ebp),%edx
8010434b: 83 c2 08 add $0x8,%edx
8010434e: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104352: 89 04 24 mov %eax,(%esp)
80104355: e8 18 cc ff ff call 80100f72 <filedup>
8010435a: 8b 55 e0 mov -0x20(%ebp),%edx
8010435d: 8b 4d e4 mov -0x1c(%ebp),%ecx
80104360: 83 c1 08 add $0x8,%ecx
80104363: 89 44 8a 08 mov %eax,0x8(%edx,%ecx,4)
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80104367: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
8010436b: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp)
8010436f: 7e bd jle 8010432e <fork+0xc8>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
80104371: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104377: 8b 40 68 mov 0x68(%eax),%eax
8010437a: 89 04 24 mov %eax,(%esp)
8010437d: e8 93 d4 ff ff call 80101815 <idup>
80104382: 8b 55 e0 mov -0x20(%ebp),%edx
80104385: 89 42 68 mov %eax,0x68(%edx)
pid = np->pid;
80104388: 8b 45 e0 mov -0x20(%ebp),%eax
8010438b: 8b 40 10 mov 0x10(%eax),%eax
8010438e: 89 45 dc mov %eax,-0x24(%ebp)
np->state = RUNNABLE;
80104391: 8b 45 e0 mov -0x20(%ebp),%eax
80104394: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
safestrcpy(np->name, proc->name, sizeof(proc->name));
8010439b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801043a1: 8d 50 6c lea 0x6c(%eax),%edx
801043a4: 8b 45 e0 mov -0x20(%ebp),%eax
801043a7: 83 c0 6c add $0x6c,%eax
801043aa: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
801043b1: 00
801043b2: 89 54 24 04 mov %edx,0x4(%esp)
801043b6: 89 04 24 mov %eax,(%esp)
801043b9: e8 18 0b 00 00 call 80104ed6 <safestrcpy>
return pid;
801043be: 8b 45 dc mov -0x24(%ebp),%eax
}
801043c1: 83 c4 2c add $0x2c,%esp
801043c4: 5b pop %ebx
801043c5: 5e pop %esi
801043c6: 5f pop %edi
801043c7: 5d pop %ebp
801043c8: c3 ret
801043c9 <exit>:
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
801043c9: 55 push %ebp
801043ca: 89 e5 mov %esp,%ebp
801043cc: 83 ec 28 sub $0x28,%esp
struct proc *p;
int fd;
if(proc == initproc)
801043cf: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801043d6: a1 48 b6 10 80 mov 0x8010b648,%eax
801043db: 39 c2 cmp %eax,%edx
801043dd: 75 0c jne 801043eb <exit+0x22>
panic("init exiting");
801043df: c7 04 24 30 85 10 80 movl $0x80108530,(%esp)
801043e6: e8 4f c1 ff ff call 8010053a <panic>
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
801043eb: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
801043f2: eb 44 jmp 80104438 <exit+0x6f>
if(proc->ofile[fd]){
801043f4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801043fa: 8b 55 f0 mov -0x10(%ebp),%edx
801043fd: 83 c2 08 add $0x8,%edx
80104400: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104404: 85 c0 test %eax,%eax
80104406: 74 2c je 80104434 <exit+0x6b>
fileclose(proc->ofile[fd]);
80104408: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010440e: 8b 55 f0 mov -0x10(%ebp),%edx
80104411: 83 c2 08 add $0x8,%edx
80104414: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104418: 89 04 24 mov %eax,(%esp)
8010441b: e8 9a cb ff ff call 80100fba <fileclose>
proc->ofile[fd] = 0;
80104420: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104426: 8b 55 f0 mov -0x10(%ebp),%edx
80104429: 83 c2 08 add $0x8,%edx
8010442c: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80104433: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80104434: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80104438: 83 7d f0 0f cmpl $0xf,-0x10(%ebp)
8010443c: 7e b6 jle 801043f4 <exit+0x2b>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
iput(proc->cwd);
8010443e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104444: 8b 40 68 mov 0x68(%eax),%eax
80104447: 89 04 24 mov %eax,(%esp)
8010444a: e8 ab d5 ff ff call 801019fa <iput>
proc->cwd = 0;
8010444f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104455: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
8010445c: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104463: e8 fa 05 00 00 call 80104a62 <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80104468: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010446e: 8b 40 14 mov 0x14(%eax),%eax
80104471: 89 04 24 mov %eax,(%esp)
80104474: e8 ba 03 00 00 call 80104833 <wakeup1>
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104479: c7 45 f4 54 ff 10 80 movl $0x8010ff54,-0xc(%ebp)
80104480: eb 38 jmp 801044ba <exit+0xf1>
if(p->parent == proc){
80104482: 8b 45 f4 mov -0xc(%ebp),%eax
80104485: 8b 50 14 mov 0x14(%eax),%edx
80104488: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010448e: 39 c2 cmp %eax,%edx
80104490: 75 24 jne 801044b6 <exit+0xed>
p->parent = initproc;
80104492: 8b 15 48 b6 10 80 mov 0x8010b648,%edx
80104498: 8b 45 f4 mov -0xc(%ebp),%eax
8010449b: 89 50 14 mov %edx,0x14(%eax)
if(p->state == ZOMBIE)
8010449e: 8b 45 f4 mov -0xc(%ebp),%eax
801044a1: 8b 40 0c mov 0xc(%eax),%eax
801044a4: 83 f8 05 cmp $0x5,%eax
801044a7: 75 0d jne 801044b6 <exit+0xed>
wakeup1(initproc);
801044a9: a1 48 b6 10 80 mov 0x8010b648,%eax
801044ae: 89 04 24 mov %eax,(%esp)
801044b1: e8 7d 03 00 00 call 80104833 <wakeup1>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801044b6: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
801044ba: 81 7d f4 54 1e 11 80 cmpl $0x80111e54,-0xc(%ebp)
801044c1: 72 bf jb 80104482 <exit+0xb9>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
801044c3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801044c9: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax)
sched();
801044d0: e8 b3 01 00 00 call 80104688 <sched>
panic("zombie exit");
801044d5: c7 04 24 3d 85 10 80 movl $0x8010853d,(%esp)
801044dc: e8 59 c0 ff ff call 8010053a <panic>
801044e1 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
801044e1: 55 push %ebp
801044e2: 89 e5 mov %esp,%ebp
801044e4: 83 ec 28 sub $0x28,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
801044e7: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
801044ee: e8 6f 05 00 00 call 80104a62 <acquire>
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
801044f3: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801044fa: c7 45 f4 54 ff 10 80 movl $0x8010ff54,-0xc(%ebp)
80104501: e9 9a 00 00 00 jmp 801045a0 <wait+0xbf>
if(p->parent != proc)
80104506: 8b 45 f4 mov -0xc(%ebp),%eax
80104509: 8b 50 14 mov 0x14(%eax),%edx
8010450c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104512: 39 c2 cmp %eax,%edx
80104514: 74 05 je 8010451b <wait+0x3a>
continue;
80104516: e9 81 00 00 00 jmp 8010459c <wait+0xbb>
havekids = 1;
8010451b: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
if(p->state == ZOMBIE){
80104522: 8b 45 f4 mov -0xc(%ebp),%eax
80104525: 8b 40 0c mov 0xc(%eax),%eax
80104528: 83 f8 05 cmp $0x5,%eax
8010452b: 75 6f jne 8010459c <wait+0xbb>
// Found one.
pid = p->pid;
8010452d: 8b 45 f4 mov -0xc(%ebp),%eax
80104530: 8b 40 10 mov 0x10(%eax),%eax
80104533: 89 45 ec mov %eax,-0x14(%ebp)
kfree(p->kstack);
80104536: 8b 45 f4 mov -0xc(%ebp),%eax
80104539: 8b 40 08 mov 0x8(%eax),%eax
8010453c: 89 04 24 mov %eax,(%esp)
8010453f: e8 f1 e4 ff ff call 80102a35 <kfree>
p->kstack = 0;
80104544: 8b 45 f4 mov -0xc(%ebp),%eax
80104547: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
freevm(p->pgdir);
8010454e: 8b 45 f4 mov -0xc(%ebp),%eax
80104551: 8b 40 04 mov 0x4(%eax),%eax
80104554: 89 04 24 mov %eax,(%esp)
80104557: e8 db 39 00 00 call 80107f37 <freevm>
p->state = UNUSED;
8010455c: 8b 45 f4 mov -0xc(%ebp),%eax
8010455f: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
p->pid = 0;
80104566: 8b 45 f4 mov -0xc(%ebp),%eax
80104569: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
p->parent = 0;
80104570: 8b 45 f4 mov -0xc(%ebp),%eax
80104573: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
p->name[0] = 0;
8010457a: 8b 45 f4 mov -0xc(%ebp),%eax
8010457d: c6 40 6c 00 movb $0x0,0x6c(%eax)
p->killed = 0;
80104581: 8b 45 f4 mov -0xc(%ebp),%eax
80104584: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax)
release(&ptable.lock);
8010458b: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104592: e8 2d 05 00 00 call 80104ac4 <release>
return pid;
80104597: 8b 45 ec mov -0x14(%ebp),%eax
8010459a: eb 52 jmp 801045ee <wait+0x10d>
acquire(&ptable.lock);
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010459c: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
801045a0: 81 7d f4 54 1e 11 80 cmpl $0x80111e54,-0xc(%ebp)
801045a7: 0f 82 59 ff ff ff jb 80104506 <wait+0x25>
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
801045ad: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801045b1: 74 0d je 801045c0 <wait+0xdf>
801045b3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045b9: 8b 40 24 mov 0x24(%eax),%eax
801045bc: 85 c0 test %eax,%eax
801045be: 74 13 je 801045d3 <wait+0xf2>
release(&ptable.lock);
801045c0: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
801045c7: e8 f8 04 00 00 call 80104ac4 <release>
return -1;
801045cc: b8 ff ff ff ff mov $0xffffffff,%eax
801045d1: eb 1b jmp 801045ee <wait+0x10d>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
801045d3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045d9: c7 44 24 04 20 ff 10 movl $0x8010ff20,0x4(%esp)
801045e0: 80
801045e1: 89 04 24 mov %eax,(%esp)
801045e4: e8 af 01 00 00 call 80104798 <sleep>
}
801045e9: e9 05 ff ff ff jmp 801044f3 <wait+0x12>
}
801045ee: c9 leave
801045ef: c3 ret
801045f0 <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
801045f0: 55 push %ebp
801045f1: 89 e5 mov %esp,%ebp
801045f3: 83 ec 28 sub $0x28,%esp
struct proc *p;
for(;;){
// Enable interrupts on this processor.
sti();
801045f6: e8 85 f9 ff ff call 80103f80 <sti>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
801045fb: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104602: e8 5b 04 00 00 call 80104a62 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104607: c7 45 f4 54 ff 10 80 movl $0x8010ff54,-0xc(%ebp)
8010460e: eb 5e jmp 8010466e <scheduler+0x7e>
if(p->state != RUNNABLE)
80104610: 8b 45 f4 mov -0xc(%ebp),%eax
80104613: 8b 40 0c mov 0xc(%eax),%eax
80104616: 83 f8 03 cmp $0x3,%eax
80104619: 74 02 je 8010461d <scheduler+0x2d>
continue;
8010461b: eb 4d jmp 8010466a <scheduler+0x7a>
// Switch to chosen process. It is the process's job
// to release ptable.lock and then reacquire it
// before jumping back to us.
proc = p;
8010461d: 8b 45 f4 mov -0xc(%ebp),%eax
80104620: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
80104626: 8b 45 f4 mov -0xc(%ebp),%eax
80104629: 89 04 24 mov %eax,(%esp)
8010462c: e8 93 34 00 00 call 80107ac4 <switchuvm>
p->state = RUNNING;
80104631: 8b 45 f4 mov -0xc(%ebp),%eax
80104634: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
swtch(&cpu->scheduler, proc->context);
8010463b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104641: 8b 40 1c mov 0x1c(%eax),%eax
80104644: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
8010464b: 83 c2 04 add $0x4,%edx
8010464e: 89 44 24 04 mov %eax,0x4(%esp)
80104652: 89 14 24 mov %edx,(%esp)
80104655: e8 ed 08 00 00 call 80104f47 <swtch>
switchkvm();
8010465a: e8 48 34 00 00 call 80107aa7 <switchkvm>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
8010465f: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80104666: 00 00 00 00
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010466a: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
8010466e: 81 7d f4 54 1e 11 80 cmpl $0x80111e54,-0xc(%ebp)
80104675: 72 99 jb 80104610 <scheduler+0x20>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
}
release(&ptable.lock);
80104677: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
8010467e: e8 41 04 00 00 call 80104ac4 <release>
}
80104683: e9 6e ff ff ff jmp 801045f6 <scheduler+0x6>
80104688 <sched>:
// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
80104688: 55 push %ebp
80104689: 89 e5 mov %esp,%ebp
8010468b: 83 ec 28 sub $0x28,%esp
int intena;
if(!holding(&ptable.lock))
8010468e: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104695: e8 f2 04 00 00 call 80104b8c <holding>
8010469a: 85 c0 test %eax,%eax
8010469c: 75 0c jne 801046aa <sched+0x22>
panic("sched ptable.lock");
8010469e: c7 04 24 49 85 10 80 movl $0x80108549,(%esp)
801046a5: e8 90 be ff ff call 8010053a <panic>
if(cpu->ncli != 1)
801046aa: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801046b0: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
801046b6: 83 f8 01 cmp $0x1,%eax
801046b9: 74 0c je 801046c7 <sched+0x3f>
panic("sched locks");
801046bb: c7 04 24 5b 85 10 80 movl $0x8010855b,(%esp)
801046c2: e8 73 be ff ff call 8010053a <panic>
if(proc->state == RUNNING)
801046c7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046cd: 8b 40 0c mov 0xc(%eax),%eax
801046d0: 83 f8 04 cmp $0x4,%eax
801046d3: 75 0c jne 801046e1 <sched+0x59>
panic("sched running");
801046d5: c7 04 24 67 85 10 80 movl $0x80108567,(%esp)
801046dc: e8 59 be ff ff call 8010053a <panic>
if(readeflags()&FL_IF)
801046e1: e8 8a f8 ff ff call 80103f70 <readeflags>
801046e6: 25 00 02 00 00 and $0x200,%eax
801046eb: 85 c0 test %eax,%eax
801046ed: 74 0c je 801046fb <sched+0x73>
panic("sched interruptible");
801046ef: c7 04 24 75 85 10 80 movl $0x80108575,(%esp)
801046f6: e8 3f be ff ff call 8010053a <panic>
intena = cpu->intena;
801046fb: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104701: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80104707: 89 45 f4 mov %eax,-0xc(%ebp)
swtch(&proc->context, cpu->scheduler);
8010470a: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104710: 8b 40 04 mov 0x4(%eax),%eax
80104713: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010471a: 83 c2 1c add $0x1c,%edx
8010471d: 89 44 24 04 mov %eax,0x4(%esp)
80104721: 89 14 24 mov %edx,(%esp)
80104724: e8 1e 08 00 00 call 80104f47 <swtch>
cpu->intena = intena;
80104729: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010472f: 8b 55 f4 mov -0xc(%ebp),%edx
80104732: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
80104738: c9 leave
80104739: c3 ret
8010473a <yield>:
// Give up the CPU for one scheduling round.
void
yield(void)
{
8010473a: 55 push %ebp
8010473b: 89 e5 mov %esp,%ebp
8010473d: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock); //DOC: yieldlock
80104740: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104747: e8 16 03 00 00 call 80104a62 <acquire>
proc->state = RUNNABLE;
8010474c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104752: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
80104759: e8 2a ff ff ff call 80104688 <sched>
release(&ptable.lock);
8010475e: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104765: e8 5a 03 00 00 call 80104ac4 <release>
}
8010476a: c9 leave
8010476b: c3 ret
8010476c <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
8010476c: 55 push %ebp
8010476d: 89 e5 mov %esp,%ebp
8010476f: 83 ec 18 sub $0x18,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80104772: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104779: e8 46 03 00 00 call 80104ac4 <release>
if (first) {
8010477e: a1 08 b0 10 80 mov 0x8010b008,%eax
80104783: 85 c0 test %eax,%eax
80104785: 74 0f je 80104796 <forkret+0x2a>
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80104787: c7 05 08 b0 10 80 00 movl $0x0,0x8010b008
8010478e: 00 00 00
initlog();
80104791: e8 2d e8 ff ff call 80102fc3 <initlog>
}
// Return to "caller", actually trapret (see allocproc).
}
80104796: c9 leave
80104797: c3 ret
80104798 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80104798: 55 push %ebp
80104799: 89 e5 mov %esp,%ebp
8010479b: 83 ec 18 sub $0x18,%esp
if(proc == 0)
8010479e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047a4: 85 c0 test %eax,%eax
801047a6: 75 0c jne 801047b4 <sleep+0x1c>
panic("sleep");
801047a8: c7 04 24 89 85 10 80 movl $0x80108589,(%esp)
801047af: e8 86 bd ff ff call 8010053a <panic>
if(lk == 0)
801047b4: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801047b8: 75 0c jne 801047c6 <sleep+0x2e>
panic("sleep without lk");
801047ba: c7 04 24 8f 85 10 80 movl $0x8010858f,(%esp)
801047c1: e8 74 bd ff ff call 8010053a <panic>
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if(lk != &ptable.lock){ //DOC: sleeplock0
801047c6: 81 7d 0c 20 ff 10 80 cmpl $0x8010ff20,0xc(%ebp)
801047cd: 74 17 je 801047e6 <sleep+0x4e>
acquire(&ptable.lock); //DOC: sleeplock1
801047cf: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
801047d6: e8 87 02 00 00 call 80104a62 <acquire>
release(lk);
801047db: 8b 45 0c mov 0xc(%ebp),%eax
801047de: 89 04 24 mov %eax,(%esp)
801047e1: e8 de 02 00 00 call 80104ac4 <release>
}
// Go to sleep.
proc->chan = chan;
801047e6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047ec: 8b 55 08 mov 0x8(%ebp),%edx
801047ef: 89 50 20 mov %edx,0x20(%eax)
proc->state = SLEEPING;
801047f2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047f8: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
801047ff: e8 84 fe ff ff call 80104688 <sched>
// Tidy up.
proc->chan = 0;
80104804: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010480a: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
80104811: 81 7d 0c 20 ff 10 80 cmpl $0x8010ff20,0xc(%ebp)
80104818: 74 17 je 80104831 <sleep+0x99>
release(&ptable.lock);
8010481a: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104821: e8 9e 02 00 00 call 80104ac4 <release>
acquire(lk);
80104826: 8b 45 0c mov 0xc(%ebp),%eax
80104829: 89 04 24 mov %eax,(%esp)
8010482c: e8 31 02 00 00 call 80104a62 <acquire>
}
}
80104831: c9 leave
80104832: c3 ret
80104833 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
80104833: 55 push %ebp
80104834: 89 e5 mov %esp,%ebp
80104836: 83 ec 10 sub $0x10,%esp
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104839: c7 45 fc 54 ff 10 80 movl $0x8010ff54,-0x4(%ebp)
80104840: eb 24 jmp 80104866 <wakeup1+0x33>
if(p->state == SLEEPING && p->chan == chan)
80104842: 8b 45 fc mov -0x4(%ebp),%eax
80104845: 8b 40 0c mov 0xc(%eax),%eax
80104848: 83 f8 02 cmp $0x2,%eax
8010484b: 75 15 jne 80104862 <wakeup1+0x2f>
8010484d: 8b 45 fc mov -0x4(%ebp),%eax
80104850: 8b 40 20 mov 0x20(%eax),%eax
80104853: 3b 45 08 cmp 0x8(%ebp),%eax
80104856: 75 0a jne 80104862 <wakeup1+0x2f>
p->state = RUNNABLE;
80104858: 8b 45 fc mov -0x4(%ebp),%eax
8010485b: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104862: 83 45 fc 7c addl $0x7c,-0x4(%ebp)
80104866: 81 7d fc 54 1e 11 80 cmpl $0x80111e54,-0x4(%ebp)
8010486d: 72 d3 jb 80104842 <wakeup1+0xf>
if(p->state == SLEEPING && p->chan == chan)
p->state = RUNNABLE;
}
8010486f: c9 leave
80104870: c3 ret
80104871 <wakeup>:
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80104871: 55 push %ebp
80104872: 89 e5 mov %esp,%ebp
80104874: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock);
80104877: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
8010487e: e8 df 01 00 00 call 80104a62 <acquire>
wakeup1(chan);
80104883: 8b 45 08 mov 0x8(%ebp),%eax
80104886: 89 04 24 mov %eax,(%esp)
80104889: e8 a5 ff ff ff call 80104833 <wakeup1>
release(&ptable.lock);
8010488e: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104895: e8 2a 02 00 00 call 80104ac4 <release>
}
8010489a: c9 leave
8010489b: c3 ret
8010489c <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
8010489c: 55 push %ebp
8010489d: 89 e5 mov %esp,%ebp
8010489f: 83 ec 28 sub $0x28,%esp
struct proc *p;
acquire(&ptable.lock);
801048a2: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
801048a9: e8 b4 01 00 00 call 80104a62 <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801048ae: c7 45 f4 54 ff 10 80 movl $0x8010ff54,-0xc(%ebp)
801048b5: eb 41 jmp 801048f8 <kill+0x5c>
if(p->pid == pid){
801048b7: 8b 45 f4 mov -0xc(%ebp),%eax
801048ba: 8b 40 10 mov 0x10(%eax),%eax
801048bd: 3b 45 08 cmp 0x8(%ebp),%eax
801048c0: 75 32 jne 801048f4 <kill+0x58>
p->killed = 1;
801048c2: 8b 45 f4 mov -0xc(%ebp),%eax
801048c5: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
801048cc: 8b 45 f4 mov -0xc(%ebp),%eax
801048cf: 8b 40 0c mov 0xc(%eax),%eax
801048d2: 83 f8 02 cmp $0x2,%eax
801048d5: 75 0a jne 801048e1 <kill+0x45>
p->state = RUNNABLE;
801048d7: 8b 45 f4 mov -0xc(%ebp),%eax
801048da: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
801048e1: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
801048e8: e8 d7 01 00 00 call 80104ac4 <release>
return 0;
801048ed: b8 00 00 00 00 mov $0x0,%eax
801048f2: eb 1e jmp 80104912 <kill+0x76>
kill(int pid)
{
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801048f4: 83 45 f4 7c addl $0x7c,-0xc(%ebp)
801048f8: 81 7d f4 54 1e 11 80 cmpl $0x80111e54,-0xc(%ebp)
801048ff: 72 b6 jb 801048b7 <kill+0x1b>
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80104901: c7 04 24 20 ff 10 80 movl $0x8010ff20,(%esp)
80104908: e8 b7 01 00 00 call 80104ac4 <release>
return -1;
8010490d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104912: c9 leave
80104913: c3 ret
80104914 <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
80104914: 55 push %ebp
80104915: 89 e5 mov %esp,%ebp
80104917: 83 ec 58 sub $0x58,%esp
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010491a: c7 45 f0 54 ff 10 80 movl $0x8010ff54,-0x10(%ebp)
80104921: e9 d6 00 00 00 jmp 801049fc <procdump+0xe8>
if(p->state == UNUSED)
80104926: 8b 45 f0 mov -0x10(%ebp),%eax
80104929: 8b 40 0c mov 0xc(%eax),%eax
8010492c: 85 c0 test %eax,%eax
8010492e: 75 05 jne 80104935 <procdump+0x21>
continue;
80104930: e9 c3 00 00 00 jmp 801049f8 <procdump+0xe4>
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80104935: 8b 45 f0 mov -0x10(%ebp),%eax
80104938: 8b 40 0c mov 0xc(%eax),%eax
8010493b: 83 f8 05 cmp $0x5,%eax
8010493e: 77 23 ja 80104963 <procdump+0x4f>
80104940: 8b 45 f0 mov -0x10(%ebp),%eax
80104943: 8b 40 0c mov 0xc(%eax),%eax
80104946: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax
8010494d: 85 c0 test %eax,%eax
8010494f: 74 12 je 80104963 <procdump+0x4f>
state = states[p->state];
80104951: 8b 45 f0 mov -0x10(%ebp),%eax
80104954: 8b 40 0c mov 0xc(%eax),%eax
80104957: 8b 04 85 0c b0 10 80 mov -0x7fef4ff4(,%eax,4),%eax
8010495e: 89 45 ec mov %eax,-0x14(%ebp)
80104961: eb 07 jmp 8010496a <procdump+0x56>
else
state = "???";
80104963: c7 45 ec a0 85 10 80 movl $0x801085a0,-0x14(%ebp)
cprintf("%d %s %s", p->pid, state, p->name);
8010496a: 8b 45 f0 mov -0x10(%ebp),%eax
8010496d: 8d 50 6c lea 0x6c(%eax),%edx
80104970: 8b 45 f0 mov -0x10(%ebp),%eax
80104973: 8b 40 10 mov 0x10(%eax),%eax
80104976: 89 54 24 0c mov %edx,0xc(%esp)
8010497a: 8b 55 ec mov -0x14(%ebp),%edx
8010497d: 89 54 24 08 mov %edx,0x8(%esp)
80104981: 89 44 24 04 mov %eax,0x4(%esp)
80104985: c7 04 24 a4 85 10 80 movl $0x801085a4,(%esp)
8010498c: e8 0f ba ff ff call 801003a0 <cprintf>
if(p->state == SLEEPING){
80104991: 8b 45 f0 mov -0x10(%ebp),%eax
80104994: 8b 40 0c mov 0xc(%eax),%eax
80104997: 83 f8 02 cmp $0x2,%eax
8010499a: 75 50 jne 801049ec <procdump+0xd8>
getcallerpcs((uint*)p->context->ebp+2, pc);
8010499c: 8b 45 f0 mov -0x10(%ebp),%eax
8010499f: 8b 40 1c mov 0x1c(%eax),%eax
801049a2: 8b 40 0c mov 0xc(%eax),%eax
801049a5: 83 c0 08 add $0x8,%eax
801049a8: 8d 55 c4 lea -0x3c(%ebp),%edx
801049ab: 89 54 24 04 mov %edx,0x4(%esp)
801049af: 89 04 24 mov %eax,(%esp)
801049b2: e8 5c 01 00 00 call 80104b13 <getcallerpcs>
for(i=0; i<10 && pc[i] != 0; i++)
801049b7: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801049be: eb 1b jmp 801049db <procdump+0xc7>
cprintf(" %p", pc[i]);
801049c0: 8b 45 f4 mov -0xc(%ebp),%eax
801049c3: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
801049c7: 89 44 24 04 mov %eax,0x4(%esp)
801049cb: c7 04 24 ad 85 10 80 movl $0x801085ad,(%esp)
801049d2: e8 c9 b9 ff ff call 801003a0 <cprintf>
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
801049d7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801049db: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801049df: 7f 0b jg 801049ec <procdump+0xd8>
801049e1: 8b 45 f4 mov -0xc(%ebp),%eax
801049e4: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
801049e8: 85 c0 test %eax,%eax
801049ea: 75 d4 jne 801049c0 <procdump+0xac>
cprintf(" %p", pc[i]);
}
cprintf("\n");
801049ec: c7 04 24 b1 85 10 80 movl $0x801085b1,(%esp)
801049f3: e8 a8 b9 ff ff call 801003a0 <cprintf>
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801049f8: 83 45 f0 7c addl $0x7c,-0x10(%ebp)
801049fc: 81 7d f0 54 1e 11 80 cmpl $0x80111e54,-0x10(%ebp)
80104a03: 0f 82 1d ff ff ff jb 80104926 <procdump+0x12>
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
80104a09: c9 leave
80104a0a: c3 ret
80104a0b <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80104a0b: 55 push %ebp
80104a0c: 89 e5 mov %esp,%ebp
80104a0e: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104a11: 9c pushf
80104a12: 58 pop %eax
80104a13: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80104a16: 8b 45 fc mov -0x4(%ebp),%eax
}
80104a19: c9 leave
80104a1a: c3 ret
80104a1b <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
80104a1b: 55 push %ebp
80104a1c: 89 e5 mov %esp,%ebp
asm volatile("cli");
80104a1e: fa cli
}
80104a1f: 5d pop %ebp
80104a20: c3 ret
80104a21 <sti>:
static inline void
sti(void)
{
80104a21: 55 push %ebp
80104a22: 89 e5 mov %esp,%ebp
asm volatile("sti");
80104a24: fb sti
}
80104a25: 5d pop %ebp
80104a26: c3 ret
80104a27 <xchg>:
static inline uint
xchg(volatile uint *addr, uint newval)
{
80104a27: 55 push %ebp
80104a28: 89 e5 mov %esp,%ebp
80104a2a: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80104a2d: 8b 55 08 mov 0x8(%ebp),%edx
80104a30: 8b 45 0c mov 0xc(%ebp),%eax
80104a33: 8b 4d 08 mov 0x8(%ebp),%ecx
80104a36: f0 87 02 lock xchg %eax,(%edx)
80104a39: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
80104a3c: 8b 45 fc mov -0x4(%ebp),%eax
}
80104a3f: c9 leave
80104a40: c3 ret
80104a41 <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
80104a41: 55 push %ebp
80104a42: 89 e5 mov %esp,%ebp
lk->name = name;
80104a44: 8b 45 08 mov 0x8(%ebp),%eax
80104a47: 8b 55 0c mov 0xc(%ebp),%edx
80104a4a: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
80104a4d: 8b 45 08 mov 0x8(%ebp),%eax
80104a50: c7 00 00 00 00 00 movl $0x0,(%eax)
lk->cpu = 0;
80104a56: 8b 45 08 mov 0x8(%ebp),%eax
80104a59: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
80104a60: 5d pop %ebp
80104a61: c3 ret
80104a62 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
80104a62: 55 push %ebp
80104a63: 89 e5 mov %esp,%ebp
80104a65: 83 ec 18 sub $0x18,%esp
pushcli(); // disable interrupts to avoid deadlock.
80104a68: e8 49 01 00 00 call 80104bb6 <pushcli>
if(holding(lk))
80104a6d: 8b 45 08 mov 0x8(%ebp),%eax
80104a70: 89 04 24 mov %eax,(%esp)
80104a73: e8 14 01 00 00 call 80104b8c <holding>
80104a78: 85 c0 test %eax,%eax
80104a7a: 74 0c je 80104a88 <acquire+0x26>
panic("acquire");
80104a7c: c7 04 24 dd 85 10 80 movl $0x801085dd,(%esp)
80104a83: e8 b2 ba ff ff call 8010053a <panic>
// The xchg is atomic.
// It also serializes, so that reads after acquire are not
// reordered before it.
while(xchg(&lk->locked, 1) != 0)
80104a88: 90 nop
80104a89: 8b 45 08 mov 0x8(%ebp),%eax
80104a8c: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80104a93: 00
80104a94: 89 04 24 mov %eax,(%esp)
80104a97: e8 8b ff ff ff call 80104a27 <xchg>
80104a9c: 85 c0 test %eax,%eax
80104a9e: 75 e9 jne 80104a89 <acquire+0x27>
;
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
80104aa0: 8b 45 08 mov 0x8(%ebp),%eax
80104aa3: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104aaa: 89 50 08 mov %edx,0x8(%eax)
getcallerpcs(&lk, lk->pcs);
80104aad: 8b 45 08 mov 0x8(%ebp),%eax
80104ab0: 83 c0 0c add $0xc,%eax
80104ab3: 89 44 24 04 mov %eax,0x4(%esp)
80104ab7: 8d 45 08 lea 0x8(%ebp),%eax
80104aba: 89 04 24 mov %eax,(%esp)
80104abd: e8 51 00 00 00 call 80104b13 <getcallerpcs>
}
80104ac2: c9 leave
80104ac3: c3 ret
80104ac4 <release>:
// Release the lock.
void
release(struct spinlock *lk)
{
80104ac4: 55 push %ebp
80104ac5: 89 e5 mov %esp,%ebp
80104ac7: 83 ec 18 sub $0x18,%esp
if(!holding(lk))
80104aca: 8b 45 08 mov 0x8(%ebp),%eax
80104acd: 89 04 24 mov %eax,(%esp)
80104ad0: e8 b7 00 00 00 call 80104b8c <holding>
80104ad5: 85 c0 test %eax,%eax
80104ad7: 75 0c jne 80104ae5 <release+0x21>
panic("release");
80104ad9: c7 04 24 e5 85 10 80 movl $0x801085e5,(%esp)
80104ae0: e8 55 ba ff ff call 8010053a <panic>
lk->pcs[0] = 0;
80104ae5: 8b 45 08 mov 0x8(%ebp),%eax
80104ae8: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
80104aef: 8b 45 08 mov 0x8(%ebp),%eax
80104af2: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
// But the 2007 Intel 64 Architecture Memory Ordering White
// Paper says that Intel 64 and IA-32 will not move a load
// after a store. So lock->locked = 0 would work here.
// The xchg being asm volatile ensures gcc emits it after
// the above assignments (and after the critical section).
xchg(&lk->locked, 0);
80104af9: 8b 45 08 mov 0x8(%ebp),%eax
80104afc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80104b03: 00
80104b04: 89 04 24 mov %eax,(%esp)
80104b07: e8 1b ff ff ff call 80104a27 <xchg>
popcli();
80104b0c: e8 e9 00 00 00 call 80104bfa <popcli>
}
80104b11: c9 leave
80104b12: c3 ret
80104b13 <getcallerpcs>:
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
80104b13: 55 push %ebp
80104b14: 89 e5 mov %esp,%ebp
80104b16: 83 ec 10 sub $0x10,%esp
uint *ebp;
int i;
ebp = (uint*)v - 2;
80104b19: 8b 45 08 mov 0x8(%ebp),%eax
80104b1c: 83 e8 08 sub $0x8,%eax
80104b1f: 89 45 fc mov %eax,-0x4(%ebp)
for(i = 0; i < 10; i++){
80104b22: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
80104b29: eb 38 jmp 80104b63 <getcallerpcs+0x50>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
80104b2b: 83 7d fc 00 cmpl $0x0,-0x4(%ebp)
80104b2f: 74 38 je 80104b69 <getcallerpcs+0x56>
80104b31: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp)
80104b38: 76 2f jbe 80104b69 <getcallerpcs+0x56>
80104b3a: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
80104b3e: 74 29 je 80104b69 <getcallerpcs+0x56>
break;
pcs[i] = ebp[1]; // saved %eip
80104b40: 8b 45 f8 mov -0x8(%ebp),%eax
80104b43: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80104b4a: 8b 45 0c mov 0xc(%ebp),%eax
80104b4d: 01 c2 add %eax,%edx
80104b4f: 8b 45 fc mov -0x4(%ebp),%eax
80104b52: 8b 40 04 mov 0x4(%eax),%eax
80104b55: 89 02 mov %eax,(%edx)
ebp = (uint*)ebp[0]; // saved %ebp
80104b57: 8b 45 fc mov -0x4(%ebp),%eax
80104b5a: 8b 00 mov (%eax),%eax
80104b5c: 89 45 fc mov %eax,-0x4(%ebp)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80104b5f: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80104b63: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
80104b67: 7e c2 jle 80104b2b <getcallerpcs+0x18>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104b69: eb 19 jmp 80104b84 <getcallerpcs+0x71>
pcs[i] = 0;
80104b6b: 8b 45 f8 mov -0x8(%ebp),%eax
80104b6e: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80104b75: 8b 45 0c mov 0xc(%ebp),%eax
80104b78: 01 d0 add %edx,%eax
80104b7a: c7 00 00 00 00 00 movl $0x0,(%eax)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80104b80: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80104b84: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
80104b88: 7e e1 jle 80104b6b <getcallerpcs+0x58>
pcs[i] = 0;
}
80104b8a: c9 leave
80104b8b: c3 ret
80104b8c <holding>:
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80104b8c: 55 push %ebp
80104b8d: 89 e5 mov %esp,%ebp
return lock->locked && lock->cpu == cpu;
80104b8f: 8b 45 08 mov 0x8(%ebp),%eax
80104b92: 8b 00 mov (%eax),%eax
80104b94: 85 c0 test %eax,%eax
80104b96: 74 17 je 80104baf <holding+0x23>
80104b98: 8b 45 08 mov 0x8(%ebp),%eax
80104b9b: 8b 50 08 mov 0x8(%eax),%edx
80104b9e: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104ba4: 39 c2 cmp %eax,%edx
80104ba6: 75 07 jne 80104baf <holding+0x23>
80104ba8: b8 01 00 00 00 mov $0x1,%eax
80104bad: eb 05 jmp 80104bb4 <holding+0x28>
80104baf: b8 00 00 00 00 mov $0x0,%eax
}
80104bb4: 5d pop %ebp
80104bb5: c3 ret
80104bb6 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80104bb6: 55 push %ebp
80104bb7: 89 e5 mov %esp,%ebp
80104bb9: 83 ec 10 sub $0x10,%esp
int eflags;
eflags = readeflags();
80104bbc: e8 4a fe ff ff call 80104a0b <readeflags>
80104bc1: 89 45 fc mov %eax,-0x4(%ebp)
cli();
80104bc4: e8 52 fe ff ff call 80104a1b <cli>
if(cpu->ncli++ == 0)
80104bc9: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104bd0: 8b 82 ac 00 00 00 mov 0xac(%edx),%eax
80104bd6: 8d 48 01 lea 0x1(%eax),%ecx
80104bd9: 89 8a ac 00 00 00 mov %ecx,0xac(%edx)
80104bdf: 85 c0 test %eax,%eax
80104be1: 75 15 jne 80104bf8 <pushcli+0x42>
cpu->intena = eflags & FL_IF;
80104be3: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104be9: 8b 55 fc mov -0x4(%ebp),%edx
80104bec: 81 e2 00 02 00 00 and $0x200,%edx
80104bf2: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
80104bf8: c9 leave
80104bf9: c3 ret
80104bfa <popcli>:
void
popcli(void)
{
80104bfa: 55 push %ebp
80104bfb: 89 e5 mov %esp,%ebp
80104bfd: 83 ec 18 sub $0x18,%esp
if(readeflags()&FL_IF)
80104c00: e8 06 fe ff ff call 80104a0b <readeflags>
80104c05: 25 00 02 00 00 and $0x200,%eax
80104c0a: 85 c0 test %eax,%eax
80104c0c: 74 0c je 80104c1a <popcli+0x20>
panic("popcli - interruptible");
80104c0e: c7 04 24 ed 85 10 80 movl $0x801085ed,(%esp)
80104c15: e8 20 b9 ff ff call 8010053a <panic>
if(--cpu->ncli < 0)
80104c1a: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104c20: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
80104c26: 83 ea 01 sub $0x1,%edx
80104c29: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
80104c2f: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104c35: 85 c0 test %eax,%eax
80104c37: 79 0c jns 80104c45 <popcli+0x4b>
panic("popcli");
80104c39: c7 04 24 04 86 10 80 movl $0x80108604,(%esp)
80104c40: e8 f5 b8 ff ff call 8010053a <panic>
if(cpu->ncli == 0 && cpu->intena)
80104c45: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104c4b: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104c51: 85 c0 test %eax,%eax
80104c53: 75 15 jne 80104c6a <popcli+0x70>
80104c55: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104c5b: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80104c61: 85 c0 test %eax,%eax
80104c63: 74 05 je 80104c6a <popcli+0x70>
sti();
80104c65: e8 b7 fd ff ff call 80104a21 <sti>
}
80104c6a: c9 leave
80104c6b: c3 ret
80104c6c <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
80104c6c: 55 push %ebp
80104c6d: 89 e5 mov %esp,%ebp
80104c6f: 57 push %edi
80104c70: 53 push %ebx
asm volatile("cld; rep stosb" :
80104c71: 8b 4d 08 mov 0x8(%ebp),%ecx
80104c74: 8b 55 10 mov 0x10(%ebp),%edx
80104c77: 8b 45 0c mov 0xc(%ebp),%eax
80104c7a: 89 cb mov %ecx,%ebx
80104c7c: 89 df mov %ebx,%edi
80104c7e: 89 d1 mov %edx,%ecx
80104c80: fc cld
80104c81: f3 aa rep stos %al,%es:(%edi)
80104c83: 89 ca mov %ecx,%edx
80104c85: 89 fb mov %edi,%ebx
80104c87: 89 5d 08 mov %ebx,0x8(%ebp)
80104c8a: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
80104c8d: 5b pop %ebx
80104c8e: 5f pop %edi
80104c8f: 5d pop %ebp
80104c90: c3 ret
80104c91 <stosl>:
static inline void
stosl(void *addr, int data, int cnt)
{
80104c91: 55 push %ebp
80104c92: 89 e5 mov %esp,%ebp
80104c94: 57 push %edi
80104c95: 53 push %ebx
asm volatile("cld; rep stosl" :
80104c96: 8b 4d 08 mov 0x8(%ebp),%ecx
80104c99: 8b 55 10 mov 0x10(%ebp),%edx
80104c9c: 8b 45 0c mov 0xc(%ebp),%eax
80104c9f: 89 cb mov %ecx,%ebx
80104ca1: 89 df mov %ebx,%edi
80104ca3: 89 d1 mov %edx,%ecx
80104ca5: fc cld
80104ca6: f3 ab rep stos %eax,%es:(%edi)
80104ca8: 89 ca mov %ecx,%edx
80104caa: 89 fb mov %edi,%ebx
80104cac: 89 5d 08 mov %ebx,0x8(%ebp)
80104caf: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
80104cb2: 5b pop %ebx
80104cb3: 5f pop %edi
80104cb4: 5d pop %ebp
80104cb5: c3 ret
80104cb6 <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
80104cb6: 55 push %ebp
80104cb7: 89 e5 mov %esp,%ebp
80104cb9: 83 ec 0c sub $0xc,%esp
if ((int)dst%4 == 0 && n%4 == 0){
80104cbc: 8b 45 08 mov 0x8(%ebp),%eax
80104cbf: 83 e0 03 and $0x3,%eax
80104cc2: 85 c0 test %eax,%eax
80104cc4: 75 49 jne 80104d0f <memset+0x59>
80104cc6: 8b 45 10 mov 0x10(%ebp),%eax
80104cc9: 83 e0 03 and $0x3,%eax
80104ccc: 85 c0 test %eax,%eax
80104cce: 75 3f jne 80104d0f <memset+0x59>
c &= 0xFF;
80104cd0: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
80104cd7: 8b 45 10 mov 0x10(%ebp),%eax
80104cda: c1 e8 02 shr $0x2,%eax
80104cdd: 89 c2 mov %eax,%edx
80104cdf: 8b 45 0c mov 0xc(%ebp),%eax
80104ce2: c1 e0 18 shl $0x18,%eax
80104ce5: 89 c1 mov %eax,%ecx
80104ce7: 8b 45 0c mov 0xc(%ebp),%eax
80104cea: c1 e0 10 shl $0x10,%eax
80104ced: 09 c1 or %eax,%ecx
80104cef: 8b 45 0c mov 0xc(%ebp),%eax
80104cf2: c1 e0 08 shl $0x8,%eax
80104cf5: 09 c8 or %ecx,%eax
80104cf7: 0b 45 0c or 0xc(%ebp),%eax
80104cfa: 89 54 24 08 mov %edx,0x8(%esp)
80104cfe: 89 44 24 04 mov %eax,0x4(%esp)
80104d02: 8b 45 08 mov 0x8(%ebp),%eax
80104d05: 89 04 24 mov %eax,(%esp)
80104d08: e8 84 ff ff ff call 80104c91 <stosl>
80104d0d: eb 19 jmp 80104d28 <memset+0x72>
} else
stosb(dst, c, n);
80104d0f: 8b 45 10 mov 0x10(%ebp),%eax
80104d12: 89 44 24 08 mov %eax,0x8(%esp)
80104d16: 8b 45 0c mov 0xc(%ebp),%eax
80104d19: 89 44 24 04 mov %eax,0x4(%esp)
80104d1d: 8b 45 08 mov 0x8(%ebp),%eax
80104d20: 89 04 24 mov %eax,(%esp)
80104d23: e8 44 ff ff ff call 80104c6c <stosb>
return dst;
80104d28: 8b 45 08 mov 0x8(%ebp),%eax
}
80104d2b: c9 leave
80104d2c: c3 ret
80104d2d <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
80104d2d: 55 push %ebp
80104d2e: 89 e5 mov %esp,%ebp
80104d30: 83 ec 10 sub $0x10,%esp
const uchar *s1, *s2;
s1 = v1;
80104d33: 8b 45 08 mov 0x8(%ebp),%eax
80104d36: 89 45 fc mov %eax,-0x4(%ebp)
s2 = v2;
80104d39: 8b 45 0c mov 0xc(%ebp),%eax
80104d3c: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0){
80104d3f: eb 30 jmp 80104d71 <memcmp+0x44>
if(*s1 != *s2)
80104d41: 8b 45 fc mov -0x4(%ebp),%eax
80104d44: 0f b6 10 movzbl (%eax),%edx
80104d47: 8b 45 f8 mov -0x8(%ebp),%eax
80104d4a: 0f b6 00 movzbl (%eax),%eax
80104d4d: 38 c2 cmp %al,%dl
80104d4f: 74 18 je 80104d69 <memcmp+0x3c>
return *s1 - *s2;
80104d51: 8b 45 fc mov -0x4(%ebp),%eax
80104d54: 0f b6 00 movzbl (%eax),%eax
80104d57: 0f b6 d0 movzbl %al,%edx
80104d5a: 8b 45 f8 mov -0x8(%ebp),%eax
80104d5d: 0f b6 00 movzbl (%eax),%eax
80104d60: 0f b6 c0 movzbl %al,%eax
80104d63: 29 c2 sub %eax,%edx
80104d65: 89 d0 mov %edx,%eax
80104d67: eb 1a jmp 80104d83 <memcmp+0x56>
s1++, s2++;
80104d69: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80104d6d: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
80104d71: 8b 45 10 mov 0x10(%ebp),%eax
80104d74: 8d 50 ff lea -0x1(%eax),%edx
80104d77: 89 55 10 mov %edx,0x10(%ebp)
80104d7a: 85 c0 test %eax,%eax
80104d7c: 75 c3 jne 80104d41 <memcmp+0x14>
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
80104d7e: b8 00 00 00 00 mov $0x0,%eax
}
80104d83: c9 leave
80104d84: c3 ret
80104d85 <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80104d85: 55 push %ebp
80104d86: 89 e5 mov %esp,%ebp
80104d88: 83 ec 10 sub $0x10,%esp
const char *s;
char *d;
s = src;
80104d8b: 8b 45 0c mov 0xc(%ebp),%eax
80104d8e: 89 45 fc mov %eax,-0x4(%ebp)
d = dst;
80104d91: 8b 45 08 mov 0x8(%ebp),%eax
80104d94: 89 45 f8 mov %eax,-0x8(%ebp)
if(s < d && s + n > d){
80104d97: 8b 45 fc mov -0x4(%ebp),%eax
80104d9a: 3b 45 f8 cmp -0x8(%ebp),%eax
80104d9d: 73 3d jae 80104ddc <memmove+0x57>
80104d9f: 8b 45 10 mov 0x10(%ebp),%eax
80104da2: 8b 55 fc mov -0x4(%ebp),%edx
80104da5: 01 d0 add %edx,%eax
80104da7: 3b 45 f8 cmp -0x8(%ebp),%eax
80104daa: 76 30 jbe 80104ddc <memmove+0x57>
s += n;
80104dac: 8b 45 10 mov 0x10(%ebp),%eax
80104daf: 01 45 fc add %eax,-0x4(%ebp)
d += n;
80104db2: 8b 45 10 mov 0x10(%ebp),%eax
80104db5: 01 45 f8 add %eax,-0x8(%ebp)
while(n-- > 0)
80104db8: eb 13 jmp 80104dcd <memmove+0x48>
*--d = *--s;
80104dba: 83 6d f8 01 subl $0x1,-0x8(%ebp)
80104dbe: 83 6d fc 01 subl $0x1,-0x4(%ebp)
80104dc2: 8b 45 fc mov -0x4(%ebp),%eax
80104dc5: 0f b6 10 movzbl (%eax),%edx
80104dc8: 8b 45 f8 mov -0x8(%ebp),%eax
80104dcb: 88 10 mov %dl,(%eax)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
80104dcd: 8b 45 10 mov 0x10(%ebp),%eax
80104dd0: 8d 50 ff lea -0x1(%eax),%edx
80104dd3: 89 55 10 mov %edx,0x10(%ebp)
80104dd6: 85 c0 test %eax,%eax
80104dd8: 75 e0 jne 80104dba <memmove+0x35>
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
80104dda: eb 26 jmp 80104e02 <memmove+0x7d>
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80104ddc: eb 17 jmp 80104df5 <memmove+0x70>
*d++ = *s++;
80104dde: 8b 45 f8 mov -0x8(%ebp),%eax
80104de1: 8d 50 01 lea 0x1(%eax),%edx
80104de4: 89 55 f8 mov %edx,-0x8(%ebp)
80104de7: 8b 55 fc mov -0x4(%ebp),%edx
80104dea: 8d 4a 01 lea 0x1(%edx),%ecx
80104ded: 89 4d fc mov %ecx,-0x4(%ebp)
80104df0: 0f b6 12 movzbl (%edx),%edx
80104df3: 88 10 mov %dl,(%eax)
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
80104df5: 8b 45 10 mov 0x10(%ebp),%eax
80104df8: 8d 50 ff lea -0x1(%eax),%edx
80104dfb: 89 55 10 mov %edx,0x10(%ebp)
80104dfe: 85 c0 test %eax,%eax
80104e00: 75 dc jne 80104dde <memmove+0x59>
*d++ = *s++;
return dst;
80104e02: 8b 45 08 mov 0x8(%ebp),%eax
}
80104e05: c9 leave
80104e06: c3 ret
80104e07 <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
80104e07: 55 push %ebp
80104e08: 89 e5 mov %esp,%ebp
80104e0a: 83 ec 0c sub $0xc,%esp
return memmove(dst, src, n);
80104e0d: 8b 45 10 mov 0x10(%ebp),%eax
80104e10: 89 44 24 08 mov %eax,0x8(%esp)
80104e14: 8b 45 0c mov 0xc(%ebp),%eax
80104e17: 89 44 24 04 mov %eax,0x4(%esp)
80104e1b: 8b 45 08 mov 0x8(%ebp),%eax
80104e1e: 89 04 24 mov %eax,(%esp)
80104e21: e8 5f ff ff ff call 80104d85 <memmove>
}
80104e26: c9 leave
80104e27: c3 ret
80104e28 <strncmp>:
int
strncmp(const char *p, const char *q, uint n)
{
80104e28: 55 push %ebp
80104e29: 89 e5 mov %esp,%ebp
while(n > 0 && *p && *p == *q)
80104e2b: eb 0c jmp 80104e39 <strncmp+0x11>
n--, p++, q++;
80104e2d: 83 6d 10 01 subl $0x1,0x10(%ebp)
80104e31: 83 45 08 01 addl $0x1,0x8(%ebp)
80104e35: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
80104e39: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80104e3d: 74 1a je 80104e59 <strncmp+0x31>
80104e3f: 8b 45 08 mov 0x8(%ebp),%eax
80104e42: 0f b6 00 movzbl (%eax),%eax
80104e45: 84 c0 test %al,%al
80104e47: 74 10 je 80104e59 <strncmp+0x31>
80104e49: 8b 45 08 mov 0x8(%ebp),%eax
80104e4c: 0f b6 10 movzbl (%eax),%edx
80104e4f: 8b 45 0c mov 0xc(%ebp),%eax
80104e52: 0f b6 00 movzbl (%eax),%eax
80104e55: 38 c2 cmp %al,%dl
80104e57: 74 d4 je 80104e2d <strncmp+0x5>
n--, p++, q++;
if(n == 0)
80104e59: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80104e5d: 75 07 jne 80104e66 <strncmp+0x3e>
return 0;
80104e5f: b8 00 00 00 00 mov $0x0,%eax
80104e64: eb 16 jmp 80104e7c <strncmp+0x54>
return (uchar)*p - (uchar)*q;
80104e66: 8b 45 08 mov 0x8(%ebp),%eax
80104e69: 0f b6 00 movzbl (%eax),%eax
80104e6c: 0f b6 d0 movzbl %al,%edx
80104e6f: 8b 45 0c mov 0xc(%ebp),%eax
80104e72: 0f b6 00 movzbl (%eax),%eax
80104e75: 0f b6 c0 movzbl %al,%eax
80104e78: 29 c2 sub %eax,%edx
80104e7a: 89 d0 mov %edx,%eax
}
80104e7c: 5d pop %ebp
80104e7d: c3 ret
80104e7e <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80104e7e: 55 push %ebp
80104e7f: 89 e5 mov %esp,%ebp
80104e81: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80104e84: 8b 45 08 mov 0x8(%ebp),%eax
80104e87: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0 && (*s++ = *t++) != 0)
80104e8a: 90 nop
80104e8b: 8b 45 10 mov 0x10(%ebp),%eax
80104e8e: 8d 50 ff lea -0x1(%eax),%edx
80104e91: 89 55 10 mov %edx,0x10(%ebp)
80104e94: 85 c0 test %eax,%eax
80104e96: 7e 1e jle 80104eb6 <strncpy+0x38>
80104e98: 8b 45 08 mov 0x8(%ebp),%eax
80104e9b: 8d 50 01 lea 0x1(%eax),%edx
80104e9e: 89 55 08 mov %edx,0x8(%ebp)
80104ea1: 8b 55 0c mov 0xc(%ebp),%edx
80104ea4: 8d 4a 01 lea 0x1(%edx),%ecx
80104ea7: 89 4d 0c mov %ecx,0xc(%ebp)
80104eaa: 0f b6 12 movzbl (%edx),%edx
80104ead: 88 10 mov %dl,(%eax)
80104eaf: 0f b6 00 movzbl (%eax),%eax
80104eb2: 84 c0 test %al,%al
80104eb4: 75 d5 jne 80104e8b <strncpy+0xd>
;
while(n-- > 0)
80104eb6: eb 0c jmp 80104ec4 <strncpy+0x46>
*s++ = 0;
80104eb8: 8b 45 08 mov 0x8(%ebp),%eax
80104ebb: 8d 50 01 lea 0x1(%eax),%edx
80104ebe: 89 55 08 mov %edx,0x8(%ebp)
80104ec1: c6 00 00 movb $0x0,(%eax)
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
80104ec4: 8b 45 10 mov 0x10(%ebp),%eax
80104ec7: 8d 50 ff lea -0x1(%eax),%edx
80104eca: 89 55 10 mov %edx,0x10(%ebp)
80104ecd: 85 c0 test %eax,%eax
80104ecf: 7f e7 jg 80104eb8 <strncpy+0x3a>
*s++ = 0;
return os;
80104ed1: 8b 45 fc mov -0x4(%ebp),%eax
}
80104ed4: c9 leave
80104ed5: c3 ret
80104ed6 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80104ed6: 55 push %ebp
80104ed7: 89 e5 mov %esp,%ebp
80104ed9: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80104edc: 8b 45 08 mov 0x8(%ebp),%eax
80104edf: 89 45 fc mov %eax,-0x4(%ebp)
if(n <= 0)
80104ee2: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80104ee6: 7f 05 jg 80104eed <safestrcpy+0x17>
return os;
80104ee8: 8b 45 fc mov -0x4(%ebp),%eax
80104eeb: eb 31 jmp 80104f1e <safestrcpy+0x48>
while(--n > 0 && (*s++ = *t++) != 0)
80104eed: 83 6d 10 01 subl $0x1,0x10(%ebp)
80104ef1: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80104ef5: 7e 1e jle 80104f15 <safestrcpy+0x3f>
80104ef7: 8b 45 08 mov 0x8(%ebp),%eax
80104efa: 8d 50 01 lea 0x1(%eax),%edx
80104efd: 89 55 08 mov %edx,0x8(%ebp)
80104f00: 8b 55 0c mov 0xc(%ebp),%edx
80104f03: 8d 4a 01 lea 0x1(%edx),%ecx
80104f06: 89 4d 0c mov %ecx,0xc(%ebp)
80104f09: 0f b6 12 movzbl (%edx),%edx
80104f0c: 88 10 mov %dl,(%eax)
80104f0e: 0f b6 00 movzbl (%eax),%eax
80104f11: 84 c0 test %al,%al
80104f13: 75 d8 jne 80104eed <safestrcpy+0x17>
;
*s = 0;
80104f15: 8b 45 08 mov 0x8(%ebp),%eax
80104f18: c6 00 00 movb $0x0,(%eax)
return os;
80104f1b: 8b 45 fc mov -0x4(%ebp),%eax
}
80104f1e: c9 leave
80104f1f: c3 ret
80104f20 <strlen>:
int
strlen(const char *s)
{
80104f20: 55 push %ebp
80104f21: 89 e5 mov %esp,%ebp
80104f23: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
80104f26: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80104f2d: eb 04 jmp 80104f33 <strlen+0x13>
80104f2f: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80104f33: 8b 55 fc mov -0x4(%ebp),%edx
80104f36: 8b 45 08 mov 0x8(%ebp),%eax
80104f39: 01 d0 add %edx,%eax
80104f3b: 0f b6 00 movzbl (%eax),%eax
80104f3e: 84 c0 test %al,%al
80104f40: 75 ed jne 80104f2f <strlen+0xf>
;
return n;
80104f42: 8b 45 fc mov -0x4(%ebp),%eax
}
80104f45: c9 leave
80104f46: c3 ret
80104f47 <swtch>:
# Save current register context in old
# and then load register context from new.
.globl swtch
swtch:
movl 4(%esp), %eax
80104f47: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
80104f4b: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-save registers
pushl %ebp
80104f4f: 55 push %ebp
pushl %ebx
80104f50: 53 push %ebx
pushl %esi
80104f51: 56 push %esi
pushl %edi
80104f52: 57 push %edi
# Switch stacks
movl %esp, (%eax)
80104f53: 89 20 mov %esp,(%eax)
movl %edx, %esp
80104f55: 89 d4 mov %edx,%esp
# Load new callee-save registers
popl %edi
80104f57: 5f pop %edi
popl %esi
80104f58: 5e pop %esi
popl %ebx
80104f59: 5b pop %ebx
popl %ebp
80104f5a: 5d pop %ebp
ret
80104f5b: c3 ret
80104f5c <fetchint>:
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
80104f5c: 55 push %ebp
80104f5d: 89 e5 mov %esp,%ebp
if(addr >= proc->sz || addr+4 > proc->sz)
80104f5f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104f65: 8b 00 mov (%eax),%eax
80104f67: 3b 45 08 cmp 0x8(%ebp),%eax
80104f6a: 76 12 jbe 80104f7e <fetchint+0x22>
80104f6c: 8b 45 08 mov 0x8(%ebp),%eax
80104f6f: 8d 50 04 lea 0x4(%eax),%edx
80104f72: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104f78: 8b 00 mov (%eax),%eax
80104f7a: 39 c2 cmp %eax,%edx
80104f7c: 76 07 jbe 80104f85 <fetchint+0x29>
return -1;
80104f7e: b8 ff ff ff ff mov $0xffffffff,%eax
80104f83: eb 0f jmp 80104f94 <fetchint+0x38>
*ip = *(int*)(addr);
80104f85: 8b 45 08 mov 0x8(%ebp),%eax
80104f88: 8b 10 mov (%eax),%edx
80104f8a: 8b 45 0c mov 0xc(%ebp),%eax
80104f8d: 89 10 mov %edx,(%eax)
return 0;
80104f8f: b8 00 00 00 00 mov $0x0,%eax
}
80104f94: 5d pop %ebp
80104f95: c3 ret
80104f96 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80104f96: 55 push %ebp
80104f97: 89 e5 mov %esp,%ebp
80104f99: 83 ec 10 sub $0x10,%esp
char *s, *ep;
if(addr >= proc->sz)
80104f9c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104fa2: 8b 00 mov (%eax),%eax
80104fa4: 3b 45 08 cmp 0x8(%ebp),%eax
80104fa7: 77 07 ja 80104fb0 <fetchstr+0x1a>
return -1;
80104fa9: b8 ff ff ff ff mov $0xffffffff,%eax
80104fae: eb 46 jmp 80104ff6 <fetchstr+0x60>
*pp = (char*)addr;
80104fb0: 8b 55 08 mov 0x8(%ebp),%edx
80104fb3: 8b 45 0c mov 0xc(%ebp),%eax
80104fb6: 89 10 mov %edx,(%eax)
ep = (char*)proc->sz;
80104fb8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104fbe: 8b 00 mov (%eax),%eax
80104fc0: 89 45 f8 mov %eax,-0x8(%ebp)
for(s = *pp; s < ep; s++)
80104fc3: 8b 45 0c mov 0xc(%ebp),%eax
80104fc6: 8b 00 mov (%eax),%eax
80104fc8: 89 45 fc mov %eax,-0x4(%ebp)
80104fcb: eb 1c jmp 80104fe9 <fetchstr+0x53>
if(*s == 0)
80104fcd: 8b 45 fc mov -0x4(%ebp),%eax
80104fd0: 0f b6 00 movzbl (%eax),%eax
80104fd3: 84 c0 test %al,%al
80104fd5: 75 0e jne 80104fe5 <fetchstr+0x4f>
return s - *pp;
80104fd7: 8b 55 fc mov -0x4(%ebp),%edx
80104fda: 8b 45 0c mov 0xc(%ebp),%eax
80104fdd: 8b 00 mov (%eax),%eax
80104fdf: 29 c2 sub %eax,%edx
80104fe1: 89 d0 mov %edx,%eax
80104fe3: eb 11 jmp 80104ff6 <fetchstr+0x60>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
80104fe5: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80104fe9: 8b 45 fc mov -0x4(%ebp),%eax
80104fec: 3b 45 f8 cmp -0x8(%ebp),%eax
80104fef: 72 dc jb 80104fcd <fetchstr+0x37>
if(*s == 0)
return s - *pp;
return -1;
80104ff1: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104ff6: c9 leave
80104ff7: c3 ret
80104ff8 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80104ff8: 55 push %ebp
80104ff9: 89 e5 mov %esp,%ebp
80104ffb: 83 ec 08 sub $0x8,%esp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80104ffe: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105004: 8b 40 18 mov 0x18(%eax),%eax
80105007: 8b 50 44 mov 0x44(%eax),%edx
8010500a: 8b 45 08 mov 0x8(%ebp),%eax
8010500d: c1 e0 02 shl $0x2,%eax
80105010: 01 d0 add %edx,%eax
80105012: 8d 50 04 lea 0x4(%eax),%edx
80105015: 8b 45 0c mov 0xc(%ebp),%eax
80105018: 89 44 24 04 mov %eax,0x4(%esp)
8010501c: 89 14 24 mov %edx,(%esp)
8010501f: e8 38 ff ff ff call 80104f5c <fetchint>
}
80105024: c9 leave
80105025: c3 ret
80105026 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80105026: 55 push %ebp
80105027: 89 e5 mov %esp,%ebp
80105029: 83 ec 18 sub $0x18,%esp
int i;
if(argint(n, &i) < 0)
8010502c: 8d 45 fc lea -0x4(%ebp),%eax
8010502f: 89 44 24 04 mov %eax,0x4(%esp)
80105033: 8b 45 08 mov 0x8(%ebp),%eax
80105036: 89 04 24 mov %eax,(%esp)
80105039: e8 ba ff ff ff call 80104ff8 <argint>
8010503e: 85 c0 test %eax,%eax
80105040: 79 07 jns 80105049 <argptr+0x23>
return -1;
80105042: b8 ff ff ff ff mov $0xffffffff,%eax
80105047: eb 3d jmp 80105086 <argptr+0x60>
if((uint)i >= proc->sz || (uint)i+size > proc->sz)
80105049: 8b 45 fc mov -0x4(%ebp),%eax
8010504c: 89 c2 mov %eax,%edx
8010504e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105054: 8b 00 mov (%eax),%eax
80105056: 39 c2 cmp %eax,%edx
80105058: 73 16 jae 80105070 <argptr+0x4a>
8010505a: 8b 45 fc mov -0x4(%ebp),%eax
8010505d: 89 c2 mov %eax,%edx
8010505f: 8b 45 10 mov 0x10(%ebp),%eax
80105062: 01 c2 add %eax,%edx
80105064: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010506a: 8b 00 mov (%eax),%eax
8010506c: 39 c2 cmp %eax,%edx
8010506e: 76 07 jbe 80105077 <argptr+0x51>
return -1;
80105070: b8 ff ff ff ff mov $0xffffffff,%eax
80105075: eb 0f jmp 80105086 <argptr+0x60>
*pp = (char*)i;
80105077: 8b 45 fc mov -0x4(%ebp),%eax
8010507a: 89 c2 mov %eax,%edx
8010507c: 8b 45 0c mov 0xc(%ebp),%eax
8010507f: 89 10 mov %edx,(%eax)
return 0;
80105081: b8 00 00 00 00 mov $0x0,%eax
}
80105086: c9 leave
80105087: c3 ret
80105088 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80105088: 55 push %ebp
80105089: 89 e5 mov %esp,%ebp
8010508b: 83 ec 18 sub $0x18,%esp
int addr;
if(argint(n, &addr) < 0)
8010508e: 8d 45 fc lea -0x4(%ebp),%eax
80105091: 89 44 24 04 mov %eax,0x4(%esp)
80105095: 8b 45 08 mov 0x8(%ebp),%eax
80105098: 89 04 24 mov %eax,(%esp)
8010509b: e8 58 ff ff ff call 80104ff8 <argint>
801050a0: 85 c0 test %eax,%eax
801050a2: 79 07 jns 801050ab <argstr+0x23>
return -1;
801050a4: b8 ff ff ff ff mov $0xffffffff,%eax
801050a9: eb 12 jmp 801050bd <argstr+0x35>
return fetchstr(addr, pp);
801050ab: 8b 45 fc mov -0x4(%ebp),%eax
801050ae: 8b 55 0c mov 0xc(%ebp),%edx
801050b1: 89 54 24 04 mov %edx,0x4(%esp)
801050b5: 89 04 24 mov %eax,(%esp)
801050b8: e8 d9 fe ff ff call 80104f96 <fetchstr>
}
801050bd: c9 leave
801050be: c3 ret
801050bf <syscall>:
// [SYS_join] sys_join,
};
void
syscall(void)
{
801050bf: 55 push %ebp
801050c0: 89 e5 mov %esp,%ebp
801050c2: 53 push %ebx
801050c3: 83 ec 24 sub $0x24,%esp
int num;
num = proc->tf->eax;
801050c6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801050cc: 8b 40 18 mov 0x18(%eax),%eax
801050cf: 8b 40 1c mov 0x1c(%eax),%eax
801050d2: 89 45 f4 mov %eax,-0xc(%ebp)
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
801050d5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801050d9: 7e 30 jle 8010510b <syscall+0x4c>
801050db: 8b 45 f4 mov -0xc(%ebp),%eax
801050de: 83 f8 16 cmp $0x16,%eax
801050e1: 77 28 ja 8010510b <syscall+0x4c>
801050e3: 8b 45 f4 mov -0xc(%ebp),%eax
801050e6: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax
801050ed: 85 c0 test %eax,%eax
801050ef: 74 1a je 8010510b <syscall+0x4c>
proc->tf->eax = syscalls[num]();
801050f1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801050f7: 8b 58 18 mov 0x18(%eax),%ebx
801050fa: 8b 45 f4 mov -0xc(%ebp),%eax
801050fd: 8b 04 85 40 b0 10 80 mov -0x7fef4fc0(,%eax,4),%eax
80105104: ff d0 call *%eax
80105106: 89 43 1c mov %eax,0x1c(%ebx)
80105109: eb 3d jmp 80105148 <syscall+0x89>
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
8010510b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105111: 8d 48 6c lea 0x6c(%eax),%ecx
80105114: 65 a1 04 00 00 00 mov %gs:0x4,%eax
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
8010511a: 8b 40 10 mov 0x10(%eax),%eax
8010511d: 8b 55 f4 mov -0xc(%ebp),%edx
80105120: 89 54 24 0c mov %edx,0xc(%esp)
80105124: 89 4c 24 08 mov %ecx,0x8(%esp)
80105128: 89 44 24 04 mov %eax,0x4(%esp)
8010512c: c7 04 24 0b 86 10 80 movl $0x8010860b,(%esp)
80105133: e8 68 b2 ff ff call 801003a0 <cprintf>
proc->pid, proc->name, num);
proc->tf->eax = -1;
80105138: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010513e: 8b 40 18 mov 0x18(%eax),%eax
80105141: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
80105148: 83 c4 24 add $0x24,%esp
8010514b: 5b pop %ebx
8010514c: 5d pop %ebp
8010514d: c3 ret
8010514e <argfd>:
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
8010514e: 55 push %ebp
8010514f: 89 e5 mov %esp,%ebp
80105151: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80105154: 8d 45 f0 lea -0x10(%ebp),%eax
80105157: 89 44 24 04 mov %eax,0x4(%esp)
8010515b: 8b 45 08 mov 0x8(%ebp),%eax
8010515e: 89 04 24 mov %eax,(%esp)
80105161: e8 92 fe ff ff call 80104ff8 <argint>
80105166: 85 c0 test %eax,%eax
80105168: 79 07 jns 80105171 <argfd+0x23>
return -1;
8010516a: b8 ff ff ff ff mov $0xffffffff,%eax
8010516f: eb 50 jmp 801051c1 <argfd+0x73>
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80105171: 8b 45 f0 mov -0x10(%ebp),%eax
80105174: 85 c0 test %eax,%eax
80105176: 78 21 js 80105199 <argfd+0x4b>
80105178: 8b 45 f0 mov -0x10(%ebp),%eax
8010517b: 83 f8 0f cmp $0xf,%eax
8010517e: 7f 19 jg 80105199 <argfd+0x4b>
80105180: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105186: 8b 55 f0 mov -0x10(%ebp),%edx
80105189: 83 c2 08 add $0x8,%edx
8010518c: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105190: 89 45 f4 mov %eax,-0xc(%ebp)
80105193: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105197: 75 07 jne 801051a0 <argfd+0x52>
return -1;
80105199: b8 ff ff ff ff mov $0xffffffff,%eax
8010519e: eb 21 jmp 801051c1 <argfd+0x73>
if(pfd)
801051a0: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801051a4: 74 08 je 801051ae <argfd+0x60>
*pfd = fd;
801051a6: 8b 55 f0 mov -0x10(%ebp),%edx
801051a9: 8b 45 0c mov 0xc(%ebp),%eax
801051ac: 89 10 mov %edx,(%eax)
if(pf)
801051ae: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801051b2: 74 08 je 801051bc <argfd+0x6e>
*pf = f;
801051b4: 8b 45 10 mov 0x10(%ebp),%eax
801051b7: 8b 55 f4 mov -0xc(%ebp),%edx
801051ba: 89 10 mov %edx,(%eax)
return 0;
801051bc: b8 00 00 00 00 mov $0x0,%eax
}
801051c1: c9 leave
801051c2: c3 ret
801051c3 <fdalloc>:
// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
801051c3: 55 push %ebp
801051c4: 89 e5 mov %esp,%ebp
801051c6: 83 ec 10 sub $0x10,%esp
int fd;
for(fd = 0; fd < NOFILE; fd++){
801051c9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
801051d0: eb 30 jmp 80105202 <fdalloc+0x3f>
if(proc->ofile[fd] == 0){
801051d2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801051d8: 8b 55 fc mov -0x4(%ebp),%edx
801051db: 83 c2 08 add $0x8,%edx
801051de: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801051e2: 85 c0 test %eax,%eax
801051e4: 75 18 jne 801051fe <fdalloc+0x3b>
proc->ofile[fd] = f;
801051e6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801051ec: 8b 55 fc mov -0x4(%ebp),%edx
801051ef: 8d 4a 08 lea 0x8(%edx),%ecx
801051f2: 8b 55 08 mov 0x8(%ebp),%edx
801051f5: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4)
return fd;
801051f9: 8b 45 fc mov -0x4(%ebp),%eax
801051fc: eb 0f jmp 8010520d <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
801051fe: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105202: 83 7d fc 0f cmpl $0xf,-0x4(%ebp)
80105206: 7e ca jle 801051d2 <fdalloc+0xf>
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
return fd;
}
}
return -1;
80105208: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010520d: c9 leave
8010520e: c3 ret
8010520f <sys_dup>:
int
sys_dup(void)
{
8010520f: 55 push %ebp
80105210: 89 e5 mov %esp,%ebp
80105212: 83 ec 28 sub $0x28,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80105215: 8d 45 f0 lea -0x10(%ebp),%eax
80105218: 89 44 24 08 mov %eax,0x8(%esp)
8010521c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105223: 00
80105224: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010522b: e8 1e ff ff ff call 8010514e <argfd>
80105230: 85 c0 test %eax,%eax
80105232: 79 07 jns 8010523b <sys_dup+0x2c>
return -1;
80105234: b8 ff ff ff ff mov $0xffffffff,%eax
80105239: eb 29 jmp 80105264 <sys_dup+0x55>
if((fd=fdalloc(f)) < 0)
8010523b: 8b 45 f0 mov -0x10(%ebp),%eax
8010523e: 89 04 24 mov %eax,(%esp)
80105241: e8 7d ff ff ff call 801051c3 <fdalloc>
80105246: 89 45 f4 mov %eax,-0xc(%ebp)
80105249: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010524d: 79 07 jns 80105256 <sys_dup+0x47>
return -1;
8010524f: b8 ff ff ff ff mov $0xffffffff,%eax
80105254: eb 0e jmp 80105264 <sys_dup+0x55>
filedup(f);
80105256: 8b 45 f0 mov -0x10(%ebp),%eax
80105259: 89 04 24 mov %eax,(%esp)
8010525c: e8 11 bd ff ff call 80100f72 <filedup>
return fd;
80105261: 8b 45 f4 mov -0xc(%ebp),%eax
}
80105264: c9 leave
80105265: c3 ret
80105266 <sys_read>:
int
sys_read(void)
{
80105266: 55 push %ebp
80105267: 89 e5 mov %esp,%ebp
80105269: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
8010526c: 8d 45 f4 lea -0xc(%ebp),%eax
8010526f: 89 44 24 08 mov %eax,0x8(%esp)
80105273: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010527a: 00
8010527b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105282: e8 c7 fe ff ff call 8010514e <argfd>
80105287: 85 c0 test %eax,%eax
80105289: 78 35 js 801052c0 <sys_read+0x5a>
8010528b: 8d 45 f0 lea -0x10(%ebp),%eax
8010528e: 89 44 24 04 mov %eax,0x4(%esp)
80105292: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105299: e8 5a fd ff ff call 80104ff8 <argint>
8010529e: 85 c0 test %eax,%eax
801052a0: 78 1e js 801052c0 <sys_read+0x5a>
801052a2: 8b 45 f0 mov -0x10(%ebp),%eax
801052a5: 89 44 24 08 mov %eax,0x8(%esp)
801052a9: 8d 45 ec lea -0x14(%ebp),%eax
801052ac: 89 44 24 04 mov %eax,0x4(%esp)
801052b0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801052b7: e8 6a fd ff ff call 80105026 <argptr>
801052bc: 85 c0 test %eax,%eax
801052be: 79 07 jns 801052c7 <sys_read+0x61>
return -1;
801052c0: b8 ff ff ff ff mov $0xffffffff,%eax
801052c5: eb 19 jmp 801052e0 <sys_read+0x7a>
return fileread(f, p, n);
801052c7: 8b 4d f0 mov -0x10(%ebp),%ecx
801052ca: 8b 55 ec mov -0x14(%ebp),%edx
801052cd: 8b 45 f4 mov -0xc(%ebp),%eax
801052d0: 89 4c 24 08 mov %ecx,0x8(%esp)
801052d4: 89 54 24 04 mov %edx,0x4(%esp)
801052d8: 89 04 24 mov %eax,(%esp)
801052db: e8 ff bd ff ff call 801010df <fileread>
}
801052e0: c9 leave
801052e1: c3 ret
801052e2 <sys_write>:
int
sys_write(void)
{
801052e2: 55 push %ebp
801052e3: 89 e5 mov %esp,%ebp
801052e5: 83 ec 28 sub $0x28,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
801052e8: 8d 45 f4 lea -0xc(%ebp),%eax
801052eb: 89 44 24 08 mov %eax,0x8(%esp)
801052ef: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801052f6: 00
801052f7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801052fe: e8 4b fe ff ff call 8010514e <argfd>
80105303: 85 c0 test %eax,%eax
80105305: 78 35 js 8010533c <sys_write+0x5a>
80105307: 8d 45 f0 lea -0x10(%ebp),%eax
8010530a: 89 44 24 04 mov %eax,0x4(%esp)
8010530e: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105315: e8 de fc ff ff call 80104ff8 <argint>
8010531a: 85 c0 test %eax,%eax
8010531c: 78 1e js 8010533c <sys_write+0x5a>
8010531e: 8b 45 f0 mov -0x10(%ebp),%eax
80105321: 89 44 24 08 mov %eax,0x8(%esp)
80105325: 8d 45 ec lea -0x14(%ebp),%eax
80105328: 89 44 24 04 mov %eax,0x4(%esp)
8010532c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105333: e8 ee fc ff ff call 80105026 <argptr>
80105338: 85 c0 test %eax,%eax
8010533a: 79 07 jns 80105343 <sys_write+0x61>
return -1;
8010533c: b8 ff ff ff ff mov $0xffffffff,%eax
80105341: eb 19 jmp 8010535c <sys_write+0x7a>
return filewrite(f, p, n);
80105343: 8b 4d f0 mov -0x10(%ebp),%ecx
80105346: 8b 55 ec mov -0x14(%ebp),%edx
80105349: 8b 45 f4 mov -0xc(%ebp),%eax
8010534c: 89 4c 24 08 mov %ecx,0x8(%esp)
80105350: 89 54 24 04 mov %edx,0x4(%esp)
80105354: 89 04 24 mov %eax,(%esp)
80105357: e8 3f be ff ff call 8010119b <filewrite>
}
8010535c: c9 leave
8010535d: c3 ret
8010535e <sys_close>:
int
sys_close(void)
{
8010535e: 55 push %ebp
8010535f: 89 e5 mov %esp,%ebp
80105361: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80105364: 8d 45 f0 lea -0x10(%ebp),%eax
80105367: 89 44 24 08 mov %eax,0x8(%esp)
8010536b: 8d 45 f4 lea -0xc(%ebp),%eax
8010536e: 89 44 24 04 mov %eax,0x4(%esp)
80105372: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105379: e8 d0 fd ff ff call 8010514e <argfd>
8010537e: 85 c0 test %eax,%eax
80105380: 79 07 jns 80105389 <sys_close+0x2b>
return -1;
80105382: b8 ff ff ff ff mov $0xffffffff,%eax
80105387: eb 24 jmp 801053ad <sys_close+0x4f>
proc->ofile[fd] = 0;
80105389: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010538f: 8b 55 f4 mov -0xc(%ebp),%edx
80105392: 83 c2 08 add $0x8,%edx
80105395: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
8010539c: 00
fileclose(f);
8010539d: 8b 45 f0 mov -0x10(%ebp),%eax
801053a0: 89 04 24 mov %eax,(%esp)
801053a3: e8 12 bc ff ff call 80100fba <fileclose>
return 0;
801053a8: b8 00 00 00 00 mov $0x0,%eax
}
801053ad: c9 leave
801053ae: c3 ret
801053af <sys_fstat>:
int
sys_fstat(void)
{
801053af: 55 push %ebp
801053b0: 89 e5 mov %esp,%ebp
801053b2: 83 ec 28 sub $0x28,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
801053b5: 8d 45 f4 lea -0xc(%ebp),%eax
801053b8: 89 44 24 08 mov %eax,0x8(%esp)
801053bc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801053c3: 00
801053c4: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801053cb: e8 7e fd ff ff call 8010514e <argfd>
801053d0: 85 c0 test %eax,%eax
801053d2: 78 1f js 801053f3 <sys_fstat+0x44>
801053d4: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
801053db: 00
801053dc: 8d 45 f0 lea -0x10(%ebp),%eax
801053df: 89 44 24 04 mov %eax,0x4(%esp)
801053e3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801053ea: e8 37 fc ff ff call 80105026 <argptr>
801053ef: 85 c0 test %eax,%eax
801053f1: 79 07 jns 801053fa <sys_fstat+0x4b>
return -1;
801053f3: b8 ff ff ff ff mov $0xffffffff,%eax
801053f8: eb 12 jmp 8010540c <sys_fstat+0x5d>
return filestat(f, st);
801053fa: 8b 55 f0 mov -0x10(%ebp),%edx
801053fd: 8b 45 f4 mov -0xc(%ebp),%eax
80105400: 89 54 24 04 mov %edx,0x4(%esp)
80105404: 89 04 24 mov %eax,(%esp)
80105407: e8 84 bc ff ff call 80101090 <filestat>
}
8010540c: c9 leave
8010540d: c3 ret
8010540e <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
8010540e: 55 push %ebp
8010540f: 89 e5 mov %esp,%ebp
80105411: 83 ec 38 sub $0x38,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105414: 8d 45 d8 lea -0x28(%ebp),%eax
80105417: 89 44 24 04 mov %eax,0x4(%esp)
8010541b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105422: e8 61 fc ff ff call 80105088 <argstr>
80105427: 85 c0 test %eax,%eax
80105429: 78 17 js 80105442 <sys_link+0x34>
8010542b: 8d 45 dc lea -0x24(%ebp),%eax
8010542e: 89 44 24 04 mov %eax,0x4(%esp)
80105432: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105439: e8 4a fc ff ff call 80105088 <argstr>
8010543e: 85 c0 test %eax,%eax
80105440: 79 0a jns 8010544c <sys_link+0x3e>
return -1;
80105442: b8 ff ff ff ff mov $0xffffffff,%eax
80105447: e9 3d 01 00 00 jmp 80105589 <sys_link+0x17b>
if((ip = namei(old)) == 0)
8010544c: 8b 45 d8 mov -0x28(%ebp),%eax
8010544f: 89 04 24 mov %eax,(%esp)
80105452: e8 9b cf ff ff call 801023f2 <namei>
80105457: 89 45 f4 mov %eax,-0xc(%ebp)
8010545a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010545e: 75 0a jne 8010546a <sys_link+0x5c>
return -1;
80105460: b8 ff ff ff ff mov $0xffffffff,%eax
80105465: e9 1f 01 00 00 jmp 80105589 <sys_link+0x17b>
begin_trans();
8010546a: e8 62 dd ff ff call 801031d1 <begin_trans>
ilock(ip);
8010546f: 8b 45 f4 mov -0xc(%ebp),%eax
80105472: 89 04 24 mov %eax,(%esp)
80105475: e8 cd c3 ff ff call 80101847 <ilock>
if(ip->type == T_DIR){
8010547a: 8b 45 f4 mov -0xc(%ebp),%eax
8010547d: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105481: 66 83 f8 01 cmp $0x1,%ax
80105485: 75 1a jne 801054a1 <sys_link+0x93>
iunlockput(ip);
80105487: 8b 45 f4 mov -0xc(%ebp),%eax
8010548a: 89 04 24 mov %eax,(%esp)
8010548d: e8 39 c6 ff ff call 80101acb <iunlockput>
commit_trans();
80105492: e8 83 dd ff ff call 8010321a <commit_trans>
return -1;
80105497: b8 ff ff ff ff mov $0xffffffff,%eax
8010549c: e9 e8 00 00 00 jmp 80105589 <sys_link+0x17b>
}
ip->nlink++;
801054a1: 8b 45 f4 mov -0xc(%ebp),%eax
801054a4: 0f b7 40 16 movzwl 0x16(%eax),%eax
801054a8: 8d 50 01 lea 0x1(%eax),%edx
801054ab: 8b 45 f4 mov -0xc(%ebp),%eax
801054ae: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
801054b2: 8b 45 f4 mov -0xc(%ebp),%eax
801054b5: 89 04 24 mov %eax,(%esp)
801054b8: e8 ce c1 ff ff call 8010168b <iupdate>
iunlock(ip);
801054bd: 8b 45 f4 mov -0xc(%ebp),%eax
801054c0: 89 04 24 mov %eax,(%esp)
801054c3: e8 cd c4 ff ff call 80101995 <iunlock>
if((dp = nameiparent(new, name)) == 0)
801054c8: 8b 45 dc mov -0x24(%ebp),%eax
801054cb: 8d 55 e2 lea -0x1e(%ebp),%edx
801054ce: 89 54 24 04 mov %edx,0x4(%esp)
801054d2: 89 04 24 mov %eax,(%esp)
801054d5: e8 3a cf ff ff call 80102414 <nameiparent>
801054da: 89 45 f0 mov %eax,-0x10(%ebp)
801054dd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801054e1: 75 02 jne 801054e5 <sys_link+0xd7>
goto bad;
801054e3: eb 68 jmp 8010554d <sys_link+0x13f>
ilock(dp);
801054e5: 8b 45 f0 mov -0x10(%ebp),%eax
801054e8: 89 04 24 mov %eax,(%esp)
801054eb: e8 57 c3 ff ff call 80101847 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
801054f0: 8b 45 f0 mov -0x10(%ebp),%eax
801054f3: 8b 10 mov (%eax),%edx
801054f5: 8b 45 f4 mov -0xc(%ebp),%eax
801054f8: 8b 00 mov (%eax),%eax
801054fa: 39 c2 cmp %eax,%edx
801054fc: 75 20 jne 8010551e <sys_link+0x110>
801054fe: 8b 45 f4 mov -0xc(%ebp),%eax
80105501: 8b 40 04 mov 0x4(%eax),%eax
80105504: 89 44 24 08 mov %eax,0x8(%esp)
80105508: 8d 45 e2 lea -0x1e(%ebp),%eax
8010550b: 89 44 24 04 mov %eax,0x4(%esp)
8010550f: 8b 45 f0 mov -0x10(%ebp),%eax
80105512: 89 04 24 mov %eax,(%esp)
80105515: e8 18 cc ff ff call 80102132 <dirlink>
8010551a: 85 c0 test %eax,%eax
8010551c: 79 0d jns 8010552b <sys_link+0x11d>
iunlockput(dp);
8010551e: 8b 45 f0 mov -0x10(%ebp),%eax
80105521: 89 04 24 mov %eax,(%esp)
80105524: e8 a2 c5 ff ff call 80101acb <iunlockput>
goto bad;
80105529: eb 22 jmp 8010554d <sys_link+0x13f>
}
iunlockput(dp);
8010552b: 8b 45 f0 mov -0x10(%ebp),%eax
8010552e: 89 04 24 mov %eax,(%esp)
80105531: e8 95 c5 ff ff call 80101acb <iunlockput>
iput(ip);
80105536: 8b 45 f4 mov -0xc(%ebp),%eax
80105539: 89 04 24 mov %eax,(%esp)
8010553c: e8 b9 c4 ff ff call 801019fa <iput>
commit_trans();
80105541: e8 d4 dc ff ff call 8010321a <commit_trans>
return 0;
80105546: b8 00 00 00 00 mov $0x0,%eax
8010554b: eb 3c jmp 80105589 <sys_link+0x17b>
bad:
ilock(ip);
8010554d: 8b 45 f4 mov -0xc(%ebp),%eax
80105550: 89 04 24 mov %eax,(%esp)
80105553: e8 ef c2 ff ff call 80101847 <ilock>
ip->nlink--;
80105558: 8b 45 f4 mov -0xc(%ebp),%eax
8010555b: 0f b7 40 16 movzwl 0x16(%eax),%eax
8010555f: 8d 50 ff lea -0x1(%eax),%edx
80105562: 8b 45 f4 mov -0xc(%ebp),%eax
80105565: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105569: 8b 45 f4 mov -0xc(%ebp),%eax
8010556c: 89 04 24 mov %eax,(%esp)
8010556f: e8 17 c1 ff ff call 8010168b <iupdate>
iunlockput(ip);
80105574: 8b 45 f4 mov -0xc(%ebp),%eax
80105577: 89 04 24 mov %eax,(%esp)
8010557a: e8 4c c5 ff ff call 80101acb <iunlockput>
commit_trans();
8010557f: e8 96 dc ff ff call 8010321a <commit_trans>
return -1;
80105584: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105589: c9 leave
8010558a: c3 ret
8010558b <isdirempty>:
// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
8010558b: 55 push %ebp
8010558c: 89 e5 mov %esp,%ebp
8010558e: 83 ec 38 sub $0x38,%esp
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105591: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp)
80105598: eb 4b jmp 801055e5 <isdirempty+0x5a>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010559a: 8b 45 f4 mov -0xc(%ebp),%eax
8010559d: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801055a4: 00
801055a5: 89 44 24 08 mov %eax,0x8(%esp)
801055a9: 8d 45 e4 lea -0x1c(%ebp),%eax
801055ac: 89 44 24 04 mov %eax,0x4(%esp)
801055b0: 8b 45 08 mov 0x8(%ebp),%eax
801055b3: 89 04 24 mov %eax,(%esp)
801055b6: e8 99 c7 ff ff call 80101d54 <readi>
801055bb: 83 f8 10 cmp $0x10,%eax
801055be: 74 0c je 801055cc <isdirempty+0x41>
panic("isdirempty: readi");
801055c0: c7 04 24 28 86 10 80 movl $0x80108628,(%esp)
801055c7: e8 6e af ff ff call 8010053a <panic>
if(de.inum != 0)
801055cc: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
801055d0: 66 85 c0 test %ax,%ax
801055d3: 74 07 je 801055dc <isdirempty+0x51>
return 0;
801055d5: b8 00 00 00 00 mov $0x0,%eax
801055da: eb 1b jmp 801055f7 <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
801055dc: 8b 45 f4 mov -0xc(%ebp),%eax
801055df: 83 c0 10 add $0x10,%eax
801055e2: 89 45 f4 mov %eax,-0xc(%ebp)
801055e5: 8b 55 f4 mov -0xc(%ebp),%edx
801055e8: 8b 45 08 mov 0x8(%ebp),%eax
801055eb: 8b 40 18 mov 0x18(%eax),%eax
801055ee: 39 c2 cmp %eax,%edx
801055f0: 72 a8 jb 8010559a <isdirempty+0xf>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
if(de.inum != 0)
return 0;
}
return 1;
801055f2: b8 01 00 00 00 mov $0x1,%eax
}
801055f7: c9 leave
801055f8: c3 ret
801055f9 <sys_unlink>:
//PAGEBREAK!
int
sys_unlink(void)
{
801055f9: 55 push %ebp
801055fa: 89 e5 mov %esp,%ebp
801055fc: 83 ec 48 sub $0x48,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
801055ff: 8d 45 cc lea -0x34(%ebp),%eax
80105602: 89 44 24 04 mov %eax,0x4(%esp)
80105606: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010560d: e8 76 fa ff ff call 80105088 <argstr>
80105612: 85 c0 test %eax,%eax
80105614: 79 0a jns 80105620 <sys_unlink+0x27>
return -1;
80105616: b8 ff ff ff ff mov $0xffffffff,%eax
8010561b: e9 aa 01 00 00 jmp 801057ca <sys_unlink+0x1d1>
if((dp = nameiparent(path, name)) == 0)
80105620: 8b 45 cc mov -0x34(%ebp),%eax
80105623: 8d 55 d2 lea -0x2e(%ebp),%edx
80105626: 89 54 24 04 mov %edx,0x4(%esp)
8010562a: 89 04 24 mov %eax,(%esp)
8010562d: e8 e2 cd ff ff call 80102414 <nameiparent>
80105632: 89 45 f4 mov %eax,-0xc(%ebp)
80105635: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105639: 75 0a jne 80105645 <sys_unlink+0x4c>
return -1;
8010563b: b8 ff ff ff ff mov $0xffffffff,%eax
80105640: e9 85 01 00 00 jmp 801057ca <sys_unlink+0x1d1>
begin_trans();
80105645: e8 87 db ff ff call 801031d1 <begin_trans>
ilock(dp);
8010564a: 8b 45 f4 mov -0xc(%ebp),%eax
8010564d: 89 04 24 mov %eax,(%esp)
80105650: e8 f2 c1 ff ff call 80101847 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105655: c7 44 24 04 3a 86 10 movl $0x8010863a,0x4(%esp)
8010565c: 80
8010565d: 8d 45 d2 lea -0x2e(%ebp),%eax
80105660: 89 04 24 mov %eax,(%esp)
80105663: e8 df c9 ff ff call 80102047 <namecmp>
80105668: 85 c0 test %eax,%eax
8010566a: 0f 84 45 01 00 00 je 801057b5 <sys_unlink+0x1bc>
80105670: c7 44 24 04 3c 86 10 movl $0x8010863c,0x4(%esp)
80105677: 80
80105678: 8d 45 d2 lea -0x2e(%ebp),%eax
8010567b: 89 04 24 mov %eax,(%esp)
8010567e: e8 c4 c9 ff ff call 80102047 <namecmp>
80105683: 85 c0 test %eax,%eax
80105685: 0f 84 2a 01 00 00 je 801057b5 <sys_unlink+0x1bc>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
8010568b: 8d 45 c8 lea -0x38(%ebp),%eax
8010568e: 89 44 24 08 mov %eax,0x8(%esp)
80105692: 8d 45 d2 lea -0x2e(%ebp),%eax
80105695: 89 44 24 04 mov %eax,0x4(%esp)
80105699: 8b 45 f4 mov -0xc(%ebp),%eax
8010569c: 89 04 24 mov %eax,(%esp)
8010569f: e8 c5 c9 ff ff call 80102069 <dirlookup>
801056a4: 89 45 f0 mov %eax,-0x10(%ebp)
801056a7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801056ab: 75 05 jne 801056b2 <sys_unlink+0xb9>
goto bad;
801056ad: e9 03 01 00 00 jmp 801057b5 <sys_unlink+0x1bc>
ilock(ip);
801056b2: 8b 45 f0 mov -0x10(%ebp),%eax
801056b5: 89 04 24 mov %eax,(%esp)
801056b8: e8 8a c1 ff ff call 80101847 <ilock>
if(ip->nlink < 1)
801056bd: 8b 45 f0 mov -0x10(%ebp),%eax
801056c0: 0f b7 40 16 movzwl 0x16(%eax),%eax
801056c4: 66 85 c0 test %ax,%ax
801056c7: 7f 0c jg 801056d5 <sys_unlink+0xdc>
panic("unlink: nlink < 1");
801056c9: c7 04 24 3f 86 10 80 movl $0x8010863f,(%esp)
801056d0: e8 65 ae ff ff call 8010053a <panic>
if(ip->type == T_DIR && !isdirempty(ip)){
801056d5: 8b 45 f0 mov -0x10(%ebp),%eax
801056d8: 0f b7 40 10 movzwl 0x10(%eax),%eax
801056dc: 66 83 f8 01 cmp $0x1,%ax
801056e0: 75 1f jne 80105701 <sys_unlink+0x108>
801056e2: 8b 45 f0 mov -0x10(%ebp),%eax
801056e5: 89 04 24 mov %eax,(%esp)
801056e8: e8 9e fe ff ff call 8010558b <isdirempty>
801056ed: 85 c0 test %eax,%eax
801056ef: 75 10 jne 80105701 <sys_unlink+0x108>
iunlockput(ip);
801056f1: 8b 45 f0 mov -0x10(%ebp),%eax
801056f4: 89 04 24 mov %eax,(%esp)
801056f7: e8 cf c3 ff ff call 80101acb <iunlockput>
goto bad;
801056fc: e9 b4 00 00 00 jmp 801057b5 <sys_unlink+0x1bc>
}
memset(&de, 0, sizeof(de));
80105701: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80105708: 00
80105709: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105710: 00
80105711: 8d 45 e0 lea -0x20(%ebp),%eax
80105714: 89 04 24 mov %eax,(%esp)
80105717: e8 9a f5 ff ff call 80104cb6 <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010571c: 8b 45 c8 mov -0x38(%ebp),%eax
8010571f: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80105726: 00
80105727: 89 44 24 08 mov %eax,0x8(%esp)
8010572b: 8d 45 e0 lea -0x20(%ebp),%eax
8010572e: 89 44 24 04 mov %eax,0x4(%esp)
80105732: 8b 45 f4 mov -0xc(%ebp),%eax
80105735: 89 04 24 mov %eax,(%esp)
80105738: e8 7b c7 ff ff call 80101eb8 <writei>
8010573d: 83 f8 10 cmp $0x10,%eax
80105740: 74 0c je 8010574e <sys_unlink+0x155>
panic("unlink: writei");
80105742: c7 04 24 51 86 10 80 movl $0x80108651,(%esp)
80105749: e8 ec ad ff ff call 8010053a <panic>
if(ip->type == T_DIR){
8010574e: 8b 45 f0 mov -0x10(%ebp),%eax
80105751: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105755: 66 83 f8 01 cmp $0x1,%ax
80105759: 75 1c jne 80105777 <sys_unlink+0x17e>
dp->nlink--;
8010575b: 8b 45 f4 mov -0xc(%ebp),%eax
8010575e: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105762: 8d 50 ff lea -0x1(%eax),%edx
80105765: 8b 45 f4 mov -0xc(%ebp),%eax
80105768: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
8010576c: 8b 45 f4 mov -0xc(%ebp),%eax
8010576f: 89 04 24 mov %eax,(%esp)
80105772: e8 14 bf ff ff call 8010168b <iupdate>
}
iunlockput(dp);
80105777: 8b 45 f4 mov -0xc(%ebp),%eax
8010577a: 89 04 24 mov %eax,(%esp)
8010577d: e8 49 c3 ff ff call 80101acb <iunlockput>
ip->nlink--;
80105782: 8b 45 f0 mov -0x10(%ebp),%eax
80105785: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105789: 8d 50 ff lea -0x1(%eax),%edx
8010578c: 8b 45 f0 mov -0x10(%ebp),%eax
8010578f: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105793: 8b 45 f0 mov -0x10(%ebp),%eax
80105796: 89 04 24 mov %eax,(%esp)
80105799: e8 ed be ff ff call 8010168b <iupdate>
iunlockput(ip);
8010579e: 8b 45 f0 mov -0x10(%ebp),%eax
801057a1: 89 04 24 mov %eax,(%esp)
801057a4: e8 22 c3 ff ff call 80101acb <iunlockput>
commit_trans();
801057a9: e8 6c da ff ff call 8010321a <commit_trans>
return 0;
801057ae: b8 00 00 00 00 mov $0x0,%eax
801057b3: eb 15 jmp 801057ca <sys_unlink+0x1d1>
bad:
iunlockput(dp);
801057b5: 8b 45 f4 mov -0xc(%ebp),%eax
801057b8: 89 04 24 mov %eax,(%esp)
801057bb: e8 0b c3 ff ff call 80101acb <iunlockput>
commit_trans();
801057c0: e8 55 da ff ff call 8010321a <commit_trans>
return -1;
801057c5: b8 ff ff ff ff mov $0xffffffff,%eax
}
801057ca: c9 leave
801057cb: c3 ret
801057cc <create>:
static struct inode*
create(char *path, short type, short major, short minor)
{
801057cc: 55 push %ebp
801057cd: 89 e5 mov %esp,%ebp
801057cf: 83 ec 48 sub $0x48,%esp
801057d2: 8b 4d 0c mov 0xc(%ebp),%ecx
801057d5: 8b 55 10 mov 0x10(%ebp),%edx
801057d8: 8b 45 14 mov 0x14(%ebp),%eax
801057db: 66 89 4d d4 mov %cx,-0x2c(%ebp)
801057df: 66 89 55 d0 mov %dx,-0x30(%ebp)
801057e3: 66 89 45 cc mov %ax,-0x34(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801057e7: 8d 45 de lea -0x22(%ebp),%eax
801057ea: 89 44 24 04 mov %eax,0x4(%esp)
801057ee: 8b 45 08 mov 0x8(%ebp),%eax
801057f1: 89 04 24 mov %eax,(%esp)
801057f4: e8 1b cc ff ff call 80102414 <nameiparent>
801057f9: 89 45 f4 mov %eax,-0xc(%ebp)
801057fc: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105800: 75 0a jne 8010580c <create+0x40>
return 0;
80105802: b8 00 00 00 00 mov $0x0,%eax
80105807: e9 7e 01 00 00 jmp 8010598a <create+0x1be>
ilock(dp);
8010580c: 8b 45 f4 mov -0xc(%ebp),%eax
8010580f: 89 04 24 mov %eax,(%esp)
80105812: e8 30 c0 ff ff call 80101847 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
80105817: 8d 45 ec lea -0x14(%ebp),%eax
8010581a: 89 44 24 08 mov %eax,0x8(%esp)
8010581e: 8d 45 de lea -0x22(%ebp),%eax
80105821: 89 44 24 04 mov %eax,0x4(%esp)
80105825: 8b 45 f4 mov -0xc(%ebp),%eax
80105828: 89 04 24 mov %eax,(%esp)
8010582b: e8 39 c8 ff ff call 80102069 <dirlookup>
80105830: 89 45 f0 mov %eax,-0x10(%ebp)
80105833: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105837: 74 47 je 80105880 <create+0xb4>
iunlockput(dp);
80105839: 8b 45 f4 mov -0xc(%ebp),%eax
8010583c: 89 04 24 mov %eax,(%esp)
8010583f: e8 87 c2 ff ff call 80101acb <iunlockput>
ilock(ip);
80105844: 8b 45 f0 mov -0x10(%ebp),%eax
80105847: 89 04 24 mov %eax,(%esp)
8010584a: e8 f8 bf ff ff call 80101847 <ilock>
if(type == T_FILE && ip->type == T_FILE)
8010584f: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp)
80105854: 75 15 jne 8010586b <create+0x9f>
80105856: 8b 45 f0 mov -0x10(%ebp),%eax
80105859: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010585d: 66 83 f8 02 cmp $0x2,%ax
80105861: 75 08 jne 8010586b <create+0x9f>
return ip;
80105863: 8b 45 f0 mov -0x10(%ebp),%eax
80105866: e9 1f 01 00 00 jmp 8010598a <create+0x1be>
iunlockput(ip);
8010586b: 8b 45 f0 mov -0x10(%ebp),%eax
8010586e: 89 04 24 mov %eax,(%esp)
80105871: e8 55 c2 ff ff call 80101acb <iunlockput>
return 0;
80105876: b8 00 00 00 00 mov $0x0,%eax
8010587b: e9 0a 01 00 00 jmp 8010598a <create+0x1be>
}
if((ip = ialloc(dp->dev, type)) == 0)
80105880: 0f bf 55 d4 movswl -0x2c(%ebp),%edx
80105884: 8b 45 f4 mov -0xc(%ebp),%eax
80105887: 8b 00 mov (%eax),%eax
80105889: 89 54 24 04 mov %edx,0x4(%esp)
8010588d: 89 04 24 mov %eax,(%esp)
80105890: e8 17 bd ff ff call 801015ac <ialloc>
80105895: 89 45 f0 mov %eax,-0x10(%ebp)
80105898: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010589c: 75 0c jne 801058aa <create+0xde>
panic("create: ialloc");
8010589e: c7 04 24 60 86 10 80 movl $0x80108660,(%esp)
801058a5: e8 90 ac ff ff call 8010053a <panic>
ilock(ip);
801058aa: 8b 45 f0 mov -0x10(%ebp),%eax
801058ad: 89 04 24 mov %eax,(%esp)
801058b0: e8 92 bf ff ff call 80101847 <ilock>
ip->major = major;
801058b5: 8b 45 f0 mov -0x10(%ebp),%eax
801058b8: 0f b7 55 d0 movzwl -0x30(%ebp),%edx
801058bc: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = minor;
801058c0: 8b 45 f0 mov -0x10(%ebp),%eax
801058c3: 0f b7 55 cc movzwl -0x34(%ebp),%edx
801058c7: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = 1;
801058cb: 8b 45 f0 mov -0x10(%ebp),%eax
801058ce: 66 c7 40 16 01 00 movw $0x1,0x16(%eax)
iupdate(ip);
801058d4: 8b 45 f0 mov -0x10(%ebp),%eax
801058d7: 89 04 24 mov %eax,(%esp)
801058da: e8 ac bd ff ff call 8010168b <iupdate>
if(type == T_DIR){ // Create . and .. entries.
801058df: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp)
801058e4: 75 6a jne 80105950 <create+0x184>
dp->nlink++; // for ".."
801058e6: 8b 45 f4 mov -0xc(%ebp),%eax
801058e9: 0f b7 40 16 movzwl 0x16(%eax),%eax
801058ed: 8d 50 01 lea 0x1(%eax),%edx
801058f0: 8b 45 f4 mov -0xc(%ebp),%eax
801058f3: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
801058f7: 8b 45 f4 mov -0xc(%ebp),%eax
801058fa: 89 04 24 mov %eax,(%esp)
801058fd: e8 89 bd ff ff call 8010168b <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
80105902: 8b 45 f0 mov -0x10(%ebp),%eax
80105905: 8b 40 04 mov 0x4(%eax),%eax
80105908: 89 44 24 08 mov %eax,0x8(%esp)
8010590c: c7 44 24 04 3a 86 10 movl $0x8010863a,0x4(%esp)
80105913: 80
80105914: 8b 45 f0 mov -0x10(%ebp),%eax
80105917: 89 04 24 mov %eax,(%esp)
8010591a: e8 13 c8 ff ff call 80102132 <dirlink>
8010591f: 85 c0 test %eax,%eax
80105921: 78 21 js 80105944 <create+0x178>
80105923: 8b 45 f4 mov -0xc(%ebp),%eax
80105926: 8b 40 04 mov 0x4(%eax),%eax
80105929: 89 44 24 08 mov %eax,0x8(%esp)
8010592d: c7 44 24 04 3c 86 10 movl $0x8010863c,0x4(%esp)
80105934: 80
80105935: 8b 45 f0 mov -0x10(%ebp),%eax
80105938: 89 04 24 mov %eax,(%esp)
8010593b: e8 f2 c7 ff ff call 80102132 <dirlink>
80105940: 85 c0 test %eax,%eax
80105942: 79 0c jns 80105950 <create+0x184>
panic("create dots");
80105944: c7 04 24 6f 86 10 80 movl $0x8010866f,(%esp)
8010594b: e8 ea ab ff ff call 8010053a <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
80105950: 8b 45 f0 mov -0x10(%ebp),%eax
80105953: 8b 40 04 mov 0x4(%eax),%eax
80105956: 89 44 24 08 mov %eax,0x8(%esp)
8010595a: 8d 45 de lea -0x22(%ebp),%eax
8010595d: 89 44 24 04 mov %eax,0x4(%esp)
80105961: 8b 45 f4 mov -0xc(%ebp),%eax
80105964: 89 04 24 mov %eax,(%esp)
80105967: e8 c6 c7 ff ff call 80102132 <dirlink>
8010596c: 85 c0 test %eax,%eax
8010596e: 79 0c jns 8010597c <create+0x1b0>
panic("create: dirlink");
80105970: c7 04 24 7b 86 10 80 movl $0x8010867b,(%esp)
80105977: e8 be ab ff ff call 8010053a <panic>
iunlockput(dp);
8010597c: 8b 45 f4 mov -0xc(%ebp),%eax
8010597f: 89 04 24 mov %eax,(%esp)
80105982: e8 44 c1 ff ff call 80101acb <iunlockput>
return ip;
80105987: 8b 45 f0 mov -0x10(%ebp),%eax
}
8010598a: c9 leave
8010598b: c3 ret
8010598c <sys_open>:
int
sys_open(void)
{
8010598c: 55 push %ebp
8010598d: 89 e5 mov %esp,%ebp
8010598f: 83 ec 38 sub $0x38,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80105992: 8d 45 e8 lea -0x18(%ebp),%eax
80105995: 89 44 24 04 mov %eax,0x4(%esp)
80105999: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801059a0: e8 e3 f6 ff ff call 80105088 <argstr>
801059a5: 85 c0 test %eax,%eax
801059a7: 78 17 js 801059c0 <sys_open+0x34>
801059a9: 8d 45 e4 lea -0x1c(%ebp),%eax
801059ac: 89 44 24 04 mov %eax,0x4(%esp)
801059b0: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801059b7: e8 3c f6 ff ff call 80104ff8 <argint>
801059bc: 85 c0 test %eax,%eax
801059be: 79 0a jns 801059ca <sys_open+0x3e>
return -1;
801059c0: b8 ff ff ff ff mov $0xffffffff,%eax
801059c5: e9 48 01 00 00 jmp 80105b12 <sys_open+0x186>
if(omode & O_CREATE){
801059ca: 8b 45 e4 mov -0x1c(%ebp),%eax
801059cd: 25 00 02 00 00 and $0x200,%eax
801059d2: 85 c0 test %eax,%eax
801059d4: 74 40 je 80105a16 <sys_open+0x8a>
begin_trans();
801059d6: e8 f6 d7 ff ff call 801031d1 <begin_trans>
ip = create(path, T_FILE, 0, 0);
801059db: 8b 45 e8 mov -0x18(%ebp),%eax
801059de: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
801059e5: 00
801059e6: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801059ed: 00
801059ee: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
801059f5: 00
801059f6: 89 04 24 mov %eax,(%esp)
801059f9: e8 ce fd ff ff call 801057cc <create>
801059fe: 89 45 f4 mov %eax,-0xc(%ebp)
commit_trans();
80105a01: e8 14 d8 ff ff call 8010321a <commit_trans>
if(ip == 0)
80105a06: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105a0a: 75 5c jne 80105a68 <sys_open+0xdc>
return -1;
80105a0c: b8 ff ff ff ff mov $0xffffffff,%eax
80105a11: e9 fc 00 00 00 jmp 80105b12 <sys_open+0x186>
} else {
if((ip = namei(path)) == 0)
80105a16: 8b 45 e8 mov -0x18(%ebp),%eax
80105a19: 89 04 24 mov %eax,(%esp)
80105a1c: e8 d1 c9 ff ff call 801023f2 <namei>
80105a21: 89 45 f4 mov %eax,-0xc(%ebp)
80105a24: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105a28: 75 0a jne 80105a34 <sys_open+0xa8>
return -1;
80105a2a: b8 ff ff ff ff mov $0xffffffff,%eax
80105a2f: e9 de 00 00 00 jmp 80105b12 <sys_open+0x186>
ilock(ip);
80105a34: 8b 45 f4 mov -0xc(%ebp),%eax
80105a37: 89 04 24 mov %eax,(%esp)
80105a3a: e8 08 be ff ff call 80101847 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
80105a3f: 8b 45 f4 mov -0xc(%ebp),%eax
80105a42: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105a46: 66 83 f8 01 cmp $0x1,%ax
80105a4a: 75 1c jne 80105a68 <sys_open+0xdc>
80105a4c: 8b 45 e4 mov -0x1c(%ebp),%eax
80105a4f: 85 c0 test %eax,%eax
80105a51: 74 15 je 80105a68 <sys_open+0xdc>
iunlockput(ip);
80105a53: 8b 45 f4 mov -0xc(%ebp),%eax
80105a56: 89 04 24 mov %eax,(%esp)
80105a59: e8 6d c0 ff ff call 80101acb <iunlockput>
return -1;
80105a5e: b8 ff ff ff ff mov $0xffffffff,%eax
80105a63: e9 aa 00 00 00 jmp 80105b12 <sys_open+0x186>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80105a68: e8 a5 b4 ff ff call 80100f12 <filealloc>
80105a6d: 89 45 f0 mov %eax,-0x10(%ebp)
80105a70: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105a74: 74 14 je 80105a8a <sys_open+0xfe>
80105a76: 8b 45 f0 mov -0x10(%ebp),%eax
80105a79: 89 04 24 mov %eax,(%esp)
80105a7c: e8 42 f7 ff ff call 801051c3 <fdalloc>
80105a81: 89 45 ec mov %eax,-0x14(%ebp)
80105a84: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80105a88: 79 23 jns 80105aad <sys_open+0x121>
if(f)
80105a8a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105a8e: 74 0b je 80105a9b <sys_open+0x10f>
fileclose(f);
80105a90: 8b 45 f0 mov -0x10(%ebp),%eax
80105a93: 89 04 24 mov %eax,(%esp)
80105a96: e8 1f b5 ff ff call 80100fba <fileclose>
iunlockput(ip);
80105a9b: 8b 45 f4 mov -0xc(%ebp),%eax
80105a9e: 89 04 24 mov %eax,(%esp)
80105aa1: e8 25 c0 ff ff call 80101acb <iunlockput>
return -1;
80105aa6: b8 ff ff ff ff mov $0xffffffff,%eax
80105aab: eb 65 jmp 80105b12 <sys_open+0x186>
}
iunlock(ip);
80105aad: 8b 45 f4 mov -0xc(%ebp),%eax
80105ab0: 89 04 24 mov %eax,(%esp)
80105ab3: e8 dd be ff ff call 80101995 <iunlock>
f->type = FD_INODE;
80105ab8: 8b 45 f0 mov -0x10(%ebp),%eax
80105abb: c7 00 02 00 00 00 movl $0x2,(%eax)
f->ip = ip;
80105ac1: 8b 45 f0 mov -0x10(%ebp),%eax
80105ac4: 8b 55 f4 mov -0xc(%ebp),%edx
80105ac7: 89 50 10 mov %edx,0x10(%eax)
f->off = 0;
80105aca: 8b 45 f0 mov -0x10(%ebp),%eax
80105acd: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
f->readable = !(omode & O_WRONLY);
80105ad4: 8b 45 e4 mov -0x1c(%ebp),%eax
80105ad7: 83 e0 01 and $0x1,%eax
80105ada: 85 c0 test %eax,%eax
80105adc: 0f 94 c0 sete %al
80105adf: 89 c2 mov %eax,%edx
80105ae1: 8b 45 f0 mov -0x10(%ebp),%eax
80105ae4: 88 50 08 mov %dl,0x8(%eax)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
80105ae7: 8b 45 e4 mov -0x1c(%ebp),%eax
80105aea: 83 e0 01 and $0x1,%eax
80105aed: 85 c0 test %eax,%eax
80105aef: 75 0a jne 80105afb <sys_open+0x16f>
80105af1: 8b 45 e4 mov -0x1c(%ebp),%eax
80105af4: 83 e0 02 and $0x2,%eax
80105af7: 85 c0 test %eax,%eax
80105af9: 74 07 je 80105b02 <sys_open+0x176>
80105afb: b8 01 00 00 00 mov $0x1,%eax
80105b00: eb 05 jmp 80105b07 <sys_open+0x17b>
80105b02: b8 00 00 00 00 mov $0x0,%eax
80105b07: 89 c2 mov %eax,%edx
80105b09: 8b 45 f0 mov -0x10(%ebp),%eax
80105b0c: 88 50 09 mov %dl,0x9(%eax)
return fd;
80105b0f: 8b 45 ec mov -0x14(%ebp),%eax
}
80105b12: c9 leave
80105b13: c3 ret
80105b14 <sys_mkdir>:
int
sys_mkdir(void)
{
80105b14: 55 push %ebp
80105b15: 89 e5 mov %esp,%ebp
80105b17: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_trans();
80105b1a: e8 b2 d6 ff ff call 801031d1 <begin_trans>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
80105b1f: 8d 45 f0 lea -0x10(%ebp),%eax
80105b22: 89 44 24 04 mov %eax,0x4(%esp)
80105b26: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105b2d: e8 56 f5 ff ff call 80105088 <argstr>
80105b32: 85 c0 test %eax,%eax
80105b34: 78 2c js 80105b62 <sys_mkdir+0x4e>
80105b36: 8b 45 f0 mov -0x10(%ebp),%eax
80105b39: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
80105b40: 00
80105b41: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80105b48: 00
80105b49: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80105b50: 00
80105b51: 89 04 24 mov %eax,(%esp)
80105b54: e8 73 fc ff ff call 801057cc <create>
80105b59: 89 45 f4 mov %eax,-0xc(%ebp)
80105b5c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105b60: 75 0c jne 80105b6e <sys_mkdir+0x5a>
commit_trans();
80105b62: e8 b3 d6 ff ff call 8010321a <commit_trans>
return -1;
80105b67: b8 ff ff ff ff mov $0xffffffff,%eax
80105b6c: eb 15 jmp 80105b83 <sys_mkdir+0x6f>
}
iunlockput(ip);
80105b6e: 8b 45 f4 mov -0xc(%ebp),%eax
80105b71: 89 04 24 mov %eax,(%esp)
80105b74: e8 52 bf ff ff call 80101acb <iunlockput>
commit_trans();
80105b79: e8 9c d6 ff ff call 8010321a <commit_trans>
return 0;
80105b7e: b8 00 00 00 00 mov $0x0,%eax
}
80105b83: c9 leave
80105b84: c3 ret
80105b85 <sys_mknod>:
int
sys_mknod(void)
{
80105b85: 55 push %ebp
80105b86: 89 e5 mov %esp,%ebp
80105b88: 83 ec 38 sub $0x38,%esp
struct inode *ip;
char *path;
int len;
int major, minor;
begin_trans();
80105b8b: e8 41 d6 ff ff call 801031d1 <begin_trans>
if((len=argstr(0, &path)) < 0 ||
80105b90: 8d 45 ec lea -0x14(%ebp),%eax
80105b93: 89 44 24 04 mov %eax,0x4(%esp)
80105b97: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105b9e: e8 e5 f4 ff ff call 80105088 <argstr>
80105ba3: 89 45 f4 mov %eax,-0xc(%ebp)
80105ba6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105baa: 78 5e js 80105c0a <sys_mknod+0x85>
argint(1, &major) < 0 ||
80105bac: 8d 45 e8 lea -0x18(%ebp),%eax
80105baf: 89 44 24 04 mov %eax,0x4(%esp)
80105bb3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105bba: e8 39 f4 ff ff call 80104ff8 <argint>
char *path;
int len;
int major, minor;
begin_trans();
if((len=argstr(0, &path)) < 0 ||
80105bbf: 85 c0 test %eax,%eax
80105bc1: 78 47 js 80105c0a <sys_mknod+0x85>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105bc3: 8d 45 e4 lea -0x1c(%ebp),%eax
80105bc6: 89 44 24 04 mov %eax,0x4(%esp)
80105bca: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105bd1: e8 22 f4 ff ff call 80104ff8 <argint>
int len;
int major, minor;
begin_trans();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
80105bd6: 85 c0 test %eax,%eax
80105bd8: 78 30 js 80105c0a <sys_mknod+0x85>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
80105bda: 8b 45 e4 mov -0x1c(%ebp),%eax
80105bdd: 0f bf c8 movswl %ax,%ecx
80105be0: 8b 45 e8 mov -0x18(%ebp),%eax
80105be3: 0f bf d0 movswl %ax,%edx
80105be6: 8b 45 ec mov -0x14(%ebp),%eax
int major, minor;
begin_trans();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80105be9: 89 4c 24 0c mov %ecx,0xc(%esp)
80105bed: 89 54 24 08 mov %edx,0x8(%esp)
80105bf1: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80105bf8: 00
80105bf9: 89 04 24 mov %eax,(%esp)
80105bfc: e8 cb fb ff ff call 801057cc <create>
80105c01: 89 45 f0 mov %eax,-0x10(%ebp)
80105c04: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105c08: 75 0c jne 80105c16 <sys_mknod+0x91>
(ip = create(path, T_DEV, major, minor)) == 0){
commit_trans();
80105c0a: e8 0b d6 ff ff call 8010321a <commit_trans>
return -1;
80105c0f: b8 ff ff ff ff mov $0xffffffff,%eax
80105c14: eb 15 jmp 80105c2b <sys_mknod+0xa6>
}
iunlockput(ip);
80105c16: 8b 45 f0 mov -0x10(%ebp),%eax
80105c19: 89 04 24 mov %eax,(%esp)
80105c1c: e8 aa be ff ff call 80101acb <iunlockput>
commit_trans();
80105c21: e8 f4 d5 ff ff call 8010321a <commit_trans>
return 0;
80105c26: b8 00 00 00 00 mov $0x0,%eax
}
80105c2b: c9 leave
80105c2c: c3 ret
80105c2d <sys_chdir>:
int
sys_chdir(void)
{
80105c2d: 55 push %ebp
80105c2e: 89 e5 mov %esp,%ebp
80105c30: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
80105c33: 8d 45 f0 lea -0x10(%ebp),%eax
80105c36: 89 44 24 04 mov %eax,0x4(%esp)
80105c3a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105c41: e8 42 f4 ff ff call 80105088 <argstr>
80105c46: 85 c0 test %eax,%eax
80105c48: 78 14 js 80105c5e <sys_chdir+0x31>
80105c4a: 8b 45 f0 mov -0x10(%ebp),%eax
80105c4d: 89 04 24 mov %eax,(%esp)
80105c50: e8 9d c7 ff ff call 801023f2 <namei>
80105c55: 89 45 f4 mov %eax,-0xc(%ebp)
80105c58: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105c5c: 75 07 jne 80105c65 <sys_chdir+0x38>
return -1;
80105c5e: b8 ff ff ff ff mov $0xffffffff,%eax
80105c63: eb 57 jmp 80105cbc <sys_chdir+0x8f>
ilock(ip);
80105c65: 8b 45 f4 mov -0xc(%ebp),%eax
80105c68: 89 04 24 mov %eax,(%esp)
80105c6b: e8 d7 bb ff ff call 80101847 <ilock>
if(ip->type != T_DIR){
80105c70: 8b 45 f4 mov -0xc(%ebp),%eax
80105c73: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105c77: 66 83 f8 01 cmp $0x1,%ax
80105c7b: 74 12 je 80105c8f <sys_chdir+0x62>
iunlockput(ip);
80105c7d: 8b 45 f4 mov -0xc(%ebp),%eax
80105c80: 89 04 24 mov %eax,(%esp)
80105c83: e8 43 be ff ff call 80101acb <iunlockput>
return -1;
80105c88: b8 ff ff ff ff mov $0xffffffff,%eax
80105c8d: eb 2d jmp 80105cbc <sys_chdir+0x8f>
}
iunlock(ip);
80105c8f: 8b 45 f4 mov -0xc(%ebp),%eax
80105c92: 89 04 24 mov %eax,(%esp)
80105c95: e8 fb bc ff ff call 80101995 <iunlock>
iput(proc->cwd);
80105c9a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105ca0: 8b 40 68 mov 0x68(%eax),%eax
80105ca3: 89 04 24 mov %eax,(%esp)
80105ca6: e8 4f bd ff ff call 801019fa <iput>
proc->cwd = ip;
80105cab: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105cb1: 8b 55 f4 mov -0xc(%ebp),%edx
80105cb4: 89 50 68 mov %edx,0x68(%eax)
return 0;
80105cb7: b8 00 00 00 00 mov $0x0,%eax
}
80105cbc: c9 leave
80105cbd: c3 ret
80105cbe <sys_exec>:
int
sys_exec(void)
{
80105cbe: 55 push %ebp
80105cbf: 89 e5 mov %esp,%ebp
80105cc1: 81 ec a8 00 00 00 sub $0xa8,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
80105cc7: 8d 45 f0 lea -0x10(%ebp),%eax
80105cca: 89 44 24 04 mov %eax,0x4(%esp)
80105cce: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105cd5: e8 ae f3 ff ff call 80105088 <argstr>
80105cda: 85 c0 test %eax,%eax
80105cdc: 78 1a js 80105cf8 <sys_exec+0x3a>
80105cde: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax
80105ce4: 89 44 24 04 mov %eax,0x4(%esp)
80105ce8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105cef: e8 04 f3 ff ff call 80104ff8 <argint>
80105cf4: 85 c0 test %eax,%eax
80105cf6: 79 0a jns 80105d02 <sys_exec+0x44>
return -1;
80105cf8: b8 ff ff ff ff mov $0xffffffff,%eax
80105cfd: e9 c8 00 00 00 jmp 80105dca <sys_exec+0x10c>
}
memset(argv, 0, sizeof(argv));
80105d02: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
80105d09: 00
80105d0a: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105d11: 00
80105d12: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
80105d18: 89 04 24 mov %eax,(%esp)
80105d1b: e8 96 ef ff ff call 80104cb6 <memset>
for(i=0;; i++){
80105d20: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(i >= NELEM(argv))
80105d27: 8b 45 f4 mov -0xc(%ebp),%eax
80105d2a: 83 f8 1f cmp $0x1f,%eax
80105d2d: 76 0a jbe 80105d39 <sys_exec+0x7b>
return -1;
80105d2f: b8 ff ff ff ff mov $0xffffffff,%eax
80105d34: e9 91 00 00 00 jmp 80105dca <sys_exec+0x10c>
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
80105d39: 8b 45 f4 mov -0xc(%ebp),%eax
80105d3c: c1 e0 02 shl $0x2,%eax
80105d3f: 89 c2 mov %eax,%edx
80105d41: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax
80105d47: 01 c2 add %eax,%edx
80105d49: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
80105d4f: 89 44 24 04 mov %eax,0x4(%esp)
80105d53: 89 14 24 mov %edx,(%esp)
80105d56: e8 01 f2 ff ff call 80104f5c <fetchint>
80105d5b: 85 c0 test %eax,%eax
80105d5d: 79 07 jns 80105d66 <sys_exec+0xa8>
return -1;
80105d5f: b8 ff ff ff ff mov $0xffffffff,%eax
80105d64: eb 64 jmp 80105dca <sys_exec+0x10c>
if(uarg == 0){
80105d66: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
80105d6c: 85 c0 test %eax,%eax
80105d6e: 75 26 jne 80105d96 <sys_exec+0xd8>
argv[i] = 0;
80105d70: 8b 45 f4 mov -0xc(%ebp),%eax
80105d73: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4)
80105d7a: 00 00 00 00
break;
80105d7e: 90 nop
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
80105d7f: 8b 45 f0 mov -0x10(%ebp),%eax
80105d82: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx
80105d88: 89 54 24 04 mov %edx,0x4(%esp)
80105d8c: 89 04 24 mov %eax,(%esp)
80105d8f: e8 5b ad ff ff call 80100aef <exec>
80105d94: eb 34 jmp 80105dca <sys_exec+0x10c>
return -1;
if(uarg == 0){
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80105d96: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
80105d9c: 8b 55 f4 mov -0xc(%ebp),%edx
80105d9f: c1 e2 02 shl $0x2,%edx
80105da2: 01 c2 add %eax,%edx
80105da4: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
80105daa: 89 54 24 04 mov %edx,0x4(%esp)
80105dae: 89 04 24 mov %eax,(%esp)
80105db1: e8 e0 f1 ff ff call 80104f96 <fetchstr>
80105db6: 85 c0 test %eax,%eax
80105db8: 79 07 jns 80105dc1 <sys_exec+0x103>
return -1;
80105dba: b8 ff ff ff ff mov $0xffffffff,%eax
80105dbf: eb 09 jmp 80105dca <sys_exec+0x10c>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
80105dc1: 83 45 f4 01 addl $0x1,-0xc(%ebp)
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
80105dc5: e9 5d ff ff ff jmp 80105d27 <sys_exec+0x69>
return exec(path, argv);
}
80105dca: c9 leave
80105dcb: c3 ret
80105dcc <sys_pipe>:
int
sys_pipe(void)
{
80105dcc: 55 push %ebp
80105dcd: 89 e5 mov %esp,%ebp
80105dcf: 83 ec 38 sub $0x38,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
80105dd2: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp)
80105dd9: 00
80105dda: 8d 45 ec lea -0x14(%ebp),%eax
80105ddd: 89 44 24 04 mov %eax,0x4(%esp)
80105de1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105de8: e8 39 f2 ff ff call 80105026 <argptr>
80105ded: 85 c0 test %eax,%eax
80105def: 79 0a jns 80105dfb <sys_pipe+0x2f>
return -1;
80105df1: b8 ff ff ff ff mov $0xffffffff,%eax
80105df6: e9 9b 00 00 00 jmp 80105e96 <sys_pipe+0xca>
if(pipealloc(&rf, &wf) < 0)
80105dfb: 8d 45 e4 lea -0x1c(%ebp),%eax
80105dfe: 89 44 24 04 mov %eax,0x4(%esp)
80105e02: 8d 45 e8 lea -0x18(%ebp),%eax
80105e05: 89 04 24 mov %eax,(%esp)
80105e08: e8 ae dd ff ff call 80103bbb <pipealloc>
80105e0d: 85 c0 test %eax,%eax
80105e0f: 79 07 jns 80105e18 <sys_pipe+0x4c>
return -1;
80105e11: b8 ff ff ff ff mov $0xffffffff,%eax
80105e16: eb 7e jmp 80105e96 <sys_pipe+0xca>
fd0 = -1;
80105e18: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp)
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80105e1f: 8b 45 e8 mov -0x18(%ebp),%eax
80105e22: 89 04 24 mov %eax,(%esp)
80105e25: e8 99 f3 ff ff call 801051c3 <fdalloc>
80105e2a: 89 45 f4 mov %eax,-0xc(%ebp)
80105e2d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105e31: 78 14 js 80105e47 <sys_pipe+0x7b>
80105e33: 8b 45 e4 mov -0x1c(%ebp),%eax
80105e36: 89 04 24 mov %eax,(%esp)
80105e39: e8 85 f3 ff ff call 801051c3 <fdalloc>
80105e3e: 89 45 f0 mov %eax,-0x10(%ebp)
80105e41: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105e45: 79 37 jns 80105e7e <sys_pipe+0xb2>
if(fd0 >= 0)
80105e47: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105e4b: 78 14 js 80105e61 <sys_pipe+0x95>
proc->ofile[fd0] = 0;
80105e4d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105e53: 8b 55 f4 mov -0xc(%ebp),%edx
80105e56: 83 c2 08 add $0x8,%edx
80105e59: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80105e60: 00
fileclose(rf);
80105e61: 8b 45 e8 mov -0x18(%ebp),%eax
80105e64: 89 04 24 mov %eax,(%esp)
80105e67: e8 4e b1 ff ff call 80100fba <fileclose>
fileclose(wf);
80105e6c: 8b 45 e4 mov -0x1c(%ebp),%eax
80105e6f: 89 04 24 mov %eax,(%esp)
80105e72: e8 43 b1 ff ff call 80100fba <fileclose>
return -1;
80105e77: b8 ff ff ff ff mov $0xffffffff,%eax
80105e7c: eb 18 jmp 80105e96 <sys_pipe+0xca>
}
fd[0] = fd0;
80105e7e: 8b 45 ec mov -0x14(%ebp),%eax
80105e81: 8b 55 f4 mov -0xc(%ebp),%edx
80105e84: 89 10 mov %edx,(%eax)
fd[1] = fd1;
80105e86: 8b 45 ec mov -0x14(%ebp),%eax
80105e89: 8d 50 04 lea 0x4(%eax),%edx
80105e8c: 8b 45 f0 mov -0x10(%ebp),%eax
80105e8f: 89 02 mov %eax,(%edx)
return 0;
80105e91: b8 00 00 00 00 mov $0x0,%eax
}
80105e96: c9 leave
80105e97: c3 ret
80105e98 <name_of_inode>:
int
name_of_inode(struct inode *ip, struct inode *parent, char buf[DIRSIZ]) {
80105e98: 55 push %ebp
80105e99: 89 e5 mov %esp,%ebp
80105e9b: 83 ec 38 sub $0x38,%esp
uint off;
struct dirent de;
for (off = 0; off < parent->size; off += sizeof(de)) {
80105e9e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80105ea5: eb 6b jmp 80105f12 <name_of_inode+0x7a>
if (readi(parent, (char*)&de, off, sizeof(de)) != sizeof(de))
80105ea7: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80105eae: 00
80105eaf: 8b 45 f4 mov -0xc(%ebp),%eax
80105eb2: 89 44 24 08 mov %eax,0x8(%esp)
80105eb6: 8d 45 e4 lea -0x1c(%ebp),%eax
80105eb9: 89 44 24 04 mov %eax,0x4(%esp)
80105ebd: 8b 45 0c mov 0xc(%ebp),%eax
80105ec0: 89 04 24 mov %eax,(%esp)
80105ec3: e8 8c be ff ff call 80101d54 <readi>
80105ec8: 83 f8 10 cmp $0x10,%eax
80105ecb: 74 0c je 80105ed9 <name_of_inode+0x41>
panic("couldn't read dir entry");
80105ecd: c7 04 24 8b 86 10 80 movl $0x8010868b,(%esp)
80105ed4: e8 61 a6 ff ff call 8010053a <panic>
if (de.inum == ip->inum) {
80105ed9: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
80105edd: 0f b7 d0 movzwl %ax,%edx
80105ee0: 8b 45 08 mov 0x8(%ebp),%eax
80105ee3: 8b 40 04 mov 0x4(%eax),%eax
80105ee6: 39 c2 cmp %eax,%edx
80105ee8: 75 24 jne 80105f0e <name_of_inode+0x76>
safestrcpy(buf, de.name, DIRSIZ);
80105eea: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80105ef1: 00
80105ef2: 8d 45 e4 lea -0x1c(%ebp),%eax
80105ef5: 83 c0 02 add $0x2,%eax
80105ef8: 89 44 24 04 mov %eax,0x4(%esp)
80105efc: 8b 45 10 mov 0x10(%ebp),%eax
80105eff: 89 04 24 mov %eax,(%esp)
80105f02: e8 cf ef ff ff call 80104ed6 <safestrcpy>
return 0;
80105f07: b8 00 00 00 00 mov $0x0,%eax
80105f0c: eb 14 jmp 80105f22 <name_of_inode+0x8a>
}
int
name_of_inode(struct inode *ip, struct inode *parent, char buf[DIRSIZ]) {
uint off;
struct dirent de;
for (off = 0; off < parent->size; off += sizeof(de)) {
80105f0e: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80105f12: 8b 45 0c mov 0xc(%ebp),%eax
80105f15: 8b 40 18 mov 0x18(%eax),%eax
80105f18: 3b 45 f4 cmp -0xc(%ebp),%eax
80105f1b: 77 8a ja 80105ea7 <name_of_inode+0xf>
if (de.inum == ip->inum) {
safestrcpy(buf, de.name, DIRSIZ);
return 0;
}
}
return -1;
80105f1d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105f22: c9 leave
80105f23: c3 ret
80105f24 <name_for_inode>:
int
name_for_inode(char* buf, int n, struct inode *ip) {
80105f24: 55 push %ebp
80105f25: 89 e5 mov %esp,%ebp
80105f27: 53 push %ebx
80105f28: 83 ec 34 sub $0x34,%esp
int path_offset;
struct inode *parent;
char node_name[DIRSIZ];
if (ip->inum == namei("/")->inum) { //namei is inefficient but iget isn't exported for some reason
80105f2b: 8b 45 10 mov 0x10(%ebp),%eax
80105f2e: 8b 58 04 mov 0x4(%eax),%ebx
80105f31: c7 04 24 a3 86 10 80 movl $0x801086a3,(%esp)
80105f38: e8 b5 c4 ff ff call 801023f2 <namei>
80105f3d: 8b 40 04 mov 0x4(%eax),%eax
80105f40: 39 c3 cmp %eax,%ebx
80105f42: 75 10 jne 80105f54 <name_for_inode+0x30>
buf[0] = '/';
80105f44: 8b 45 08 mov 0x8(%ebp),%eax
80105f47: c6 00 2f movb $0x2f,(%eax)
return 1;
80105f4a: b8 01 00 00 00 mov $0x1,%eax
80105f4f: e9 22 01 00 00 jmp 80106076 <name_for_inode+0x152>
} else if (ip->type == T_DIR) {
80105f54: 8b 45 10 mov 0x10(%ebp),%eax
80105f57: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105f5b: 66 83 f8 01 cmp $0x1,%ax
80105f5f: 0f 85 df 00 00 00 jne 80106044 <name_for_inode+0x120>
parent = dirlookup(ip, "..", 0);
80105f65: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80105f6c: 00
80105f6d: c7 44 24 04 3c 86 10 movl $0x8010863c,0x4(%esp)
80105f74: 80
80105f75: 8b 45 10 mov 0x10(%ebp),%eax
80105f78: 89 04 24 mov %eax,(%esp)
80105f7b: e8 e9 c0 ff ff call 80102069 <dirlookup>
80105f80: 89 45 f4 mov %eax,-0xc(%ebp)
ilock(parent);
80105f83: 8b 45 f4 mov -0xc(%ebp),%eax
80105f86: 89 04 24 mov %eax,(%esp)
80105f89: e8 b9 b8 ff ff call 80101847 <ilock>
if (name_of_inode(ip, parent, node_name)) {
80105f8e: 8d 45 e2 lea -0x1e(%ebp),%eax
80105f91: 89 44 24 08 mov %eax,0x8(%esp)
80105f95: 8b 45 f4 mov -0xc(%ebp),%eax
80105f98: 89 44 24 04 mov %eax,0x4(%esp)
80105f9c: 8b 45 10 mov 0x10(%ebp),%eax
80105f9f: 89 04 24 mov %eax,(%esp)
80105fa2: e8 f1 fe ff ff call 80105e98 <name_of_inode>
80105fa7: 85 c0 test %eax,%eax
80105fa9: 74 0c je 80105fb7 <name_for_inode+0x93>
panic("could not find name of inode in parent!");
80105fab: c7 04 24 a8 86 10 80 movl $0x801086a8,(%esp)
80105fb2: e8 83 a5 ff ff call 8010053a <panic>
}
path_offset = name_for_inode(buf, n, parent);
80105fb7: 8b 45 f4 mov -0xc(%ebp),%eax
80105fba: 89 44 24 08 mov %eax,0x8(%esp)
80105fbe: 8b 45 0c mov 0xc(%ebp),%eax
80105fc1: 89 44 24 04 mov %eax,0x4(%esp)
80105fc5: 8b 45 08 mov 0x8(%ebp),%eax
80105fc8: 89 04 24 mov %eax,(%esp)
80105fcb: e8 54 ff ff ff call 80105f24 <name_for_inode>
80105fd0: 89 45 f0 mov %eax,-0x10(%ebp)
safestrcpy(buf + path_offset, node_name, n - path_offset);
80105fd3: 8b 45 f0 mov -0x10(%ebp),%eax
80105fd6: 8b 55 0c mov 0xc(%ebp),%edx
80105fd9: 29 c2 sub %eax,%edx
80105fdb: 89 d0 mov %edx,%eax
80105fdd: 8b 4d f0 mov -0x10(%ebp),%ecx
80105fe0: 8b 55 08 mov 0x8(%ebp),%edx
80105fe3: 01 ca add %ecx,%edx
80105fe5: 89 44 24 08 mov %eax,0x8(%esp)
80105fe9: 8d 45 e2 lea -0x1e(%ebp),%eax
80105fec: 89 44 24 04 mov %eax,0x4(%esp)
80105ff0: 89 14 24 mov %edx,(%esp)
80105ff3: e8 de ee ff ff call 80104ed6 <safestrcpy>
path_offset += strlen(node_name);
80105ff8: 8d 45 e2 lea -0x1e(%ebp),%eax
80105ffb: 89 04 24 mov %eax,(%esp)
80105ffe: e8 1d ef ff ff call 80104f20 <strlen>
80106003: 01 45 f0 add %eax,-0x10(%ebp)
if (path_offset == n - 1) {
80106006: 8b 45 0c mov 0xc(%ebp),%eax
80106009: 83 e8 01 sub $0x1,%eax
8010600c: 3b 45 f0 cmp -0x10(%ebp),%eax
8010600f: 75 10 jne 80106021 <name_for_inode+0xfd>
buf[path_offset] = '\0';
80106011: 8b 55 f0 mov -0x10(%ebp),%edx
80106014: 8b 45 08 mov 0x8(%ebp),%eax
80106017: 01 d0 add %edx,%eax
80106019: c6 00 00 movb $0x0,(%eax)
return n;
8010601c: 8b 45 0c mov 0xc(%ebp),%eax
8010601f: eb 55 jmp 80106076 <name_for_inode+0x152>
} else {
buf[path_offset++] = '/';
80106021: 8b 45 f0 mov -0x10(%ebp),%eax
80106024: 8d 50 01 lea 0x1(%eax),%edx
80106027: 89 55 f0 mov %edx,-0x10(%ebp)
8010602a: 89 c2 mov %eax,%edx
8010602c: 8b 45 08 mov 0x8(%ebp),%eax
8010602f: 01 d0 add %edx,%eax
80106031: c6 00 2f movb $0x2f,(%eax)
}
iput(parent); //free
80106034: 8b 45 f4 mov -0xc(%ebp),%eax
80106037: 89 04 24 mov %eax,(%esp)
8010603a: e8 bb b9 ff ff call 801019fa <iput>
return path_offset;
8010603f: 8b 45 f0 mov -0x10(%ebp),%eax
80106042: eb 32 jmp 80106076 <name_for_inode+0x152>
} else if (ip->type == T_DEV || ip->type == T_FILE) {
80106044: 8b 45 10 mov 0x10(%ebp),%eax
80106047: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010604b: 66 83 f8 03 cmp $0x3,%ax
8010604f: 74 0d je 8010605e <name_for_inode+0x13a>
80106051: 8b 45 10 mov 0x10(%ebp),%eax
80106054: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106058: 66 83 f8 02 cmp $0x2,%ax
8010605c: 75 0c jne 8010606a <name_for_inode+0x146>
panic("process cwd is a device node / file, not a directory!");
8010605e: c7 04 24 d0 86 10 80 movl $0x801086d0,(%esp)
80106065: e8 d0 a4 ff ff call 8010053a <panic>
} else {
panic("unknown inode type");
8010606a: c7 04 24 06 87 10 80 movl $0x80108706,(%esp)
80106071: e8 c4 a4 ff ff call 8010053a <panic>
}
}
80106076: 83 c4 34 add $0x34,%esp
80106079: 5b pop %ebx
8010607a: 5d pop %ebp
8010607b: c3 ret
8010607c <sys_getcwd>:
int
sys_getcwd(void)
{
8010607c: 55 push %ebp
8010607d: 89 e5 mov %esp,%ebp
8010607f: 83 ec 28 sub $0x28,%esp
char *p;
int n;
if(argint(1, &n) < 0 || argptr(0, &p, n) < 0)
80106082: 8d 45 f0 lea -0x10(%ebp),%eax
80106085: 89 44 24 04 mov %eax,0x4(%esp)
80106089: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80106090: e8 63 ef ff ff call 80104ff8 <argint>
80106095: 85 c0 test %eax,%eax
80106097: 78 1e js 801060b7 <sys_getcwd+0x3b>
80106099: 8b 45 f0 mov -0x10(%ebp),%eax
8010609c: 89 44 24 08 mov %eax,0x8(%esp)
801060a0: 8d 45 f4 lea -0xc(%ebp),%eax
801060a3: 89 44 24 04 mov %eax,0x4(%esp)
801060a7: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801060ae: e8 73 ef ff ff call 80105026 <argptr>
801060b3: 85 c0 test %eax,%eax
801060b5: 79 07 jns 801060be <sys_getcwd+0x42>
return -1;
801060b7: b8 ff ff ff ff mov $0xffffffff,%eax
801060bc: eb 1f jmp 801060dd <sys_getcwd+0x61>
return name_for_inode(p, n, proc->cwd);
801060be: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801060c4: 8b 48 68 mov 0x68(%eax),%ecx
801060c7: 8b 55 f0 mov -0x10(%ebp),%edx
801060ca: 8b 45 f4 mov -0xc(%ebp),%eax
801060cd: 89 4c 24 08 mov %ecx,0x8(%esp)
801060d1: 89 54 24 04 mov %edx,0x4(%esp)
801060d5: 89 04 24 mov %eax,(%esp)
801060d8: e8 47 fe ff ff call 80105f24 <name_for_inode>
}
801060dd: c9 leave
801060de: c3 ret
801060df <sys_fork>:
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
801060df: 55 push %ebp
801060e0: 89 e5 mov %esp,%ebp
801060e2: 83 ec 08 sub $0x8,%esp
return fork();
801060e5: e8 7c e1 ff ff call 80104266 <fork>
}
801060ea: c9 leave
801060eb: c3 ret
801060ec <sys_exit>:
int
sys_exit(void)
{
801060ec: 55 push %ebp
801060ed: 89 e5 mov %esp,%ebp
801060ef: 83 ec 08 sub $0x8,%esp
exit();
801060f2: e8 d2 e2 ff ff call 801043c9 <exit>
return 0; // not reached
801060f7: b8 00 00 00 00 mov $0x0,%eax
}
801060fc: c9 leave
801060fd: c3 ret
801060fe <sys_wait>:
int
sys_wait(void)
{
801060fe: 55 push %ebp
801060ff: 89 e5 mov %esp,%ebp
80106101: 83 ec 08 sub $0x8,%esp
return wait();
80106104: e8 d8 e3 ff ff call 801044e1 <wait>
}
80106109: c9 leave
8010610a: c3 ret
8010610b <sys_kill>:
int
sys_kill(void)
{
8010610b: 55 push %ebp
8010610c: 89 e5 mov %esp,%ebp
8010610e: 83 ec 28 sub $0x28,%esp
int pid;
if(argint(0, &pid) < 0)
80106111: 8d 45 f4 lea -0xc(%ebp),%eax
80106114: 89 44 24 04 mov %eax,0x4(%esp)
80106118: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010611f: e8 d4 ee ff ff call 80104ff8 <argint>
80106124: 85 c0 test %eax,%eax
80106126: 79 07 jns 8010612f <sys_kill+0x24>
return -1;
80106128: b8 ff ff ff ff mov $0xffffffff,%eax
8010612d: eb 0b jmp 8010613a <sys_kill+0x2f>
return kill(pid);
8010612f: 8b 45 f4 mov -0xc(%ebp),%eax
80106132: 89 04 24 mov %eax,(%esp)
80106135: e8 62 e7 ff ff call 8010489c <kill>
}
8010613a: c9 leave
8010613b: c3 ret
8010613c <sys_getpid>:
int
sys_getpid(void)
{
8010613c: 55 push %ebp
8010613d: 89 e5 mov %esp,%ebp
return proc->pid;
8010613f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106145: 8b 40 10 mov 0x10(%eax),%eax
}
80106148: 5d pop %ebp
80106149: c3 ret
8010614a <sys_sbrk>:
int
sys_sbrk(void)
{
8010614a: 55 push %ebp
8010614b: 89 e5 mov %esp,%ebp
8010614d: 83 ec 28 sub $0x28,%esp
int addr;
int n;
if(argint(0, &n) < 0)
80106150: 8d 45 f0 lea -0x10(%ebp),%eax
80106153: 89 44 24 04 mov %eax,0x4(%esp)
80106157: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010615e: e8 95 ee ff ff call 80104ff8 <argint>
80106163: 85 c0 test %eax,%eax
80106165: 79 07 jns 8010616e <sys_sbrk+0x24>
return -1;
80106167: b8 ff ff ff ff mov $0xffffffff,%eax
8010616c: eb 24 jmp 80106192 <sys_sbrk+0x48>
addr = proc->sz;
8010616e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106174: 8b 00 mov (%eax),%eax
80106176: 89 45 f4 mov %eax,-0xc(%ebp)
if(growproc(n) < 0)
80106179: 8b 45 f0 mov -0x10(%ebp),%eax
8010617c: 89 04 24 mov %eax,(%esp)
8010617f: e8 3d e0 ff ff call 801041c1 <growproc>
80106184: 85 c0 test %eax,%eax
80106186: 79 07 jns 8010618f <sys_sbrk+0x45>
return -1;
80106188: b8 ff ff ff ff mov $0xffffffff,%eax
8010618d: eb 03 jmp 80106192 <sys_sbrk+0x48>
return addr;
8010618f: 8b 45 f4 mov -0xc(%ebp),%eax
}
80106192: c9 leave
80106193: c3 ret
80106194 <sys_sleep>:
int
sys_sleep(void)
{
80106194: 55 push %ebp
80106195: 89 e5 mov %esp,%ebp
80106197: 83 ec 28 sub $0x28,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
8010619a: 8d 45 f0 lea -0x10(%ebp),%eax
8010619d: 89 44 24 04 mov %eax,0x4(%esp)
801061a1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801061a8: e8 4b ee ff ff call 80104ff8 <argint>
801061ad: 85 c0 test %eax,%eax
801061af: 79 07 jns 801061b8 <sys_sleep+0x24>
return -1;
801061b1: b8 ff ff ff ff mov $0xffffffff,%eax
801061b6: eb 6c jmp 80106224 <sys_sleep+0x90>
acquire(&tickslock);
801061b8: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
801061bf: e8 9e e8 ff ff call 80104a62 <acquire>
ticks0 = ticks;
801061c4: a1 a0 26 11 80 mov 0x801126a0,%eax
801061c9: 89 45 f4 mov %eax,-0xc(%ebp)
while(ticks - ticks0 < n){
801061cc: eb 34 jmp 80106202 <sys_sleep+0x6e>
if(proc->killed){
801061ce: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801061d4: 8b 40 24 mov 0x24(%eax),%eax
801061d7: 85 c0 test %eax,%eax
801061d9: 74 13 je 801061ee <sys_sleep+0x5a>
release(&tickslock);
801061db: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
801061e2: e8 dd e8 ff ff call 80104ac4 <release>
return -1;
801061e7: b8 ff ff ff ff mov $0xffffffff,%eax
801061ec: eb 36 jmp 80106224 <sys_sleep+0x90>
}
sleep(&ticks, &tickslock);
801061ee: c7 44 24 04 60 1e 11 movl $0x80111e60,0x4(%esp)
801061f5: 80
801061f6: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
801061fd: e8 96 e5 ff ff call 80104798 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
80106202: a1 a0 26 11 80 mov 0x801126a0,%eax
80106207: 2b 45 f4 sub -0xc(%ebp),%eax
8010620a: 89 c2 mov %eax,%edx
8010620c: 8b 45 f0 mov -0x10(%ebp),%eax
8010620f: 39 c2 cmp %eax,%edx
80106211: 72 bb jb 801061ce <sys_sleep+0x3a>
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80106213: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
8010621a: e8 a5 e8 ff ff call 80104ac4 <release>
return 0;
8010621f: b8 00 00 00 00 mov $0x0,%eax
}
80106224: c9 leave
80106225: c3 ret
80106226 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
80106226: 55 push %ebp
80106227: 89 e5 mov %esp,%ebp
80106229: 83 ec 28 sub $0x28,%esp
uint xticks;
acquire(&tickslock);
8010622c: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
80106233: e8 2a e8 ff ff call 80104a62 <acquire>
xticks = ticks;
80106238: a1 a0 26 11 80 mov 0x801126a0,%eax
8010623d: 89 45 f4 mov %eax,-0xc(%ebp)
release(&tickslock);
80106240: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
80106247: e8 78 e8 ff ff call 80104ac4 <release>
return xticks;
8010624c: 8b 45 f4 mov -0xc(%ebp),%eax
}
8010624f: c9 leave
80106250: c3 ret
80106251 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106251: 55 push %ebp
80106252: 89 e5 mov %esp,%ebp
80106254: 83 ec 08 sub $0x8,%esp
80106257: 8b 55 08 mov 0x8(%ebp),%edx
8010625a: 8b 45 0c mov 0xc(%ebp),%eax
8010625d: 66 89 55 fc mov %dx,-0x4(%ebp)
80106261: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106264: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80106268: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010626c: ee out %al,(%dx)
}
8010626d: c9 leave
8010626e: c3 ret
8010626f <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
8010626f: 55 push %ebp
80106270: 89 e5 mov %esp,%ebp
80106272: 83 ec 18 sub $0x18,%esp
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80106275: c7 44 24 04 34 00 00 movl $0x34,0x4(%esp)
8010627c: 00
8010627d: c7 04 24 43 00 00 00 movl $0x43,(%esp)
80106284: e8 c8 ff ff ff call 80106251 <outb>
outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106289: c7 44 24 04 9c 00 00 movl $0x9c,0x4(%esp)
80106290: 00
80106291: c7 04 24 40 00 00 00 movl $0x40,(%esp)
80106298: e8 b4 ff ff ff call 80106251 <outb>
outb(IO_TIMER1, TIMER_DIV(100) / 256);
8010629d: c7 44 24 04 2e 00 00 movl $0x2e,0x4(%esp)
801062a4: 00
801062a5: c7 04 24 40 00 00 00 movl $0x40,(%esp)
801062ac: e8 a0 ff ff ff call 80106251 <outb>
picenable(IRQ_TIMER);
801062b1: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801062b8: e8 91 d7 ff ff call 80103a4e <picenable>
}
801062bd: c9 leave
801062be: c3 ret
801062bf <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
801062bf: 1e push %ds
pushl %es
801062c0: 06 push %es
pushl %fs
801062c1: 0f a0 push %fs
pushl %gs
801062c3: 0f a8 push %gs
pushal
801062c5: 60 pusha
# Set up data and per-cpu segments.
movw $(SEG_KDATA<<3), %ax
801062c6: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
801062ca: 8e d8 mov %eax,%ds
movw %ax, %es
801062cc: 8e c0 mov %eax,%es
movw $(SEG_KCPU<<3), %ax
801062ce: 66 b8 18 00 mov $0x18,%ax
movw %ax, %fs
801062d2: 8e e0 mov %eax,%fs
movw %ax, %gs
801062d4: 8e e8 mov %eax,%gs
# Call trap(tf), where tf=%esp
pushl %esp
801062d6: 54 push %esp
call trap
801062d7: e8 d8 01 00 00 call 801064b4 <trap>
addl $4, %esp
801062dc: 83 c4 04 add $0x4,%esp
801062df <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
801062df: 61 popa
popl %gs
801062e0: 0f a9 pop %gs
popl %fs
801062e2: 0f a1 pop %fs
popl %es
801062e4: 07 pop %es
popl %ds
801062e5: 1f pop %ds
addl $0x8, %esp # trapno and errcode
801062e6: 83 c4 08 add $0x8,%esp
iret
801062e9: cf iret
801062ea <lidt>:
struct gatedesc;
static inline void
lidt(struct gatedesc *p, int size)
{
801062ea: 55 push %ebp
801062eb: 89 e5 mov %esp,%ebp
801062ed: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
801062f0: 8b 45 0c mov 0xc(%ebp),%eax
801062f3: 83 e8 01 sub $0x1,%eax
801062f6: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
801062fa: 8b 45 08 mov 0x8(%ebp),%eax
801062fd: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80106301: 8b 45 08 mov 0x8(%ebp),%eax
80106304: c1 e8 10 shr $0x10,%eax
80106307: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
8010630b: 8d 45 fa lea -0x6(%ebp),%eax
8010630e: 0f 01 18 lidtl (%eax)
}
80106311: c9 leave
80106312: c3 ret
80106313 <rcr2>:
return result;
}
static inline uint
rcr2(void)
{
80106313: 55 push %ebp
80106314: 89 e5 mov %esp,%ebp
80106316: 83 ec 10 sub $0x10,%esp
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
80106319: 0f 20 d0 mov %cr2,%eax
8010631c: 89 45 fc mov %eax,-0x4(%ebp)
return val;
8010631f: 8b 45 fc mov -0x4(%ebp),%eax
}
80106322: c9 leave
80106323: c3 ret
80106324 <tvinit>:
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
80106324: 55 push %ebp
80106325: 89 e5 mov %esp,%ebp
80106327: 83 ec 28 sub $0x28,%esp
int i;
for(i = 0; i < 256; i++)
8010632a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80106331: e9 c3 00 00 00 jmp 801063f9 <tvinit+0xd5>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80106336: 8b 45 f4 mov -0xc(%ebp),%eax
80106339: 8b 04 85 9c b0 10 80 mov -0x7fef4f64(,%eax,4),%eax
80106340: 89 c2 mov %eax,%edx
80106342: 8b 45 f4 mov -0xc(%ebp),%eax
80106345: 66 89 14 c5 a0 1e 11 mov %dx,-0x7feee160(,%eax,8)
8010634c: 80
8010634d: 8b 45 f4 mov -0xc(%ebp),%eax
80106350: 66 c7 04 c5 a2 1e 11 movw $0x8,-0x7feee15e(,%eax,8)
80106357: 80 08 00
8010635a: 8b 45 f4 mov -0xc(%ebp),%eax
8010635d: 0f b6 14 c5 a4 1e 11 movzbl -0x7feee15c(,%eax,8),%edx
80106364: 80
80106365: 83 e2 e0 and $0xffffffe0,%edx
80106368: 88 14 c5 a4 1e 11 80 mov %dl,-0x7feee15c(,%eax,8)
8010636f: 8b 45 f4 mov -0xc(%ebp),%eax
80106372: 0f b6 14 c5 a4 1e 11 movzbl -0x7feee15c(,%eax,8),%edx
80106379: 80
8010637a: 83 e2 1f and $0x1f,%edx
8010637d: 88 14 c5 a4 1e 11 80 mov %dl,-0x7feee15c(,%eax,8)
80106384: 8b 45 f4 mov -0xc(%ebp),%eax
80106387: 0f b6 14 c5 a5 1e 11 movzbl -0x7feee15b(,%eax,8),%edx
8010638e: 80
8010638f: 83 e2 f0 and $0xfffffff0,%edx
80106392: 83 ca 0e or $0xe,%edx
80106395: 88 14 c5 a5 1e 11 80 mov %dl,-0x7feee15b(,%eax,8)
8010639c: 8b 45 f4 mov -0xc(%ebp),%eax
8010639f: 0f b6 14 c5 a5 1e 11 movzbl -0x7feee15b(,%eax,8),%edx
801063a6: 80
801063a7: 83 e2 ef and $0xffffffef,%edx
801063aa: 88 14 c5 a5 1e 11 80 mov %dl,-0x7feee15b(,%eax,8)
801063b1: 8b 45 f4 mov -0xc(%ebp),%eax
801063b4: 0f b6 14 c5 a5 1e 11 movzbl -0x7feee15b(,%eax,8),%edx
801063bb: 80
801063bc: 83 e2 9f and $0xffffff9f,%edx
801063bf: 88 14 c5 a5 1e 11 80 mov %dl,-0x7feee15b(,%eax,8)
801063c6: 8b 45 f4 mov -0xc(%ebp),%eax
801063c9: 0f b6 14 c5 a5 1e 11 movzbl -0x7feee15b(,%eax,8),%edx
801063d0: 80
801063d1: 83 ca 80 or $0xffffff80,%edx
801063d4: 88 14 c5 a5 1e 11 80 mov %dl,-0x7feee15b(,%eax,8)
801063db: 8b 45 f4 mov -0xc(%ebp),%eax
801063de: 8b 04 85 9c b0 10 80 mov -0x7fef4f64(,%eax,4),%eax
801063e5: c1 e8 10 shr $0x10,%eax
801063e8: 89 c2 mov %eax,%edx
801063ea: 8b 45 f4 mov -0xc(%ebp),%eax
801063ed: 66 89 14 c5 a6 1e 11 mov %dx,-0x7feee15a(,%eax,8)
801063f4: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
801063f5: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801063f9: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp)
80106400: 0f 8e 30 ff ff ff jle 80106336 <tvinit+0x12>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
80106406: a1 9c b1 10 80 mov 0x8010b19c,%eax
8010640b: 66 a3 a0 20 11 80 mov %ax,0x801120a0
80106411: 66 c7 05 a2 20 11 80 movw $0x8,0x801120a2
80106418: 08 00
8010641a: 0f b6 05 a4 20 11 80 movzbl 0x801120a4,%eax
80106421: 83 e0 e0 and $0xffffffe0,%eax
80106424: a2 a4 20 11 80 mov %al,0x801120a4
80106429: 0f b6 05 a4 20 11 80 movzbl 0x801120a4,%eax
80106430: 83 e0 1f and $0x1f,%eax
80106433: a2 a4 20 11 80 mov %al,0x801120a4
80106438: 0f b6 05 a5 20 11 80 movzbl 0x801120a5,%eax
8010643f: 83 c8 0f or $0xf,%eax
80106442: a2 a5 20 11 80 mov %al,0x801120a5
80106447: 0f b6 05 a5 20 11 80 movzbl 0x801120a5,%eax
8010644e: 83 e0 ef and $0xffffffef,%eax
80106451: a2 a5 20 11 80 mov %al,0x801120a5
80106456: 0f b6 05 a5 20 11 80 movzbl 0x801120a5,%eax
8010645d: 83 c8 60 or $0x60,%eax
80106460: a2 a5 20 11 80 mov %al,0x801120a5
80106465: 0f b6 05 a5 20 11 80 movzbl 0x801120a5,%eax
8010646c: 83 c8 80 or $0xffffff80,%eax
8010646f: a2 a5 20 11 80 mov %al,0x801120a5
80106474: a1 9c b1 10 80 mov 0x8010b19c,%eax
80106479: c1 e8 10 shr $0x10,%eax
8010647c: 66 a3 a6 20 11 80 mov %ax,0x801120a6
initlock(&tickslock, "time");
80106482: c7 44 24 04 1c 87 10 movl $0x8010871c,0x4(%esp)
80106489: 80
8010648a: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
80106491: e8 ab e5 ff ff call 80104a41 <initlock>
}
80106496: c9 leave
80106497: c3 ret
80106498 <idtinit>:
void
idtinit(void)
{
80106498: 55 push %ebp
80106499: 89 e5 mov %esp,%ebp
8010649b: 83 ec 08 sub $0x8,%esp
lidt(idt, sizeof(idt));
8010649e: c7 44 24 04 00 08 00 movl $0x800,0x4(%esp)
801064a5: 00
801064a6: c7 04 24 a0 1e 11 80 movl $0x80111ea0,(%esp)
801064ad: e8 38 fe ff ff call 801062ea <lidt>
}
801064b2: c9 leave
801064b3: c3 ret
801064b4 <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
801064b4: 55 push %ebp
801064b5: 89 e5 mov %esp,%ebp
801064b7: 57 push %edi
801064b8: 56 push %esi
801064b9: 53 push %ebx
801064ba: 83 ec 3c sub $0x3c,%esp
if(tf->trapno == T_SYSCALL){
801064bd: 8b 45 08 mov 0x8(%ebp),%eax
801064c0: 8b 40 30 mov 0x30(%eax),%eax
801064c3: 83 f8 40 cmp $0x40,%eax
801064c6: 75 3f jne 80106507 <trap+0x53>
if(proc->killed)
801064c8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801064ce: 8b 40 24 mov 0x24(%eax),%eax
801064d1: 85 c0 test %eax,%eax
801064d3: 74 05 je 801064da <trap+0x26>
exit();
801064d5: e8 ef de ff ff call 801043c9 <exit>
proc->tf = tf;
801064da: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801064e0: 8b 55 08 mov 0x8(%ebp),%edx
801064e3: 89 50 18 mov %edx,0x18(%eax)
syscall();
801064e6: e8 d4 eb ff ff call 801050bf <syscall>
if(proc->killed)
801064eb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801064f1: 8b 40 24 mov 0x24(%eax),%eax
801064f4: 85 c0 test %eax,%eax
801064f6: 74 0a je 80106502 <trap+0x4e>
exit();
801064f8: e8 cc de ff ff call 801043c9 <exit>
return;
801064fd: e9 2d 02 00 00 jmp 8010672f <trap+0x27b>
80106502: e9 28 02 00 00 jmp 8010672f <trap+0x27b>
}
switch(tf->trapno){
80106507: 8b 45 08 mov 0x8(%ebp),%eax
8010650a: 8b 40 30 mov 0x30(%eax),%eax
8010650d: 83 e8 20 sub $0x20,%eax
80106510: 83 f8 1f cmp $0x1f,%eax
80106513: 0f 87 bc 00 00 00 ja 801065d5 <trap+0x121>
80106519: 8b 04 85 c4 87 10 80 mov -0x7fef783c(,%eax,4),%eax
80106520: ff e0 jmp *%eax
case T_IRQ0 + IRQ_TIMER:
if(cpu->id == 0){
80106522: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106528: 0f b6 00 movzbl (%eax),%eax
8010652b: 84 c0 test %al,%al
8010652d: 75 31 jne 80106560 <trap+0xac>
acquire(&tickslock);
8010652f: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
80106536: e8 27 e5 ff ff call 80104a62 <acquire>
ticks++;
8010653b: a1 a0 26 11 80 mov 0x801126a0,%eax
80106540: 83 c0 01 add $0x1,%eax
80106543: a3 a0 26 11 80 mov %eax,0x801126a0
wakeup(&ticks);
80106548: c7 04 24 a0 26 11 80 movl $0x801126a0,(%esp)
8010654f: e8 1d e3 ff ff call 80104871 <wakeup>
release(&tickslock);
80106554: c7 04 24 60 1e 11 80 movl $0x80111e60,(%esp)
8010655b: e8 64 e5 ff ff call 80104ac4 <release>
}
lapiceoi();
80106560: e8 3a c9 ff ff call 80102e9f <lapiceoi>
break;
80106565: e9 41 01 00 00 jmp 801066ab <trap+0x1f7>
case T_IRQ0 + IRQ_IDE:
ideintr();
8010656a: e8 5b c1 ff ff call 801026ca <ideintr>
lapiceoi();
8010656f: e8 2b c9 ff ff call 80102e9f <lapiceoi>
break;
80106574: e9 32 01 00 00 jmp 801066ab <trap+0x1f7>
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80106579: e8 0d c7 ff ff call 80102c8b <kbdintr>
lapiceoi();
8010657e: e8 1c c9 ff ff call 80102e9f <lapiceoi>
break;
80106583: e9 23 01 00 00 jmp 801066ab <trap+0x1f7>
case T_IRQ0 + IRQ_COM1:
uartintr();
80106588: e8 97 03 00 00 call 80106924 <uartintr>
lapiceoi();
8010658d: e8 0d c9 ff ff call 80102e9f <lapiceoi>
break;
80106592: e9 14 01 00 00 jmp 801066ab <trap+0x1f7>
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106597: 8b 45 08 mov 0x8(%ebp),%eax
8010659a: 8b 48 38 mov 0x38(%eax),%ecx
cpu->id, tf->cs, tf->eip);
8010659d: 8b 45 08 mov 0x8(%ebp),%eax
801065a0: 0f b7 40 3c movzwl 0x3c(%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801065a4: 0f b7 d0 movzwl %ax,%edx
cpu->id, tf->cs, tf->eip);
801065a7: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801065ad: 0f b6 00 movzbl (%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
801065b0: 0f b6 c0 movzbl %al,%eax
801065b3: 89 4c 24 0c mov %ecx,0xc(%esp)
801065b7: 89 54 24 08 mov %edx,0x8(%esp)
801065bb: 89 44 24 04 mov %eax,0x4(%esp)
801065bf: c7 04 24 24 87 10 80 movl $0x80108724,(%esp)
801065c6: e8 d5 9d ff ff call 801003a0 <cprintf>
cpu->id, tf->cs, tf->eip);
lapiceoi();
801065cb: e8 cf c8 ff ff call 80102e9f <lapiceoi>
break;
801065d0: e9 d6 00 00 00 jmp 801066ab <trap+0x1f7>
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
801065d5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801065db: 85 c0 test %eax,%eax
801065dd: 74 11 je 801065f0 <trap+0x13c>
801065df: 8b 45 08 mov 0x8(%ebp),%eax
801065e2: 0f b7 40 3c movzwl 0x3c(%eax),%eax
801065e6: 0f b7 c0 movzwl %ax,%eax
801065e9: 83 e0 03 and $0x3,%eax
801065ec: 85 c0 test %eax,%eax
801065ee: 75 46 jne 80106636 <trap+0x182>
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
801065f0: e8 1e fd ff ff call 80106313 <rcr2>
801065f5: 8b 55 08 mov 0x8(%ebp),%edx
801065f8: 8b 5a 38 mov 0x38(%edx),%ebx
tf->trapno, cpu->id, tf->eip, rcr2());
801065fb: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80106602: 0f b6 12 movzbl (%edx),%edx
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106605: 0f b6 ca movzbl %dl,%ecx
80106608: 8b 55 08 mov 0x8(%ebp),%edx
8010660b: 8b 52 30 mov 0x30(%edx),%edx
8010660e: 89 44 24 10 mov %eax,0x10(%esp)
80106612: 89 5c 24 0c mov %ebx,0xc(%esp)
80106616: 89 4c 24 08 mov %ecx,0x8(%esp)
8010661a: 89 54 24 04 mov %edx,0x4(%esp)
8010661e: c7 04 24 48 87 10 80 movl $0x80108748,(%esp)
80106625: e8 76 9d ff ff call 801003a0 <cprintf>
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
8010662a: c7 04 24 7a 87 10 80 movl $0x8010877a,(%esp)
80106631: e8 04 9f ff ff call 8010053a <panic>
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80106636: e8 d8 fc ff ff call 80106313 <rcr2>
8010663b: 89 c2 mov %eax,%edx
8010663d: 8b 45 08 mov 0x8(%ebp),%eax
80106640: 8b 78 38 mov 0x38(%eax),%edi
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106643: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106649: 0f b6 00 movzbl (%eax),%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
8010664c: 0f b6 f0 movzbl %al,%esi
8010664f: 8b 45 08 mov 0x8(%ebp),%eax
80106652: 8b 58 34 mov 0x34(%eax),%ebx
80106655: 8b 45 08 mov 0x8(%ebp),%eax
80106658: 8b 48 30 mov 0x30(%eax),%ecx
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
8010665b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106661: 83 c0 6c add $0x6c,%eax
80106664: 89 45 e4 mov %eax,-0x1c(%ebp)
80106667: 65 a1 04 00 00 00 mov %gs:0x4,%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
8010666d: 8b 40 10 mov 0x10(%eax),%eax
80106670: 89 54 24 1c mov %edx,0x1c(%esp)
80106674: 89 7c 24 18 mov %edi,0x18(%esp)
80106678: 89 74 24 14 mov %esi,0x14(%esp)
8010667c: 89 5c 24 10 mov %ebx,0x10(%esp)
80106680: 89 4c 24 0c mov %ecx,0xc(%esp)
80106684: 8b 75 e4 mov -0x1c(%ebp),%esi
80106687: 89 74 24 08 mov %esi,0x8(%esp)
8010668b: 89 44 24 04 mov %eax,0x4(%esp)
8010668f: c7 04 24 80 87 10 80 movl $0x80108780,(%esp)
80106696: e8 05 9d ff ff call 801003a0 <cprintf>
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
rcr2());
proc->killed = 1;
8010669b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066a1: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
801066a8: eb 01 jmp 801066ab <trap+0x1f7>
ideintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
801066aa: 90 nop
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
801066ab: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066b1: 85 c0 test %eax,%eax
801066b3: 74 24 je 801066d9 <trap+0x225>
801066b5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066bb: 8b 40 24 mov 0x24(%eax),%eax
801066be: 85 c0 test %eax,%eax
801066c0: 74 17 je 801066d9 <trap+0x225>
801066c2: 8b 45 08 mov 0x8(%ebp),%eax
801066c5: 0f b7 40 3c movzwl 0x3c(%eax),%eax
801066c9: 0f b7 c0 movzwl %ax,%eax
801066cc: 83 e0 03 and $0x3,%eax
801066cf: 83 f8 03 cmp $0x3,%eax
801066d2: 75 05 jne 801066d9 <trap+0x225>
exit();
801066d4: e8 f0 dc ff ff call 801043c9 <exit>
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
801066d9: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066df: 85 c0 test %eax,%eax
801066e1: 74 1e je 80106701 <trap+0x24d>
801066e3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801066e9: 8b 40 0c mov 0xc(%eax),%eax
801066ec: 83 f8 04 cmp $0x4,%eax
801066ef: 75 10 jne 80106701 <trap+0x24d>
801066f1: 8b 45 08 mov 0x8(%ebp),%eax
801066f4: 8b 40 30 mov 0x30(%eax),%eax
801066f7: 83 f8 20 cmp $0x20,%eax
801066fa: 75 05 jne 80106701 <trap+0x24d>
yield();
801066fc: e8 39 e0 ff ff call 8010473a <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80106701: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106707: 85 c0 test %eax,%eax
80106709: 74 24 je 8010672f <trap+0x27b>
8010670b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106711: 8b 40 24 mov 0x24(%eax),%eax
80106714: 85 c0 test %eax,%eax
80106716: 74 17 je 8010672f <trap+0x27b>
80106718: 8b 45 08 mov 0x8(%ebp),%eax
8010671b: 0f b7 40 3c movzwl 0x3c(%eax),%eax
8010671f: 0f b7 c0 movzwl %ax,%eax
80106722: 83 e0 03 and $0x3,%eax
80106725: 83 f8 03 cmp $0x3,%eax
80106728: 75 05 jne 8010672f <trap+0x27b>
exit();
8010672a: e8 9a dc ff ff call 801043c9 <exit>
}
8010672f: 83 c4 3c add $0x3c,%esp
80106732: 5b pop %ebx
80106733: 5e pop %esi
80106734: 5f pop %edi
80106735: 5d pop %ebp
80106736: c3 ret
80106737 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80106737: 55 push %ebp
80106738: 89 e5 mov %esp,%ebp
8010673a: 83 ec 14 sub $0x14,%esp
8010673d: 8b 45 08 mov 0x8(%ebp),%eax
80106740: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80106744: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80106748: 89 c2 mov %eax,%edx
8010674a: ec in (%dx),%al
8010674b: 88 45 ff mov %al,-0x1(%ebp)
return data;
8010674e: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80106752: c9 leave
80106753: c3 ret
80106754 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106754: 55 push %ebp
80106755: 89 e5 mov %esp,%ebp
80106757: 83 ec 08 sub $0x8,%esp
8010675a: 8b 55 08 mov 0x8(%ebp),%edx
8010675d: 8b 45 0c mov 0xc(%ebp),%eax
80106760: 66 89 55 fc mov %dx,-0x4(%ebp)
80106764: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106767: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
8010676b: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010676f: ee out %al,(%dx)
}
80106770: c9 leave
80106771: c3 ret
80106772 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80106772: 55 push %ebp
80106773: 89 e5 mov %esp,%ebp
80106775: 83 ec 28 sub $0x28,%esp
char *p;
// Turn off the FIFO
outb(COM1+2, 0);
80106778: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010677f: 00
80106780: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
80106787: e8 c8 ff ff ff call 80106754 <outb>
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb(COM1+3, 0x80); // Unlock divisor
8010678c: c7 44 24 04 80 00 00 movl $0x80,0x4(%esp)
80106793: 00
80106794: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
8010679b: e8 b4 ff ff ff call 80106754 <outb>
outb(COM1+0, 115200/9600);
801067a0: c7 44 24 04 0c 00 00 movl $0xc,0x4(%esp)
801067a7: 00
801067a8: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
801067af: e8 a0 ff ff ff call 80106754 <outb>
outb(COM1+1, 0);
801067b4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801067bb: 00
801067bc: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
801067c3: e8 8c ff ff ff call 80106754 <outb>
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
801067c8: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
801067cf: 00
801067d0: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
801067d7: e8 78 ff ff ff call 80106754 <outb>
outb(COM1+4, 0);
801067dc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801067e3: 00
801067e4: c7 04 24 fc 03 00 00 movl $0x3fc,(%esp)
801067eb: e8 64 ff ff ff call 80106754 <outb>
outb(COM1+1, 0x01); // Enable receive interrupts.
801067f0: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
801067f7: 00
801067f8: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
801067ff: e8 50 ff ff ff call 80106754 <outb>
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
80106804: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
8010680b: e8 27 ff ff ff call 80106737 <inb>
80106810: 3c ff cmp $0xff,%al
80106812: 75 02 jne 80106816 <uartinit+0xa4>
return;
80106814: eb 6a jmp 80106880 <uartinit+0x10e>
uart = 1;
80106816: c7 05 4c b6 10 80 01 movl $0x1,0x8010b64c
8010681d: 00 00 00
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
80106820: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
80106827: e8 0b ff ff ff call 80106737 <inb>
inb(COM1+0);
8010682c: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
80106833: e8 ff fe ff ff call 80106737 <inb>
picenable(IRQ_COM1);
80106838: c7 04 24 04 00 00 00 movl $0x4,(%esp)
8010683f: e8 0a d2 ff ff call 80103a4e <picenable>
ioapicenable(IRQ_COM1, 0);
80106844: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010684b: 00
8010684c: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80106853: e8 f1 c0 ff ff call 80102949 <ioapicenable>
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80106858: c7 45 f4 44 88 10 80 movl $0x80108844,-0xc(%ebp)
8010685f: eb 15 jmp 80106876 <uartinit+0x104>
uartputc(*p);
80106861: 8b 45 f4 mov -0xc(%ebp),%eax
80106864: 0f b6 00 movzbl (%eax),%eax
80106867: 0f be c0 movsbl %al,%eax
8010686a: 89 04 24 mov %eax,(%esp)
8010686d: e8 10 00 00 00 call 80106882 <uartputc>
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80106872: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80106876: 8b 45 f4 mov -0xc(%ebp),%eax
80106879: 0f b6 00 movzbl (%eax),%eax
8010687c: 84 c0 test %al,%al
8010687e: 75 e1 jne 80106861 <uartinit+0xef>
uartputc(*p);
}
80106880: c9 leave
80106881: c3 ret
80106882 <uartputc>:
void
uartputc(int c)
{
80106882: 55 push %ebp
80106883: 89 e5 mov %esp,%ebp
80106885: 83 ec 28 sub $0x28,%esp
int i;
if(!uart)
80106888: a1 4c b6 10 80 mov 0x8010b64c,%eax
8010688d: 85 c0 test %eax,%eax
8010688f: 75 02 jne 80106893 <uartputc+0x11>
return;
80106891: eb 4b jmp 801068de <uartputc+0x5c>
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
80106893: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010689a: eb 10 jmp 801068ac <uartputc+0x2a>
microdelay(10);
8010689c: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
801068a3: e8 1c c6 ff ff call 80102ec4 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
801068a8: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801068ac: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp)
801068b0: 7f 16 jg 801068c8 <uartputc+0x46>
801068b2: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
801068b9: e8 79 fe ff ff call 80106737 <inb>
801068be: 0f b6 c0 movzbl %al,%eax
801068c1: 83 e0 20 and $0x20,%eax
801068c4: 85 c0 test %eax,%eax
801068c6: 74 d4 je 8010689c <uartputc+0x1a>
microdelay(10);
outb(COM1+0, c);
801068c8: 8b 45 08 mov 0x8(%ebp),%eax
801068cb: 0f b6 c0 movzbl %al,%eax
801068ce: 89 44 24 04 mov %eax,0x4(%esp)
801068d2: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
801068d9: e8 76 fe ff ff call 80106754 <outb>
}
801068de: c9 leave
801068df: c3 ret
801068e0 <uartgetc>:
static int
uartgetc(void)
{
801068e0: 55 push %ebp
801068e1: 89 e5 mov %esp,%ebp
801068e3: 83 ec 04 sub $0x4,%esp
if(!uart)
801068e6: a1 4c b6 10 80 mov 0x8010b64c,%eax
801068eb: 85 c0 test %eax,%eax
801068ed: 75 07 jne 801068f6 <uartgetc+0x16>
return -1;
801068ef: b8 ff ff ff ff mov $0xffffffff,%eax
801068f4: eb 2c jmp 80106922 <uartgetc+0x42>
if(!(inb(COM1+5) & 0x01))
801068f6: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
801068fd: e8 35 fe ff ff call 80106737 <inb>
80106902: 0f b6 c0 movzbl %al,%eax
80106905: 83 e0 01 and $0x1,%eax
80106908: 85 c0 test %eax,%eax
8010690a: 75 07 jne 80106913 <uartgetc+0x33>
return -1;
8010690c: b8 ff ff ff ff mov $0xffffffff,%eax
80106911: eb 0f jmp 80106922 <uartgetc+0x42>
return inb(COM1+0);
80106913: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
8010691a: e8 18 fe ff ff call 80106737 <inb>
8010691f: 0f b6 c0 movzbl %al,%eax
}
80106922: c9 leave
80106923: c3 ret
80106924 <uartintr>:
void
uartintr(void)
{
80106924: 55 push %ebp
80106925: 89 e5 mov %esp,%ebp
80106927: 83 ec 18 sub $0x18,%esp
consoleintr(uartgetc);
8010692a: c7 04 24 e0 68 10 80 movl $0x801068e0,(%esp)
80106931: e8 77 9e ff ff call 801007ad <consoleintr>
}
80106936: c9 leave
80106937: c3 ret
80106938 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
80106938: 6a 00 push $0x0
pushl $0
8010693a: 6a 00 push $0x0
jmp alltraps
8010693c: e9 7e f9 ff ff jmp 801062bf <alltraps>
80106941 <vector1>:
.globl vector1
vector1:
pushl $0
80106941: 6a 00 push $0x0
pushl $1
80106943: 6a 01 push $0x1
jmp alltraps
80106945: e9 75 f9 ff ff jmp 801062bf <alltraps>
8010694a <vector2>:
.globl vector2
vector2:
pushl $0
8010694a: 6a 00 push $0x0
pushl $2
8010694c: 6a 02 push $0x2
jmp alltraps
8010694e: e9 6c f9 ff ff jmp 801062bf <alltraps>
80106953 <vector3>:
.globl vector3
vector3:
pushl $0
80106953: 6a 00 push $0x0
pushl $3
80106955: 6a 03 push $0x3
jmp alltraps
80106957: e9 63 f9 ff ff jmp 801062bf <alltraps>
8010695c <vector4>:
.globl vector4
vector4:
pushl $0
8010695c: 6a 00 push $0x0
pushl $4
8010695e: 6a 04 push $0x4
jmp alltraps
80106960: e9 5a f9 ff ff jmp 801062bf <alltraps>
80106965 <vector5>:
.globl vector5
vector5:
pushl $0
80106965: 6a 00 push $0x0
pushl $5
80106967: 6a 05 push $0x5
jmp alltraps
80106969: e9 51 f9 ff ff jmp 801062bf <alltraps>
8010696e <vector6>:
.globl vector6
vector6:
pushl $0
8010696e: 6a 00 push $0x0
pushl $6
80106970: 6a 06 push $0x6
jmp alltraps
80106972: e9 48 f9 ff ff jmp 801062bf <alltraps>
80106977 <vector7>:
.globl vector7
vector7:
pushl $0
80106977: 6a 00 push $0x0
pushl $7
80106979: 6a 07 push $0x7
jmp alltraps
8010697b: e9 3f f9 ff ff jmp 801062bf <alltraps>
80106980 <vector8>:
.globl vector8
vector8:
pushl $8
80106980: 6a 08 push $0x8
jmp alltraps
80106982: e9 38 f9 ff ff jmp 801062bf <alltraps>
80106987 <vector9>:
.globl vector9
vector9:
pushl $0
80106987: 6a 00 push $0x0
pushl $9
80106989: 6a 09 push $0x9
jmp alltraps
8010698b: e9 2f f9 ff ff jmp 801062bf <alltraps>
80106990 <vector10>:
.globl vector10
vector10:
pushl $10
80106990: 6a 0a push $0xa
jmp alltraps
80106992: e9 28 f9 ff ff jmp 801062bf <alltraps>
80106997 <vector11>:
.globl vector11
vector11:
pushl $11
80106997: 6a 0b push $0xb
jmp alltraps
80106999: e9 21 f9 ff ff jmp 801062bf <alltraps>
8010699e <vector12>:
.globl vector12
vector12:
pushl $12
8010699e: 6a 0c push $0xc
jmp alltraps
801069a0: e9 1a f9 ff ff jmp 801062bf <alltraps>
801069a5 <vector13>:
.globl vector13
vector13:
pushl $13
801069a5: 6a 0d push $0xd
jmp alltraps
801069a7: e9 13 f9 ff ff jmp 801062bf <alltraps>
801069ac <vector14>:
.globl vector14
vector14:
pushl $14
801069ac: 6a 0e push $0xe
jmp alltraps
801069ae: e9 0c f9 ff ff jmp 801062bf <alltraps>
801069b3 <vector15>:
.globl vector15
vector15:
pushl $0
801069b3: 6a 00 push $0x0
pushl $15
801069b5: 6a 0f push $0xf
jmp alltraps
801069b7: e9 03 f9 ff ff jmp 801062bf <alltraps>
801069bc <vector16>:
.globl vector16
vector16:
pushl $0
801069bc: 6a 00 push $0x0
pushl $16
801069be: 6a 10 push $0x10
jmp alltraps
801069c0: e9 fa f8 ff ff jmp 801062bf <alltraps>
801069c5 <vector17>:
.globl vector17
vector17:
pushl $17
801069c5: 6a 11 push $0x11
jmp alltraps
801069c7: e9 f3 f8 ff ff jmp 801062bf <alltraps>
801069cc <vector18>:
.globl vector18
vector18:
pushl $0
801069cc: 6a 00 push $0x0
pushl $18
801069ce: 6a 12 push $0x12
jmp alltraps
801069d0: e9 ea f8 ff ff jmp 801062bf <alltraps>
801069d5 <vector19>:
.globl vector19
vector19:
pushl $0
801069d5: 6a 00 push $0x0
pushl $19
801069d7: 6a 13 push $0x13
jmp alltraps
801069d9: e9 e1 f8 ff ff jmp 801062bf <alltraps>
801069de <vector20>:
.globl vector20
vector20:
pushl $0
801069de: 6a 00 push $0x0
pushl $20
801069e0: 6a 14 push $0x14
jmp alltraps
801069e2: e9 d8 f8 ff ff jmp 801062bf <alltraps>
801069e7 <vector21>:
.globl vector21
vector21:
pushl $0
801069e7: 6a 00 push $0x0
pushl $21
801069e9: 6a 15 push $0x15
jmp alltraps
801069eb: e9 cf f8 ff ff jmp 801062bf <alltraps>
801069f0 <vector22>:
.globl vector22
vector22:
pushl $0
801069f0: 6a 00 push $0x0
pushl $22
801069f2: 6a 16 push $0x16
jmp alltraps
801069f4: e9 c6 f8 ff ff jmp 801062bf <alltraps>
801069f9 <vector23>:
.globl vector23
vector23:
pushl $0
801069f9: 6a 00 push $0x0
pushl $23
801069fb: 6a 17 push $0x17
jmp alltraps
801069fd: e9 bd f8 ff ff jmp 801062bf <alltraps>
80106a02 <vector24>:
.globl vector24
vector24:
pushl $0
80106a02: 6a 00 push $0x0
pushl $24
80106a04: 6a 18 push $0x18
jmp alltraps
80106a06: e9 b4 f8 ff ff jmp 801062bf <alltraps>
80106a0b <vector25>:
.globl vector25
vector25:
pushl $0
80106a0b: 6a 00 push $0x0
pushl $25
80106a0d: 6a 19 push $0x19
jmp alltraps
80106a0f: e9 ab f8 ff ff jmp 801062bf <alltraps>
80106a14 <vector26>:
.globl vector26
vector26:
pushl $0
80106a14: 6a 00 push $0x0
pushl $26
80106a16: 6a 1a push $0x1a
jmp alltraps
80106a18: e9 a2 f8 ff ff jmp 801062bf <alltraps>
80106a1d <vector27>:
.globl vector27
vector27:
pushl $0
80106a1d: 6a 00 push $0x0
pushl $27
80106a1f: 6a 1b push $0x1b
jmp alltraps
80106a21: e9 99 f8 ff ff jmp 801062bf <alltraps>
80106a26 <vector28>:
.globl vector28
vector28:
pushl $0
80106a26: 6a 00 push $0x0
pushl $28
80106a28: 6a 1c push $0x1c
jmp alltraps
80106a2a: e9 90 f8 ff ff jmp 801062bf <alltraps>
80106a2f <vector29>:
.globl vector29
vector29:
pushl $0
80106a2f: 6a 00 push $0x0
pushl $29
80106a31: 6a 1d push $0x1d
jmp alltraps
80106a33: e9 87 f8 ff ff jmp 801062bf <alltraps>
80106a38 <vector30>:
.globl vector30
vector30:
pushl $0
80106a38: 6a 00 push $0x0
pushl $30
80106a3a: 6a 1e push $0x1e
jmp alltraps
80106a3c: e9 7e f8 ff ff jmp 801062bf <alltraps>
80106a41 <vector31>:
.globl vector31
vector31:
pushl $0
80106a41: 6a 00 push $0x0
pushl $31
80106a43: 6a 1f push $0x1f
jmp alltraps
80106a45: e9 75 f8 ff ff jmp 801062bf <alltraps>
80106a4a <vector32>:
.globl vector32
vector32:
pushl $0
80106a4a: 6a 00 push $0x0
pushl $32
80106a4c: 6a 20 push $0x20
jmp alltraps
80106a4e: e9 6c f8 ff ff jmp 801062bf <alltraps>
80106a53 <vector33>:
.globl vector33
vector33:
pushl $0
80106a53: 6a 00 push $0x0
pushl $33
80106a55: 6a 21 push $0x21
jmp alltraps
80106a57: e9 63 f8 ff ff jmp 801062bf <alltraps>
80106a5c <vector34>:
.globl vector34
vector34:
pushl $0
80106a5c: 6a 00 push $0x0
pushl $34
80106a5e: 6a 22 push $0x22
jmp alltraps
80106a60: e9 5a f8 ff ff jmp 801062bf <alltraps>
80106a65 <vector35>:
.globl vector35
vector35:
pushl $0
80106a65: 6a 00 push $0x0
pushl $35
80106a67: 6a 23 push $0x23
jmp alltraps
80106a69: e9 51 f8 ff ff jmp 801062bf <alltraps>
80106a6e <vector36>:
.globl vector36
vector36:
pushl $0
80106a6e: 6a 00 push $0x0
pushl $36
80106a70: 6a 24 push $0x24
jmp alltraps
80106a72: e9 48 f8 ff ff jmp 801062bf <alltraps>
80106a77 <vector37>:
.globl vector37
vector37:
pushl $0
80106a77: 6a 00 push $0x0
pushl $37
80106a79: 6a 25 push $0x25
jmp alltraps
80106a7b: e9 3f f8 ff ff jmp 801062bf <alltraps>
80106a80 <vector38>:
.globl vector38
vector38:
pushl $0
80106a80: 6a 00 push $0x0
pushl $38
80106a82: 6a 26 push $0x26
jmp alltraps
80106a84: e9 36 f8 ff ff jmp 801062bf <alltraps>
80106a89 <vector39>:
.globl vector39
vector39:
pushl $0
80106a89: 6a 00 push $0x0
pushl $39
80106a8b: 6a 27 push $0x27
jmp alltraps
80106a8d: e9 2d f8 ff ff jmp 801062bf <alltraps>
80106a92 <vector40>:
.globl vector40
vector40:
pushl $0
80106a92: 6a 00 push $0x0
pushl $40
80106a94: 6a 28 push $0x28
jmp alltraps
80106a96: e9 24 f8 ff ff jmp 801062bf <alltraps>
80106a9b <vector41>:
.globl vector41
vector41:
pushl $0
80106a9b: 6a 00 push $0x0
pushl $41
80106a9d: 6a 29 push $0x29
jmp alltraps
80106a9f: e9 1b f8 ff ff jmp 801062bf <alltraps>
80106aa4 <vector42>:
.globl vector42
vector42:
pushl $0
80106aa4: 6a 00 push $0x0
pushl $42
80106aa6: 6a 2a push $0x2a
jmp alltraps
80106aa8: e9 12 f8 ff ff jmp 801062bf <alltraps>
80106aad <vector43>:
.globl vector43
vector43:
pushl $0
80106aad: 6a 00 push $0x0
pushl $43
80106aaf: 6a 2b push $0x2b
jmp alltraps
80106ab1: e9 09 f8 ff ff jmp 801062bf <alltraps>
80106ab6 <vector44>:
.globl vector44
vector44:
pushl $0
80106ab6: 6a 00 push $0x0
pushl $44
80106ab8: 6a 2c push $0x2c
jmp alltraps
80106aba: e9 00 f8 ff ff jmp 801062bf <alltraps>
80106abf <vector45>:
.globl vector45
vector45:
pushl $0
80106abf: 6a 00 push $0x0
pushl $45
80106ac1: 6a 2d push $0x2d
jmp alltraps
80106ac3: e9 f7 f7 ff ff jmp 801062bf <alltraps>
80106ac8 <vector46>:
.globl vector46
vector46:
pushl $0
80106ac8: 6a 00 push $0x0
pushl $46
80106aca: 6a 2e push $0x2e
jmp alltraps
80106acc: e9 ee f7 ff ff jmp 801062bf <alltraps>
80106ad1 <vector47>:
.globl vector47
vector47:
pushl $0
80106ad1: 6a 00 push $0x0
pushl $47
80106ad3: 6a 2f push $0x2f
jmp alltraps
80106ad5: e9 e5 f7 ff ff jmp 801062bf <alltraps>
80106ada <vector48>:
.globl vector48
vector48:
pushl $0
80106ada: 6a 00 push $0x0
pushl $48
80106adc: 6a 30 push $0x30
jmp alltraps
80106ade: e9 dc f7 ff ff jmp 801062bf <alltraps>
80106ae3 <vector49>:
.globl vector49
vector49:
pushl $0
80106ae3: 6a 00 push $0x0
pushl $49
80106ae5: 6a 31 push $0x31
jmp alltraps
80106ae7: e9 d3 f7 ff ff jmp 801062bf <alltraps>
80106aec <vector50>:
.globl vector50
vector50:
pushl $0
80106aec: 6a 00 push $0x0
pushl $50
80106aee: 6a 32 push $0x32
jmp alltraps
80106af0: e9 ca f7 ff ff jmp 801062bf <alltraps>
80106af5 <vector51>:
.globl vector51
vector51:
pushl $0
80106af5: 6a 00 push $0x0
pushl $51
80106af7: 6a 33 push $0x33
jmp alltraps
80106af9: e9 c1 f7 ff ff jmp 801062bf <alltraps>
80106afe <vector52>:
.globl vector52
vector52:
pushl $0
80106afe: 6a 00 push $0x0
pushl $52
80106b00: 6a 34 push $0x34
jmp alltraps
80106b02: e9 b8 f7 ff ff jmp 801062bf <alltraps>
80106b07 <vector53>:
.globl vector53
vector53:
pushl $0
80106b07: 6a 00 push $0x0
pushl $53
80106b09: 6a 35 push $0x35
jmp alltraps
80106b0b: e9 af f7 ff ff jmp 801062bf <alltraps>
80106b10 <vector54>:
.globl vector54
vector54:
pushl $0
80106b10: 6a 00 push $0x0
pushl $54
80106b12: 6a 36 push $0x36
jmp alltraps
80106b14: e9 a6 f7 ff ff jmp 801062bf <alltraps>
80106b19 <vector55>:
.globl vector55
vector55:
pushl $0
80106b19: 6a 00 push $0x0
pushl $55
80106b1b: 6a 37 push $0x37
jmp alltraps
80106b1d: e9 9d f7 ff ff jmp 801062bf <alltraps>
80106b22 <vector56>:
.globl vector56
vector56:
pushl $0
80106b22: 6a 00 push $0x0
pushl $56
80106b24: 6a 38 push $0x38
jmp alltraps
80106b26: e9 94 f7 ff ff jmp 801062bf <alltraps>
80106b2b <vector57>:
.globl vector57
vector57:
pushl $0
80106b2b: 6a 00 push $0x0
pushl $57
80106b2d: 6a 39 push $0x39
jmp alltraps
80106b2f: e9 8b f7 ff ff jmp 801062bf <alltraps>
80106b34 <vector58>:
.globl vector58
vector58:
pushl $0
80106b34: 6a 00 push $0x0
pushl $58
80106b36: 6a 3a push $0x3a
jmp alltraps
80106b38: e9 82 f7 ff ff jmp 801062bf <alltraps>
80106b3d <vector59>:
.globl vector59
vector59:
pushl $0
80106b3d: 6a 00 push $0x0
pushl $59
80106b3f: 6a 3b push $0x3b
jmp alltraps
80106b41: e9 79 f7 ff ff jmp 801062bf <alltraps>
80106b46 <vector60>:
.globl vector60
vector60:
pushl $0
80106b46: 6a 00 push $0x0
pushl $60
80106b48: 6a 3c push $0x3c
jmp alltraps
80106b4a: e9 70 f7 ff ff jmp 801062bf <alltraps>
80106b4f <vector61>:
.globl vector61
vector61:
pushl $0
80106b4f: 6a 00 push $0x0
pushl $61
80106b51: 6a 3d push $0x3d
jmp alltraps
80106b53: e9 67 f7 ff ff jmp 801062bf <alltraps>
80106b58 <vector62>:
.globl vector62
vector62:
pushl $0
80106b58: 6a 00 push $0x0
pushl $62
80106b5a: 6a 3e push $0x3e
jmp alltraps
80106b5c: e9 5e f7 ff ff jmp 801062bf <alltraps>
80106b61 <vector63>:
.globl vector63
vector63:
pushl $0
80106b61: 6a 00 push $0x0
pushl $63
80106b63: 6a 3f push $0x3f
jmp alltraps
80106b65: e9 55 f7 ff ff jmp 801062bf <alltraps>
80106b6a <vector64>:
.globl vector64
vector64:
pushl $0
80106b6a: 6a 00 push $0x0
pushl $64
80106b6c: 6a 40 push $0x40
jmp alltraps
80106b6e: e9 4c f7 ff ff jmp 801062bf <alltraps>
80106b73 <vector65>:
.globl vector65
vector65:
pushl $0
80106b73: 6a 00 push $0x0
pushl $65
80106b75: 6a 41 push $0x41
jmp alltraps
80106b77: e9 43 f7 ff ff jmp 801062bf <alltraps>
80106b7c <vector66>:
.globl vector66
vector66:
pushl $0
80106b7c: 6a 00 push $0x0
pushl $66
80106b7e: 6a 42 push $0x42
jmp alltraps
80106b80: e9 3a f7 ff ff jmp 801062bf <alltraps>
80106b85 <vector67>:
.globl vector67
vector67:
pushl $0
80106b85: 6a 00 push $0x0
pushl $67
80106b87: 6a 43 push $0x43
jmp alltraps
80106b89: e9 31 f7 ff ff jmp 801062bf <alltraps>
80106b8e <vector68>:
.globl vector68
vector68:
pushl $0
80106b8e: 6a 00 push $0x0
pushl $68
80106b90: 6a 44 push $0x44
jmp alltraps
80106b92: e9 28 f7 ff ff jmp 801062bf <alltraps>
80106b97 <vector69>:
.globl vector69
vector69:
pushl $0
80106b97: 6a 00 push $0x0
pushl $69
80106b99: 6a 45 push $0x45
jmp alltraps
80106b9b: e9 1f f7 ff ff jmp 801062bf <alltraps>
80106ba0 <vector70>:
.globl vector70
vector70:
pushl $0
80106ba0: 6a 00 push $0x0
pushl $70
80106ba2: 6a 46 push $0x46
jmp alltraps
80106ba4: e9 16 f7 ff ff jmp 801062bf <alltraps>
80106ba9 <vector71>:
.globl vector71
vector71:
pushl $0
80106ba9: 6a 00 push $0x0
pushl $71
80106bab: 6a 47 push $0x47
jmp alltraps
80106bad: e9 0d f7 ff ff jmp 801062bf <alltraps>
80106bb2 <vector72>:
.globl vector72
vector72:
pushl $0
80106bb2: 6a 00 push $0x0
pushl $72
80106bb4: 6a 48 push $0x48
jmp alltraps
80106bb6: e9 04 f7 ff ff jmp 801062bf <alltraps>
80106bbb <vector73>:
.globl vector73
vector73:
pushl $0
80106bbb: 6a 00 push $0x0
pushl $73
80106bbd: 6a 49 push $0x49
jmp alltraps
80106bbf: e9 fb f6 ff ff jmp 801062bf <alltraps>
80106bc4 <vector74>:
.globl vector74
vector74:
pushl $0
80106bc4: 6a 00 push $0x0
pushl $74
80106bc6: 6a 4a push $0x4a
jmp alltraps
80106bc8: e9 f2 f6 ff ff jmp 801062bf <alltraps>
80106bcd <vector75>:
.globl vector75
vector75:
pushl $0
80106bcd: 6a 00 push $0x0
pushl $75
80106bcf: 6a 4b push $0x4b
jmp alltraps
80106bd1: e9 e9 f6 ff ff jmp 801062bf <alltraps>
80106bd6 <vector76>:
.globl vector76
vector76:
pushl $0
80106bd6: 6a 00 push $0x0
pushl $76
80106bd8: 6a 4c push $0x4c
jmp alltraps
80106bda: e9 e0 f6 ff ff jmp 801062bf <alltraps>
80106bdf <vector77>:
.globl vector77
vector77:
pushl $0
80106bdf: 6a 00 push $0x0
pushl $77
80106be1: 6a 4d push $0x4d
jmp alltraps
80106be3: e9 d7 f6 ff ff jmp 801062bf <alltraps>
80106be8 <vector78>:
.globl vector78
vector78:
pushl $0
80106be8: 6a 00 push $0x0
pushl $78
80106bea: 6a 4e push $0x4e
jmp alltraps
80106bec: e9 ce f6 ff ff jmp 801062bf <alltraps>
80106bf1 <vector79>:
.globl vector79
vector79:
pushl $0
80106bf1: 6a 00 push $0x0
pushl $79
80106bf3: 6a 4f push $0x4f
jmp alltraps
80106bf5: e9 c5 f6 ff ff jmp 801062bf <alltraps>
80106bfa <vector80>:
.globl vector80
vector80:
pushl $0
80106bfa: 6a 00 push $0x0
pushl $80
80106bfc: 6a 50 push $0x50
jmp alltraps
80106bfe: e9 bc f6 ff ff jmp 801062bf <alltraps>
80106c03 <vector81>:
.globl vector81
vector81:
pushl $0
80106c03: 6a 00 push $0x0
pushl $81
80106c05: 6a 51 push $0x51
jmp alltraps
80106c07: e9 b3 f6 ff ff jmp 801062bf <alltraps>
80106c0c <vector82>:
.globl vector82
vector82:
pushl $0
80106c0c: 6a 00 push $0x0
pushl $82
80106c0e: 6a 52 push $0x52
jmp alltraps
80106c10: e9 aa f6 ff ff jmp 801062bf <alltraps>
80106c15 <vector83>:
.globl vector83
vector83:
pushl $0
80106c15: 6a 00 push $0x0
pushl $83
80106c17: 6a 53 push $0x53
jmp alltraps
80106c19: e9 a1 f6 ff ff jmp 801062bf <alltraps>
80106c1e <vector84>:
.globl vector84
vector84:
pushl $0
80106c1e: 6a 00 push $0x0
pushl $84
80106c20: 6a 54 push $0x54
jmp alltraps
80106c22: e9 98 f6 ff ff jmp 801062bf <alltraps>
80106c27 <vector85>:
.globl vector85
vector85:
pushl $0
80106c27: 6a 00 push $0x0
pushl $85
80106c29: 6a 55 push $0x55
jmp alltraps
80106c2b: e9 8f f6 ff ff jmp 801062bf <alltraps>
80106c30 <vector86>:
.globl vector86
vector86:
pushl $0
80106c30: 6a 00 push $0x0
pushl $86
80106c32: 6a 56 push $0x56
jmp alltraps
80106c34: e9 86 f6 ff ff jmp 801062bf <alltraps>
80106c39 <vector87>:
.globl vector87
vector87:
pushl $0
80106c39: 6a 00 push $0x0
pushl $87
80106c3b: 6a 57 push $0x57
jmp alltraps
80106c3d: e9 7d f6 ff ff jmp 801062bf <alltraps>
80106c42 <vector88>:
.globl vector88
vector88:
pushl $0
80106c42: 6a 00 push $0x0
pushl $88
80106c44: 6a 58 push $0x58
jmp alltraps
80106c46: e9 74 f6 ff ff jmp 801062bf <alltraps>
80106c4b <vector89>:
.globl vector89
vector89:
pushl $0
80106c4b: 6a 00 push $0x0
pushl $89
80106c4d: 6a 59 push $0x59
jmp alltraps
80106c4f: e9 6b f6 ff ff jmp 801062bf <alltraps>
80106c54 <vector90>:
.globl vector90
vector90:
pushl $0
80106c54: 6a 00 push $0x0
pushl $90
80106c56: 6a 5a push $0x5a
jmp alltraps
80106c58: e9 62 f6 ff ff jmp 801062bf <alltraps>
80106c5d <vector91>:
.globl vector91
vector91:
pushl $0
80106c5d: 6a 00 push $0x0
pushl $91
80106c5f: 6a 5b push $0x5b
jmp alltraps
80106c61: e9 59 f6 ff ff jmp 801062bf <alltraps>
80106c66 <vector92>:
.globl vector92
vector92:
pushl $0
80106c66: 6a 00 push $0x0
pushl $92
80106c68: 6a 5c push $0x5c
jmp alltraps
80106c6a: e9 50 f6 ff ff jmp 801062bf <alltraps>
80106c6f <vector93>:
.globl vector93
vector93:
pushl $0
80106c6f: 6a 00 push $0x0
pushl $93
80106c71: 6a 5d push $0x5d
jmp alltraps
80106c73: e9 47 f6 ff ff jmp 801062bf <alltraps>
80106c78 <vector94>:
.globl vector94
vector94:
pushl $0
80106c78: 6a 00 push $0x0
pushl $94
80106c7a: 6a 5e push $0x5e
jmp alltraps
80106c7c: e9 3e f6 ff ff jmp 801062bf <alltraps>
80106c81 <vector95>:
.globl vector95
vector95:
pushl $0
80106c81: 6a 00 push $0x0
pushl $95
80106c83: 6a 5f push $0x5f
jmp alltraps
80106c85: e9 35 f6 ff ff jmp 801062bf <alltraps>
80106c8a <vector96>:
.globl vector96
vector96:
pushl $0
80106c8a: 6a 00 push $0x0
pushl $96
80106c8c: 6a 60 push $0x60
jmp alltraps
80106c8e: e9 2c f6 ff ff jmp 801062bf <alltraps>
80106c93 <vector97>:
.globl vector97
vector97:
pushl $0
80106c93: 6a 00 push $0x0
pushl $97
80106c95: 6a 61 push $0x61
jmp alltraps
80106c97: e9 23 f6 ff ff jmp 801062bf <alltraps>
80106c9c <vector98>:
.globl vector98
vector98:
pushl $0
80106c9c: 6a 00 push $0x0
pushl $98
80106c9e: 6a 62 push $0x62
jmp alltraps
80106ca0: e9 1a f6 ff ff jmp 801062bf <alltraps>
80106ca5 <vector99>:
.globl vector99
vector99:
pushl $0
80106ca5: 6a 00 push $0x0
pushl $99
80106ca7: 6a 63 push $0x63
jmp alltraps
80106ca9: e9 11 f6 ff ff jmp 801062bf <alltraps>
80106cae <vector100>:
.globl vector100
vector100:
pushl $0
80106cae: 6a 00 push $0x0
pushl $100
80106cb0: 6a 64 push $0x64
jmp alltraps
80106cb2: e9 08 f6 ff ff jmp 801062bf <alltraps>
80106cb7 <vector101>:
.globl vector101
vector101:
pushl $0
80106cb7: 6a 00 push $0x0
pushl $101
80106cb9: 6a 65 push $0x65
jmp alltraps
80106cbb: e9 ff f5 ff ff jmp 801062bf <alltraps>
80106cc0 <vector102>:
.globl vector102
vector102:
pushl $0
80106cc0: 6a 00 push $0x0
pushl $102
80106cc2: 6a 66 push $0x66
jmp alltraps
80106cc4: e9 f6 f5 ff ff jmp 801062bf <alltraps>
80106cc9 <vector103>:
.globl vector103
vector103:
pushl $0
80106cc9: 6a 00 push $0x0
pushl $103
80106ccb: 6a 67 push $0x67
jmp alltraps
80106ccd: e9 ed f5 ff ff jmp 801062bf <alltraps>
80106cd2 <vector104>:
.globl vector104
vector104:
pushl $0
80106cd2: 6a 00 push $0x0
pushl $104
80106cd4: 6a 68 push $0x68
jmp alltraps
80106cd6: e9 e4 f5 ff ff jmp 801062bf <alltraps>
80106cdb <vector105>:
.globl vector105
vector105:
pushl $0
80106cdb: 6a 00 push $0x0
pushl $105
80106cdd: 6a 69 push $0x69
jmp alltraps
80106cdf: e9 db f5 ff ff jmp 801062bf <alltraps>
80106ce4 <vector106>:
.globl vector106
vector106:
pushl $0
80106ce4: 6a 00 push $0x0
pushl $106
80106ce6: 6a 6a push $0x6a
jmp alltraps
80106ce8: e9 d2 f5 ff ff jmp 801062bf <alltraps>
80106ced <vector107>:
.globl vector107
vector107:
pushl $0
80106ced: 6a 00 push $0x0
pushl $107
80106cef: 6a 6b push $0x6b
jmp alltraps
80106cf1: e9 c9 f5 ff ff jmp 801062bf <alltraps>
80106cf6 <vector108>:
.globl vector108
vector108:
pushl $0
80106cf6: 6a 00 push $0x0
pushl $108
80106cf8: 6a 6c push $0x6c
jmp alltraps
80106cfa: e9 c0 f5 ff ff jmp 801062bf <alltraps>
80106cff <vector109>:
.globl vector109
vector109:
pushl $0
80106cff: 6a 00 push $0x0
pushl $109
80106d01: 6a 6d push $0x6d
jmp alltraps
80106d03: e9 b7 f5 ff ff jmp 801062bf <alltraps>
80106d08 <vector110>:
.globl vector110
vector110:
pushl $0
80106d08: 6a 00 push $0x0
pushl $110
80106d0a: 6a 6e push $0x6e
jmp alltraps
80106d0c: e9 ae f5 ff ff jmp 801062bf <alltraps>
80106d11 <vector111>:
.globl vector111
vector111:
pushl $0
80106d11: 6a 00 push $0x0
pushl $111
80106d13: 6a 6f push $0x6f
jmp alltraps
80106d15: e9 a5 f5 ff ff jmp 801062bf <alltraps>
80106d1a <vector112>:
.globl vector112
vector112:
pushl $0
80106d1a: 6a 00 push $0x0
pushl $112
80106d1c: 6a 70 push $0x70
jmp alltraps
80106d1e: e9 9c f5 ff ff jmp 801062bf <alltraps>
80106d23 <vector113>:
.globl vector113
vector113:
pushl $0
80106d23: 6a 00 push $0x0
pushl $113
80106d25: 6a 71 push $0x71
jmp alltraps
80106d27: e9 93 f5 ff ff jmp 801062bf <alltraps>
80106d2c <vector114>:
.globl vector114
vector114:
pushl $0
80106d2c: 6a 00 push $0x0
pushl $114
80106d2e: 6a 72 push $0x72
jmp alltraps
80106d30: e9 8a f5 ff ff jmp 801062bf <alltraps>
80106d35 <vector115>:
.globl vector115
vector115:
pushl $0
80106d35: 6a 00 push $0x0
pushl $115
80106d37: 6a 73 push $0x73
jmp alltraps
80106d39: e9 81 f5 ff ff jmp 801062bf <alltraps>
80106d3e <vector116>:
.globl vector116
vector116:
pushl $0
80106d3e: 6a 00 push $0x0
pushl $116
80106d40: 6a 74 push $0x74
jmp alltraps
80106d42: e9 78 f5 ff ff jmp 801062bf <alltraps>
80106d47 <vector117>:
.globl vector117
vector117:
pushl $0
80106d47: 6a 00 push $0x0
pushl $117
80106d49: 6a 75 push $0x75
jmp alltraps
80106d4b: e9 6f f5 ff ff jmp 801062bf <alltraps>
80106d50 <vector118>:
.globl vector118
vector118:
pushl $0
80106d50: 6a 00 push $0x0
pushl $118
80106d52: 6a 76 push $0x76
jmp alltraps
80106d54: e9 66 f5 ff ff jmp 801062bf <alltraps>
80106d59 <vector119>:
.globl vector119
vector119:
pushl $0
80106d59: 6a 00 push $0x0
pushl $119
80106d5b: 6a 77 push $0x77
jmp alltraps
80106d5d: e9 5d f5 ff ff jmp 801062bf <alltraps>
80106d62 <vector120>:
.globl vector120
vector120:
pushl $0
80106d62: 6a 00 push $0x0
pushl $120
80106d64: 6a 78 push $0x78
jmp alltraps
80106d66: e9 54 f5 ff ff jmp 801062bf <alltraps>
80106d6b <vector121>:
.globl vector121
vector121:
pushl $0
80106d6b: 6a 00 push $0x0
pushl $121
80106d6d: 6a 79 push $0x79
jmp alltraps
80106d6f: e9 4b f5 ff ff jmp 801062bf <alltraps>
80106d74 <vector122>:
.globl vector122
vector122:
pushl $0
80106d74: 6a 00 push $0x0
pushl $122
80106d76: 6a 7a push $0x7a
jmp alltraps
80106d78: e9 42 f5 ff ff jmp 801062bf <alltraps>
80106d7d <vector123>:
.globl vector123
vector123:
pushl $0
80106d7d: 6a 00 push $0x0
pushl $123
80106d7f: 6a 7b push $0x7b
jmp alltraps
80106d81: e9 39 f5 ff ff jmp 801062bf <alltraps>
80106d86 <vector124>:
.globl vector124
vector124:
pushl $0
80106d86: 6a 00 push $0x0
pushl $124
80106d88: 6a 7c push $0x7c
jmp alltraps
80106d8a: e9 30 f5 ff ff jmp 801062bf <alltraps>
80106d8f <vector125>:
.globl vector125
vector125:
pushl $0
80106d8f: 6a 00 push $0x0
pushl $125
80106d91: 6a 7d push $0x7d
jmp alltraps
80106d93: e9 27 f5 ff ff jmp 801062bf <alltraps>
80106d98 <vector126>:
.globl vector126
vector126:
pushl $0
80106d98: 6a 00 push $0x0
pushl $126
80106d9a: 6a 7e push $0x7e
jmp alltraps
80106d9c: e9 1e f5 ff ff jmp 801062bf <alltraps>
80106da1 <vector127>:
.globl vector127
vector127:
pushl $0
80106da1: 6a 00 push $0x0
pushl $127
80106da3: 6a 7f push $0x7f
jmp alltraps
80106da5: e9 15 f5 ff ff jmp 801062bf <alltraps>
80106daa <vector128>:
.globl vector128
vector128:
pushl $0
80106daa: 6a 00 push $0x0
pushl $128
80106dac: 68 80 00 00 00 push $0x80
jmp alltraps
80106db1: e9 09 f5 ff ff jmp 801062bf <alltraps>
80106db6 <vector129>:
.globl vector129
vector129:
pushl $0
80106db6: 6a 00 push $0x0
pushl $129
80106db8: 68 81 00 00 00 push $0x81
jmp alltraps
80106dbd: e9 fd f4 ff ff jmp 801062bf <alltraps>
80106dc2 <vector130>:
.globl vector130
vector130:
pushl $0
80106dc2: 6a 00 push $0x0
pushl $130
80106dc4: 68 82 00 00 00 push $0x82
jmp alltraps
80106dc9: e9 f1 f4 ff ff jmp 801062bf <alltraps>
80106dce <vector131>:
.globl vector131
vector131:
pushl $0
80106dce: 6a 00 push $0x0
pushl $131
80106dd0: 68 83 00 00 00 push $0x83
jmp alltraps
80106dd5: e9 e5 f4 ff ff jmp 801062bf <alltraps>
80106dda <vector132>:
.globl vector132
vector132:
pushl $0
80106dda: 6a 00 push $0x0
pushl $132
80106ddc: 68 84 00 00 00 push $0x84
jmp alltraps
80106de1: e9 d9 f4 ff ff jmp 801062bf <alltraps>
80106de6 <vector133>:
.globl vector133
vector133:
pushl $0
80106de6: 6a 00 push $0x0
pushl $133
80106de8: 68 85 00 00 00 push $0x85
jmp alltraps
80106ded: e9 cd f4 ff ff jmp 801062bf <alltraps>
80106df2 <vector134>:
.globl vector134
vector134:
pushl $0
80106df2: 6a 00 push $0x0
pushl $134
80106df4: 68 86 00 00 00 push $0x86
jmp alltraps
80106df9: e9 c1 f4 ff ff jmp 801062bf <alltraps>
80106dfe <vector135>:
.globl vector135
vector135:
pushl $0
80106dfe: 6a 00 push $0x0
pushl $135
80106e00: 68 87 00 00 00 push $0x87
jmp alltraps
80106e05: e9 b5 f4 ff ff jmp 801062bf <alltraps>
80106e0a <vector136>:
.globl vector136
vector136:
pushl $0
80106e0a: 6a 00 push $0x0
pushl $136
80106e0c: 68 88 00 00 00 push $0x88
jmp alltraps
80106e11: e9 a9 f4 ff ff jmp 801062bf <alltraps>
80106e16 <vector137>:
.globl vector137
vector137:
pushl $0
80106e16: 6a 00 push $0x0
pushl $137
80106e18: 68 89 00 00 00 push $0x89
jmp alltraps
80106e1d: e9 9d f4 ff ff jmp 801062bf <alltraps>
80106e22 <vector138>:
.globl vector138
vector138:
pushl $0
80106e22: 6a 00 push $0x0
pushl $138
80106e24: 68 8a 00 00 00 push $0x8a
jmp alltraps
80106e29: e9 91 f4 ff ff jmp 801062bf <alltraps>
80106e2e <vector139>:
.globl vector139
vector139:
pushl $0
80106e2e: 6a 00 push $0x0
pushl $139
80106e30: 68 8b 00 00 00 push $0x8b
jmp alltraps
80106e35: e9 85 f4 ff ff jmp 801062bf <alltraps>
80106e3a <vector140>:
.globl vector140
vector140:
pushl $0
80106e3a: 6a 00 push $0x0
pushl $140
80106e3c: 68 8c 00 00 00 push $0x8c
jmp alltraps
80106e41: e9 79 f4 ff ff jmp 801062bf <alltraps>
80106e46 <vector141>:
.globl vector141
vector141:
pushl $0
80106e46: 6a 00 push $0x0
pushl $141
80106e48: 68 8d 00 00 00 push $0x8d
jmp alltraps
80106e4d: e9 6d f4 ff ff jmp 801062bf <alltraps>
80106e52 <vector142>:
.globl vector142
vector142:
pushl $0
80106e52: 6a 00 push $0x0
pushl $142
80106e54: 68 8e 00 00 00 push $0x8e
jmp alltraps
80106e59: e9 61 f4 ff ff jmp 801062bf <alltraps>
80106e5e <vector143>:
.globl vector143
vector143:
pushl $0
80106e5e: 6a 00 push $0x0
pushl $143
80106e60: 68 8f 00 00 00 push $0x8f
jmp alltraps
80106e65: e9 55 f4 ff ff jmp 801062bf <alltraps>
80106e6a <vector144>:
.globl vector144
vector144:
pushl $0
80106e6a: 6a 00 push $0x0
pushl $144
80106e6c: 68 90 00 00 00 push $0x90
jmp alltraps
80106e71: e9 49 f4 ff ff jmp 801062bf <alltraps>
80106e76 <vector145>:
.globl vector145
vector145:
pushl $0
80106e76: 6a 00 push $0x0
pushl $145
80106e78: 68 91 00 00 00 push $0x91
jmp alltraps
80106e7d: e9 3d f4 ff ff jmp 801062bf <alltraps>
80106e82 <vector146>:
.globl vector146
vector146:
pushl $0
80106e82: 6a 00 push $0x0
pushl $146
80106e84: 68 92 00 00 00 push $0x92
jmp alltraps
80106e89: e9 31 f4 ff ff jmp 801062bf <alltraps>
80106e8e <vector147>:
.globl vector147
vector147:
pushl $0
80106e8e: 6a 00 push $0x0
pushl $147
80106e90: 68 93 00 00 00 push $0x93
jmp alltraps
80106e95: e9 25 f4 ff ff jmp 801062bf <alltraps>
80106e9a <vector148>:
.globl vector148
vector148:
pushl $0
80106e9a: 6a 00 push $0x0
pushl $148
80106e9c: 68 94 00 00 00 push $0x94
jmp alltraps
80106ea1: e9 19 f4 ff ff jmp 801062bf <alltraps>
80106ea6 <vector149>:
.globl vector149
vector149:
pushl $0
80106ea6: 6a 00 push $0x0
pushl $149
80106ea8: 68 95 00 00 00 push $0x95
jmp alltraps
80106ead: e9 0d f4 ff ff jmp 801062bf <alltraps>
80106eb2 <vector150>:
.globl vector150
vector150:
pushl $0
80106eb2: 6a 00 push $0x0
pushl $150
80106eb4: 68 96 00 00 00 push $0x96
jmp alltraps
80106eb9: e9 01 f4 ff ff jmp 801062bf <alltraps>
80106ebe <vector151>:
.globl vector151
vector151:
pushl $0
80106ebe: 6a 00 push $0x0
pushl $151
80106ec0: 68 97 00 00 00 push $0x97
jmp alltraps
80106ec5: e9 f5 f3 ff ff jmp 801062bf <alltraps>
80106eca <vector152>:
.globl vector152
vector152:
pushl $0
80106eca: 6a 00 push $0x0
pushl $152
80106ecc: 68 98 00 00 00 push $0x98
jmp alltraps
80106ed1: e9 e9 f3 ff ff jmp 801062bf <alltraps>
80106ed6 <vector153>:
.globl vector153
vector153:
pushl $0
80106ed6: 6a 00 push $0x0
pushl $153
80106ed8: 68 99 00 00 00 push $0x99
jmp alltraps
80106edd: e9 dd f3 ff ff jmp 801062bf <alltraps>
80106ee2 <vector154>:
.globl vector154
vector154:
pushl $0
80106ee2: 6a 00 push $0x0
pushl $154
80106ee4: 68 9a 00 00 00 push $0x9a
jmp alltraps
80106ee9: e9 d1 f3 ff ff jmp 801062bf <alltraps>
80106eee <vector155>:
.globl vector155
vector155:
pushl $0
80106eee: 6a 00 push $0x0
pushl $155
80106ef0: 68 9b 00 00 00 push $0x9b
jmp alltraps
80106ef5: e9 c5 f3 ff ff jmp 801062bf <alltraps>
80106efa <vector156>:
.globl vector156
vector156:
pushl $0
80106efa: 6a 00 push $0x0
pushl $156
80106efc: 68 9c 00 00 00 push $0x9c
jmp alltraps
80106f01: e9 b9 f3 ff ff jmp 801062bf <alltraps>
80106f06 <vector157>:
.globl vector157
vector157:
pushl $0
80106f06: 6a 00 push $0x0
pushl $157
80106f08: 68 9d 00 00 00 push $0x9d
jmp alltraps
80106f0d: e9 ad f3 ff ff jmp 801062bf <alltraps>
80106f12 <vector158>:
.globl vector158
vector158:
pushl $0
80106f12: 6a 00 push $0x0
pushl $158
80106f14: 68 9e 00 00 00 push $0x9e
jmp alltraps
80106f19: e9 a1 f3 ff ff jmp 801062bf <alltraps>
80106f1e <vector159>:
.globl vector159
vector159:
pushl $0
80106f1e: 6a 00 push $0x0
pushl $159
80106f20: 68 9f 00 00 00 push $0x9f
jmp alltraps
80106f25: e9 95 f3 ff ff jmp 801062bf <alltraps>
80106f2a <vector160>:
.globl vector160
vector160:
pushl $0
80106f2a: 6a 00 push $0x0
pushl $160
80106f2c: 68 a0 00 00 00 push $0xa0
jmp alltraps
80106f31: e9 89 f3 ff ff jmp 801062bf <alltraps>
80106f36 <vector161>:
.globl vector161
vector161:
pushl $0
80106f36: 6a 00 push $0x0
pushl $161
80106f38: 68 a1 00 00 00 push $0xa1
jmp alltraps
80106f3d: e9 7d f3 ff ff jmp 801062bf <alltraps>
80106f42 <vector162>:
.globl vector162
vector162:
pushl $0
80106f42: 6a 00 push $0x0
pushl $162
80106f44: 68 a2 00 00 00 push $0xa2
jmp alltraps
80106f49: e9 71 f3 ff ff jmp 801062bf <alltraps>
80106f4e <vector163>:
.globl vector163
vector163:
pushl $0
80106f4e: 6a 00 push $0x0
pushl $163
80106f50: 68 a3 00 00 00 push $0xa3
jmp alltraps
80106f55: e9 65 f3 ff ff jmp 801062bf <alltraps>
80106f5a <vector164>:
.globl vector164
vector164:
pushl $0
80106f5a: 6a 00 push $0x0
pushl $164
80106f5c: 68 a4 00 00 00 push $0xa4
jmp alltraps
80106f61: e9 59 f3 ff ff jmp 801062bf <alltraps>
80106f66 <vector165>:
.globl vector165
vector165:
pushl $0
80106f66: 6a 00 push $0x0
pushl $165
80106f68: 68 a5 00 00 00 push $0xa5
jmp alltraps
80106f6d: e9 4d f3 ff ff jmp 801062bf <alltraps>
80106f72 <vector166>:
.globl vector166
vector166:
pushl $0
80106f72: 6a 00 push $0x0
pushl $166
80106f74: 68 a6 00 00 00 push $0xa6
jmp alltraps
80106f79: e9 41 f3 ff ff jmp 801062bf <alltraps>
80106f7e <vector167>:
.globl vector167
vector167:
pushl $0
80106f7e: 6a 00 push $0x0
pushl $167
80106f80: 68 a7 00 00 00 push $0xa7
jmp alltraps
80106f85: e9 35 f3 ff ff jmp 801062bf <alltraps>
80106f8a <vector168>:
.globl vector168
vector168:
pushl $0
80106f8a: 6a 00 push $0x0
pushl $168
80106f8c: 68 a8 00 00 00 push $0xa8
jmp alltraps
80106f91: e9 29 f3 ff ff jmp 801062bf <alltraps>
80106f96 <vector169>:
.globl vector169
vector169:
pushl $0
80106f96: 6a 00 push $0x0
pushl $169
80106f98: 68 a9 00 00 00 push $0xa9
jmp alltraps
80106f9d: e9 1d f3 ff ff jmp 801062bf <alltraps>
80106fa2 <vector170>:
.globl vector170
vector170:
pushl $0
80106fa2: 6a 00 push $0x0
pushl $170
80106fa4: 68 aa 00 00 00 push $0xaa
jmp alltraps
80106fa9: e9 11 f3 ff ff jmp 801062bf <alltraps>
80106fae <vector171>:
.globl vector171
vector171:
pushl $0
80106fae: 6a 00 push $0x0
pushl $171
80106fb0: 68 ab 00 00 00 push $0xab
jmp alltraps
80106fb5: e9 05 f3 ff ff jmp 801062bf <alltraps>
80106fba <vector172>:
.globl vector172
vector172:
pushl $0
80106fba: 6a 00 push $0x0
pushl $172
80106fbc: 68 ac 00 00 00 push $0xac
jmp alltraps
80106fc1: e9 f9 f2 ff ff jmp 801062bf <alltraps>
80106fc6 <vector173>:
.globl vector173
vector173:
pushl $0
80106fc6: 6a 00 push $0x0
pushl $173
80106fc8: 68 ad 00 00 00 push $0xad
jmp alltraps
80106fcd: e9 ed f2 ff ff jmp 801062bf <alltraps>
80106fd2 <vector174>:
.globl vector174
vector174:
pushl $0
80106fd2: 6a 00 push $0x0
pushl $174
80106fd4: 68 ae 00 00 00 push $0xae
jmp alltraps
80106fd9: e9 e1 f2 ff ff jmp 801062bf <alltraps>
80106fde <vector175>:
.globl vector175
vector175:
pushl $0
80106fde: 6a 00 push $0x0
pushl $175
80106fe0: 68 af 00 00 00 push $0xaf
jmp alltraps
80106fe5: e9 d5 f2 ff ff jmp 801062bf <alltraps>
80106fea <vector176>:
.globl vector176
vector176:
pushl $0
80106fea: 6a 00 push $0x0
pushl $176
80106fec: 68 b0 00 00 00 push $0xb0
jmp alltraps
80106ff1: e9 c9 f2 ff ff jmp 801062bf <alltraps>
80106ff6 <vector177>:
.globl vector177
vector177:
pushl $0
80106ff6: 6a 00 push $0x0
pushl $177
80106ff8: 68 b1 00 00 00 push $0xb1
jmp alltraps
80106ffd: e9 bd f2 ff ff jmp 801062bf <alltraps>
80107002 <vector178>:
.globl vector178
vector178:
pushl $0
80107002: 6a 00 push $0x0
pushl $178
80107004: 68 b2 00 00 00 push $0xb2
jmp alltraps
80107009: e9 b1 f2 ff ff jmp 801062bf <alltraps>
8010700e <vector179>:
.globl vector179
vector179:
pushl $0
8010700e: 6a 00 push $0x0
pushl $179
80107010: 68 b3 00 00 00 push $0xb3
jmp alltraps
80107015: e9 a5 f2 ff ff jmp 801062bf <alltraps>
8010701a <vector180>:
.globl vector180
vector180:
pushl $0
8010701a: 6a 00 push $0x0
pushl $180
8010701c: 68 b4 00 00 00 push $0xb4
jmp alltraps
80107021: e9 99 f2 ff ff jmp 801062bf <alltraps>
80107026 <vector181>:
.globl vector181
vector181:
pushl $0
80107026: 6a 00 push $0x0
pushl $181
80107028: 68 b5 00 00 00 push $0xb5
jmp alltraps
8010702d: e9 8d f2 ff ff jmp 801062bf <alltraps>
80107032 <vector182>:
.globl vector182
vector182:
pushl $0
80107032: 6a 00 push $0x0
pushl $182
80107034: 68 b6 00 00 00 push $0xb6
jmp alltraps
80107039: e9 81 f2 ff ff jmp 801062bf <alltraps>
8010703e <vector183>:
.globl vector183
vector183:
pushl $0
8010703e: 6a 00 push $0x0
pushl $183
80107040: 68 b7 00 00 00 push $0xb7
jmp alltraps
80107045: e9 75 f2 ff ff jmp 801062bf <alltraps>
8010704a <vector184>:
.globl vector184
vector184:
pushl $0
8010704a: 6a 00 push $0x0
pushl $184
8010704c: 68 b8 00 00 00 push $0xb8
jmp alltraps
80107051: e9 69 f2 ff ff jmp 801062bf <alltraps>
80107056 <vector185>:
.globl vector185
vector185:
pushl $0
80107056: 6a 00 push $0x0
pushl $185
80107058: 68 b9 00 00 00 push $0xb9
jmp alltraps
8010705d: e9 5d f2 ff ff jmp 801062bf <alltraps>
80107062 <vector186>:
.globl vector186
vector186:
pushl $0
80107062: 6a 00 push $0x0
pushl $186
80107064: 68 ba 00 00 00 push $0xba
jmp alltraps
80107069: e9 51 f2 ff ff jmp 801062bf <alltraps>
8010706e <vector187>:
.globl vector187
vector187:
pushl $0
8010706e: 6a 00 push $0x0
pushl $187
80107070: 68 bb 00 00 00 push $0xbb
jmp alltraps
80107075: e9 45 f2 ff ff jmp 801062bf <alltraps>
8010707a <vector188>:
.globl vector188
vector188:
pushl $0
8010707a: 6a 00 push $0x0
pushl $188
8010707c: 68 bc 00 00 00 push $0xbc
jmp alltraps
80107081: e9 39 f2 ff ff jmp 801062bf <alltraps>
80107086 <vector189>:
.globl vector189
vector189:
pushl $0
80107086: 6a 00 push $0x0
pushl $189
80107088: 68 bd 00 00 00 push $0xbd
jmp alltraps
8010708d: e9 2d f2 ff ff jmp 801062bf <alltraps>
80107092 <vector190>:
.globl vector190
vector190:
pushl $0
80107092: 6a 00 push $0x0
pushl $190
80107094: 68 be 00 00 00 push $0xbe
jmp alltraps
80107099: e9 21 f2 ff ff jmp 801062bf <alltraps>
8010709e <vector191>:
.globl vector191
vector191:
pushl $0
8010709e: 6a 00 push $0x0
pushl $191
801070a0: 68 bf 00 00 00 push $0xbf
jmp alltraps
801070a5: e9 15 f2 ff ff jmp 801062bf <alltraps>
801070aa <vector192>:
.globl vector192
vector192:
pushl $0
801070aa: 6a 00 push $0x0
pushl $192
801070ac: 68 c0 00 00 00 push $0xc0
jmp alltraps
801070b1: e9 09 f2 ff ff jmp 801062bf <alltraps>
801070b6 <vector193>:
.globl vector193
vector193:
pushl $0
801070b6: 6a 00 push $0x0
pushl $193
801070b8: 68 c1 00 00 00 push $0xc1
jmp alltraps
801070bd: e9 fd f1 ff ff jmp 801062bf <alltraps>
801070c2 <vector194>:
.globl vector194
vector194:
pushl $0
801070c2: 6a 00 push $0x0
pushl $194
801070c4: 68 c2 00 00 00 push $0xc2
jmp alltraps
801070c9: e9 f1 f1 ff ff jmp 801062bf <alltraps>
801070ce <vector195>:
.globl vector195
vector195:
pushl $0
801070ce: 6a 00 push $0x0
pushl $195
801070d0: 68 c3 00 00 00 push $0xc3
jmp alltraps
801070d5: e9 e5 f1 ff ff jmp 801062bf <alltraps>
801070da <vector196>:
.globl vector196
vector196:
pushl $0
801070da: 6a 00 push $0x0
pushl $196
801070dc: 68 c4 00 00 00 push $0xc4
jmp alltraps
801070e1: e9 d9 f1 ff ff jmp 801062bf <alltraps>
801070e6 <vector197>:
.globl vector197
vector197:
pushl $0
801070e6: 6a 00 push $0x0
pushl $197
801070e8: 68 c5 00 00 00 push $0xc5
jmp alltraps
801070ed: e9 cd f1 ff ff jmp 801062bf <alltraps>
801070f2 <vector198>:
.globl vector198
vector198:
pushl $0
801070f2: 6a 00 push $0x0
pushl $198
801070f4: 68 c6 00 00 00 push $0xc6
jmp alltraps
801070f9: e9 c1 f1 ff ff jmp 801062bf <alltraps>
801070fe <vector199>:
.globl vector199
vector199:
pushl $0
801070fe: 6a 00 push $0x0
pushl $199
80107100: 68 c7 00 00 00 push $0xc7
jmp alltraps
80107105: e9 b5 f1 ff ff jmp 801062bf <alltraps>
8010710a <vector200>:
.globl vector200
vector200:
pushl $0
8010710a: 6a 00 push $0x0
pushl $200
8010710c: 68 c8 00 00 00 push $0xc8
jmp alltraps
80107111: e9 a9 f1 ff ff jmp 801062bf <alltraps>
80107116 <vector201>:
.globl vector201
vector201:
pushl $0
80107116: 6a 00 push $0x0
pushl $201
80107118: 68 c9 00 00 00 push $0xc9
jmp alltraps
8010711d: e9 9d f1 ff ff jmp 801062bf <alltraps>
80107122 <vector202>:
.globl vector202
vector202:
pushl $0
80107122: 6a 00 push $0x0
pushl $202
80107124: 68 ca 00 00 00 push $0xca
jmp alltraps
80107129: e9 91 f1 ff ff jmp 801062bf <alltraps>
8010712e <vector203>:
.globl vector203
vector203:
pushl $0
8010712e: 6a 00 push $0x0
pushl $203
80107130: 68 cb 00 00 00 push $0xcb
jmp alltraps
80107135: e9 85 f1 ff ff jmp 801062bf <alltraps>
8010713a <vector204>:
.globl vector204
vector204:
pushl $0
8010713a: 6a 00 push $0x0
pushl $204
8010713c: 68 cc 00 00 00 push $0xcc
jmp alltraps
80107141: e9 79 f1 ff ff jmp 801062bf <alltraps>
80107146 <vector205>:
.globl vector205
vector205:
pushl $0
80107146: 6a 00 push $0x0
pushl $205
80107148: 68 cd 00 00 00 push $0xcd
jmp alltraps
8010714d: e9 6d f1 ff ff jmp 801062bf <alltraps>
80107152 <vector206>:
.globl vector206
vector206:
pushl $0
80107152: 6a 00 push $0x0
pushl $206
80107154: 68 ce 00 00 00 push $0xce
jmp alltraps
80107159: e9 61 f1 ff ff jmp 801062bf <alltraps>
8010715e <vector207>:
.globl vector207
vector207:
pushl $0
8010715e: 6a 00 push $0x0
pushl $207
80107160: 68 cf 00 00 00 push $0xcf
jmp alltraps
80107165: e9 55 f1 ff ff jmp 801062bf <alltraps>
8010716a <vector208>:
.globl vector208
vector208:
pushl $0
8010716a: 6a 00 push $0x0
pushl $208
8010716c: 68 d0 00 00 00 push $0xd0
jmp alltraps
80107171: e9 49 f1 ff ff jmp 801062bf <alltraps>
80107176 <vector209>:
.globl vector209
vector209:
pushl $0
80107176: 6a 00 push $0x0
pushl $209
80107178: 68 d1 00 00 00 push $0xd1
jmp alltraps
8010717d: e9 3d f1 ff ff jmp 801062bf <alltraps>
80107182 <vector210>:
.globl vector210
vector210:
pushl $0
80107182: 6a 00 push $0x0
pushl $210
80107184: 68 d2 00 00 00 push $0xd2
jmp alltraps
80107189: e9 31 f1 ff ff jmp 801062bf <alltraps>
8010718e <vector211>:
.globl vector211
vector211:
pushl $0
8010718e: 6a 00 push $0x0
pushl $211
80107190: 68 d3 00 00 00 push $0xd3
jmp alltraps
80107195: e9 25 f1 ff ff jmp 801062bf <alltraps>
8010719a <vector212>:
.globl vector212
vector212:
pushl $0
8010719a: 6a 00 push $0x0
pushl $212
8010719c: 68 d4 00 00 00 push $0xd4
jmp alltraps
801071a1: e9 19 f1 ff ff jmp 801062bf <alltraps>
801071a6 <vector213>:
.globl vector213
vector213:
pushl $0
801071a6: 6a 00 push $0x0
pushl $213
801071a8: 68 d5 00 00 00 push $0xd5
jmp alltraps
801071ad: e9 0d f1 ff ff jmp 801062bf <alltraps>
801071b2 <vector214>:
.globl vector214
vector214:
pushl $0
801071b2: 6a 00 push $0x0
pushl $214
801071b4: 68 d6 00 00 00 push $0xd6
jmp alltraps
801071b9: e9 01 f1 ff ff jmp 801062bf <alltraps>
801071be <vector215>:
.globl vector215
vector215:
pushl $0
801071be: 6a 00 push $0x0
pushl $215
801071c0: 68 d7 00 00 00 push $0xd7
jmp alltraps
801071c5: e9 f5 f0 ff ff jmp 801062bf <alltraps>
801071ca <vector216>:
.globl vector216
vector216:
pushl $0
801071ca: 6a 00 push $0x0
pushl $216
801071cc: 68 d8 00 00 00 push $0xd8
jmp alltraps
801071d1: e9 e9 f0 ff ff jmp 801062bf <alltraps>
801071d6 <vector217>:
.globl vector217
vector217:
pushl $0
801071d6: 6a 00 push $0x0
pushl $217
801071d8: 68 d9 00 00 00 push $0xd9
jmp alltraps
801071dd: e9 dd f0 ff ff jmp 801062bf <alltraps>
801071e2 <vector218>:
.globl vector218
vector218:
pushl $0
801071e2: 6a 00 push $0x0
pushl $218
801071e4: 68 da 00 00 00 push $0xda
jmp alltraps
801071e9: e9 d1 f0 ff ff jmp 801062bf <alltraps>
801071ee <vector219>:
.globl vector219
vector219:
pushl $0
801071ee: 6a 00 push $0x0
pushl $219
801071f0: 68 db 00 00 00 push $0xdb
jmp alltraps
801071f5: e9 c5 f0 ff ff jmp 801062bf <alltraps>
801071fa <vector220>:
.globl vector220
vector220:
pushl $0
801071fa: 6a 00 push $0x0
pushl $220
801071fc: 68 dc 00 00 00 push $0xdc
jmp alltraps
80107201: e9 b9 f0 ff ff jmp 801062bf <alltraps>
80107206 <vector221>:
.globl vector221
vector221:
pushl $0
80107206: 6a 00 push $0x0
pushl $221
80107208: 68 dd 00 00 00 push $0xdd
jmp alltraps
8010720d: e9 ad f0 ff ff jmp 801062bf <alltraps>
80107212 <vector222>:
.globl vector222
vector222:
pushl $0
80107212: 6a 00 push $0x0
pushl $222
80107214: 68 de 00 00 00 push $0xde
jmp alltraps
80107219: e9 a1 f0 ff ff jmp 801062bf <alltraps>
8010721e <vector223>:
.globl vector223
vector223:
pushl $0
8010721e: 6a 00 push $0x0
pushl $223
80107220: 68 df 00 00 00 push $0xdf
jmp alltraps
80107225: e9 95 f0 ff ff jmp 801062bf <alltraps>
8010722a <vector224>:
.globl vector224
vector224:
pushl $0
8010722a: 6a 00 push $0x0
pushl $224
8010722c: 68 e0 00 00 00 push $0xe0
jmp alltraps
80107231: e9 89 f0 ff ff jmp 801062bf <alltraps>
80107236 <vector225>:
.globl vector225
vector225:
pushl $0
80107236: 6a 00 push $0x0
pushl $225
80107238: 68 e1 00 00 00 push $0xe1
jmp alltraps
8010723d: e9 7d f0 ff ff jmp 801062bf <alltraps>
80107242 <vector226>:
.globl vector226
vector226:
pushl $0
80107242: 6a 00 push $0x0
pushl $226
80107244: 68 e2 00 00 00 push $0xe2
jmp alltraps
80107249: e9 71 f0 ff ff jmp 801062bf <alltraps>
8010724e <vector227>:
.globl vector227
vector227:
pushl $0
8010724e: 6a 00 push $0x0
pushl $227
80107250: 68 e3 00 00 00 push $0xe3
jmp alltraps
80107255: e9 65 f0 ff ff jmp 801062bf <alltraps>
8010725a <vector228>:
.globl vector228
vector228:
pushl $0
8010725a: 6a 00 push $0x0
pushl $228
8010725c: 68 e4 00 00 00 push $0xe4
jmp alltraps
80107261: e9 59 f0 ff ff jmp 801062bf <alltraps>
80107266 <vector229>:
.globl vector229
vector229:
pushl $0
80107266: 6a 00 push $0x0
pushl $229
80107268: 68 e5 00 00 00 push $0xe5
jmp alltraps
8010726d: e9 4d f0 ff ff jmp 801062bf <alltraps>
80107272 <vector230>:
.globl vector230
vector230:
pushl $0
80107272: 6a 00 push $0x0
pushl $230
80107274: 68 e6 00 00 00 push $0xe6
jmp alltraps
80107279: e9 41 f0 ff ff jmp 801062bf <alltraps>
8010727e <vector231>:
.globl vector231
vector231:
pushl $0
8010727e: 6a 00 push $0x0
pushl $231
80107280: 68 e7 00 00 00 push $0xe7
jmp alltraps
80107285: e9 35 f0 ff ff jmp 801062bf <alltraps>
8010728a <vector232>:
.globl vector232
vector232:
pushl $0
8010728a: 6a 00 push $0x0
pushl $232
8010728c: 68 e8 00 00 00 push $0xe8
jmp alltraps
80107291: e9 29 f0 ff ff jmp 801062bf <alltraps>
80107296 <vector233>:
.globl vector233
vector233:
pushl $0
80107296: 6a 00 push $0x0
pushl $233
80107298: 68 e9 00 00 00 push $0xe9
jmp alltraps
8010729d: e9 1d f0 ff ff jmp 801062bf <alltraps>
801072a2 <vector234>:
.globl vector234
vector234:
pushl $0
801072a2: 6a 00 push $0x0
pushl $234
801072a4: 68 ea 00 00 00 push $0xea
jmp alltraps
801072a9: e9 11 f0 ff ff jmp 801062bf <alltraps>
801072ae <vector235>:
.globl vector235
vector235:
pushl $0
801072ae: 6a 00 push $0x0
pushl $235
801072b0: 68 eb 00 00 00 push $0xeb
jmp alltraps
801072b5: e9 05 f0 ff ff jmp 801062bf <alltraps>
801072ba <vector236>:
.globl vector236
vector236:
pushl $0
801072ba: 6a 00 push $0x0
pushl $236
801072bc: 68 ec 00 00 00 push $0xec
jmp alltraps
801072c1: e9 f9 ef ff ff jmp 801062bf <alltraps>
801072c6 <vector237>:
.globl vector237
vector237:
pushl $0
801072c6: 6a 00 push $0x0
pushl $237
801072c8: 68 ed 00 00 00 push $0xed
jmp alltraps
801072cd: e9 ed ef ff ff jmp 801062bf <alltraps>
801072d2 <vector238>:
.globl vector238
vector238:
pushl $0
801072d2: 6a 00 push $0x0
pushl $238
801072d4: 68 ee 00 00 00 push $0xee
jmp alltraps
801072d9: e9 e1 ef ff ff jmp 801062bf <alltraps>
801072de <vector239>:
.globl vector239
vector239:
pushl $0
801072de: 6a 00 push $0x0
pushl $239
801072e0: 68 ef 00 00 00 push $0xef
jmp alltraps
801072e5: e9 d5 ef ff ff jmp 801062bf <alltraps>
801072ea <vector240>:
.globl vector240
vector240:
pushl $0
801072ea: 6a 00 push $0x0
pushl $240
801072ec: 68 f0 00 00 00 push $0xf0
jmp alltraps
801072f1: e9 c9 ef ff ff jmp 801062bf <alltraps>
801072f6 <vector241>:
.globl vector241
vector241:
pushl $0
801072f6: 6a 00 push $0x0
pushl $241
801072f8: 68 f1 00 00 00 push $0xf1
jmp alltraps
801072fd: e9 bd ef ff ff jmp 801062bf <alltraps>
80107302 <vector242>:
.globl vector242
vector242:
pushl $0
80107302: 6a 00 push $0x0
pushl $242
80107304: 68 f2 00 00 00 push $0xf2
jmp alltraps
80107309: e9 b1 ef ff ff jmp 801062bf <alltraps>
8010730e <vector243>:
.globl vector243
vector243:
pushl $0
8010730e: 6a 00 push $0x0
pushl $243
80107310: 68 f3 00 00 00 push $0xf3
jmp alltraps
80107315: e9 a5 ef ff ff jmp 801062bf <alltraps>
8010731a <vector244>:
.globl vector244
vector244:
pushl $0
8010731a: 6a 00 push $0x0
pushl $244
8010731c: 68 f4 00 00 00 push $0xf4
jmp alltraps
80107321: e9 99 ef ff ff jmp 801062bf <alltraps>
80107326 <vector245>:
.globl vector245
vector245:
pushl $0
80107326: 6a 00 push $0x0
pushl $245
80107328: 68 f5 00 00 00 push $0xf5
jmp alltraps
8010732d: e9 8d ef ff ff jmp 801062bf <alltraps>
80107332 <vector246>:
.globl vector246
vector246:
pushl $0
80107332: 6a 00 push $0x0
pushl $246
80107334: 68 f6 00 00 00 push $0xf6
jmp alltraps
80107339: e9 81 ef ff ff jmp 801062bf <alltraps>
8010733e <vector247>:
.globl vector247
vector247:
pushl $0
8010733e: 6a 00 push $0x0
pushl $247
80107340: 68 f7 00 00 00 push $0xf7
jmp alltraps
80107345: e9 75 ef ff ff jmp 801062bf <alltraps>
8010734a <vector248>:
.globl vector248
vector248:
pushl $0
8010734a: 6a 00 push $0x0
pushl $248
8010734c: 68 f8 00 00 00 push $0xf8
jmp alltraps
80107351: e9 69 ef ff ff jmp 801062bf <alltraps>
80107356 <vector249>:
.globl vector249
vector249:
pushl $0
80107356: 6a 00 push $0x0
pushl $249
80107358: 68 f9 00 00 00 push $0xf9
jmp alltraps
8010735d: e9 5d ef ff ff jmp 801062bf <alltraps>
80107362 <vector250>:
.globl vector250
vector250:
pushl $0
80107362: 6a 00 push $0x0
pushl $250
80107364: 68 fa 00 00 00 push $0xfa
jmp alltraps
80107369: e9 51 ef ff ff jmp 801062bf <alltraps>
8010736e <vector251>:
.globl vector251
vector251:
pushl $0
8010736e: 6a 00 push $0x0
pushl $251
80107370: 68 fb 00 00 00 push $0xfb
jmp alltraps
80107375: e9 45 ef ff ff jmp 801062bf <alltraps>
8010737a <vector252>:
.globl vector252
vector252:
pushl $0
8010737a: 6a 00 push $0x0
pushl $252
8010737c: 68 fc 00 00 00 push $0xfc
jmp alltraps
80107381: e9 39 ef ff ff jmp 801062bf <alltraps>
80107386 <vector253>:
.globl vector253
vector253:
pushl $0
80107386: 6a 00 push $0x0
pushl $253
80107388: 68 fd 00 00 00 push $0xfd
jmp alltraps
8010738d: e9 2d ef ff ff jmp 801062bf <alltraps>
80107392 <vector254>:
.globl vector254
vector254:
pushl $0
80107392: 6a 00 push $0x0
pushl $254
80107394: 68 fe 00 00 00 push $0xfe
jmp alltraps
80107399: e9 21 ef ff ff jmp 801062bf <alltraps>
8010739e <vector255>:
.globl vector255
vector255:
pushl $0
8010739e: 6a 00 push $0x0
pushl $255
801073a0: 68 ff 00 00 00 push $0xff
jmp alltraps
801073a5: e9 15 ef ff ff jmp 801062bf <alltraps>
801073aa <lgdt>:
struct segdesc;
static inline void
lgdt(struct segdesc *p, int size)
{
801073aa: 55 push %ebp
801073ab: 89 e5 mov %esp,%ebp
801073ad: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
801073b0: 8b 45 0c mov 0xc(%ebp),%eax
801073b3: 83 e8 01 sub $0x1,%eax
801073b6: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
801073ba: 8b 45 08 mov 0x8(%ebp),%eax
801073bd: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
801073c1: 8b 45 08 mov 0x8(%ebp),%eax
801073c4: c1 e8 10 shr $0x10,%eax
801073c7: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
801073cb: 8d 45 fa lea -0x6(%ebp),%eax
801073ce: 0f 01 10 lgdtl (%eax)
}
801073d1: c9 leave
801073d2: c3 ret
801073d3 <ltr>:
asm volatile("lidt (%0)" : : "r" (pd));
}
static inline void
ltr(ushort sel)
{
801073d3: 55 push %ebp
801073d4: 89 e5 mov %esp,%ebp
801073d6: 83 ec 04 sub $0x4,%esp
801073d9: 8b 45 08 mov 0x8(%ebp),%eax
801073dc: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("ltr %0" : : "r" (sel));
801073e0: 0f b7 45 fc movzwl -0x4(%ebp),%eax
801073e4: 0f 00 d8 ltr %ax
}
801073e7: c9 leave
801073e8: c3 ret
801073e9 <loadgs>:
return eflags;
}
static inline void
loadgs(ushort v)
{
801073e9: 55 push %ebp
801073ea: 89 e5 mov %esp,%ebp
801073ec: 83 ec 04 sub $0x4,%esp
801073ef: 8b 45 08 mov 0x8(%ebp),%eax
801073f2: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("movw %0, %%gs" : : "r" (v));
801073f6: 0f b7 45 fc movzwl -0x4(%ebp),%eax
801073fa: 8e e8 mov %eax,%gs
}
801073fc: c9 leave
801073fd: c3 ret
801073fe <lcr3>:
return val;
}
static inline void
lcr3(uint val)
{
801073fe: 55 push %ebp
801073ff: 89 e5 mov %esp,%ebp
asm volatile("movl %0,%%cr3" : : "r" (val));
80107401: 8b 45 08 mov 0x8(%ebp),%eax
80107404: 0f 22 d8 mov %eax,%cr3
}
80107407: 5d pop %ebp
80107408: c3 ret
80107409 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
80107409: 55 push %ebp
8010740a: 89 e5 mov %esp,%ebp
8010740c: 8b 45 08 mov 0x8(%ebp),%eax
8010740f: 05 00 00 00 80 add $0x80000000,%eax
80107414: 5d pop %ebp
80107415: c3 ret
80107416 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80107416: 55 push %ebp
80107417: 89 e5 mov %esp,%ebp
80107419: 8b 45 08 mov 0x8(%ebp),%eax
8010741c: 05 00 00 00 80 add $0x80000000,%eax
80107421: 5d pop %ebp
80107422: c3 ret
80107423 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80107423: 55 push %ebp
80107424: 89 e5 mov %esp,%ebp
80107426: 53 push %ebx
80107427: 83 ec 24 sub $0x24,%esp
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
8010742a: e8 18 ba ff ff call 80102e47 <cpunum>
8010742f: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80107435: 05 20 f9 10 80 add $0x8010f920,%eax
8010743a: 89 45 f4 mov %eax,-0xc(%ebp)
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
8010743d: 8b 45 f4 mov -0xc(%ebp),%eax
80107440: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax)
80107446: 8b 45 f4 mov -0xc(%ebp),%eax
80107449: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax)
8010744f: 8b 45 f4 mov -0xc(%ebp),%eax
80107452: c6 40 7c 00 movb $0x0,0x7c(%eax)
80107456: 8b 45 f4 mov -0xc(%ebp),%eax
80107459: 0f b6 50 7d movzbl 0x7d(%eax),%edx
8010745d: 83 e2 f0 and $0xfffffff0,%edx
80107460: 83 ca 0a or $0xa,%edx
80107463: 88 50 7d mov %dl,0x7d(%eax)
80107466: 8b 45 f4 mov -0xc(%ebp),%eax
80107469: 0f b6 50 7d movzbl 0x7d(%eax),%edx
8010746d: 83 ca 10 or $0x10,%edx
80107470: 88 50 7d mov %dl,0x7d(%eax)
80107473: 8b 45 f4 mov -0xc(%ebp),%eax
80107476: 0f b6 50 7d movzbl 0x7d(%eax),%edx
8010747a: 83 e2 9f and $0xffffff9f,%edx
8010747d: 88 50 7d mov %dl,0x7d(%eax)
80107480: 8b 45 f4 mov -0xc(%ebp),%eax
80107483: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107487: 83 ca 80 or $0xffffff80,%edx
8010748a: 88 50 7d mov %dl,0x7d(%eax)
8010748d: 8b 45 f4 mov -0xc(%ebp),%eax
80107490: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107494: 83 ca 0f or $0xf,%edx
80107497: 88 50 7e mov %dl,0x7e(%eax)
8010749a: 8b 45 f4 mov -0xc(%ebp),%eax
8010749d: 0f b6 50 7e movzbl 0x7e(%eax),%edx
801074a1: 83 e2 ef and $0xffffffef,%edx
801074a4: 88 50 7e mov %dl,0x7e(%eax)
801074a7: 8b 45 f4 mov -0xc(%ebp),%eax
801074aa: 0f b6 50 7e movzbl 0x7e(%eax),%edx
801074ae: 83 e2 df and $0xffffffdf,%edx
801074b1: 88 50 7e mov %dl,0x7e(%eax)
801074b4: 8b 45 f4 mov -0xc(%ebp),%eax
801074b7: 0f b6 50 7e movzbl 0x7e(%eax),%edx
801074bb: 83 ca 40 or $0x40,%edx
801074be: 88 50 7e mov %dl,0x7e(%eax)
801074c1: 8b 45 f4 mov -0xc(%ebp),%eax
801074c4: 0f b6 50 7e movzbl 0x7e(%eax),%edx
801074c8: 83 ca 80 or $0xffffff80,%edx
801074cb: 88 50 7e mov %dl,0x7e(%eax)
801074ce: 8b 45 f4 mov -0xc(%ebp),%eax
801074d1: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
801074d5: 8b 45 f4 mov -0xc(%ebp),%eax
801074d8: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax)
801074df: ff ff
801074e1: 8b 45 f4 mov -0xc(%ebp),%eax
801074e4: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax)
801074eb: 00 00
801074ed: 8b 45 f4 mov -0xc(%ebp),%eax
801074f0: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
801074f7: 8b 45 f4 mov -0xc(%ebp),%eax
801074fa: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107501: 83 e2 f0 and $0xfffffff0,%edx
80107504: 83 ca 02 or $0x2,%edx
80107507: 88 90 85 00 00 00 mov %dl,0x85(%eax)
8010750d: 8b 45 f4 mov -0xc(%ebp),%eax
80107510: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107517: 83 ca 10 or $0x10,%edx
8010751a: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107520: 8b 45 f4 mov -0xc(%ebp),%eax
80107523: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
8010752a: 83 e2 9f and $0xffffff9f,%edx
8010752d: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107533: 8b 45 f4 mov -0xc(%ebp),%eax
80107536: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
8010753d: 83 ca 80 or $0xffffff80,%edx
80107540: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107546: 8b 45 f4 mov -0xc(%ebp),%eax
80107549: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107550: 83 ca 0f or $0xf,%edx
80107553: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107559: 8b 45 f4 mov -0xc(%ebp),%eax
8010755c: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107563: 83 e2 ef and $0xffffffef,%edx
80107566: 88 90 86 00 00 00 mov %dl,0x86(%eax)
8010756c: 8b 45 f4 mov -0xc(%ebp),%eax
8010756f: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107576: 83 e2 df and $0xffffffdf,%edx
80107579: 88 90 86 00 00 00 mov %dl,0x86(%eax)
8010757f: 8b 45 f4 mov -0xc(%ebp),%eax
80107582: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107589: 83 ca 40 or $0x40,%edx
8010758c: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107592: 8b 45 f4 mov -0xc(%ebp),%eax
80107595: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
8010759c: 83 ca 80 or $0xffffff80,%edx
8010759f: 88 90 86 00 00 00 mov %dl,0x86(%eax)
801075a5: 8b 45 f4 mov -0xc(%ebp),%eax
801075a8: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
801075af: 8b 45 f4 mov -0xc(%ebp),%eax
801075b2: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax)
801075b9: ff ff
801075bb: 8b 45 f4 mov -0xc(%ebp),%eax
801075be: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax)
801075c5: 00 00
801075c7: 8b 45 f4 mov -0xc(%ebp),%eax
801075ca: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
801075d1: 8b 45 f4 mov -0xc(%ebp),%eax
801075d4: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
801075db: 83 e2 f0 and $0xfffffff0,%edx
801075de: 83 ca 0a or $0xa,%edx
801075e1: 88 90 95 00 00 00 mov %dl,0x95(%eax)
801075e7: 8b 45 f4 mov -0xc(%ebp),%eax
801075ea: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
801075f1: 83 ca 10 or $0x10,%edx
801075f4: 88 90 95 00 00 00 mov %dl,0x95(%eax)
801075fa: 8b 45 f4 mov -0xc(%ebp),%eax
801075fd: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107604: 83 ca 60 or $0x60,%edx
80107607: 88 90 95 00 00 00 mov %dl,0x95(%eax)
8010760d: 8b 45 f4 mov -0xc(%ebp),%eax
80107610: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107617: 83 ca 80 or $0xffffff80,%edx
8010761a: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107620: 8b 45 f4 mov -0xc(%ebp),%eax
80107623: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
8010762a: 83 ca 0f or $0xf,%edx
8010762d: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107633: 8b 45 f4 mov -0xc(%ebp),%eax
80107636: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
8010763d: 83 e2 ef and $0xffffffef,%edx
80107640: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107646: 8b 45 f4 mov -0xc(%ebp),%eax
80107649: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107650: 83 e2 df and $0xffffffdf,%edx
80107653: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107659: 8b 45 f4 mov -0xc(%ebp),%eax
8010765c: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107663: 83 ca 40 or $0x40,%edx
80107666: 88 90 96 00 00 00 mov %dl,0x96(%eax)
8010766c: 8b 45 f4 mov -0xc(%ebp),%eax
8010766f: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107676: 83 ca 80 or $0xffffff80,%edx
80107679: 88 90 96 00 00 00 mov %dl,0x96(%eax)
8010767f: 8b 45 f4 mov -0xc(%ebp),%eax
80107682: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107689: 8b 45 f4 mov -0xc(%ebp),%eax
8010768c: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax)
80107693: ff ff
80107695: 8b 45 f4 mov -0xc(%ebp),%eax
80107698: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax)
8010769f: 00 00
801076a1: 8b 45 f4 mov -0xc(%ebp),%eax
801076a4: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
801076ab: 8b 45 f4 mov -0xc(%ebp),%eax
801076ae: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
801076b5: 83 e2 f0 and $0xfffffff0,%edx
801076b8: 83 ca 02 or $0x2,%edx
801076bb: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
801076c1: 8b 45 f4 mov -0xc(%ebp),%eax
801076c4: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
801076cb: 83 ca 10 or $0x10,%edx
801076ce: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
801076d4: 8b 45 f4 mov -0xc(%ebp),%eax
801076d7: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
801076de: 83 ca 60 or $0x60,%edx
801076e1: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
801076e7: 8b 45 f4 mov -0xc(%ebp),%eax
801076ea: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
801076f1: 83 ca 80 or $0xffffff80,%edx
801076f4: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
801076fa: 8b 45 f4 mov -0xc(%ebp),%eax
801076fd: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107704: 83 ca 0f or $0xf,%edx
80107707: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
8010770d: 8b 45 f4 mov -0xc(%ebp),%eax
80107710: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107717: 83 e2 ef and $0xffffffef,%edx
8010771a: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107720: 8b 45 f4 mov -0xc(%ebp),%eax
80107723: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
8010772a: 83 e2 df and $0xffffffdf,%edx
8010772d: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107733: 8b 45 f4 mov -0xc(%ebp),%eax
80107736: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
8010773d: 83 ca 40 or $0x40,%edx
80107740: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107746: 8b 45 f4 mov -0xc(%ebp),%eax
80107749: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107750: 83 ca 80 or $0xffffff80,%edx
80107753: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107759: 8b 45 f4 mov -0xc(%ebp),%eax
8010775c: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax)
// Map cpu, and curproc
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
80107763: 8b 45 f4 mov -0xc(%ebp),%eax
80107766: 05 b4 00 00 00 add $0xb4,%eax
8010776b: 89 c3 mov %eax,%ebx
8010776d: 8b 45 f4 mov -0xc(%ebp),%eax
80107770: 05 b4 00 00 00 add $0xb4,%eax
80107775: c1 e8 10 shr $0x10,%eax
80107778: 89 c1 mov %eax,%ecx
8010777a: 8b 45 f4 mov -0xc(%ebp),%eax
8010777d: 05 b4 00 00 00 add $0xb4,%eax
80107782: c1 e8 18 shr $0x18,%eax
80107785: 89 c2 mov %eax,%edx
80107787: 8b 45 f4 mov -0xc(%ebp),%eax
8010778a: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax)
80107791: 00 00
80107793: 8b 45 f4 mov -0xc(%ebp),%eax
80107796: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax)
8010779d: 8b 45 f4 mov -0xc(%ebp),%eax
801077a0: 88 88 8c 00 00 00 mov %cl,0x8c(%eax)
801077a6: 8b 45 f4 mov -0xc(%ebp),%eax
801077a9: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
801077b0: 83 e1 f0 and $0xfffffff0,%ecx
801077b3: 83 c9 02 or $0x2,%ecx
801077b6: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
801077bc: 8b 45 f4 mov -0xc(%ebp),%eax
801077bf: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
801077c6: 83 c9 10 or $0x10,%ecx
801077c9: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
801077cf: 8b 45 f4 mov -0xc(%ebp),%eax
801077d2: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
801077d9: 83 e1 9f and $0xffffff9f,%ecx
801077dc: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
801077e2: 8b 45 f4 mov -0xc(%ebp),%eax
801077e5: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
801077ec: 83 c9 80 or $0xffffff80,%ecx
801077ef: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
801077f5: 8b 45 f4 mov -0xc(%ebp),%eax
801077f8: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
801077ff: 83 e1 f0 and $0xfffffff0,%ecx
80107802: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80107808: 8b 45 f4 mov -0xc(%ebp),%eax
8010780b: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80107812: 83 e1 ef and $0xffffffef,%ecx
80107815: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
8010781b: 8b 45 f4 mov -0xc(%ebp),%eax
8010781e: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80107825: 83 e1 df and $0xffffffdf,%ecx
80107828: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
8010782e: 8b 45 f4 mov -0xc(%ebp),%eax
80107831: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80107838: 83 c9 40 or $0x40,%ecx
8010783b: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80107841: 8b 45 f4 mov -0xc(%ebp),%eax
80107844: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
8010784b: 83 c9 80 or $0xffffff80,%ecx
8010784e: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80107854: 8b 45 f4 mov -0xc(%ebp),%eax
80107857: 88 90 8f 00 00 00 mov %dl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
8010785d: 8b 45 f4 mov -0xc(%ebp),%eax
80107860: 83 c0 70 add $0x70,%eax
80107863: c7 44 24 04 38 00 00 movl $0x38,0x4(%esp)
8010786a: 00
8010786b: 89 04 24 mov %eax,(%esp)
8010786e: e8 37 fb ff ff call 801073aa <lgdt>
loadgs(SEG_KCPU << 3);
80107873: c7 04 24 18 00 00 00 movl $0x18,(%esp)
8010787a: e8 6a fb ff ff call 801073e9 <loadgs>
// Initialize cpu-local storage.
cpu = c;
8010787f: 8b 45 f4 mov -0xc(%ebp),%eax
80107882: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
80107888: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
8010788f: 00 00 00 00
}
80107893: 83 c4 24 add $0x24,%esp
80107896: 5b pop %ebx
80107897: 5d pop %ebp
80107898: c3 ret
80107899 <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
80107899: 55 push %ebp
8010789a: 89 e5 mov %esp,%ebp
8010789c: 83 ec 28 sub $0x28,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
8010789f: 8b 45 0c mov 0xc(%ebp),%eax
801078a2: c1 e8 16 shr $0x16,%eax
801078a5: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
801078ac: 8b 45 08 mov 0x8(%ebp),%eax
801078af: 01 d0 add %edx,%eax
801078b1: 89 45 f0 mov %eax,-0x10(%ebp)
if(*pde & PTE_P){
801078b4: 8b 45 f0 mov -0x10(%ebp),%eax
801078b7: 8b 00 mov (%eax),%eax
801078b9: 83 e0 01 and $0x1,%eax
801078bc: 85 c0 test %eax,%eax
801078be: 74 17 je 801078d7 <walkpgdir+0x3e>
pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
801078c0: 8b 45 f0 mov -0x10(%ebp),%eax
801078c3: 8b 00 mov (%eax),%eax
801078c5: 25 00 f0 ff ff and $0xfffff000,%eax
801078ca: 89 04 24 mov %eax,(%esp)
801078cd: e8 44 fb ff ff call 80107416 <p2v>
801078d2: 89 45 f4 mov %eax,-0xc(%ebp)
801078d5: eb 4b jmp 80107922 <walkpgdir+0x89>
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801078d7: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801078db: 74 0e je 801078eb <walkpgdir+0x52>
801078dd: e8 ec b1 ff ff call 80102ace <kalloc>
801078e2: 89 45 f4 mov %eax,-0xc(%ebp)
801078e5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801078e9: 75 07 jne 801078f2 <walkpgdir+0x59>
return 0;
801078eb: b8 00 00 00 00 mov $0x0,%eax
801078f0: eb 47 jmp 80107939 <walkpgdir+0xa0>
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
801078f2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801078f9: 00
801078fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107901: 00
80107902: 8b 45 f4 mov -0xc(%ebp),%eax
80107905: 89 04 24 mov %eax,(%esp)
80107908: e8 a9 d3 ff ff call 80104cb6 <memset>
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
8010790d: 8b 45 f4 mov -0xc(%ebp),%eax
80107910: 89 04 24 mov %eax,(%esp)
80107913: e8 f1 fa ff ff call 80107409 <v2p>
80107918: 83 c8 07 or $0x7,%eax
8010791b: 89 c2 mov %eax,%edx
8010791d: 8b 45 f0 mov -0x10(%ebp),%eax
80107920: 89 10 mov %edx,(%eax)
}
return &pgtab[PTX(va)];
80107922: 8b 45 0c mov 0xc(%ebp),%eax
80107925: c1 e8 0c shr $0xc,%eax
80107928: 25 ff 03 00 00 and $0x3ff,%eax
8010792d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80107934: 8b 45 f4 mov -0xc(%ebp),%eax
80107937: 01 d0 add %edx,%eax
}
80107939: c9 leave
8010793a: c3 ret
8010793b <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
8010793b: 55 push %ebp
8010793c: 89 e5 mov %esp,%ebp
8010793e: 83 ec 28 sub $0x28,%esp
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
80107941: 8b 45 0c mov 0xc(%ebp),%eax
80107944: 25 00 f0 ff ff and $0xfffff000,%eax
80107949: 89 45 f4 mov %eax,-0xc(%ebp)
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
8010794c: 8b 55 0c mov 0xc(%ebp),%edx
8010794f: 8b 45 10 mov 0x10(%ebp),%eax
80107952: 01 d0 add %edx,%eax
80107954: 83 e8 01 sub $0x1,%eax
80107957: 25 00 f0 ff ff and $0xfffff000,%eax
8010795c: 89 45 f0 mov %eax,-0x10(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
8010795f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
80107966: 00
80107967: 8b 45 f4 mov -0xc(%ebp),%eax
8010796a: 89 44 24 04 mov %eax,0x4(%esp)
8010796e: 8b 45 08 mov 0x8(%ebp),%eax
80107971: 89 04 24 mov %eax,(%esp)
80107974: e8 20 ff ff ff call 80107899 <walkpgdir>
80107979: 89 45 ec mov %eax,-0x14(%ebp)
8010797c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80107980: 75 07 jne 80107989 <mappages+0x4e>
return -1;
80107982: b8 ff ff ff ff mov $0xffffffff,%eax
80107987: eb 48 jmp 801079d1 <mappages+0x96>
if(*pte & PTE_P)
80107989: 8b 45 ec mov -0x14(%ebp),%eax
8010798c: 8b 00 mov (%eax),%eax
8010798e: 83 e0 01 and $0x1,%eax
80107991: 85 c0 test %eax,%eax
80107993: 74 0c je 801079a1 <mappages+0x66>
panic("remap");
80107995: c7 04 24 4c 88 10 80 movl $0x8010884c,(%esp)
8010799c: e8 99 8b ff ff call 8010053a <panic>
*pte = pa | perm | PTE_P;
801079a1: 8b 45 18 mov 0x18(%ebp),%eax
801079a4: 0b 45 14 or 0x14(%ebp),%eax
801079a7: 83 c8 01 or $0x1,%eax
801079aa: 89 c2 mov %eax,%edx
801079ac: 8b 45 ec mov -0x14(%ebp),%eax
801079af: 89 10 mov %edx,(%eax)
if(a == last)
801079b1: 8b 45 f4 mov -0xc(%ebp),%eax
801079b4: 3b 45 f0 cmp -0x10(%ebp),%eax
801079b7: 75 08 jne 801079c1 <mappages+0x86>
break;
801079b9: 90 nop
a += PGSIZE;
pa += PGSIZE;
}
return 0;
801079ba: b8 00 00 00 00 mov $0x0,%eax
801079bf: eb 10 jmp 801079d1 <mappages+0x96>
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
if(a == last)
break;
a += PGSIZE;
801079c1: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
pa += PGSIZE;
801079c8: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp)
}
801079cf: eb 8e jmp 8010795f <mappages+0x24>
return 0;
}
801079d1: c9 leave
801079d2: c3 ret
801079d3 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
801079d3: 55 push %ebp
801079d4: 89 e5 mov %esp,%ebp
801079d6: 53 push %ebx
801079d7: 83 ec 34 sub $0x34,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
801079da: e8 ef b0 ff ff call 80102ace <kalloc>
801079df: 89 45 f0 mov %eax,-0x10(%ebp)
801079e2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801079e6: 75 0a jne 801079f2 <setupkvm+0x1f>
return 0;
801079e8: b8 00 00 00 00 mov $0x0,%eax
801079ed: e9 98 00 00 00 jmp 80107a8a <setupkvm+0xb7>
memset(pgdir, 0, PGSIZE);
801079f2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801079f9: 00
801079fa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107a01: 00
80107a02: 8b 45 f0 mov -0x10(%ebp),%eax
80107a05: 89 04 24 mov %eax,(%esp)
80107a08: e8 a9 d2 ff ff call 80104cb6 <memset>
if (p2v(PHYSTOP) > (void*)DEVSPACE)
80107a0d: c7 04 24 00 00 00 0e movl $0xe000000,(%esp)
80107a14: e8 fd f9 ff ff call 80107416 <p2v>
80107a19: 3d 00 00 00 fe cmp $0xfe000000,%eax
80107a1e: 76 0c jbe 80107a2c <setupkvm+0x59>
panic("PHYSTOP too high");
80107a20: c7 04 24 52 88 10 80 movl $0x80108852,(%esp)
80107a27: e8 0e 8b ff ff call 8010053a <panic>
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107a2c: c7 45 f4 a0 b4 10 80 movl $0x8010b4a0,-0xc(%ebp)
80107a33: eb 49 jmp 80107a7e <setupkvm+0xab>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80107a35: 8b 45 f4 mov -0xc(%ebp),%eax
80107a38: 8b 48 0c mov 0xc(%eax),%ecx
80107a3b: 8b 45 f4 mov -0xc(%ebp),%eax
80107a3e: 8b 50 04 mov 0x4(%eax),%edx
80107a41: 8b 45 f4 mov -0xc(%ebp),%eax
80107a44: 8b 58 08 mov 0x8(%eax),%ebx
80107a47: 8b 45 f4 mov -0xc(%ebp),%eax
80107a4a: 8b 40 04 mov 0x4(%eax),%eax
80107a4d: 29 c3 sub %eax,%ebx
80107a4f: 8b 45 f4 mov -0xc(%ebp),%eax
80107a52: 8b 00 mov (%eax),%eax
80107a54: 89 4c 24 10 mov %ecx,0x10(%esp)
80107a58: 89 54 24 0c mov %edx,0xc(%esp)
80107a5c: 89 5c 24 08 mov %ebx,0x8(%esp)
80107a60: 89 44 24 04 mov %eax,0x4(%esp)
80107a64: 8b 45 f0 mov -0x10(%ebp),%eax
80107a67: 89 04 24 mov %eax,(%esp)
80107a6a: e8 cc fe ff ff call 8010793b <mappages>
80107a6f: 85 c0 test %eax,%eax
80107a71: 79 07 jns 80107a7a <setupkvm+0xa7>
(uint)k->phys_start, k->perm) < 0)
return 0;
80107a73: b8 00 00 00 00 mov $0x0,%eax
80107a78: eb 10 jmp 80107a8a <setupkvm+0xb7>
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80107a7a: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80107a7e: 81 7d f4 e0 b4 10 80 cmpl $0x8010b4e0,-0xc(%ebp)
80107a85: 72 ae jb 80107a35 <setupkvm+0x62>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
80107a87: 8b 45 f0 mov -0x10(%ebp),%eax
}
80107a8a: 83 c4 34 add $0x34,%esp
80107a8d: 5b pop %ebx
80107a8e: 5d pop %ebp
80107a8f: c3 ret
80107a90 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
80107a90: 55 push %ebp
80107a91: 89 e5 mov %esp,%ebp
80107a93: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
80107a96: e8 38 ff ff ff call 801079d3 <setupkvm>
80107a9b: a3 f8 26 11 80 mov %eax,0x801126f8
switchkvm();
80107aa0: e8 02 00 00 00 call 80107aa7 <switchkvm>
}
80107aa5: c9 leave
80107aa6: c3 ret
80107aa7 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80107aa7: 55 push %ebp
80107aa8: 89 e5 mov %esp,%ebp
80107aaa: 83 ec 04 sub $0x4,%esp
lcr3(v2p(kpgdir)); // switch to the kernel page table
80107aad: a1 f8 26 11 80 mov 0x801126f8,%eax
80107ab2: 89 04 24 mov %eax,(%esp)
80107ab5: e8 4f f9 ff ff call 80107409 <v2p>
80107aba: 89 04 24 mov %eax,(%esp)
80107abd: e8 3c f9 ff ff call 801073fe <lcr3>
}
80107ac2: c9 leave
80107ac3: c3 ret
80107ac4 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80107ac4: 55 push %ebp
80107ac5: 89 e5 mov %esp,%ebp
80107ac7: 53 push %ebx
80107ac8: 83 ec 14 sub $0x14,%esp
pushcli();
80107acb: e8 e6 d0 ff ff call 80104bb6 <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80107ad0: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107ad6: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107add: 83 c2 08 add $0x8,%edx
80107ae0: 89 d3 mov %edx,%ebx
80107ae2: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107ae9: 83 c2 08 add $0x8,%edx
80107aec: c1 ea 10 shr $0x10,%edx
80107aef: 89 d1 mov %edx,%ecx
80107af1: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80107af8: 83 c2 08 add $0x8,%edx
80107afb: c1 ea 18 shr $0x18,%edx
80107afe: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax)
80107b05: 67 00
80107b07: 66 89 98 a2 00 00 00 mov %bx,0xa2(%eax)
80107b0e: 88 88 a4 00 00 00 mov %cl,0xa4(%eax)
80107b14: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107b1b: 83 e1 f0 and $0xfffffff0,%ecx
80107b1e: 83 c9 09 or $0x9,%ecx
80107b21: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107b27: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107b2e: 83 c9 10 or $0x10,%ecx
80107b31: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107b37: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107b3e: 83 e1 9f and $0xffffff9f,%ecx
80107b41: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107b47: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80107b4e: 83 c9 80 or $0xffffff80,%ecx
80107b51: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80107b57: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107b5e: 83 e1 f0 and $0xfffffff0,%ecx
80107b61: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107b67: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107b6e: 83 e1 ef and $0xffffffef,%ecx
80107b71: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107b77: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107b7e: 83 e1 df and $0xffffffdf,%ecx
80107b81: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107b87: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107b8e: 83 c9 40 or $0x40,%ecx
80107b91: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107b97: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
80107b9e: 83 e1 7f and $0x7f,%ecx
80107ba1: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80107ba7: 88 90 a7 00 00 00 mov %dl,0xa7(%eax)
cpu->gdt[SEG_TSS].s = 0;
80107bad: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107bb3: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
80107bba: 83 e2 ef and $0xffffffef,%edx
80107bbd: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
80107bc3: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107bc9: 66 c7 40 10 10 00 movw $0x10,0x10(%eax)
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
80107bcf: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80107bd5: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80107bdc: 8b 52 08 mov 0x8(%edx),%edx
80107bdf: 81 c2 00 10 00 00 add $0x1000,%edx
80107be5: 89 50 0c mov %edx,0xc(%eax)
ltr(SEG_TSS << 3);
80107be8: c7 04 24 30 00 00 00 movl $0x30,(%esp)
80107bef: e8 df f7 ff ff call 801073d3 <ltr>
if(p->pgdir == 0)
80107bf4: 8b 45 08 mov 0x8(%ebp),%eax
80107bf7: 8b 40 04 mov 0x4(%eax),%eax
80107bfa: 85 c0 test %eax,%eax
80107bfc: 75 0c jne 80107c0a <switchuvm+0x146>
panic("switchuvm: no pgdir");
80107bfe: c7 04 24 63 88 10 80 movl $0x80108863,(%esp)
80107c05: e8 30 89 ff ff call 8010053a <panic>
lcr3(v2p(p->pgdir)); // switch to new address space
80107c0a: 8b 45 08 mov 0x8(%ebp),%eax
80107c0d: 8b 40 04 mov 0x4(%eax),%eax
80107c10: 89 04 24 mov %eax,(%esp)
80107c13: e8 f1 f7 ff ff call 80107409 <v2p>
80107c18: 89 04 24 mov %eax,(%esp)
80107c1b: e8 de f7 ff ff call 801073fe <lcr3>
popcli();
80107c20: e8 d5 cf ff ff call 80104bfa <popcli>
}
80107c25: 83 c4 14 add $0x14,%esp
80107c28: 5b pop %ebx
80107c29: 5d pop %ebp
80107c2a: c3 ret
80107c2b <inituvm>:
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80107c2b: 55 push %ebp
80107c2c: 89 e5 mov %esp,%ebp
80107c2e: 83 ec 38 sub $0x38,%esp
char *mem;
if(sz >= PGSIZE)
80107c31: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp)
80107c38: 76 0c jbe 80107c46 <inituvm+0x1b>
panic("inituvm: more than a page");
80107c3a: c7 04 24 77 88 10 80 movl $0x80108877,(%esp)
80107c41: e8 f4 88 ff ff call 8010053a <panic>
mem = kalloc();
80107c46: e8 83 ae ff ff call 80102ace <kalloc>
80107c4b: 89 45 f4 mov %eax,-0xc(%ebp)
memset(mem, 0, PGSIZE);
80107c4e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107c55: 00
80107c56: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107c5d: 00
80107c5e: 8b 45 f4 mov -0xc(%ebp),%eax
80107c61: 89 04 24 mov %eax,(%esp)
80107c64: e8 4d d0 ff ff call 80104cb6 <memset>
mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107c69: 8b 45 f4 mov -0xc(%ebp),%eax
80107c6c: 89 04 24 mov %eax,(%esp)
80107c6f: e8 95 f7 ff ff call 80107409 <v2p>
80107c74: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80107c7b: 00
80107c7c: 89 44 24 0c mov %eax,0xc(%esp)
80107c80: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107c87: 00
80107c88: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107c8f: 00
80107c90: 8b 45 08 mov 0x8(%ebp),%eax
80107c93: 89 04 24 mov %eax,(%esp)
80107c96: e8 a0 fc ff ff call 8010793b <mappages>
memmove(mem, init, sz);
80107c9b: 8b 45 10 mov 0x10(%ebp),%eax
80107c9e: 89 44 24 08 mov %eax,0x8(%esp)
80107ca2: 8b 45 0c mov 0xc(%ebp),%eax
80107ca5: 89 44 24 04 mov %eax,0x4(%esp)
80107ca9: 8b 45 f4 mov -0xc(%ebp),%eax
80107cac: 89 04 24 mov %eax,(%esp)
80107caf: e8 d1 d0 ff ff call 80104d85 <memmove>
}
80107cb4: c9 leave
80107cb5: c3 ret
80107cb6 <loaduvm>:
// Load a program segment into pgdir. addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
80107cb6: 55 push %ebp
80107cb7: 89 e5 mov %esp,%ebp
80107cb9: 53 push %ebx
80107cba: 83 ec 24 sub $0x24,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80107cbd: 8b 45 0c mov 0xc(%ebp),%eax
80107cc0: 25 ff 0f 00 00 and $0xfff,%eax
80107cc5: 85 c0 test %eax,%eax
80107cc7: 74 0c je 80107cd5 <loaduvm+0x1f>
panic("loaduvm: addr must be page aligned");
80107cc9: c7 04 24 94 88 10 80 movl $0x80108894,(%esp)
80107cd0: e8 65 88 ff ff call 8010053a <panic>
for(i = 0; i < sz; i += PGSIZE){
80107cd5: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80107cdc: e9 a9 00 00 00 jmp 80107d8a <loaduvm+0xd4>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
80107ce1: 8b 45 f4 mov -0xc(%ebp),%eax
80107ce4: 8b 55 0c mov 0xc(%ebp),%edx
80107ce7: 01 d0 add %edx,%eax
80107ce9: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80107cf0: 00
80107cf1: 89 44 24 04 mov %eax,0x4(%esp)
80107cf5: 8b 45 08 mov 0x8(%ebp),%eax
80107cf8: 89 04 24 mov %eax,(%esp)
80107cfb: e8 99 fb ff ff call 80107899 <walkpgdir>
80107d00: 89 45 ec mov %eax,-0x14(%ebp)
80107d03: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80107d07: 75 0c jne 80107d15 <loaduvm+0x5f>
panic("loaduvm: address should exist");
80107d09: c7 04 24 b7 88 10 80 movl $0x801088b7,(%esp)
80107d10: e8 25 88 ff ff call 8010053a <panic>
pa = PTE_ADDR(*pte);
80107d15: 8b 45 ec mov -0x14(%ebp),%eax
80107d18: 8b 00 mov (%eax),%eax
80107d1a: 25 00 f0 ff ff and $0xfffff000,%eax
80107d1f: 89 45 e8 mov %eax,-0x18(%ebp)
if(sz - i < PGSIZE)
80107d22: 8b 45 f4 mov -0xc(%ebp),%eax
80107d25: 8b 55 18 mov 0x18(%ebp),%edx
80107d28: 29 c2 sub %eax,%edx
80107d2a: 89 d0 mov %edx,%eax
80107d2c: 3d ff 0f 00 00 cmp $0xfff,%eax
80107d31: 77 0f ja 80107d42 <loaduvm+0x8c>
n = sz - i;
80107d33: 8b 45 f4 mov -0xc(%ebp),%eax
80107d36: 8b 55 18 mov 0x18(%ebp),%edx
80107d39: 29 c2 sub %eax,%edx
80107d3b: 89 d0 mov %edx,%eax
80107d3d: 89 45 f0 mov %eax,-0x10(%ebp)
80107d40: eb 07 jmp 80107d49 <loaduvm+0x93>
else
n = PGSIZE;
80107d42: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp)
if(readi(ip, p2v(pa), offset+i, n) != n)
80107d49: 8b 45 f4 mov -0xc(%ebp),%eax
80107d4c: 8b 55 14 mov 0x14(%ebp),%edx
80107d4f: 8d 1c 02 lea (%edx,%eax,1),%ebx
80107d52: 8b 45 e8 mov -0x18(%ebp),%eax
80107d55: 89 04 24 mov %eax,(%esp)
80107d58: e8 b9 f6 ff ff call 80107416 <p2v>
80107d5d: 8b 55 f0 mov -0x10(%ebp),%edx
80107d60: 89 54 24 0c mov %edx,0xc(%esp)
80107d64: 89 5c 24 08 mov %ebx,0x8(%esp)
80107d68: 89 44 24 04 mov %eax,0x4(%esp)
80107d6c: 8b 45 10 mov 0x10(%ebp),%eax
80107d6f: 89 04 24 mov %eax,(%esp)
80107d72: e8 dd 9f ff ff call 80101d54 <readi>
80107d77: 3b 45 f0 cmp -0x10(%ebp),%eax
80107d7a: 74 07 je 80107d83 <loaduvm+0xcd>
return -1;
80107d7c: b8 ff ff ff ff mov $0xffffffff,%eax
80107d81: eb 18 jmp 80107d9b <loaduvm+0xe5>
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
80107d83: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80107d8a: 8b 45 f4 mov -0xc(%ebp),%eax
80107d8d: 3b 45 18 cmp 0x18(%ebp),%eax
80107d90: 0f 82 4b ff ff ff jb 80107ce1 <loaduvm+0x2b>
else
n = PGSIZE;
if(readi(ip, p2v(pa), offset+i, n) != n)
return -1;
}
return 0;
80107d96: b8 00 00 00 00 mov $0x0,%eax
}
80107d9b: 83 c4 24 add $0x24,%esp
80107d9e: 5b pop %ebx
80107d9f: 5d pop %ebp
80107da0: c3 ret
80107da1 <allocuvm>:
// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned. Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107da1: 55 push %ebp
80107da2: 89 e5 mov %esp,%ebp
80107da4: 83 ec 38 sub $0x38,%esp
char *mem;
uint a;
if(newsz >= KERNBASE)
80107da7: 8b 45 10 mov 0x10(%ebp),%eax
80107daa: 85 c0 test %eax,%eax
80107dac: 79 0a jns 80107db8 <allocuvm+0x17>
return 0;
80107dae: b8 00 00 00 00 mov $0x0,%eax
80107db3: e9 c1 00 00 00 jmp 80107e79 <allocuvm+0xd8>
if(newsz < oldsz)
80107db8: 8b 45 10 mov 0x10(%ebp),%eax
80107dbb: 3b 45 0c cmp 0xc(%ebp),%eax
80107dbe: 73 08 jae 80107dc8 <allocuvm+0x27>
return oldsz;
80107dc0: 8b 45 0c mov 0xc(%ebp),%eax
80107dc3: e9 b1 00 00 00 jmp 80107e79 <allocuvm+0xd8>
a = PGROUNDUP(oldsz);
80107dc8: 8b 45 0c mov 0xc(%ebp),%eax
80107dcb: 05 ff 0f 00 00 add $0xfff,%eax
80107dd0: 25 00 f0 ff ff and $0xfffff000,%eax
80107dd5: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < newsz; a += PGSIZE){
80107dd8: e9 8d 00 00 00 jmp 80107e6a <allocuvm+0xc9>
mem = kalloc();
80107ddd: e8 ec ac ff ff call 80102ace <kalloc>
80107de2: 89 45 f0 mov %eax,-0x10(%ebp)
if(mem == 0){
80107de5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80107de9: 75 2c jne 80107e17 <allocuvm+0x76>
cprintf("allocuvm out of memory\n");
80107deb: c7 04 24 d5 88 10 80 movl $0x801088d5,(%esp)
80107df2: e8 a9 85 ff ff call 801003a0 <cprintf>
deallocuvm(pgdir, newsz, oldsz);
80107df7: 8b 45 0c mov 0xc(%ebp),%eax
80107dfa: 89 44 24 08 mov %eax,0x8(%esp)
80107dfe: 8b 45 10 mov 0x10(%ebp),%eax
80107e01: 89 44 24 04 mov %eax,0x4(%esp)
80107e05: 8b 45 08 mov 0x8(%ebp),%eax
80107e08: 89 04 24 mov %eax,(%esp)
80107e0b: e8 6b 00 00 00 call 80107e7b <deallocuvm>
return 0;
80107e10: b8 00 00 00 00 mov $0x0,%eax
80107e15: eb 62 jmp 80107e79 <allocuvm+0xd8>
}
memset(mem, 0, PGSIZE);
80107e17: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107e1e: 00
80107e1f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107e26: 00
80107e27: 8b 45 f0 mov -0x10(%ebp),%eax
80107e2a: 89 04 24 mov %eax,(%esp)
80107e2d: e8 84 ce ff ff call 80104cb6 <memset>
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80107e32: 8b 45 f0 mov -0x10(%ebp),%eax
80107e35: 89 04 24 mov %eax,(%esp)
80107e38: e8 cc f5 ff ff call 80107409 <v2p>
80107e3d: 8b 55 f4 mov -0xc(%ebp),%edx
80107e40: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80107e47: 00
80107e48: 89 44 24 0c mov %eax,0xc(%esp)
80107e4c: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80107e53: 00
80107e54: 89 54 24 04 mov %edx,0x4(%esp)
80107e58: 8b 45 08 mov 0x8(%ebp),%eax
80107e5b: 89 04 24 mov %eax,(%esp)
80107e5e: e8 d8 fa ff ff call 8010793b <mappages>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80107e63: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80107e6a: 8b 45 f4 mov -0xc(%ebp),%eax
80107e6d: 3b 45 10 cmp 0x10(%ebp),%eax
80107e70: 0f 82 67 ff ff ff jb 80107ddd <allocuvm+0x3c>
return 0;
}
memset(mem, 0, PGSIZE);
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
}
return newsz;
80107e76: 8b 45 10 mov 0x10(%ebp),%eax
}
80107e79: c9 leave
80107e7a: c3 ret
80107e7b <deallocuvm>:
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
80107e7b: 55 push %ebp
80107e7c: 89 e5 mov %esp,%ebp
80107e7e: 83 ec 28 sub $0x28,%esp
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80107e81: 8b 45 10 mov 0x10(%ebp),%eax
80107e84: 3b 45 0c cmp 0xc(%ebp),%eax
80107e87: 72 08 jb 80107e91 <deallocuvm+0x16>
return oldsz;
80107e89: 8b 45 0c mov 0xc(%ebp),%eax
80107e8c: e9 a4 00 00 00 jmp 80107f35 <deallocuvm+0xba>
a = PGROUNDUP(newsz);
80107e91: 8b 45 10 mov 0x10(%ebp),%eax
80107e94: 05 ff 0f 00 00 add $0xfff,%eax
80107e99: 25 00 f0 ff ff and $0xfffff000,%eax
80107e9e: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < oldsz; a += PGSIZE){
80107ea1: e9 80 00 00 00 jmp 80107f26 <deallocuvm+0xab>
pte = walkpgdir(pgdir, (char*)a, 0);
80107ea6: 8b 45 f4 mov -0xc(%ebp),%eax
80107ea9: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80107eb0: 00
80107eb1: 89 44 24 04 mov %eax,0x4(%esp)
80107eb5: 8b 45 08 mov 0x8(%ebp),%eax
80107eb8: 89 04 24 mov %eax,(%esp)
80107ebb: e8 d9 f9 ff ff call 80107899 <walkpgdir>
80107ec0: 89 45 f0 mov %eax,-0x10(%ebp)
if(!pte)
80107ec3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80107ec7: 75 09 jne 80107ed2 <deallocuvm+0x57>
a += (NPTENTRIES - 1) * PGSIZE;
80107ec9: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp)
80107ed0: eb 4d jmp 80107f1f <deallocuvm+0xa4>
else if((*pte & PTE_P) != 0){
80107ed2: 8b 45 f0 mov -0x10(%ebp),%eax
80107ed5: 8b 00 mov (%eax),%eax
80107ed7: 83 e0 01 and $0x1,%eax
80107eda: 85 c0 test %eax,%eax
80107edc: 74 41 je 80107f1f <deallocuvm+0xa4>
pa = PTE_ADDR(*pte);
80107ede: 8b 45 f0 mov -0x10(%ebp),%eax
80107ee1: 8b 00 mov (%eax),%eax
80107ee3: 25 00 f0 ff ff and $0xfffff000,%eax
80107ee8: 89 45 ec mov %eax,-0x14(%ebp)
if(pa == 0)
80107eeb: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80107eef: 75 0c jne 80107efd <deallocuvm+0x82>
panic("kfree");
80107ef1: c7 04 24 ed 88 10 80 movl $0x801088ed,(%esp)
80107ef8: e8 3d 86 ff ff call 8010053a <panic>
char *v = p2v(pa);
80107efd: 8b 45 ec mov -0x14(%ebp),%eax
80107f00: 89 04 24 mov %eax,(%esp)
80107f03: e8 0e f5 ff ff call 80107416 <p2v>
80107f08: 89 45 e8 mov %eax,-0x18(%ebp)
kfree(v);
80107f0b: 8b 45 e8 mov -0x18(%ebp),%eax
80107f0e: 89 04 24 mov %eax,(%esp)
80107f11: e8 1f ab ff ff call 80102a35 <kfree>
*pte = 0;
80107f16: 8b 45 f0 mov -0x10(%ebp),%eax
80107f19: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
80107f1f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80107f26: 8b 45 f4 mov -0xc(%ebp),%eax
80107f29: 3b 45 0c cmp 0xc(%ebp),%eax
80107f2c: 0f 82 74 ff ff ff jb 80107ea6 <deallocuvm+0x2b>
char *v = p2v(pa);
kfree(v);
*pte = 0;
}
}
return newsz;
80107f32: 8b 45 10 mov 0x10(%ebp),%eax
}
80107f35: c9 leave
80107f36: c3 ret
80107f37 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80107f37: 55 push %ebp
80107f38: 89 e5 mov %esp,%ebp
80107f3a: 83 ec 28 sub $0x28,%esp
uint i;
if(pgdir == 0)
80107f3d: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80107f41: 75 0c jne 80107f4f <freevm+0x18>
panic("freevm: no pgdir");
80107f43: c7 04 24 f3 88 10 80 movl $0x801088f3,(%esp)
80107f4a: e8 eb 85 ff ff call 8010053a <panic>
deallocuvm(pgdir, KERNBASE, 0);
80107f4f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80107f56: 00
80107f57: c7 44 24 04 00 00 00 movl $0x80000000,0x4(%esp)
80107f5e: 80
80107f5f: 8b 45 08 mov 0x8(%ebp),%eax
80107f62: 89 04 24 mov %eax,(%esp)
80107f65: e8 11 ff ff ff call 80107e7b <deallocuvm>
for(i = 0; i < NPDENTRIES; i++){
80107f6a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80107f71: eb 48 jmp 80107fbb <freevm+0x84>
if(pgdir[i] & PTE_P){
80107f73: 8b 45 f4 mov -0xc(%ebp),%eax
80107f76: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80107f7d: 8b 45 08 mov 0x8(%ebp),%eax
80107f80: 01 d0 add %edx,%eax
80107f82: 8b 00 mov (%eax),%eax
80107f84: 83 e0 01 and $0x1,%eax
80107f87: 85 c0 test %eax,%eax
80107f89: 74 2c je 80107fb7 <freevm+0x80>
char * v = p2v(PTE_ADDR(pgdir[i]));
80107f8b: 8b 45 f4 mov -0xc(%ebp),%eax
80107f8e: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80107f95: 8b 45 08 mov 0x8(%ebp),%eax
80107f98: 01 d0 add %edx,%eax
80107f9a: 8b 00 mov (%eax),%eax
80107f9c: 25 00 f0 ff ff and $0xfffff000,%eax
80107fa1: 89 04 24 mov %eax,(%esp)
80107fa4: e8 6d f4 ff ff call 80107416 <p2v>
80107fa9: 89 45 f0 mov %eax,-0x10(%ebp)
kfree(v);
80107fac: 8b 45 f0 mov -0x10(%ebp),%eax
80107faf: 89 04 24 mov %eax,(%esp)
80107fb2: e8 7e aa ff ff call 80102a35 <kfree>
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
80107fb7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80107fbb: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp)
80107fc2: 76 af jbe 80107f73 <freevm+0x3c>
if(pgdir[i] & PTE_P){
char * v = p2v(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
80107fc4: 8b 45 08 mov 0x8(%ebp),%eax
80107fc7: 89 04 24 mov %eax,(%esp)
80107fca: e8 66 aa ff ff call 80102a35 <kfree>
}
80107fcf: c9 leave
80107fd0: c3 ret
80107fd1 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
80107fd1: 55 push %ebp
80107fd2: 89 e5 mov %esp,%ebp
80107fd4: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80107fd7: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80107fde: 00
80107fdf: 8b 45 0c mov 0xc(%ebp),%eax
80107fe2: 89 44 24 04 mov %eax,0x4(%esp)
80107fe6: 8b 45 08 mov 0x8(%ebp),%eax
80107fe9: 89 04 24 mov %eax,(%esp)
80107fec: e8 a8 f8 ff ff call 80107899 <walkpgdir>
80107ff1: 89 45 f4 mov %eax,-0xc(%ebp)
if(pte == 0)
80107ff4: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80107ff8: 75 0c jne 80108006 <clearpteu+0x35>
panic("clearpteu");
80107ffa: c7 04 24 04 89 10 80 movl $0x80108904,(%esp)
80108001: e8 34 85 ff ff call 8010053a <panic>
*pte &= ~PTE_U;
80108006: 8b 45 f4 mov -0xc(%ebp),%eax
80108009: 8b 00 mov (%eax),%eax
8010800b: 83 e0 fb and $0xfffffffb,%eax
8010800e: 89 c2 mov %eax,%edx
80108010: 8b 45 f4 mov -0xc(%ebp),%eax
80108013: 89 10 mov %edx,(%eax)
}
80108015: c9 leave
80108016: c3 ret
80108017 <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
80108017: 55 push %ebp
80108018: 89 e5 mov %esp,%ebp
8010801a: 53 push %ebx
8010801b: 83 ec 44 sub $0x44,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
8010801e: e8 b0 f9 ff ff call 801079d3 <setupkvm>
80108023: 89 45 f0 mov %eax,-0x10(%ebp)
80108026: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010802a: 75 0a jne 80108036 <copyuvm+0x1f>
return 0;
8010802c: b8 00 00 00 00 mov $0x0,%eax
80108031: e9 fd 00 00 00 jmp 80108133 <copyuvm+0x11c>
for(i = 0; i < sz; i += PGSIZE){
80108036: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010803d: e9 d0 00 00 00 jmp 80108112 <copyuvm+0xfb>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80108042: 8b 45 f4 mov -0xc(%ebp),%eax
80108045: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010804c: 00
8010804d: 89 44 24 04 mov %eax,0x4(%esp)
80108051: 8b 45 08 mov 0x8(%ebp),%eax
80108054: 89 04 24 mov %eax,(%esp)
80108057: e8 3d f8 ff ff call 80107899 <walkpgdir>
8010805c: 89 45 ec mov %eax,-0x14(%ebp)
8010805f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108063: 75 0c jne 80108071 <copyuvm+0x5a>
panic("copyuvm: pte should exist");
80108065: c7 04 24 0e 89 10 80 movl $0x8010890e,(%esp)
8010806c: e8 c9 84 ff ff call 8010053a <panic>
if(!(*pte & PTE_P))
80108071: 8b 45 ec mov -0x14(%ebp),%eax
80108074: 8b 00 mov (%eax),%eax
80108076: 83 e0 01 and $0x1,%eax
80108079: 85 c0 test %eax,%eax
8010807b: 75 0c jne 80108089 <copyuvm+0x72>
panic("copyuvm: page not present");
8010807d: c7 04 24 28 89 10 80 movl $0x80108928,(%esp)
80108084: e8 b1 84 ff ff call 8010053a <panic>
pa = PTE_ADDR(*pte);
80108089: 8b 45 ec mov -0x14(%ebp),%eax
8010808c: 8b 00 mov (%eax),%eax
8010808e: 25 00 f0 ff ff and $0xfffff000,%eax
80108093: 89 45 e8 mov %eax,-0x18(%ebp)
flags = PTE_FLAGS(*pte);
80108096: 8b 45 ec mov -0x14(%ebp),%eax
80108099: 8b 00 mov (%eax),%eax
8010809b: 25 ff 0f 00 00 and $0xfff,%eax
801080a0: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
801080a3: e8 26 aa ff ff call 80102ace <kalloc>
801080a8: 89 45 e0 mov %eax,-0x20(%ebp)
801080ab: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
801080af: 75 02 jne 801080b3 <copyuvm+0x9c>
goto bad;
801080b1: eb 70 jmp 80108123 <copyuvm+0x10c>
memmove(mem, (char*)p2v(pa), PGSIZE);
801080b3: 8b 45 e8 mov -0x18(%ebp),%eax
801080b6: 89 04 24 mov %eax,(%esp)
801080b9: e8 58 f3 ff ff call 80107416 <p2v>
801080be: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801080c5: 00
801080c6: 89 44 24 04 mov %eax,0x4(%esp)
801080ca: 8b 45 e0 mov -0x20(%ebp),%eax
801080cd: 89 04 24 mov %eax,(%esp)
801080d0: e8 b0 cc ff ff call 80104d85 <memmove>
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
801080d5: 8b 5d e4 mov -0x1c(%ebp),%ebx
801080d8: 8b 45 e0 mov -0x20(%ebp),%eax
801080db: 89 04 24 mov %eax,(%esp)
801080de: e8 26 f3 ff ff call 80107409 <v2p>
801080e3: 8b 55 f4 mov -0xc(%ebp),%edx
801080e6: 89 5c 24 10 mov %ebx,0x10(%esp)
801080ea: 89 44 24 0c mov %eax,0xc(%esp)
801080ee: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801080f5: 00
801080f6: 89 54 24 04 mov %edx,0x4(%esp)
801080fa: 8b 45 f0 mov -0x10(%ebp),%eax
801080fd: 89 04 24 mov %eax,(%esp)
80108100: e8 36 f8 ff ff call 8010793b <mappages>
80108105: 85 c0 test %eax,%eax
80108107: 79 02 jns 8010810b <copyuvm+0xf4>
goto bad;
80108109: eb 18 jmp 80108123 <copyuvm+0x10c>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
8010810b: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80108112: 8b 45 f4 mov -0xc(%ebp),%eax
80108115: 3b 45 0c cmp 0xc(%ebp),%eax
80108118: 0f 82 24 ff ff ff jb 80108042 <copyuvm+0x2b>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
}
return d;
8010811e: 8b 45 f0 mov -0x10(%ebp),%eax
80108121: eb 10 jmp 80108133 <copyuvm+0x11c>
bad:
freevm(d);
80108123: 8b 45 f0 mov -0x10(%ebp),%eax
80108126: 89 04 24 mov %eax,(%esp)
80108129: e8 09 fe ff ff call 80107f37 <freevm>
return 0;
8010812e: b8 00 00 00 00 mov $0x0,%eax
}
80108133: 83 c4 44 add $0x44,%esp
80108136: 5b pop %ebx
80108137: 5d pop %ebp
80108138: c3 ret
80108139 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80108139: 55 push %ebp
8010813a: 89 e5 mov %esp,%ebp
8010813c: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
8010813f: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80108146: 00
80108147: 8b 45 0c mov 0xc(%ebp),%eax
8010814a: 89 44 24 04 mov %eax,0x4(%esp)
8010814e: 8b 45 08 mov 0x8(%ebp),%eax
80108151: 89 04 24 mov %eax,(%esp)
80108154: e8 40 f7 ff ff call 80107899 <walkpgdir>
80108159: 89 45 f4 mov %eax,-0xc(%ebp)
if((*pte & PTE_P) == 0)
8010815c: 8b 45 f4 mov -0xc(%ebp),%eax
8010815f: 8b 00 mov (%eax),%eax
80108161: 83 e0 01 and $0x1,%eax
80108164: 85 c0 test %eax,%eax
80108166: 75 07 jne 8010816f <uva2ka+0x36>
return 0;
80108168: b8 00 00 00 00 mov $0x0,%eax
8010816d: eb 25 jmp 80108194 <uva2ka+0x5b>
if((*pte & PTE_U) == 0)
8010816f: 8b 45 f4 mov -0xc(%ebp),%eax
80108172: 8b 00 mov (%eax),%eax
80108174: 83 e0 04 and $0x4,%eax
80108177: 85 c0 test %eax,%eax
80108179: 75 07 jne 80108182 <uva2ka+0x49>
return 0;
8010817b: b8 00 00 00 00 mov $0x0,%eax
80108180: eb 12 jmp 80108194 <uva2ka+0x5b>
return (char*)p2v(PTE_ADDR(*pte));
80108182: 8b 45 f4 mov -0xc(%ebp),%eax
80108185: 8b 00 mov (%eax),%eax
80108187: 25 00 f0 ff ff and $0xfffff000,%eax
8010818c: 89 04 24 mov %eax,(%esp)
8010818f: e8 82 f2 ff ff call 80107416 <p2v>
}
80108194: c9 leave
80108195: c3 ret
80108196 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80108196: 55 push %ebp
80108197: 89 e5 mov %esp,%ebp
80108199: 83 ec 28 sub $0x28,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
8010819c: 8b 45 10 mov 0x10(%ebp),%eax
8010819f: 89 45 f4 mov %eax,-0xc(%ebp)
while(len > 0){
801081a2: e9 87 00 00 00 jmp 8010822e <copyout+0x98>
va0 = (uint)PGROUNDDOWN(va);
801081a7: 8b 45 0c mov 0xc(%ebp),%eax
801081aa: 25 00 f0 ff ff and $0xfffff000,%eax
801081af: 89 45 ec mov %eax,-0x14(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
801081b2: 8b 45 ec mov -0x14(%ebp),%eax
801081b5: 89 44 24 04 mov %eax,0x4(%esp)
801081b9: 8b 45 08 mov 0x8(%ebp),%eax
801081bc: 89 04 24 mov %eax,(%esp)
801081bf: e8 75 ff ff ff call 80108139 <uva2ka>
801081c4: 89 45 e8 mov %eax,-0x18(%ebp)
if(pa0 == 0)
801081c7: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801081cb: 75 07 jne 801081d4 <copyout+0x3e>
return -1;
801081cd: b8 ff ff ff ff mov $0xffffffff,%eax
801081d2: eb 69 jmp 8010823d <copyout+0xa7>
n = PGSIZE - (va - va0);
801081d4: 8b 45 0c mov 0xc(%ebp),%eax
801081d7: 8b 55 ec mov -0x14(%ebp),%edx
801081da: 29 c2 sub %eax,%edx
801081dc: 89 d0 mov %edx,%eax
801081de: 05 00 10 00 00 add $0x1000,%eax
801081e3: 89 45 f0 mov %eax,-0x10(%ebp)
if(n > len)
801081e6: 8b 45 f0 mov -0x10(%ebp),%eax
801081e9: 3b 45 14 cmp 0x14(%ebp),%eax
801081ec: 76 06 jbe 801081f4 <copyout+0x5e>
n = len;
801081ee: 8b 45 14 mov 0x14(%ebp),%eax
801081f1: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(pa0 + (va - va0), buf, n);
801081f4: 8b 45 ec mov -0x14(%ebp),%eax
801081f7: 8b 55 0c mov 0xc(%ebp),%edx
801081fa: 29 c2 sub %eax,%edx
801081fc: 8b 45 e8 mov -0x18(%ebp),%eax
801081ff: 01 c2 add %eax,%edx
80108201: 8b 45 f0 mov -0x10(%ebp),%eax
80108204: 89 44 24 08 mov %eax,0x8(%esp)
80108208: 8b 45 f4 mov -0xc(%ebp),%eax
8010820b: 89 44 24 04 mov %eax,0x4(%esp)
8010820f: 89 14 24 mov %edx,(%esp)
80108212: e8 6e cb ff ff call 80104d85 <memmove>
len -= n;
80108217: 8b 45 f0 mov -0x10(%ebp),%eax
8010821a: 29 45 14 sub %eax,0x14(%ebp)
buf += n;
8010821d: 8b 45 f0 mov -0x10(%ebp),%eax
80108220: 01 45 f4 add %eax,-0xc(%ebp)
va = va0 + PGSIZE;
80108223: 8b 45 ec mov -0x14(%ebp),%eax
80108226: 05 00 10 00 00 add $0x1000,%eax
8010822b: 89 45 0c mov %eax,0xc(%ebp)
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
8010822e: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80108232: 0f 85 6f ff ff ff jne 801081a7 <copyout+0x11>
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80108238: b8 00 00 00 00 mov $0x0,%eax
}
8010823d: c9 leave
8010823e: c3 ret
|
/*++
Copyright (c) 2001-2002 Microsoft Corporation
Module Name:
multithreadreader.hxx
Abstract:
A multiple thread callback helper class
Author:
Jeffrey Wall (jeffwall) 6/5/02
Revision History:
--*/
#ifndef _MULTIREAD_HXX_
#define _MULTIREAD_HXX_
class MULTIPLE_THREAD_READER_CALLBACK
{
public:
virtual
HRESULT
DoThreadWork(
LPWSTR pszString,
LPVOID pContext
) = 0;
};
class MULTIPLE_THREAD_READER
{
public:
MULTIPLE_THREAD_READER();
virtual ~MULTIPLE_THREAD_READER();
HRESULT
DoWork(
MULTIPLE_THREAD_READER_CALLBACK * pCallback,
LPVOID pContext,
LPWSTR pmszString,
BOOL fMultiThreaded = TRUE
);
private:
// number of processors on the system
DWORD _cProcessors;
// The number of threads currently running
DWORD _cCurrentProcessor;
// not an allocated pointer - just here for ease of access from threads
LPWSTR _pmszString;
// The context to pass back to the callback function
LPVOID _pContext;
// The interface to callback on
MULTIPLE_THREAD_READER_CALLBACK * _pCallback;
static
HRESULT
BeginReadThread(
PVOID pvArg
);
HRESULT
ReadThread(
);
LPWSTR
Advance(
LPWSTR pmszString,
DWORD cPlaces
);
};
#endif // _MULTIREAD_HXX_
|
Name: z00_bg30.asm
Type: file
Size: 84100
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: 8C02BCE16AC97B7C198CC735AAA85E10790AD64E
Description: null
|
Name: zel_endt.asm
Type: file
Size: 217052
Last-Modified: '2016-05-13T04:23:03Z'
SHA-1: 407E93461286583D5BE8F2E468625DBB865980D9
Description: null
|
#import "registers.asm"
#import "data.asm"
#import "helpers.asm"
:BasicUpstart2(main)
main:
sei // Disable Interrupts
lda #$00 // Set Background
sta BORDER_COLOR // and Border colors
sta BACKGROUND_COLOR
sta $0286
jsr $e544
ldy #0
!:
lda revers_text, y
beq !+
sta $0400, y
iny
bne !-
!:
lda #$7f // Disable CIA
sta CIA1_INTERRUPTS
sta CIA2_INTERRUPTS
lda $dc0d
lda $dd0d
lda #$1b // Clear the High bit (lines 256-318)
sta YSCROLL
lda #$0 // Interrupt on line 0
sta RASTER
lda #<irq // IRQ Low
ldx #>irq // IRQ High
sta IRQLO // Interrupt Vector
stx IRQHI // Interrupt Vector
lda #$01 // Enable Raster Interrupts
sta IMR
lda $d019
sta $d019
cli // Allow IRQ's
jmp * // Endless Loop
revers_text: .text "******** ein graustufenverlauf ********"
.text "******** ein roter farbverlauf ********"
.text "******** ein blauer farbverlauf ********"
.for(var i = 0; i < 20; i++) { .byte $20,$a0 }
.byte $00
irq:
lda $d019
sta $d019
ldx #0
lda #50
!:
cmp $d012
bne !-
!loop:
ldy wartezeiten, x
!:
dey
bne !-
nop
nop
lda farbtabelle, x
sta $d021
inx
cpx #4 * 8
bne !loop-
lda #0
sta $d021
jmp $ea7e
wartezeiten: .byte 8, 1, 8, 8, 8, 8, 8, 8
.byte 8, 1, 8, 8, 8, 8, 8, 8
.byte 8, 1, 8, 8, 8, 8, 8, 8
.byte 8, 1, 8, 8, 8, 8, 8, 8
farbtabelle: .byte 11,12,15,01,01,15,12,0
.byte 09,02,08,10,15,07,01,0
.byte 06,14,03,01,01,03,14,0
.byte 03,13,01,13,03,13,05,0 |
; A063957: Numbers not of the form round(m*sqrt(2)) for any integer m, i.e., complement of A022846.
; 2,5,9,12,15,19,22,26,29,32,36,39,43,46,50,53,56,60,63,67,70,73,77,80,84,87,90,94,97,101,104,108,111,114,118,121,125,128,131,135,138,142,145,149,152,155,159,162,166,169,172,176,179,183,186,189,193,196,200,203,207,210,213,217,220,224,227,230,234,237,241,244,248,251,254,258,261,265,268,271,275,278,282,285,289,292,295,299,302,306,309,312,316,319,323,326,329,333,336,340,343,347,350,353,357,360,364,367,370,374,377,381,384,388,391,394,398,401,405,408,411,415,418,422,425,428,432,435,439,442,446,449,452,456,459,463,466,469,473,476,480,483,487,490,493,497,500,504,507,510,514,517,521,524,527,531,534,538,541,545,548,551,555,558,562,565,568,572,575,579,582,586,589,592,596,599,603,606,609,613,616,620,623,627,630,633,637,640,644,647,650,654,657,661,664,667,671,674,678,681,685,688,691,695,698,702,705,708,712,715,719,722,726,729,732,736,739,743,746,749,753,756,760,763,766,770,773,777,780,784,787,790,794,797,801,804,807,811,814,818,821,825,828,831,835,838,842,845,848,852
mov $2,$0
mov $4,$0
lpb $0
add $3,$2
lpb $2
add $0,$3
sub $2,1
lpe
lpb $0
sub $0,2
trn $0,$1
add $1,1
lpe
lpe
lpb $4
add $1,2
sub $4,1
lpe
add $1,2
|
;;
;; Copyright (c) 2012-2020, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
;;; routine to do a 256 bit CBC AES encrypt
;;; process 4 buffers at a time, single data structure as input
;;; Updates In and Out pointers at end
%include "include/os.asm"
%include "include/mb_mgr_datastruct.asm"
%include "include/clear_regs.asm"
%include "include/cet.inc"
%define MOVDQ movdqu ;; assume buffers not aligned
%macro pxor2 2
MOVDQ XTMP, %2
pxor %1, XTMP
%endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; struct AES_ARGS {
;; void* in[8];
;; void* out[8];
;; UINT128* keys[8];
;; UINT128 IV[8];
;; }
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; void aes_cbc_enc_256_x4(AES_ARGS *args, UINT64 len);
;; arg 1: ARG : addr of AES_ARGS structure
;; arg 2: LEN : len (in units of bytes)
%ifdef LINUX
%define ARG rdi
%define LEN rsi
%define REG3 rcx
%define REG4 rdx
%else
%define ARG rcx
%define LEN rdx
%define REG3 rsi
%define REG4 rdi
%endif
%define IDX rax
%define IN0 r8
%define KEYS0 rbx
%define IN1 r10
%define KEYS1 REG3
%define IN2 r12
%define KEYS2 REG4
%define IN3 r14
%define KEYS3 rbp
%ifndef CBC_MAC
;; No cipher text write back for CBC-MAC
%define OUT0 r9
%define OUT1 r11
%define OUT2 r13
%define OUT3 r15
%endif
%define XDATA0 xmm0
%define XDATA1 xmm1
%define XDATA2 xmm2
%define XDATA3 xmm3
%define XKEY0_3 xmm4
%define XKEY0_6 [KEYS0 + 16*6]
%define XTMP xmm5
%define XKEY0_9 xmm6
%define XKEY1_3 xmm7
%define XKEY1_6 xmm8
%define XKEY1_9 xmm9
%define XKEY2_3 xmm10
%define XKEY2_6 xmm11
%define XKEY2_9 xmm12
%define XKEY3_3 xmm13
%define XKEY3_6 xmm14
%define XKEY3_9 xmm15
section .text
%ifndef AES_CBC_ENC_X4
%ifdef CBC_MAC
MKGLOBAL(aes256_cbc_mac_x4,function,internal)
aes256_cbc_mac_x4:
endbranch64
%else
MKGLOBAL(aes_cbc_enc_256_x4,function,internal)
aes_cbc_enc_256_x4:
endbranch64
%endif
%else ;; NO-AESNI
%ifdef CBC_MAC
MKGLOBAL(aes256_cbc_mac_x4_no_aesni,function,internal)
aes256_cbc_mac_x4_no_aesni:
endbranch64
%else
MKGLOBAL(aes_cbc_enc_256_x4_no_aesni,function,internal)
aes_cbc_enc_256_x4_no_aesni:
endbranch64
%endif
%endif ;; AES_CBC_ENC_X4
push rbp
mov IDX, 16
mov IN0, [ARG + _aesarg_in + 8*0]
mov IN1, [ARG + _aesarg_in + 8*1]
mov IN2, [ARG + _aesarg_in + 8*2]
mov IN3, [ARG + _aesarg_in + 8*3]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOVDQ XDATA0, [IN0] ; load first block of plain text
MOVDQ XDATA1, [IN1] ; load first block of plain text
MOVDQ XDATA2, [IN2] ; load first block of plain text
MOVDQ XDATA3, [IN3] ; load first block of plain text
mov KEYS0, [ARG + _aesarg_keys + 8*0]
mov KEYS1, [ARG + _aesarg_keys + 8*1]
mov KEYS2, [ARG + _aesarg_keys + 8*2]
mov KEYS3, [ARG + _aesarg_keys + 8*3]
pxor XDATA0, [ARG + _aesarg_IV + 16*0] ; plaintext XOR IV
pxor XDATA1, [ARG + _aesarg_IV + 16*1] ; plaintext XOR IV
pxor XDATA2, [ARG + _aesarg_IV + 16*2] ; plaintext XOR IV
pxor XDATA3, [ARG + _aesarg_IV + 16*3] ; plaintext XOR IV
%ifndef CBC_MAC
mov OUT0, [ARG + _aesarg_out + 8*0]
mov OUT1, [ARG + _aesarg_out + 8*1]
mov OUT2, [ARG + _aesarg_out + 8*2]
mov OUT3, [ARG + _aesarg_out + 8*3]
%endif
pxor XDATA0, [KEYS0 + 16*0] ; 0. ARK
pxor XDATA1, [KEYS1 + 16*0] ; 0. ARK
pxor XDATA2, [KEYS2 + 16*0] ; 0. ARK
pxor XDATA3, [KEYS3 + 16*0] ; 0. ARK
aesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
aesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
aesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
aesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
aesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
aesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
aesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
aesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
movdqa XKEY0_3, [KEYS0 + 16*3] ; load round 3 key
movdqa XKEY1_3, [KEYS1 + 16*3] ; load round 3 key
movdqa XKEY2_3, [KEYS2 + 16*3] ; load round 3 key
movdqa XKEY3_3, [KEYS3 + 16*3] ; load round 3 key
aesenc XDATA0, XKEY0_3 ; 3. ENC
aesenc XDATA1, XKEY1_3 ; 3. ENC
aesenc XDATA2, XKEY2_3 ; 3. ENC
aesenc XDATA3, XKEY3_3 ; 3. ENC
aesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
aesenc XDATA1, [KEYS1 + 16*4] ; 4. ENC
aesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
aesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
aesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
aesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
aesenc XDATA2, [KEYS2 + 16*5] ; 5. ENC
aesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
movdqa XKEY1_6, [KEYS1 + 16*6] ; load round 6 key
movdqa XKEY2_6, [KEYS2 + 16*6] ; load round 6 key
movdqa XKEY3_6, [KEYS3 + 16*6] ; load round 6 key
aesenc XDATA0, XKEY0_6 ; 6. ENC
aesenc XDATA1, XKEY1_6 ; 6. ENC
aesenc XDATA2, XKEY2_6 ; 6. ENC
aesenc XDATA3, XKEY3_6 ; 6. ENC
aesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
aesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
aesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
aesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
aesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
aesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
aesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
aesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
movdqa XKEY0_9, [KEYS0 + 16*9] ; load round 9 key
movdqa XKEY1_9, [KEYS1 + 16*9] ; load round 9 key
movdqa XKEY2_9, [KEYS2 + 16*9] ; load round 9 key
movdqa XKEY3_9, [KEYS3 + 16*9] ; load round 9 key
aesenc XDATA0, XKEY0_9 ; 9. ENC
aesenc XDATA1, XKEY1_9 ; 9. ENC
aesenc XDATA2, XKEY2_9 ; 9. ENC
aesenc XDATA3, XKEY3_9 ; 9. ENC
aesenc XDATA0, [KEYS0 + 16*10] ; 10. ENC
aesenc XDATA1, [KEYS1 + 16*10] ; 10. ENC
aesenc XDATA2, [KEYS2 + 16*10] ; 10. ENC
aesenc XDATA3, [KEYS3 + 16*10] ; 10. ENC
aesenc XDATA0, [KEYS0 + 16*11] ; 11. ENC
aesenc XDATA1, [KEYS1 + 16*11] ; 11. ENC
aesenc XDATA2, [KEYS2 + 16*11] ; 11. ENC
aesenc XDATA3, [KEYS3 + 16*11] ; 11. ENC
aesenc XDATA0, [KEYS0 + 16*12] ; 12. ENC
aesenc XDATA1, [KEYS1 + 16*12] ; 12. ENC
aesenc XDATA2, [KEYS2 + 16*12] ; 12. ENC
aesenc XDATA3, [KEYS3 + 16*12] ; 12. ENC
aesenc XDATA0, [KEYS0 + 16*13] ; 13. ENC
aesenc XDATA1, [KEYS1 + 16*13] ; 13. ENC
aesenc XDATA2, [KEYS2 + 16*13] ; 13. ENC
aesenc XDATA3, [KEYS3 + 16*13] ; 13. ENC
aesenclast XDATA0, [KEYS0 + 16*14] ; 14. ENC
aesenclast XDATA1, [KEYS1 + 16*14] ; 14. ENC
aesenclast XDATA2, [KEYS2 + 16*14] ; 14. ENC
aesenclast XDATA3, [KEYS3 + 16*14] ; 14. ENC
%ifndef CBC_MAC
MOVDQ [OUT0], XDATA0 ; write back ciphertext
MOVDQ [OUT1], XDATA1 ; write back ciphertext
MOVDQ [OUT2], XDATA2 ; write back ciphertext
MOVDQ [OUT3], XDATA3 ; write back ciphertext
%endif
cmp LEN, IDX
je done
main_loop:
pxor2 XDATA0, [IN0 + IDX] ; plaintext XOR IV
pxor2 XDATA1, [IN1 + IDX] ; plaintext XOR IV
pxor2 XDATA2, [IN2 + IDX] ; plaintext XOR IV
pxor2 XDATA3, [IN3 + IDX] ; plaintext XOR IV
pxor XDATA0, [KEYS0 + 16*0] ; 0. ARK
pxor XDATA1, [KEYS1 + 16*0] ; 0. ARK
pxor XDATA2, [KEYS2 + 16*0] ; 0. ARK
pxor XDATA3, [KEYS3 + 16*0] ; 0. ARK
aesenc XDATA0, [KEYS0 + 16*1] ; 1. ENC
aesenc XDATA1, [KEYS1 + 16*1] ; 1. ENC
aesenc XDATA2, [KEYS2 + 16*1] ; 1. ENC
aesenc XDATA3, [KEYS3 + 16*1] ; 1. ENC
aesenc XDATA0, [KEYS0 + 16*2] ; 2. ENC
aesenc XDATA1, [KEYS1 + 16*2] ; 2. ENC
aesenc XDATA2, [KEYS2 + 16*2] ; 2. ENC
aesenc XDATA3, [KEYS3 + 16*2] ; 2. ENC
aesenc XDATA0, XKEY0_3 ; 3. ENC
aesenc XDATA1, XKEY1_3 ; 3. ENC
aesenc XDATA2, XKEY2_3 ; 3. ENC
aesenc XDATA3, XKEY3_3 ; 3. ENC
aesenc XDATA0, [KEYS0 + 16*4] ; 4. ENC
aesenc XDATA1, [KEYS1 + 16*4] ; 4. ENC
aesenc XDATA2, [KEYS2 + 16*4] ; 4. ENC
aesenc XDATA3, [KEYS3 + 16*4] ; 4. ENC
aesenc XDATA0, [KEYS0 + 16*5] ; 5. ENC
aesenc XDATA1, [KEYS1 + 16*5] ; 5. ENC
aesenc XDATA2, [KEYS2 + 16*5] ; 5. ENC
aesenc XDATA3, [KEYS3 + 16*5] ; 5. ENC
aesenc XDATA0, XKEY0_6 ; 6. ENC
aesenc XDATA1, XKEY1_6 ; 6. ENC
aesenc XDATA2, XKEY2_6 ; 6. ENC
aesenc XDATA3, XKEY3_6 ; 6. ENC
aesenc XDATA0, [KEYS0 + 16*7] ; 7. ENC
aesenc XDATA1, [KEYS1 + 16*7] ; 7. ENC
aesenc XDATA2, [KEYS2 + 16*7] ; 7. ENC
aesenc XDATA3, [KEYS3 + 16*7] ; 7. ENC
aesenc XDATA0, [KEYS0 + 16*8] ; 8. ENC
aesenc XDATA1, [KEYS1 + 16*8] ; 8. ENC
aesenc XDATA2, [KEYS2 + 16*8] ; 8. ENC
aesenc XDATA3, [KEYS3 + 16*8] ; 8. ENC
aesenc XDATA0, XKEY0_9 ; 9. ENC
aesenc XDATA1, XKEY1_9 ; 9. ENC
aesenc XDATA2, XKEY2_9 ; 9. ENC
aesenc XDATA3, XKEY3_9 ; 9. ENC
aesenc XDATA0, [KEYS0 + 16*10] ; 10. ENC
aesenc XDATA1, [KEYS1 + 16*10] ; 10. ENC
aesenc XDATA2, [KEYS2 + 16*10] ; 10. ENC
aesenc XDATA3, [KEYS3 + 16*10] ; 10. ENC
aesenc XDATA0, [KEYS0 + 16*11] ; 11. ENC
aesenc XDATA1, [KEYS1 + 16*11] ; 11. ENC
aesenc XDATA2, [KEYS2 + 16*11] ; 11. ENC
aesenc XDATA3, [KEYS3 + 16*11] ; 11. ENC
aesenc XDATA0, [KEYS0 + 16*12] ; 12. ENC
aesenc XDATA1, [KEYS1 + 16*12] ; 12. ENC
aesenc XDATA2, [KEYS2 + 16*12] ; 12. ENC
aesenc XDATA3, [KEYS3 + 16*12] ; 12. ENC
aesenc XDATA0, [KEYS0 + 16*13] ; 13. ENC
aesenc XDATA1, [KEYS1 + 16*13] ; 13. ENC
aesenc XDATA2, [KEYS2 + 16*13] ; 13. ENC
aesenc XDATA3, [KEYS3 + 16*13] ; 13. ENC
aesenclast XDATA0, [KEYS0 + 16*14] ; 14. ENC
aesenclast XDATA1, [KEYS1 + 16*14] ; 14. ENC
aesenclast XDATA2, [KEYS2 + 16*14] ; 14. ENC
aesenclast XDATA3, [KEYS3 + 16*14] ; 14. ENC
%ifndef CBC_MAC
;; No cipher text write back for CBC-MAC
MOVDQ [OUT0 + IDX], XDATA0 ; write back ciphertext
MOVDQ [OUT1 + IDX], XDATA1 ; write back ciphertex
MOVDQ [OUT2 + IDX], XDATA2 ; write back ciphertex
MOVDQ [OUT3 + IDX], XDATA3 ; write back ciphertex
%endif
add IDX, 16
cmp LEN, IDX
jne main_loop
done:
;; update IV
movdqa [ARG + _aesarg_IV + 16*0], XDATA0
movdqa [ARG + _aesarg_IV + 16*1], XDATA1
movdqa [ARG + _aesarg_IV + 16*2], XDATA2
movdqa [ARG + _aesarg_IV + 16*3], XDATA3
;; update IN and OUT
add IN0, LEN
mov [ARG + _aesarg_in + 8*0], IN0
add IN1, LEN
mov [ARG + _aesarg_in + 8*1], IN1
add IN2, LEN
mov [ARG + _aesarg_in + 8*2], IN2
add IN3, LEN
mov [ARG + _aesarg_in + 8*3], IN3
%ifndef CBC_MAC
;; No OUT pointer updates for CBC-MAC
add OUT0, LEN
mov [ARG + _aesarg_out + 8*0], OUT0
add OUT1, LEN
mov [ARG + _aesarg_out + 8*1], OUT1
add OUT2, LEN
mov [ARG + _aesarg_out + 8*2], OUT2
add OUT3, LEN
mov [ARG + _aesarg_out + 8*3], OUT3
%endif
pop rbp
%ifdef SAFE_DATA
clear_all_xmms_sse_asm
%endif ;; SAFE_DATA
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
; A133012: Even imperfect numbers.
; 2,4,8,10,12,14,16,18,20,22,24,26,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118
mov $1,3
add $1,$0
mov $2,8
lpb $2
add $1,1
sub $2,$1
sub $1,2
lpe
mul $1,2
|
.model small
.stack 100h
.data
nr db 0Ah
oddmsg db 'odd$'
evenmsg db 'even$'
.code
; macro for checking parity
; sets zero flag accordingly
macro check p
test p, 00000001b
endm check
main proc
mov ax, @data
mov ds, ax
; read a char from stdin
; store it (ascii) in al
mov ah, 01h
int 21h
mov dl, al
check dl
mov ah, 09h
jz even
odd:
lea dx, oddmsg
int 21h
jmp done
even:
lea dx, evenmsg
int 21h
done:
mov ah, 4ch
int 21h
endp
end main |
; A158133: 144n + 1.
; 145,289,433,577,721,865,1009,1153,1297,1441,1585,1729,1873,2017,2161,2305,2449,2593,2737,2881,3025,3169,3313,3457,3601,3745,3889,4033,4177,4321,4465,4609,4753,4897,5041,5185,5329,5473,5617,5761,5905,6049,6193,6337,6481,6625,6769,6913,7057,7201,7345,7489,7633,7777,7921,8065,8209,8353,8497,8641,8785,8929,9073,9217,9361,9505,9649,9793,9937,10081,10225,10369,10513,10657,10801,10945,11089,11233,11377,11521,11665,11809,11953,12097,12241,12385,12529,12673,12817,12961,13105,13249,13393,13537,13681,13825,13969,14113,14257,14401
mul $0,144
add $0,145
|
; Q68 send data to SER port 2000 Tony Tebby
; 2017 W. Lenerz
; This just takes a byte out of the SER output queue and puts it into
; the hardware FIFO. Sending is always done w/o parity.
section spp
xdef spp_sendser
xref iob_gbyt
xref iob_room
include 'dev8_keys_q68'
include 'dev8_keys_serparprt'
include 'dev8_keys_k'
;+++
; Send data to port.
;
; a6 = sysvars
;
;---
spp_sendser
btst #q68..txmpty,uart_status ; send queue empty?
beq.s srxp_exit ; no, can't send anything, we're done ->
move.l q68_ser_link,a3 ; my linkage block
tst.b spd_oact(a3) ; output active?
beq.s srxp_exit ; no, nothing to send, then ->
srxp_loop
move.l spd_obuf(a3),d0 ; output queue
ble.s srxp_nomore ; there is none ->
move.l d0,a2
jsr iob_gbyt ; get byte from output queue (special return)
beq.s srxp_sbyt ; =0 = got one, send it ->
blt.s srxp_nomore ; <0 = none got, we're done ->
; >0 = eof, possibly
subq.b #1,d1 ; is ff required?
blt.s srxp_exit ; no, done ->
bgt.s qss_cz ; yes, but really it is CTRL Z ->
moveq #k.ff,d1
bra.s srxp_sbyt ; send ff ...
qss_cz moveq #26,d1 ; ... or send CTRL Z
srxp_sbyt
move.b d1,uart_txdata ; put byte into hardware port
srxp_exit
rts
srxp_nomore
sf spd_oact(a3) ; inactivate output
bclr #q68..txstat,uart_status; and interrupt
rts
spp_end
end
;;;;;;;;;;;;;;;;;;;;;;
; if sending with parity, use his code AND modify the regs saved (D7)
; move.b spb_prty(a2),d7 ; set parity
; jsr iob_gbps ; get byte; needs parity in D7
;;;;;;;;;;;;;;;;;
|
Name: Scene-j.asm
Type: file
Size: 57079
Last-Modified: '1992-07-26T15:00:00Z'
SHA-1: C689AE3FCC526C030A0143E2E48D4A7DEE585A1D
Description: null
|
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
80
.text@150
lbegin:
ld a, ff
ldff(45), a
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
ld hl, fea0
lbegin_fill_oam:
dec l
ld(hl), a
jrnz lbegin_fill_oam
ld d, 10
ld a, d
ld(hl), a
inc l
ld a, 08
ld(hl), a
inc l
inc l
inc l
ld a, d
ld(hl), a
inc l
ld(hl), a
inc l
inc l
inc l
ld(hl), a
inc l
ld a, 18
ld(hl), a
inc l
inc l
inc l
ld a, d
ld(hl), a
inc l
ld a, 20
ld(hl), a
inc l
inc l
inc l
ld a, d
ld(hl), a
inc l
ld a, 28
ld(hl), a
inc l
ld a, 40
ldff(41), a
ld a, 02
ldff(ff), a
xor a, a
ldff(0f), a
ei
ld a, 01
ldff(45), a
ld c, 41
ld a, 93
ldff(40), a
.text@1000
lstatint:
nop
.text@1041
ldff a, (c)
and a, 03
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
// Find atan2(x, y) using the CORDIC method
// See http://bsvi.ru/uploads/CORDIC--_10EBA/cordic.pdf
// Creates a font where each char contains the number of the char (00-ff)
// Commodore 64 PRG executable file
.file [name="cordic-atan2-clear.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
// The number of iterations performed during 16-bit CORDIC atan2 calculation
.const CORDIC_ITERATIONS_16 = $f
/// $D012 RASTER Raster counter
.label RASTER = $d012
/// $D018 VIC-II base addresses
// @see #VICII_MEMORY
.label D018 = $d018
.label CHARSET = $2000
.label SCREEN = $2800
.segment Code
main: {
.const toD0181_return = (>(SCREEN&$3fff)*4)|(>CHARSET)/4&$f
// Clear the screen by modifying the charset
.label clear_char = $18
// init_font_hex(CHARSET)
jsr init_font_hex
// *D018 = toD018(SCREEN, CHARSET)
lda #toD0181_return
sta D018
// init_angle_screen(SCREEN)
jsr init_angle_screen
lda #<CHARSET
sta.z clear_char
lda #>CHARSET
sta.z clear_char+1
__b2:
// while(*RASTER!=0xff)
lda #$ff
cmp RASTER
bne __b2
// if(clear_char<CHARSET+0x0800)
lda.z clear_char+1
cmp #>CHARSET+$800
bcc !+
bne __b2
lda.z clear_char
cmp #<CHARSET+$800
bcs __b2
!:
// *clear_char++ = 0
lda #0
tay
sta (clear_char),y
// *clear_char++ = 0;
inc.z clear_char
bne !+
inc.z clear_char+1
!:
jmp __b2
}
// Make charset from proto chars
// void init_font_hex(__zp($f) char *charset)
init_font_hex: {
.label __0 = $d
.label idx = $c
.label proto_lo = 8
.label charset = $f
.label c1 = $e
.label proto_hi = $15
.label c = $17
lda #0
sta.z c
lda #<FONT_HEX_PROTO
sta.z proto_hi
lda #>FONT_HEX_PROTO
sta.z proto_hi+1
lda #<CHARSET
sta.z charset
lda #>CHARSET
sta.z charset+1
__b1:
lda #0
sta.z c1
lda #<FONT_HEX_PROTO
sta.z proto_lo
lda #>FONT_HEX_PROTO
sta.z proto_lo+1
__b2:
// charset[idx++] = 0
lda #0
tay
sta (charset),y
lda #1
sta.z idx
ldx #0
__b3:
// proto_hi[i]<<4
txa
tay
lda (proto_hi),y
asl
asl
asl
asl
sta.z __0
// proto_lo[i]<<1
txa
tay
lda (proto_lo),y
asl
// proto_hi[i]<<4 | proto_lo[i]<<1
ora.z __0
// charset[idx++] = proto_hi[i]<<4 | proto_lo[i]<<1
ldy.z idx
sta (charset),y
// charset[idx++] = proto_hi[i]<<4 | proto_lo[i]<<1;
inc.z idx
// for( byte i: 0..4)
inx
cpx #5
bne __b3
// charset[idx++] = 0
lda #0
ldy.z idx
sta (charset),y
// charset[idx++] = 0;
iny
// charset[idx++] = 0
sta (charset),y
// proto_lo += 5
lda #5
clc
adc.z proto_lo
sta.z proto_lo
bcc !+
inc.z proto_lo+1
!:
// charset += 8
lda #8
clc
adc.z charset
sta.z charset
bcc !+
inc.z charset+1
!:
// for( byte c: 0..15 )
inc.z c1
lda #$10
cmp.z c1
bne __b2
// proto_hi += 5
lda #5
clc
adc.z proto_hi
sta.z proto_hi
bcc !+
inc.z proto_hi+1
!:
// for( byte c: 0..15 )
inc.z c
lda #$10
cmp.z c
bne __b1
// }
rts
}
// Populates 1000 bytes (a screen) with values representing the angle to the center.
// Utilizes symmetry around the center
// void init_angle_screen(char *screen)
init_angle_screen: {
.label __9 = 6
.label xw = $13
.label yw = $11
.label angle_w = 6
.label ang_w = $d
.label x = $e
.label xb = $c
.label screen_topline = $15
.label screen_bottomline = $f
.label y = $17
lda #<SCREEN+$28*$c
sta.z screen_bottomline
lda #>SCREEN+$28*$c
sta.z screen_bottomline+1
lda #<SCREEN+$28*$c
sta.z screen_topline
lda #>SCREEN+$28*$c
sta.z screen_topline+1
lda #0
sta.z y
__b1:
lda #$27
sta.z xb
lda #0
sta.z x
__b2:
// for( byte x=0,xb=39; x<=19; x++, xb--)
lda.z x
cmp #$13+1
bcc __b3
// screen_topline -= 40
sec
lda.z screen_topline
sbc #$28
sta.z screen_topline
lda.z screen_topline+1
sbc #0
sta.z screen_topline+1
// screen_bottomline += 40
lda #$28
clc
adc.z screen_bottomline
sta.z screen_bottomline
bcc !+
inc.z screen_bottomline+1
!:
// for(byte y: 0..12)
inc.z y
lda #$d
cmp.z y
bne __b1
// }
rts
__b3:
// x*2
lda.z x
asl
// 39-x*2
eor #$ff
sec
adc #$27
// MAKEWORD( 39-x*2, 0 )
ldy #0
sta.z xw+1
sty.z xw
// y*2
lda.z y
asl
// MAKEWORD( y*2, 0 )
sta.z yw+1
sty.z yw
// word angle_w = atan2_16(xw, yw)
jsr atan2_16
// angle_w+0x0080
lda #$80
clc
adc.z __9
sta.z __9
bcc !+
inc.z __9+1
!:
// byte ang_w = BYTE1(angle_w+0x0080)
lda.z __9+1
sta.z ang_w
// 0x80+ang_w
lda #$80
clc
adc.z ang_w
// screen_topline[x] = 0x80+ang_w
ldy.z x
sta (screen_topline),y
// 0x80-ang_w
lda #$80
sec
sbc.z ang_w
// screen_bottomline[x] = 0x80-ang_w
sta (screen_bottomline),y
// -ang_w
lda.z ang_w
eor #$ff
clc
adc #1
// screen_topline[xb] = -ang_w
ldy.z xb
sta (screen_topline),y
// screen_bottomline[xb] = ang_w
lda.z ang_w
sta (screen_bottomline),y
// for( byte x=0,xb=39; x<=19; x++, xb--)
inc.z x
dec.z xb
jmp __b2
}
// Find the atan2(x, y) - which is the angle of the line from (0,0) to (x,y)
// Finding the angle requires a binary search using CORDIC_ITERATIONS_16
// Returns the angle in hex-degrees (0=0, 0x8000=PI, 0x10000=2*PI)
// __zp(6) unsigned int atan2_16(__zp($13) int x, __zp($11) int y)
atan2_16: {
.label __2 = 8
.label __7 = $a
.label yi = 8
.label xi = $a
.label angle = 6
.label xd = 4
.label yd = 2
.label return = 6
.label x = $13
.label y = $11
// (y>=0)?y:-y
lda.z y+1
bmi !__b1+
jmp __b1
!__b1:
sec
lda #0
sbc.z y
sta.z __2
lda #0
sbc.z y+1
sta.z __2+1
__b3:
// (x>=0)?x:-x
lda.z x+1
bmi !__b4+
jmp __b4
!__b4:
sec
lda #0
sbc.z x
sta.z __7
lda #0
sbc.z x+1
sta.z __7+1
__b6:
lda #<0
sta.z angle
sta.z angle+1
tax
__b10:
// if(yi==0)
lda.z yi+1
ora.z yi
bne __b11
__b12:
// angle /=2
lsr.z angle+1
ror.z angle
// if(x<0)
lda.z x+1
bpl __b7
// angle = 0x8000-angle
lda #<$8000
sec
sbc.z angle
sta.z angle
lda #>$8000
sbc.z angle+1
sta.z angle+1
__b7:
// if(y<0)
lda.z y+1
bpl __b8
// angle = -angle
sec
lda #0
sbc.z angle
sta.z angle
lda #0
sbc.z angle+1
sta.z angle+1
__b8:
// }
rts
__b11:
txa
tay
lda.z xi
sta.z xd
lda.z xi+1
sta.z xd+1
lda.z yi
sta.z yd
lda.z yi+1
sta.z yd+1
__b13:
// while(shift>=2)
cpy #2
bcs __b14
// if(shift)
cpy #0
beq __b17
// xd >>= 1
lda.z xd+1
cmp #$80
ror.z xd+1
ror.z xd
// yd >>= 1
lda.z yd+1
cmp #$80
ror.z yd+1
ror.z yd
__b17:
// if(yi>=0)
lda.z yi+1
bpl __b18
// xi -= yd
lda.z xi
sec
sbc.z yd
sta.z xi
lda.z xi+1
sbc.z yd+1
sta.z xi+1
// yi += xd
clc
lda.z yi
adc.z xd
sta.z yi
lda.z yi+1
adc.z xd+1
sta.z yi+1
// angle -= CORDIC_ATAN2_ANGLES_16[i]
txa
asl
tay
lda.z angle
sec
sbc CORDIC_ATAN2_ANGLES_16,y
sta.z angle
lda.z angle+1
sbc CORDIC_ATAN2_ANGLES_16+1,y
sta.z angle+1
__b19:
// for( char i: 0..CORDIC_ITERATIONS_16-1)
inx
cpx #CORDIC_ITERATIONS_16-1+1
bne !__b12+
jmp __b12
!__b12:
jmp __b10
__b18:
// xi += yd
clc
lda.z xi
adc.z yd
sta.z xi
lda.z xi+1
adc.z yd+1
sta.z xi+1
// yi -= xd
lda.z yi
sec
sbc.z xd
sta.z yi
lda.z yi+1
sbc.z xd+1
sta.z yi+1
// angle += CORDIC_ATAN2_ANGLES_16[i]
txa
asl
tay
clc
lda.z angle
adc CORDIC_ATAN2_ANGLES_16,y
sta.z angle
lda.z angle+1
adc CORDIC_ATAN2_ANGLES_16+1,y
sta.z angle+1
jmp __b19
__b14:
// xd >>= 2
lda.z xd+1
cmp #$80
ror.z xd+1
ror.z xd
lda.z xd+1
cmp #$80
ror.z xd+1
ror.z xd
// yd >>= 2
lda.z yd+1
cmp #$80
ror.z yd+1
ror.z yd
lda.z yd+1
cmp #$80
ror.z yd+1
ror.z yd
// shift -=2
dey
dey
jmp __b13
__b4:
// (x>=0)?x:-x
lda.z x
sta.z xi
lda.z x+1
sta.z xi+1
jmp __b6
__b1:
// (y>=0)?y:-y
lda.z y
sta.z yi
lda.z y+1
sta.z yi+1
jmp __b3
}
.segment Data
// Bit patterns for symbols 0-f (3x5 pixels) used in font hex
FONT_HEX_PROTO: .byte 2, 5, 5, 5, 2, 6, 2, 2, 2, 7, 6, 1, 2, 4, 7, 6, 1, 2, 1, 6, 5, 5, 7, 1, 1, 7, 4, 6, 1, 6, 3, 4, 6, 5, 2, 7, 1, 1, 1, 1, 2, 5, 2, 5, 2, 2, 5, 3, 1, 1, 2, 5, 7, 5, 5, 6, 5, 6, 5, 6, 2, 5, 4, 5, 2, 6, 5, 5, 5, 6, 7, 4, 6, 4, 7, 7, 4, 6, 4, 4
// Angles representing ATAN(0.5), ATAN(0.25), ATAN(0.125), ...
CORDIC_ATAN2_ANGLES_16:
.for (var i=0; i<CORDIC_ITERATIONS_16; i++)
.word 256*2*256*atan(1/pow(2,i))/PI/2
|
; A277425: a(n) = sqrt(16*t^2 - 32*t + k^2 + 8*k - 8*k*t + 16), where t = ceiling(sqrt(n)) and k = t^2 - n.
; 0,2,3,4,4,5,6,7,8,6,7,8,9,10,11,12,8,9,10,11,12,13,14,15,16,10,11,12,13,14,15,16,17,18,19,20,12,13,14,15,16,17,18,19,20,21,22,23,24,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36
lpb $0
sub $0,1
add $1,2
mov $2,$0
trn $0,$1
lpe
add $1,$2
mov $0,$1
|
; A269352: Kolakoski-(1,10) sequence: a(n) is length of n-th run.
; 1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1,1,1,1,1,1,1,1,10,10,10,10,10,10,10,10,10,10,1,1,1
add $0,909
mov $1,$0
div $1,10
mod $1,2
mul $1,9
add $1,1
|
//==================================================================================================
/*
EVE - Expressive Vector Engine
Copyright : EVE Contributors & Maintainers
SPDX-License-Identifier: MIT
*/
//==================================================================================================
#pragma once
#include <eve/forward.hpp>
#include <eve/detail/function/conditional.hpp>
#include <eve/detail/implementation.hpp>
#include <eve/detail/function/operators.hpp>
#include <eve/detail/skeleton.hpp>
#include <eve/detail/meta.hpp>
#include <eve/detail/abi.hpp>
#include <eve/detail/apply_over.hpp>
#include <eve/function/bit_ornot.hpp>
#include <eve/function/bit_cast.hpp>
#include <eve/function/if_else.hpp>
#include <eve/concept/value.hpp>
#include <eve/concept/compatible.hpp>
namespace eve::detail
{
// -----------------------------------------------------------------------------------------------
// Masked case
template<conditional_expr C, real_value U, real_value V>
EVE_FORCEINLINE auto bit_or_(EVE_SUPPORTS(cpu_), C const &cond, U const &t, V const &f) noexcept
requires bit_compatible_values<U, V>
{
return mask_op( cond, eve::bit_or, t, f);
}
//================================================================================================
//N parameters
//================================================================================================
template<real_value T0, real_value T1, real_value ...Ts>
auto bit_or_(EVE_SUPPORTS(cpu_), T0 a0, T1 a1, Ts... args)
requires bit_compatible_values<T0, T1> && (bit_compatible_values<T1, Ts> && ...)
{
auto that = bit_or(a0,a1);
((that = bit_or(that, args)),...);
return that;
}
template<conditional_expr C, real_value T0, real_value T1, real_value ...Ts>
auto bit_or_(EVE_SUPPORTS(cpu_), C const &cond, T0 a0, T1 a1, Ts... args)
requires bit_compatible_values<T0, T1> && (bit_compatible_values<T1, Ts> && ...)
{
auto that = bit_or(a1,args...);
return mask_op( cond, eve::bit_or, a0, that);
}
}
|
_mkdir: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: bf 01 00 00 00 mov $0x1,%edi
16: 83 ec 08 sub $0x8,%esp
19: 8b 31 mov (%ecx),%esi
1b: 8b 59 04 mov 0x4(%ecx),%ebx
1e: 83 c3 04 add $0x4,%ebx
int i;
if(argc < 2){
21: 83 fe 01 cmp $0x1,%esi
24: 7e 3e jle 64 <main+0x64>
26: 8d 76 00 lea 0x0(%esi),%esi
29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "Usage: mkdir files...\n");
exit();
}
for(i = 1; i < argc; i++){
if(mkdir(argv[i]) < 0){
30: 83 ec 0c sub $0xc,%esp
33: ff 33 pushl (%ebx)
35: e8 00 03 00 00 call 33a <mkdir>
3a: 83 c4 10 add $0x10,%esp
3d: 85 c0 test %eax,%eax
3f: 78 0f js 50 <main+0x50>
for(i = 1; i < argc; i++){
41: 83 c7 01 add $0x1,%edi
44: 83 c3 04 add $0x4,%ebx
47: 39 fe cmp %edi,%esi
49: 75 e5 jne 30 <main+0x30>
printf(2, "mkdir: %s failed to create\n", argv[i]);
break;
}
}
exit();
4b: e8 82 02 00 00 call 2d2 <exit>
printf(2, "mkdir: %s failed to create\n", argv[i]);
50: 50 push %eax
51: ff 33 pushl (%ebx)
53: 68 8f 07 00 00 push $0x78f
58: 6a 02 push $0x2
5a: e8 c1 03 00 00 call 420 <printf>
break;
5f: 83 c4 10 add $0x10,%esp
62: eb e7 jmp 4b <main+0x4b>
printf(2, "Usage: mkdir files...\n");
64: 52 push %edx
65: 52 push %edx
66: 68 78 07 00 00 push $0x778
6b: 6a 02 push $0x2
6d: e8 ae 03 00 00 call 420 <printf>
exit();
72: e8 5b 02 00 00 call 2d2 <exit>
77: 66 90 xchg %ax,%ax
79: 66 90 xchg %ax,%ax
7b: 66 90 xchg %ax,%ax
7d: 66 90 xchg %ax,%ax
7f: 90 nop
00000080 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 53 push %ebx
84: 8b 45 08 mov 0x8(%ebp),%eax
87: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
8a: 89 c2 mov %eax,%edx
8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
90: 83 c1 01 add $0x1,%ecx
93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
97: 83 c2 01 add $0x1,%edx
9a: 84 db test %bl,%bl
9c: 88 5a ff mov %bl,-0x1(%edx)
9f: 75 ef jne 90 <strcpy+0x10>
;
return os;
}
a1: 5b pop %ebx
a2: 5d pop %ebp
a3: c3 ret
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 53 push %ebx
b4: 8b 55 08 mov 0x8(%ebp),%edx
b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
ba: 0f b6 02 movzbl (%edx),%eax
bd: 0f b6 19 movzbl (%ecx),%ebx
c0: 84 c0 test %al,%al
c2: 75 1c jne e0 <strcmp+0x30>
c4: eb 2a jmp f0 <strcmp+0x40>
c6: 8d 76 00 lea 0x0(%esi),%esi
c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
d0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
d3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
d6: 83 c1 01 add $0x1,%ecx
d9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
dc: 84 c0 test %al,%al
de: 74 10 je f0 <strcmp+0x40>
e0: 38 d8 cmp %bl,%al
e2: 74 ec je d0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
e4: 29 d8 sub %ebx,%eax
}
e6: 5b pop %ebx
e7: 5d pop %ebp
e8: c3 ret
e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
f2: 29 d8 sub %ebx,%eax
}
f4: 5b pop %ebx
f5: 5d pop %ebp
f6: c3 ret
f7: 89 f6 mov %esi,%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <strlen>:
uint
strlen(const char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
106: 80 39 00 cmpb $0x0,(%ecx)
109: 74 15 je 120 <strlen+0x20>
10b: 31 d2 xor %edx,%edx
10d: 8d 76 00 lea 0x0(%esi),%esi
110: 83 c2 01 add $0x1,%edx
113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
117: 89 d0 mov %edx,%eax
119: 75 f5 jne 110 <strlen+0x10>
;
return n;
}
11b: 5d pop %ebp
11c: c3 ret
11d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
120: 31 c0 xor %eax,%eax
}
122: 5d pop %ebp
123: c3 ret
124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
137: 8b 4d 10 mov 0x10(%ebp),%ecx
13a: 8b 45 0c mov 0xc(%ebp),%eax
13d: 89 d7 mov %edx,%edi
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
142: 89 d0 mov %edx,%eax
144: 5f pop %edi
145: 5d pop %ebp
146: c3 ret
147: 89 f6 mov %esi,%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <strchr>:
char*
strchr(const char *s, char c)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 45 08 mov 0x8(%ebp),%eax
157: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
15a: 0f b6 10 movzbl (%eax),%edx
15d: 84 d2 test %dl,%dl
15f: 74 1d je 17e <strchr+0x2e>
if(*s == c)
161: 38 d3 cmp %dl,%bl
163: 89 d9 mov %ebx,%ecx
165: 75 0d jne 174 <strchr+0x24>
167: eb 17 jmp 180 <strchr+0x30>
169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
170: 38 ca cmp %cl,%dl
172: 74 0c je 180 <strchr+0x30>
for(; *s; s++)
174: 83 c0 01 add $0x1,%eax
177: 0f b6 10 movzbl (%eax),%edx
17a: 84 d2 test %dl,%dl
17c: 75 f2 jne 170 <strchr+0x20>
return (char*)s;
return 0;
17e: 31 c0 xor %eax,%eax
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <gets>:
char*
gets(char *buf, int max)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 57 push %edi
194: 56 push %esi
195: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
196: 31 f6 xor %esi,%esi
198: 89 f3 mov %esi,%ebx
{
19a: 83 ec 1c sub $0x1c,%esp
19d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1a0: eb 2f jmp 1d1 <gets+0x41>
1a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a8: 8d 45 e7 lea -0x19(%ebp),%eax
1ab: 83 ec 04 sub $0x4,%esp
1ae: 6a 01 push $0x1
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 32 01 00 00 call 2ea <read>
if(cc < 1)
1b8: 83 c4 10 add $0x10,%esp
1bb: 85 c0 test %eax,%eax
1bd: 7e 1c jle 1db <gets+0x4b>
break;
buf[i++] = c;
1bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1c3: 83 c7 01 add $0x1,%edi
1c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c9: 3c 0a cmp $0xa,%al
1cb: 74 23 je 1f0 <gets+0x60>
1cd: 3c 0d cmp $0xd,%al
1cf: 74 1f je 1f0 <gets+0x60>
for(i=0; i+1 < max; ){
1d1: 83 c3 01 add $0x1,%ebx
1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d7: 89 fe mov %edi,%esi
1d9: 7c cd jl 1a8 <gets+0x18>
1db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1e0: c6 03 00 movb $0x0,(%ebx)
}
1e3: 8d 65 f4 lea -0xc(%ebp),%esp
1e6: 5b pop %ebx
1e7: 5e pop %esi
1e8: 5f pop %edi
1e9: 5d pop %ebp
1ea: c3 ret
1eb: 90 nop
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1f0: 8b 75 08 mov 0x8(%ebp),%esi
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 01 de add %ebx,%esi
1f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1fa: c6 03 00 movb $0x0,(%ebx)
}
1fd: 8d 65 f4 lea -0xc(%ebp),%esp
200: 5b pop %ebx
201: 5e pop %esi
202: 5f pop %edi
203: 5d pop %ebp
204: c3 ret
205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <stat>:
int
stat(const char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 56 push %esi
214: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
215: 83 ec 08 sub $0x8,%esp
218: 6a 00 push $0x0
21a: ff 75 08 pushl 0x8(%ebp)
21d: e8 f0 00 00 00 call 312 <open>
if(fd < 0)
222: 83 c4 10 add $0x10,%esp
225: 85 c0 test %eax,%eax
227: 78 27 js 250 <stat+0x40>
return -1;
r = fstat(fd, st);
229: 83 ec 08 sub $0x8,%esp
22c: ff 75 0c pushl 0xc(%ebp)
22f: 89 c3 mov %eax,%ebx
231: 50 push %eax
232: e8 f3 00 00 00 call 32a <fstat>
close(fd);
237: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
23a: 89 c6 mov %eax,%esi
close(fd);
23c: e8 b9 00 00 00 call 2fa <close>
return r;
241: 83 c4 10 add $0x10,%esp
}
244: 8d 65 f8 lea -0x8(%ebp),%esp
247: 89 f0 mov %esi,%eax
249: 5b pop %ebx
24a: 5e pop %esi
24b: 5d pop %ebp
24c: c3 ret
24d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
250: be ff ff ff ff mov $0xffffffff,%esi
255: eb ed jmp 244 <stat+0x34>
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <atoi>:
int
atoi(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
264: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
267: 0f be 11 movsbl (%ecx),%edx
26a: 8d 42 d0 lea -0x30(%edx),%eax
26d: 3c 09 cmp $0x9,%al
n = 0;
26f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
274: 77 1f ja 295 <atoi+0x35>
276: 8d 76 00 lea 0x0(%esi),%esi
279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
280: 8d 04 80 lea (%eax,%eax,4),%eax
283: 83 c1 01 add $0x1,%ecx
286: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
28a: 0f be 11 movsbl (%ecx),%edx
28d: 8d 5a d0 lea -0x30(%edx),%ebx
290: 80 fb 09 cmp $0x9,%bl
293: 76 eb jbe 280 <atoi+0x20>
return n;
}
295: 5b pop %ebx
296: 5d pop %ebp
297: c3 ret
298: 90 nop
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002a0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 56 push %esi
2a4: 53 push %ebx
2a5: 8b 5d 10 mov 0x10(%ebp),%ebx
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ae: 85 db test %ebx,%ebx
2b0: 7e 14 jle 2c6 <memmove+0x26>
2b2: 31 d2 xor %edx,%edx
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2bc: 88 0c 10 mov %cl,(%eax,%edx,1)
2bf: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2c2: 39 d3 cmp %edx,%ebx
2c4: 75 f2 jne 2b8 <memmove+0x18>
return vdst;
}
2c6: 5b pop %ebx
2c7: 5e pop %esi
2c8: 5d pop %ebp
2c9: c3 ret
000002ca <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2ca: b8 01 00 00 00 mov $0x1,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <exit>:
SYSCALL(exit)
2d2: b8 02 00 00 00 mov $0x2,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <wait>:
SYSCALL(wait)
2da: b8 03 00 00 00 mov $0x3,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <pipe>:
SYSCALL(pipe)
2e2: b8 04 00 00 00 mov $0x4,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <read>:
SYSCALL(read)
2ea: b8 05 00 00 00 mov $0x5,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <write>:
SYSCALL(write)
2f2: b8 10 00 00 00 mov $0x10,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <close>:
SYSCALL(close)
2fa: b8 15 00 00 00 mov $0x15,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <kill>:
SYSCALL(kill)
302: b8 06 00 00 00 mov $0x6,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <exec>:
SYSCALL(exec)
30a: b8 07 00 00 00 mov $0x7,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <open>:
SYSCALL(open)
312: b8 0f 00 00 00 mov $0xf,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mknod>:
SYSCALL(mknod)
31a: b8 11 00 00 00 mov $0x11,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <unlink>:
SYSCALL(unlink)
322: b8 12 00 00 00 mov $0x12,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <fstat>:
SYSCALL(fstat)
32a: b8 08 00 00 00 mov $0x8,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <link>:
SYSCALL(link)
332: b8 13 00 00 00 mov $0x13,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <mkdir>:
SYSCALL(mkdir)
33a: b8 14 00 00 00 mov $0x14,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <chdir>:
SYSCALL(chdir)
342: b8 09 00 00 00 mov $0x9,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <dup>:
SYSCALL(dup)
34a: b8 0a 00 00 00 mov $0xa,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <getpid>:
SYSCALL(getpid)
352: b8 0b 00 00 00 mov $0xb,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <sbrk>:
SYSCALL(sbrk)
35a: b8 0c 00 00 00 mov $0xc,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <sleep>:
SYSCALL(sleep)
362: b8 0d 00 00 00 mov $0xd,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <uptime>:
SYSCALL(uptime)
36a: b8 0e 00 00 00 mov $0xe,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <getreadcount>:
SYSCALL(getreadcount)
372: b8 16 00 00 00 mov $0x16,%eax
377: cd 40 int $0x40
379: c3 ret
37a: 66 90 xchg %ax,%ax
37c: 66 90 xchg %ax,%ax
37e: 66 90 xchg %ax,%ax
00000380 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
380: 55 push %ebp
381: 89 e5 mov %esp,%ebp
383: 57 push %edi
384: 56 push %esi
385: 53 push %ebx
386: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
389: 85 d2 test %edx,%edx
{
38b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
38e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
390: 79 76 jns 408 <printint+0x88>
392: f6 45 08 01 testb $0x1,0x8(%ebp)
396: 74 70 je 408 <printint+0x88>
x = -xx;
398: f7 d8 neg %eax
neg = 1;
39a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3a1: 31 f6 xor %esi,%esi
3a3: 8d 5d d7 lea -0x29(%ebp),%ebx
3a6: eb 0a jmp 3b2 <printint+0x32>
3a8: 90 nop
3a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3b0: 89 fe mov %edi,%esi
3b2: 31 d2 xor %edx,%edx
3b4: 8d 7e 01 lea 0x1(%esi),%edi
3b7: f7 f1 div %ecx
3b9: 0f b6 92 b4 07 00 00 movzbl 0x7b4(%edx),%edx
}while((x /= base) != 0);
3c0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3c2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3c5: 75 e9 jne 3b0 <printint+0x30>
if(neg)
3c7: 8b 45 c4 mov -0x3c(%ebp),%eax
3ca: 85 c0 test %eax,%eax
3cc: 74 08 je 3d6 <printint+0x56>
buf[i++] = '-';
3ce: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3d3: 8d 7e 02 lea 0x2(%esi),%edi
3d6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3da: 8b 7d c0 mov -0x40(%ebp),%edi
3dd: 8d 76 00 lea 0x0(%esi),%esi
3e0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3e3: 83 ec 04 sub $0x4,%esp
3e6: 83 ee 01 sub $0x1,%esi
3e9: 6a 01 push $0x1
3eb: 53 push %ebx
3ec: 57 push %edi
3ed: 88 45 d7 mov %al,-0x29(%ebp)
3f0: e8 fd fe ff ff call 2f2 <write>
while(--i >= 0)
3f5: 83 c4 10 add $0x10,%esp
3f8: 39 de cmp %ebx,%esi
3fa: 75 e4 jne 3e0 <printint+0x60>
putc(fd, buf[i]);
}
3fc: 8d 65 f4 lea -0xc(%ebp),%esp
3ff: 5b pop %ebx
400: 5e pop %esi
401: 5f pop %edi
402: 5d pop %ebp
403: c3 ret
404: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
408: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
40f: eb 90 jmp 3a1 <printint+0x21>
411: eb 0d jmp 420 <printf>
413: 90 nop
414: 90 nop
415: 90 nop
416: 90 nop
417: 90 nop
418: 90 nop
419: 90 nop
41a: 90 nop
41b: 90 nop
41c: 90 nop
41d: 90 nop
41e: 90 nop
41f: 90 nop
00000420 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
420: 55 push %ebp
421: 89 e5 mov %esp,%ebp
423: 57 push %edi
424: 56 push %esi
425: 53 push %ebx
426: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
429: 8b 75 0c mov 0xc(%ebp),%esi
42c: 0f b6 1e movzbl (%esi),%ebx
42f: 84 db test %bl,%bl
431: 0f 84 b3 00 00 00 je 4ea <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
437: 8d 45 10 lea 0x10(%ebp),%eax
43a: 83 c6 01 add $0x1,%esi
state = 0;
43d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
43f: 89 45 d4 mov %eax,-0x2c(%ebp)
442: eb 2f jmp 473 <printf+0x53>
444: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
448: 83 f8 25 cmp $0x25,%eax
44b: 0f 84 a7 00 00 00 je 4f8 <printf+0xd8>
write(fd, &c, 1);
451: 8d 45 e2 lea -0x1e(%ebp),%eax
454: 83 ec 04 sub $0x4,%esp
457: 88 5d e2 mov %bl,-0x1e(%ebp)
45a: 6a 01 push $0x1
45c: 50 push %eax
45d: ff 75 08 pushl 0x8(%ebp)
460: e8 8d fe ff ff call 2f2 <write>
465: 83 c4 10 add $0x10,%esp
468: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
46b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
46f: 84 db test %bl,%bl
471: 74 77 je 4ea <printf+0xca>
if(state == 0){
473: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
475: 0f be cb movsbl %bl,%ecx
478: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
47b: 74 cb je 448 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
47d: 83 ff 25 cmp $0x25,%edi
480: 75 e6 jne 468 <printf+0x48>
if(c == 'd'){
482: 83 f8 64 cmp $0x64,%eax
485: 0f 84 05 01 00 00 je 590 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
48b: 81 e1 f7 00 00 00 and $0xf7,%ecx
491: 83 f9 70 cmp $0x70,%ecx
494: 74 72 je 508 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
496: 83 f8 73 cmp $0x73,%eax
499: 0f 84 99 00 00 00 je 538 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
49f: 83 f8 63 cmp $0x63,%eax
4a2: 0f 84 08 01 00 00 je 5b0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4a8: 83 f8 25 cmp $0x25,%eax
4ab: 0f 84 ef 00 00 00 je 5a0 <printf+0x180>
write(fd, &c, 1);
4b1: 8d 45 e7 lea -0x19(%ebp),%eax
4b4: 83 ec 04 sub $0x4,%esp
4b7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4bb: 6a 01 push $0x1
4bd: 50 push %eax
4be: ff 75 08 pushl 0x8(%ebp)
4c1: e8 2c fe ff ff call 2f2 <write>
4c6: 83 c4 0c add $0xc,%esp
4c9: 8d 45 e6 lea -0x1a(%ebp),%eax
4cc: 88 5d e6 mov %bl,-0x1a(%ebp)
4cf: 6a 01 push $0x1
4d1: 50 push %eax
4d2: ff 75 08 pushl 0x8(%ebp)
4d5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4d8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4da: e8 13 fe ff ff call 2f2 <write>
for(i = 0; fmt[i]; i++){
4df: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4e3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4e6: 84 db test %bl,%bl
4e8: 75 89 jne 473 <printf+0x53>
}
}
}
4ea: 8d 65 f4 lea -0xc(%ebp),%esp
4ed: 5b pop %ebx
4ee: 5e pop %esi
4ef: 5f pop %edi
4f0: 5d pop %ebp
4f1: c3 ret
4f2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
4f8: bf 25 00 00 00 mov $0x25,%edi
4fd: e9 66 ff ff ff jmp 468 <printf+0x48>
502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
508: 83 ec 0c sub $0xc,%esp
50b: b9 10 00 00 00 mov $0x10,%ecx
510: 6a 00 push $0x0
512: 8b 7d d4 mov -0x2c(%ebp),%edi
515: 8b 45 08 mov 0x8(%ebp),%eax
518: 8b 17 mov (%edi),%edx
51a: e8 61 fe ff ff call 380 <printint>
ap++;
51f: 89 f8 mov %edi,%eax
521: 83 c4 10 add $0x10,%esp
state = 0;
524: 31 ff xor %edi,%edi
ap++;
526: 83 c0 04 add $0x4,%eax
529: 89 45 d4 mov %eax,-0x2c(%ebp)
52c: e9 37 ff ff ff jmp 468 <printf+0x48>
531: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
538: 8b 45 d4 mov -0x2c(%ebp),%eax
53b: 8b 08 mov (%eax),%ecx
ap++;
53d: 83 c0 04 add $0x4,%eax
540: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
543: 85 c9 test %ecx,%ecx
545: 0f 84 8e 00 00 00 je 5d9 <printf+0x1b9>
while(*s != 0){
54b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
54e: 31 ff xor %edi,%edi
s = (char*)*ap;
550: 89 cb mov %ecx,%ebx
while(*s != 0){
552: 84 c0 test %al,%al
554: 0f 84 0e ff ff ff je 468 <printf+0x48>
55a: 89 75 d0 mov %esi,-0x30(%ebp)
55d: 89 de mov %ebx,%esi
55f: 8b 5d 08 mov 0x8(%ebp),%ebx
562: 8d 7d e3 lea -0x1d(%ebp),%edi
565: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
568: 83 ec 04 sub $0x4,%esp
s++;
56b: 83 c6 01 add $0x1,%esi
56e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
571: 6a 01 push $0x1
573: 57 push %edi
574: 53 push %ebx
575: e8 78 fd ff ff call 2f2 <write>
while(*s != 0){
57a: 0f b6 06 movzbl (%esi),%eax
57d: 83 c4 10 add $0x10,%esp
580: 84 c0 test %al,%al
582: 75 e4 jne 568 <printf+0x148>
584: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
587: 31 ff xor %edi,%edi
589: e9 da fe ff ff jmp 468 <printf+0x48>
58e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
590: 83 ec 0c sub $0xc,%esp
593: b9 0a 00 00 00 mov $0xa,%ecx
598: 6a 01 push $0x1
59a: e9 73 ff ff ff jmp 512 <printf+0xf2>
59f: 90 nop
write(fd, &c, 1);
5a0: 83 ec 04 sub $0x4,%esp
5a3: 88 5d e5 mov %bl,-0x1b(%ebp)
5a6: 8d 45 e5 lea -0x1b(%ebp),%eax
5a9: 6a 01 push $0x1
5ab: e9 21 ff ff ff jmp 4d1 <printf+0xb1>
putc(fd, *ap);
5b0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
5b3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5b6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
5b8: 6a 01 push $0x1
ap++;
5ba: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
5bd: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5c0: 8d 45 e4 lea -0x1c(%ebp),%eax
5c3: 50 push %eax
5c4: ff 75 08 pushl 0x8(%ebp)
5c7: e8 26 fd ff ff call 2f2 <write>
ap++;
5cc: 89 7d d4 mov %edi,-0x2c(%ebp)
5cf: 83 c4 10 add $0x10,%esp
state = 0;
5d2: 31 ff xor %edi,%edi
5d4: e9 8f fe ff ff jmp 468 <printf+0x48>
s = "(null)";
5d9: bb ab 07 00 00 mov $0x7ab,%ebx
while(*s != 0){
5de: b8 28 00 00 00 mov $0x28,%eax
5e3: e9 72 ff ff ff jmp 55a <printf+0x13a>
5e8: 66 90 xchg %ax,%ax
5ea: 66 90 xchg %ax,%ax
5ec: 66 90 xchg %ax,%ax
5ee: 66 90 xchg %ax,%ax
000005f0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
5f0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5f1: a1 64 0a 00 00 mov 0xa64,%eax
{
5f6: 89 e5 mov %esp,%ebp
5f8: 57 push %edi
5f9: 56 push %esi
5fa: 53 push %ebx
5fb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
5fe: 8d 4b f8 lea -0x8(%ebx),%ecx
601: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
608: 39 c8 cmp %ecx,%eax
60a: 8b 10 mov (%eax),%edx
60c: 73 32 jae 640 <free+0x50>
60e: 39 d1 cmp %edx,%ecx
610: 72 04 jb 616 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
612: 39 d0 cmp %edx,%eax
614: 72 32 jb 648 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
616: 8b 73 fc mov -0x4(%ebx),%esi
619: 8d 3c f1 lea (%ecx,%esi,8),%edi
61c: 39 fa cmp %edi,%edx
61e: 74 30 je 650 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
620: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
623: 8b 50 04 mov 0x4(%eax),%edx
626: 8d 34 d0 lea (%eax,%edx,8),%esi
629: 39 f1 cmp %esi,%ecx
62b: 74 3a je 667 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
62d: 89 08 mov %ecx,(%eax)
freep = p;
62f: a3 64 0a 00 00 mov %eax,0xa64
}
634: 5b pop %ebx
635: 5e pop %esi
636: 5f pop %edi
637: 5d pop %ebp
638: c3 ret
639: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
640: 39 d0 cmp %edx,%eax
642: 72 04 jb 648 <free+0x58>
644: 39 d1 cmp %edx,%ecx
646: 72 ce jb 616 <free+0x26>
{
648: 89 d0 mov %edx,%eax
64a: eb bc jmp 608 <free+0x18>
64c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
650: 03 72 04 add 0x4(%edx),%esi
653: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
656: 8b 10 mov (%eax),%edx
658: 8b 12 mov (%edx),%edx
65a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
65d: 8b 50 04 mov 0x4(%eax),%edx
660: 8d 34 d0 lea (%eax,%edx,8),%esi
663: 39 f1 cmp %esi,%ecx
665: 75 c6 jne 62d <free+0x3d>
p->s.size += bp->s.size;
667: 03 53 fc add -0x4(%ebx),%edx
freep = p;
66a: a3 64 0a 00 00 mov %eax,0xa64
p->s.size += bp->s.size;
66f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
672: 8b 53 f8 mov -0x8(%ebx),%edx
675: 89 10 mov %edx,(%eax)
}
677: 5b pop %ebx
678: 5e pop %esi
679: 5f pop %edi
67a: 5d pop %ebp
67b: c3 ret
67c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000680 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
680: 55 push %ebp
681: 89 e5 mov %esp,%ebp
683: 57 push %edi
684: 56 push %esi
685: 53 push %ebx
686: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
689: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
68c: 8b 15 64 0a 00 00 mov 0xa64,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
692: 8d 78 07 lea 0x7(%eax),%edi
695: c1 ef 03 shr $0x3,%edi
698: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
69b: 85 d2 test %edx,%edx
69d: 0f 84 9d 00 00 00 je 740 <malloc+0xc0>
6a3: 8b 02 mov (%edx),%eax
6a5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
6a8: 39 cf cmp %ecx,%edi
6aa: 76 6c jbe 718 <malloc+0x98>
6ac: 81 ff 00 10 00 00 cmp $0x1000,%edi
6b2: bb 00 10 00 00 mov $0x1000,%ebx
6b7: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
6ba: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6c1: eb 0e jmp 6d1 <malloc+0x51>
6c3: 90 nop
6c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6c8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6ca: 8b 48 04 mov 0x4(%eax),%ecx
6cd: 39 f9 cmp %edi,%ecx
6cf: 73 47 jae 718 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6d1: 39 05 64 0a 00 00 cmp %eax,0xa64
6d7: 89 c2 mov %eax,%edx
6d9: 75 ed jne 6c8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6db: 83 ec 0c sub $0xc,%esp
6de: 56 push %esi
6df: e8 76 fc ff ff call 35a <sbrk>
if(p == (char*)-1)
6e4: 83 c4 10 add $0x10,%esp
6e7: 83 f8 ff cmp $0xffffffff,%eax
6ea: 74 1c je 708 <malloc+0x88>
hp->s.size = nu;
6ec: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6ef: 83 ec 0c sub $0xc,%esp
6f2: 83 c0 08 add $0x8,%eax
6f5: 50 push %eax
6f6: e8 f5 fe ff ff call 5f0 <free>
return freep;
6fb: 8b 15 64 0a 00 00 mov 0xa64,%edx
if((p = morecore(nunits)) == 0)
701: 83 c4 10 add $0x10,%esp
704: 85 d2 test %edx,%edx
706: 75 c0 jne 6c8 <malloc+0x48>
return 0;
}
}
708: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
70b: 31 c0 xor %eax,%eax
}
70d: 5b pop %ebx
70e: 5e pop %esi
70f: 5f pop %edi
710: 5d pop %ebp
711: c3 ret
712: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
718: 39 cf cmp %ecx,%edi
71a: 74 54 je 770 <malloc+0xf0>
p->s.size -= nunits;
71c: 29 f9 sub %edi,%ecx
71e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
721: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
724: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
727: 89 15 64 0a 00 00 mov %edx,0xa64
}
72d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
730: 83 c0 08 add $0x8,%eax
}
733: 5b pop %ebx
734: 5e pop %esi
735: 5f pop %edi
736: 5d pop %ebp
737: c3 ret
738: 90 nop
739: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
740: c7 05 64 0a 00 00 68 movl $0xa68,0xa64
747: 0a 00 00
74a: c7 05 68 0a 00 00 68 movl $0xa68,0xa68
751: 0a 00 00
base.s.size = 0;
754: b8 68 0a 00 00 mov $0xa68,%eax
759: c7 05 6c 0a 00 00 00 movl $0x0,0xa6c
760: 00 00 00
763: e9 44 ff ff ff jmp 6ac <malloc+0x2c>
768: 90 nop
769: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
770: 8b 08 mov (%eax),%ecx
772: 89 0a mov %ecx,(%edx)
774: eb b1 jmp 727 <malloc+0xa7>
|
/*##############################################################################
HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
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.
############################################################################## */
#include "jio.hpp"
#include "jtime.hpp"
#include "jfile.ipp"
#include "jsort.hpp"
#include "thexception.hpp"
#include "thbufdef.hpp"
#include "thmfilemanager.hpp"
#include "slave.ipp"
#include "thactivityutil.ipp"
IRowStream *createFirstNReadSeqVar(IRowStream *input, unsigned limit)
{
class CFirstNReadSeqVar : implements IRowStream, public CSimpleInterface
{
IRowStream *input;
unsigned limit, c;
bool stopped;
public:
IMPLEMENT_IINTERFACE_USING(CSimpleInterface);
CFirstNReadSeqVar(IRowStream *_input, unsigned _limit) : input(_input), limit(_limit), c(0), stopped(false) { }
~CFirstNReadSeqVar() { ::Release(input); }
// IRowStream
const void *nextRow()
{
if (c<limit)
{
OwnedConstThorRow row = input->nextRow();
if (row)
{
c++;
return row.getClear();
}
}
stop();
return NULL;
}
virtual void stop()
{
if (!stopped)
{
stopped = true;
input->stop();
}
}
};
return new CFirstNReadSeqVar(input, limit);
}
class TopNSlaveActivity : public CSlaveActivity
{
typedef CSlaveActivity PARENT;
bool eos, eog, global, grouped;
ICompare *compare;
CThorExpandingRowArray sortedRows;
Owned<IRowStream> out;
IHThorTopNArg *helper;
rowidx_t topNLimit;
Owned<IRowServer> rowServer;
MemoryBuffer topology;
public:
TopNSlaveActivity(CGraphElementBase *_container, bool _global, bool _grouped)
: CSlaveActivity(_container), global(_global), grouped(_grouped), sortedRows(*this, this)
{
assertex(!(global && grouped));
helper = (IHThorTopNArg *) queryHelper();
eog = eos = false;
if (container.queryLocalOrGrouped())
setRequireInitData(false);
appendOutputLinked(this);
}
~TopNSlaveActivity()
{
out.clear();
sortedRows.kill();
}
virtual void init(MemoryBuffer &data, MemoryBuffer &slaveData)
{
topNLimit = RIUNSET;
compare = helper->queryCompare();
if (!container.queryLocalOrGrouped())
{
mpTag = container.queryJobChannel().deserializeMPTag(data);
unsigned tSz;
data.read(tSz);
topology.append(tSz, data.readDirect(tSz));
}
}
IRowStream *getNextSortGroup(IRowStream *input)
{
if (inputStopped) return NULL; // JCSMORE - should not be possible. getNextSortGroup() is called from nextRow() and should never be called after stop()
sortedRows.clearRows(); // NB: In a child query, this will mean the rows ptr will remain at high-water mark
for (;;)
{
OwnedConstThorRow row = input->nextRow();
if (!row)
{
if (grouped)
break;
row.setown(input->nextRow());
if (!row)
break;
}
if (sortedRows.ordinality() < topNLimit)
sortedRows.binaryInsert(row.getClear(), *compare);
else
{
const void *lastRow = sortedRows.query(topNLimit-1);
if (compare->docompare(lastRow, row) > 0)
sortedRows.binaryInsert(row.getClear(), *compare, true);
else // had enough and out of range
;
}
}
rowidx_t sortedCount = sortedRows.ordinality();
Owned<IRowStream> retStream;
if (global || sortedCount)
{
retStream.setown(sortedRows.createRowStream());
if (global)
{
unsigned indent = 0;
for (;;)
{
if (topology.getPos()>=topology.length())
break;
IArrayOf<IRowStream> streams;
streams.append(*retStream.getClear());
for (;;)
{
unsigned node;
topology.read(node);
if (!node)
break; // never reading from node 0 (0 == terminator)
StringBuffer s;
s.appendN(indent, ' ').append("Merging from node: ").append(node);
ActPrintLog("%s", s.str());
streams.append(*createRowStreamFromNode(*this, node+1, queryJobChannel().queryJobComm(), mpTag, abortSoon));
}
Owned<IRowLinkCounter> linkcounter = new CThorRowLinkCounter;
retStream.setown(createRowStreamMerger(streams.ordinality(), streams.getArray(), compare, false, linkcounter));
retStream.setown(createFirstNReadSeqVar(retStream.getClear(), topNLimit));
indent += 2;
}
if (!firstNode())
{
rowServer.setown(createRowServer(this, retStream, queryJobChannel().queryJobComm(), mpTag));
eos = true;
retStream.clear();
}
}
}
if (global || 0 == topNLimit || 0 == sortedCount)
{
PARENT::stopInput(0);
if (!global || 0 == topNLimit)
eos = true;
}
return retStream.getClear();
}
// IThorDataLink
virtual void start() override
{
ActivityTimer s(totalCycles, timeActivities);
PARENT::start();
// NB: topNLimit shouldn't be stupid size, resourcing will guarantee this
__int64 _topNLimit = helper->getLimit();
assertex(_topNLimit < RCIDXMAX); // hopefully never this big, but if were must be max-1 for binary insert
topNLimit = (rowidx_t)_topNLimit;
if (0 == topNLimit)
{
eos = true;
PARENT::stopInput(0);
}
else
{
out.setown(getNextSortGroup(inputStream));
eos = false;
}
eog = false;
}
virtual bool isGrouped() const override { return grouped; }
virtual void stop() override
{
if (out)
out->stop();
PARENT::stop();
}
CATCH_NEXTROW()
{
ActivityTimer t(totalCycles, timeActivities);
if (abortSoon || eos)
return NULL;
if (NULL == out)
{
out.setown(getNextSortGroup(inputStream));
if (NULL == out)
{
eos = true;
return NULL;
}
}
if (grouped)
{
OwnedConstThorRow row = out->nextRow();
if (row)
{
eog = false;
dataLinkIncrement();
return row.getClear();
}
else
{
if (eog)
{
out.setown(getNextSortGroup(inputStream));
if (NULL == out)
eos = true;
else
{
OwnedConstThorRow row = out->nextRow();
verifyex(row);
eog = false;
dataLinkIncrement();
return row.getClear();
}
}
else
{
eog = true;
out.setown(getNextSortGroup(inputStream));
if (NULL == out)
eos = true;
}
}
}
else
{
if (!global || firstNode())
{
OwnedConstThorRow row = out->nextRow();
if (row)
{
dataLinkIncrement();
return row.getClear();
}
}
}
return NULL;
}
virtual void getMetaInfo(ThorDataLinkMetaInfo &info) const override
{
initMetaInfo(info);
info.canStall = true;
info.totalRowsMin=0;
info.totalRowsMax = (RIUNSET==topNLimit) ? -1 : topNLimit; // but should always be set before getMetaInfo called
}
};
activityslaves_decl CActivityBase *createGlobalTopNSlave(CGraphElementBase *container)
{
return new TopNSlaveActivity(container, true, false);
}
activityslaves_decl CActivityBase *createLocalTopNSlave(CGraphElementBase *container)
{
return new TopNSlaveActivity(container, false, false);
}
activityslaves_decl CActivityBase *createGroupedTopNSlave(CGraphElementBase *container)
{
return new TopNSlaveActivity(container, false, true);
}
|
/* -*- Mode: C++; c-basic-offset:4 ; -*- */
/*
*
* (C) 2003 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include "mpitestconf.h"
#ifdef HAVE_IOSTREAM
// Not all C++ compilers have iostream instead of iostream.h
#include <iostream>
#ifdef HAVE_NAMESPACE_STD
// Those that do need the std namespace; otherwise, a bare "cout"
// is likely to fail to compile
using namespace std;
#endif
#else
#include <iostream.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "mpitestcxx.h"
int main( int argc, char **argv )
{
MPI::Intracomm comm;
MPI::File fh;
int r, s, i;
int fileintsize;
int errs = 0;
char filename[1024];
MPI::Offset offset;
MTest_Init();
strcpy( filename,"iotest.txt");
comm = MPI::COMM_WORLD;
s = comm.Get_size();
r = comm.Get_rank();
// Try writing the file, then check it
fh = MPI::File::Open( comm, filename, MPI::MODE_RDWR | MPI::MODE_CREATE,
MPI::INFO_NULL );
// Get the size of an INT in the file
fileintsize = fh.Get_type_extent( MPI::INT );
// We let each process write in turn, getting the position after each
// write
for (i=0; i<s; i++) {
if (i == r) {
fh.Write_shared( &i, 1, MPI::INT );
}
comm.Barrier();
offset = fh.Get_position_shared();
if (offset != fileintsize * (i+1)) {
errs++;
cout << r << " Shared position is " << offset <<
" should be " << fileintsize * (i+1) << "\n";
}
comm.Barrier();
}
fh.Close();
comm.Barrier();
if (r == 0) {
MPI::File::Delete( filename, MPI::INFO_NULL );
}
MTest_Finalize( errs );
MPI::Finalize();
}
|
;;#############################################################################
;;! \file source/iir5biq32.asm
;;!
;;! \brief 32-bit IIR filter
;;!
;;! \date Jan 11, 2011
;;!
;;
;; Group: C2000
;; Target Family: C28x
;;
;;#############################################################################
;;$TI Release: C28x Fixed Point DSP Library v1.20.00.00 $
;;$Release Date: Thu Oct 18 15:57:22 CDT 2018 $
;;$Copyright: Copyright (C) 2014-2018 Texas Instruments Incorporated -
;; http://www.ti.com/ ALL RIGHTS RESERVED $
;;#############################################################################
;;
;;*****************************************************************************
;; includes
;;*****************************************************************************
;;
;;*****************************************************************************
;; globals
;;*****************************************************************************
; Module definition for external reference
.def _IIR5BIQ32_init
.def _IIR5BIQ32_calc
;;=============================================================================
;; Routine Type : C Callable
;; Description :
;; void IIR5BIQ32_calc(IIR5BIQ32_handle)
;;
;; This routine implements the IIR filter using cascade biquad structure
;;=============================================================================
;;typedef struct {<------------ XAR4
;; void (*init)(void *); /* + 0 Ptr to Init funtion */
;; void (*calc)(void *); /* + 2 Ptr to calc fn */
;; int32_t *coeff_ptr; /* + 4 Pointer to Filter coefficient */
;; int32_t *dbuffer_ptr; /* + 6 Delay buffer ptr */
;; uint16_t nbiq; /* + 8 No of biquad */
;; int32_t input; /* + 9 Latest Input sample */
;; int32_t isf; /* +10 Input Scale Factor */
;; int32_t output32; /* +12 Filter Output */
;; int16_t output16 /* +13 Filter Output */
;; uint16_t qfmat; /* +14 Coefficients Q Format */
;; }IIR5BIQ32;
;;=============================================================================
_IIR5BIQ32_init:
ADDB XAR4,#6 ; XAR4->dbuffer_ptr
MOVL XAR6,*+XAR4[0] ; XAR6=dbuffer_ptr
MOV ACC,*+XAR4[2]<<2 ; ACC=4*nbiq
SUB ACC,#1 ; ACC=(4*nbiq)-1
MOVZ AR0,AL ; AR0=(4*nbiq)-1
ADDL ACC,*XAR4 ; ACC=dbuffer_ptr + (4*nbiq) - 1
MOVL *XAR4++,ACC ; XAR4->nbiq,
; dbuffer_ptr=dbuffer_ptr + (4*nbiq) - 1
ADDB XAR4,#2
MOV *+XAR4[1],#0 ; input=0
MOVB ACC,#32
SUB ACC,*+XAR4[7]
MOV *+XAR4[7],AL ; qfmat=32-qfmat
MOV *+XAR4[6],#0 ; output16=0
MOV *+XAR4[5],#0 ; output32=0
MOV *+XAR4[4],#0 ; output32=0
RPT AR0
|| MOV *XAR6++,#0
LRETR
_IIR5BIQ32_calc:
SETC SXM,OVM
ZAPA ; Zero the ACC, P registers and OVC counter
ADDB XAR4,#4 ; AR4->coeff_ptr
MOVL XAR7,*XAR4++ ; XAR4->dbuffer_ptr, XAR7=coeff_ptr->a21
MOVL XAR6,*XAR4++ ; XAR4->order, XAR6=dbuffer_ptr->d1(n-2)
MOVZ AR0,*XAR4++ ; XAR4->input, AR0=nbiq
;MOVX TL,*XAR4++ ; XAR4->isf, T=input
ADDB XAR4,#1
MOVL XT,*XAR4++ ; XAR4->isf, T=input
QMPYL ACC,XT,*XAR4++ ; XAR4->output32, ACC=input*isf
ADDB XAR6,#2
SUBB XAR0,#1 ; AR0=nbiq-1
; kth Biquad Computation where k=1:nbiq
biqd:
MOVL XT,*--XAR6 ; T=dk(n-2)
QMPYL P,XT,*XAR7++ ; P= dk(n-2)*a2k
MOVL XT,*--XAR6 ; T=dk(n-1)
QMPYAL P,XT,*XAR7++ ; ACC=input*isf + dk(n-2)*a2k, P=dk(n-1)*a1k
MOVL XT,*+XAR6[2] ; T=dk(n-2)
QMPYAL P,XT,*XAR7++ ; ACC=input*isf + dk(n-2)*a2k + dk(n-1)*a1k
; P=dk(n-2)*b2k
MOV T,*+XAR4[3] ; T=qfmat
LSLL ACC,T ; ACC=input*isf + dk(n-2)*a2k + dk(n-1)*a1k (Q31)
MOVDL XT,*XAR6 ; XT=dk(n-1), dk(n-2)=dk(n-1)
MOVL *XAR6,ACC ; dk(n-1)=dk(n)
QMPYL ACC,XT,*XAR7++ ; ACC=dk(n-1)*b1k
MOVL XT,*XAR6 ; XT=dk(n)
QMPYAL P,XT,*XAR7++ ; ACC=dk(n-1)*b1k + dk(n-2)*b2k, P=dk(n)*b0k
ADDL ACC,P
BANZ biqd,AR0--
MOV T,*+XAR4[3] ; T=qfmat, XAR4->output32
LSLL ACC,T
ROR ACC
MOVL *XAR4++,ACC ; output32=Filtered Output in Q30 format
MOV *XAR4,AH ; output16=Filtered Output in Q14 format
CLRC OVM
LRETR
;;#############################################################################
;; End of File
;;#############################################################################
|
; A111607: Fourth column of A109626.
; 1,2,3,3,5,3,7,2,9,10,11,9,13,7,15,4,17,18,19,15,21,11,23,6,25,26,27,21,29,15,31,8,33,34,35,27,37,19,39,10,41,42,43,33,45,23,47,12,49,50,51,39,53,27,55,14,57,58,59,45,61,31,63,16,65,66,67,51,69,35,71,18,73,74,75
mov $4,$0
add $4,1
mov $6,$4
bin $4,4
mod $4,$6
sub $4,$6
mov $2,$4
div $2,$4
mod $0,$2
add $4,1
mov $5,2
sub $5,$4
add $5,5
add $0,$5
add $2,$5
mov $3,4
lpb $0
mul $0,$3
div $0,$2
mul $0,2
mov $1,$3
mov $2,3
lpe
add $5,$1
add $0,$5
mov $1,$0
sub $1,16
|
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2012, 2013 Ripple Labs Inc.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <BeastConfig.h>
#include <ripple/json/json_value.h>
#include <ripple/json/json_reader.h>
#include <ripple/beast/unit_test.h>
#include <ripple/beast/type_name.h>
namespace ripple {
struct json_value_test : beast::unit_test::suite
{
void test_bool()
{
BEAST_EXPECT(! Json::Value());
BEAST_EXPECT(! Json::Value(""));
BEAST_EXPECT(bool (Json::Value("empty")));
BEAST_EXPECT(bool (Json::Value(false)));
BEAST_EXPECT(bool (Json::Value(true)));
BEAST_EXPECT(bool (Json::Value(0)));
BEAST_EXPECT(bool (Json::Value(1)));
Json::Value array (Json::arrayValue);
BEAST_EXPECT(! array);
array.append(0);
BEAST_EXPECT(bool (array));
Json::Value object (Json::objectValue);
BEAST_EXPECT(! object);
object[""] = false;
BEAST_EXPECT(bool (object));
}
void test_bad_json ()
{
char const* s (
"{\"method\":\"ledger\",\"params\":[{\"ledger_index\":1e300}]}"
);
Json::Value j;
Json::Reader r;
r.parse (s, j);
pass ();
}
void test_edge_cases ()
{
std::string json;
std::uint32_t max_uint = std::numeric_limits<std::uint32_t>::max ();
std::int32_t max_int = std::numeric_limits<std::int32_t>::max ();
std::int32_t min_int = std::numeric_limits<std::int32_t>::min ();
std::uint32_t a_uint = max_uint - 1978;
std::int32_t a_large_int = max_int - 1978;
std::int32_t a_small_int = min_int + 1978;
json = "{\"max_uint\":" + std::to_string (max_uint);
json += ",\"max_int\":" + std::to_string (max_int);
json += ",\"min_int\":" + std::to_string (min_int);
json += ",\"a_uint\":" + std::to_string (a_uint);
json += ",\"a_large_int\":" + std::to_string (a_large_int);
json += ",\"a_small_int\":" + std::to_string (a_small_int);
json += "}";
Json::Value j1;
Json::Reader r1;
BEAST_EXPECT(r1.parse (json, j1));
BEAST_EXPECT(j1["max_uint"].asUInt() == max_uint);
BEAST_EXPECT(j1["max_int"].asInt() == max_int);
BEAST_EXPECT(j1["min_int"].asInt() == min_int);
BEAST_EXPECT(j1["a_uint"].asUInt() == a_uint);
BEAST_EXPECT(j1["a_uint"] > a_large_int);
BEAST_EXPECT(j1["a_uint"] > a_small_int);
BEAST_EXPECT(j1["a_large_int"].asInt() == a_large_int);
BEAST_EXPECT(j1["a_large_int"].asUInt() == a_large_int);
BEAST_EXPECT(j1["a_large_int"] < a_uint);
BEAST_EXPECT(j1["a_small_int"].asInt() == a_small_int);
BEAST_EXPECT(j1["a_small_int"] < a_uint);
json = "{\"overflow\":";
json += std::to_string(std::uint64_t(max_uint) + 1);
json += "}";
Json::Value j2;
Json::Reader r2;
BEAST_EXPECT(!r2.parse (json, j2));
json = "{\"underflow\":";
json += std::to_string(std::int64_t(min_int) - 1);
json += "}";
Json::Value j3;
Json::Reader r3;
BEAST_EXPECT(!r3.parse (json, j3));
pass ();
}
void
test_copy ()
{
Json::Value v1{2.5};
BEAST_EXPECT(v1.isDouble ());
BEAST_EXPECT(v1.asDouble () == 2.5);
Json::Value v2 = v1;
BEAST_EXPECT(v1.isDouble ());
BEAST_EXPECT(v1.asDouble () == 2.5);
BEAST_EXPECT(v2.isDouble ());
BEAST_EXPECT(v2.asDouble () == 2.5);
BEAST_EXPECT(v1 == v2);
v1 = v2;
BEAST_EXPECT(v1.isDouble ());
BEAST_EXPECT(v1.asDouble () == 2.5);
BEAST_EXPECT(v2.isDouble ());
BEAST_EXPECT(v2.asDouble () == 2.5);
BEAST_EXPECT(v1 == v2);
pass ();
}
void
test_move ()
{
Json::Value v1{2.5};
BEAST_EXPECT(v1.isDouble ());
BEAST_EXPECT(v1.asDouble () == 2.5);
Json::Value v2 = std::move(v1);
BEAST_EXPECT(!v1);
BEAST_EXPECT(v2.isDouble ());
BEAST_EXPECT(v2.asDouble () == 2.5);
BEAST_EXPECT(v1 != v2);
v1 = std::move(v2);
BEAST_EXPECT(v1.isDouble ());
BEAST_EXPECT(v1.asDouble () == 2.5);
BEAST_EXPECT(! v2);
BEAST_EXPECT(v1 != v2);
pass ();
}
void
test_comparisons()
{
Json::Value a, b;
auto testEquals = [&] (std::string const& name) {
BEAST_EXPECT(a == b);
BEAST_EXPECT(a <= b);
BEAST_EXPECT(a >= b);
BEAST_EXPECT(! (a != b));
BEAST_EXPECT(! (a < b));
BEAST_EXPECT(! (a > b));
BEAST_EXPECT(b == a);
BEAST_EXPECT(b <= a);
BEAST_EXPECT(b >= a);
BEAST_EXPECT(! (b != a));
BEAST_EXPECT(! (b < a));
BEAST_EXPECT(! (b > a));
};
auto testGreaterThan = [&] (std::string const& name) {
BEAST_EXPECT(! (a == b));
BEAST_EXPECT(! (a <= b));
BEAST_EXPECT(a >= b);
BEAST_EXPECT(a != b);
BEAST_EXPECT(! (a < b));
BEAST_EXPECT(a > b);
BEAST_EXPECT(! (b == a));
BEAST_EXPECT(b <= a);
BEAST_EXPECT(! (b >= a));
BEAST_EXPECT(b != a);
BEAST_EXPECT(b < a);
BEAST_EXPECT(! (b > a));
};
a["a"] = Json::UInt (0);
b["a"] = Json::Int (0);
testEquals ("zero");
b["a"] = Json::Int (-1);
testGreaterThan ("negative");
Json::Int big = std::numeric_limits<int>::max();
Json::UInt bigger = big;
bigger++;
a["a"] = bigger;
b["a"] = big;
testGreaterThan ("big");
}
void run ()
{
test_bool ();
test_bad_json ();
test_edge_cases ();
test_copy ();
test_move ();
test_comparisons ();
}
};
BEAST_DEFINE_TESTSUITE(json_value, json, ripple);
} // ripple
|
/* Copyright 2021
** Justin Baum
** MIT License
** AlgoExpert Solutions
*/
#include <vector>
using namespace std;
typedef unsigned int uint;
int minNumberOfCoinsForChange(int n, vector<int> denoms) {
vector<int> minways = vector(n + 1, INT_MAX - 2);
minways[0] = 0;
for (int denom : denoms) {
for (int i = denom; i <= n; ++i) {
if (i - denom >= 0)
minways[i] = min(minways[i-denom] + 1, minways[i]);
}
}
return minways[n] == INT_MAX - 2 ? -1 : minways[n];
}
|
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1991-1995 -- All rights reserved.
GEOWORKS CONFIDENTIAL
PROJECT: GEOS
MODULE: Kernel/Boot
FILE: bootStrings.asm
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 1/91 Initial version
DESCRIPTION:
This file contains strings for the kernel
$Id: bootStrings.asm,v 1.2 98/04/25 11:14:59 gene Exp $
------------------------------------------------------------------------------@
.warn -unref ; most of these things are referenced as a constant plus
; a base chunk handle, so don't bitch about them being
; unreferenced.
InitStringBlock macro start
_curChunk = start
endm
DefString macro const, data, name
.assert _curChunk eq (const)
_curChunk = _curChunk + 1
ifb <name>
.warn -unref
if DBCS_PCGEOS
const&Str chunk.wchar data
else
const&Str chunk.char data
endif
.warn @unref
else
if DBCS_PCGEOS
name chunk.wchar data
else
name chunk.char data
endif
endif
endm
FixedStrings segment lmem LMEM_TYPE_GENERAL
InitStringBlock FIRST_STRING_IN_FIXED_STRINGS
DefString KS_TE_DIVIDE_BY_ZERO, <"KR-01", 0>
localize not
DefString KS_TE_OVERFLOW, <"KR-02", 0>
localize not
DefString KS_TE_BOUND, <"KR-03", 0>
localize not
DefString KS_TE_FPU_EXCEPTION, <"KR-04", 0>
localize not
DefString KS_TE_SINGLE_STEP, <"KR-05", 0>
localize not
DefString KS_TE_BREAKPOINT, <"KR-06", 0>
localize not
DefString KS_TIE_ILLEGAL_INST, <"KR-07", 0>
localize not
ifdef CATCH_PROTECTION_FAULT
DefString KS_TIE_PROTECTION_FAULT, <"KR-11", 0>
localize not
endif ; CATCH_PROTECTION_FAULT
ifdef CATCH_STACK_EXCEPTION
DefString KS_TIE_STACK_EXCEPTION, <"KR-19", 0>
localize not
endif ; CATCH_STACK_EXCEPTION
DefString KS_SYS_EMPTY_CALLED, <"KR-08", 0>
localize not
DefString KS_ILLEGAL_HANDLE, <"KR-09", 0>
localize not
DefString KS_BAD_MOVE_BLOCK, <"KR-10", 0>
localize not
DefString KS_HANDLE_TABLE_FULL, <"Out of system resource handles. (KR-12)", 0>
localize "This text is printed to the DOS text screen after the system shuts down abnormally due to running out of handles."
ifdef GPC
DefString KS_CANNOT_ALLOC_LOCAL_MEM, <"KR-13", 0>
else
DefString KS_CANNOT_ALLOC_LOCAL_MEM, <"Cannot allocate local memory (KR-13)", 0>
endif ; GPC
localize "Appears in a SysNotify box preceded by \"Undefined error in geos: \""
DefString KS_TE_SYSTEM_ERROR, <"System Error Code: ", 0>
localize "This is the initial part of the error string displayed for the \"anonymous\" errors (those that are just KR-xx, with no other explanation)",
SYS_NOTIFY_MAX_STRING-5
DefString KS_FATAL_ERROR_IN, <"Undefined error in ", 0>
ifdef GPC
DefString KS_CODE_EQUALS, <": KRX-", 0>
else
DefString KS_CODE_EQUALS, <". Error Code: KRX-", 0>
endif
DefString KS_KERNEL, <"kernel", 0>
ifdef GPC
DefString KS_FILE_ERROR, <"KR-14", 0>
else
DefString KS_UNRECOVERABLE_ERROR_IN, <"Error in ", 0>
DefString KS_UNRECOVERABLE_ERROR_PART_TWO, <"Operation cannot be completed. (KR-14)", 0>
endif ; GPC
ifdef GPC
DefString KS_FILE_READ, <"-R", 0>
DefString KS_FILE_WRITE, <"-W", 0>
DefString KS_FILE_CLOSE, <"-C", 0>
DefString KS_FILE_COMMIT, <"-M", 0>
DefString KS_FILE_TRUNCATE, <"-T", 0>
else
DefString KS_FILE_READ, <"FileRead", 0>
DefString KS_FILE_WRITE, <"FileWrite", 0>
DefString KS_FILE_CLOSE, <"FileClose", 0>
DefString KS_FILE_COMMIT, <"FileCommit", 0>
DefString KS_FILE_TRUNCATE, <"FileTruncate", 0>
endif ; GPC
ifdef GPC
if _NDO2000
DefString KS_TOO_MUCH_AT_ONCE, <"Your software is doing too much at once.", 0>, tooMuchAtOnce
else
DefString KS_TOO_MUCH_AT_ONCE, <"Your GlobalPC is doing too much at once.", 0>, tooMuchAtOnce
endif
DefString KS_TOO_MUCH_AT_ONCE_PART_TWO, <"Please exit a program or close a document.", 0>, tooMuchAtOncePartTwo
DefString KS_MEMORY_FULL, <"KR-16", 0> ; paired with KS_TE_SYSTEM_ERROR
else
DefString KS_LOW_ON_HANDLES_1, <"Low on system resource handles.", 0>
DefString KS_LOW_ON_HANDLES_2, <"Please exit an application. (KR-15)", 0>
DefString KS_MEMORY_FULL, <"Conventional memory (below 640K)", 0>, memFull1
DefString KS_MEMORY_FULL2, <"is full (KR-16)", 0>, memFull2
DefString KS_SWAP_DEVICES_FULL, <"WARNING: swap space is full.", 0>, swapDevFull
DefString KS_SWAP_DEVICES_FULL_PART_TWO, <"You may be low on disk space. (KR-17)", 0>, swapDevFull2
endif
DefString KS_SWAP_IN_ERROR, <"KR-18", 0> ; paired with KS_TE_SYSTEM_ERROR
DefString KS_THE_DISK_IN_DRIVE, <"The disk in drive ", 0>
DefString KS_HAS_NO_NAME_AND, <" has no name and", 0>
DefString KS_WILL_BE_REFERRED_TO_AS, <"will be referred to as ", 0>
DefString KS_PLEASE_INSERT_DISK, <"Please insert disk ", 0>
DefString KS_INTO_DRIVE, <"into drive ", 0>
DefString KS_UNNAMED, <"Unnamed", 0>
if CHECKSUM_DOS_BLOCKS
DefString KS_DOS_BLOCK_CHECKSUM_BAD, <"DOS Block Checksum Failure", 0>
endif
; For LibSysError handling
;
; Older products use "HARDWARE_TYPE". Historical reasons
;
ifidn HARDWARE_TYPE, <GULLIVER>
; Gulliver-specific system error strings -------------------------------------
LocalDefString errorStringC <'Tap the top hard icon to continue',0>
LocalDefString confusion <'I''m so confused',0>
LocalDefString errorStringRA <'Top hard icon to retry, bottom to abort', 0>
LocalDefString errorStringA <'Tap the bottom hard icon to abort',0>
LocalDefString errorStringBE1 <'Tap the bottom hard icon to restart',0>
LocalDefString errorStringBE2 <0>
LocalDefString errorStringE <'Tap the bottom hard icon to restart',0>
LocalDefString errorStringR <'Tap the top hard icon to retry',0>
LocalDefString errorStringRB <'Top hard icon to retry, bottom to restart',0>
LocalDefString errorStringB <'Tap the bottom hard icon to restart', 0>
LocalDefString errorStringBiz <'Please see Troubleshooting Guide', 0>
LocalDefString unableToExit <"The system is unable to exit.\\r\\nPlease restart your computer. (KR-35)", 0>
else
; General machine system error strings -------------------------------------
LocalDefString errorStringC <'Press Enter to continue', 0>
LocalDefString confusion <'I''m so confused', 0>
LocalDefString errorStringRA <'"R" to retry, "A" to abort', 0>
LocalDefString errorStringA <'"A" to abort',0>
ifndef GPC
LocalDefString errorStringBE1 <'Press "E" to exit. If this fails, try', 0>
LocalDefString errorStringBE2 <'restarting your computer.', 0>
LocalDefString errorStringE <'"E" to exit cleanly',0>
LocalDefString errorStringRB <'"R" to retry, "B" to reboot Ensemble', 0>
LocalDefString errorStringB <'"B" to reboot Ensemble', 0>
LocalDefString errorKeys <"BARE", 0>
else
LocalDefString errorKeys <"AR", 0>
endif ; GPC
LocalDefString errorStringR <'"R" to retry',0>
LocalDefString errorStringBiz <'Please see Troubleshooting Guide', 0>
LocalDefString unableToExit <"The system is unable to exit.\\r\\nPlease restart your computer. (KR-35)", 0 >
.warn -unref
LocalDefString vmHeaderOverflow1, <'Document too big.', 0>
LocalDefString vmHeaderOverflow2, <'Contact customer service.', 0>
.warn @unref
endif
;
; Some product-only strings.
;
ifdef GPC
; The number of strings here MUST be equal to the value of GPCErrorMsgCount
; defined in sysError.asm.
if _NDO2000
.warn -unref
LocalDefString GPCErrorMsg1 <'The software has experienced an error.', 0>
LocalDefString GPCErrorMsg2 <'Press E to exit. If this fails, press', 0>
LocalDefString GPCErrorMsg3 <'CTRL+ALT+DEL or restart your computer.', 0>
LocalDefString GPCErrorMsg4 <'Then start the software again.', 0>
.warn @unref
else
.warn -unref
LocalDefString GPCErrorMsg1 <'Your GlobalPC has experienced an error.', 0>
LocalDefString GPCErrorMsg2 <'Press the On/Off button on the front', 0>
LocalDefString GPCErrorMsg3 <'panel to restart the GlobalPC. If the', 0>
LocalDefString GPCErrorMsg4 <'problem persists, call customer service.', 0>
.warn @unref
endif
endif
FixedStrings ends
;----------------------------------------------------------------------------
MovableStrings segment lmem LMEM_TYPE_GENERAL
InitStringBlock FIRST_STRING_IN_MOVABLE_STRINGS
DefString KS_CANNOT_PRESERVE_VOLATILE_SWAP_DATA, <"Not enough swap space.", 0>
ife ERROR_CHECK
;---
ifdef GPC
DefString KS_CORRUPTED_INI_BUFFER, <"KR-20", 0>
DefString KS_OBJ_LOAD_ERROR, <"KR-21", 0>
DefString KS_OBJ_VM_LOAD_ERROR, <"KR-22", 0>
else
LocalDefString corruptedIniBufferStringOne <"GEOS.INI file is damaged. Restore it from backup", 0>
LocalDefString corruptedIniBufferStringTwo <"or delete it and reinstall the system software (KR-20)", 0>
LocalDefString objLoadError1 <"Error restoring state. Please exit and", 0>
LocalDefString objLoadError2 <"restart the system. (KR-21)", 0>
LocalDefString objVMLoadError1 <"Error reading VM file. The document or data", 0>
LocalDefString objVMLoadError2 <"file may be damaged. (KR-22)", 0>
endif ; GPC
endif ; !ERROR_CHECK
;---
LocalDefString noSpaceForIniString1 <"No room to write GEOS.INI. Please", 0>
LocalDefString noSpaceForIniString2 <"make room, now. (KR-36)", 0>
; pulled non-localizable string from sysmisc.geo - jfh 12/04/03
LocalDefString PowerOffString <'You may now safely turn off the computer',0>
localize "the power off message (displayed in DOS) after shutting down Geos"
MovableStrings ends
;----------------------------------------------------------------------------
InitStrings segment lmem LMEM_TYPE_GENERAL
InitStringBlock FIRST_STRING_IN_INIT_STRINGS
DefString KS_CANNOT_LOAD_MEMORY_VIDEO_DRIVER, <"Cannot load a required system file (vidmem). You may need to reinstall the system software. (KR-25)", 0>
DefString KS_CANNOT_LOAD_KEYBOARD_DRIVER, <"Cannot load a required system file (keyboard). You may need to reinstall the system software. (KR-26)", 0>
DefString KS_CANNOT_LOAD_UI, <"Cannot load a required system file (ui). You may need to reinstall the system software. (KR-27)", 0
DefString KS_BAD_FONT_PATH, <"Cannot find USERDATA\\\\FONT directory. You may need to reinstall the system software. (KR-28)", 0>
DefString KS_NO_FONT_FILES, <"No valid font files found in USERDATA\\\\FONT directory. (KR-29)", 0>
DefString KS_DEFAULT_FONT_NOT_FOUND, <"Cannot load a required system file (sysfont). You may need to reinstall the system software. (KR-30)", 0>
DefString KS_UNSUPPORTED_DOS_VERSION, <"DOS version too old. You need DOS version 3.0 or higher. (KR-31)", 0>
DefString KS_UNABLE_TO_REGISTER_TOP_LEVEL_DISK, <"Unable to register the disk containing main system directory. (KR-32)", 0>
DefString KS_FILE_SYSTEM_DRIVER_FOR_DRIVE, <"File-system driver for drive ", 0>
DefString KS_NOT_LOADED, <"not loaded. (KR-33)", 0>
DefString KS_PRIMARY_FSD_NOT_LOADED, <"Unable to identify file-system in use. (KR-34)", 0>
DefString KS_ERROR_PREFIX, <"System error: ", 0>
InitStrings ends
.warn @unref
|
; A017366: a(n) = (10*n+8)^2.
; 64,324,784,1444,2304,3364,4624,6084,7744,9604,11664,13924,16384,19044,21904,24964,28224,31684,35344,39204,43264,47524,51984,56644,61504,66564,71824,77284,82944,88804,94864,101124,107584,114244,121104,128164,135424,142884,150544,158404,166464,174724,183184,191844,200704,209764,219024,228484,238144,248004,258064,268324,278784,289444,300304,311364,322624,334084,345744,357604,369664,381924,394384,407044,419904,432964,446224,459684,473344,487204,501264,515524,529984,544644,559504,574564,589824,605284,620944,636804,652864,669124,685584,702244,719104,736164,753424,770884,788544,806404,824464,842724,861184,879844,898704,917764,937024,956484,976144,996004
mul $0,10
add $0,8
pow $0,2
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_fullscreen_video_status.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/layout/intersection_geometry.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
namespace blink {
namespace {
constexpr double kCheckFullscreenIntervalSeconds = 1.0f;
constexpr float kMostlyFillViewportThresholdOfOccupationProportion = 0.85f;
constexpr float kMostlyFillViewportThresholdOfVisibleProportion = 0.75f;
} // anonymous namespace
MediaCustomControlsFullscreenDetector::MediaCustomControlsFullscreenDetector(
HTMLVideoElement& video)
: EventListener(kCPPEventListenerType),
video_element_(video),
check_viewport_intersection_timer_(
video.GetDocument().GetTaskRunner(TaskType::kInternalMedia),
this,
&MediaCustomControlsFullscreenDetector::
OnCheckViewportIntersectionTimerFired) {
if (VideoElement().isConnected())
Attach();
}
bool MediaCustomControlsFullscreenDetector::operator==(
const EventListener& other) const {
return this == &other;
}
void MediaCustomControlsFullscreenDetector::Attach() {
VideoElement().addEventListener(EventTypeNames::loadedmetadata, this, true);
VideoElement().GetDocument().addEventListener(
EventTypeNames::webkitfullscreenchange, this, true);
VideoElement().GetDocument().addEventListener(
EventTypeNames::fullscreenchange, this, true);
}
void MediaCustomControlsFullscreenDetector::Detach() {
VideoElement().removeEventListener(EventTypeNames::loadedmetadata, this,
true);
VideoElement().GetDocument().removeEventListener(
EventTypeNames::webkitfullscreenchange, this, true);
VideoElement().GetDocument().removeEventListener(
EventTypeNames::fullscreenchange, this, true);
check_viewport_intersection_timer_.Stop();
if (VideoElement().GetWebMediaPlayer()) {
VideoElement().GetWebMediaPlayer()->SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus::kNotEffectivelyFullscreen);
}
}
bool MediaCustomControlsFullscreenDetector::ComputeIsDominantVideoForTests(
const IntRect& target_rect,
const IntRect& root_rect,
const IntRect& intersection_rect) {
if (target_rect.IsEmpty() || root_rect.IsEmpty())
return false;
const float x_occupation_proportion =
1.0f * intersection_rect.Width() / root_rect.Width();
const float y_occupation_proportion =
1.0f * intersection_rect.Height() / root_rect.Height();
// If the viewport is mostly occupied by the video, return true.
if (std::min(x_occupation_proportion, y_occupation_proportion) >=
kMostlyFillViewportThresholdOfOccupationProportion) {
return true;
}
// If neither of the dimensions of the viewport is mostly occupied by the
// video, return false.
if (std::max(x_occupation_proportion, y_occupation_proportion) <
kMostlyFillViewportThresholdOfOccupationProportion) {
return false;
}
// If the video is mostly visible in the indominant dimension, return true.
// Otherwise return false.
if (x_occupation_proportion > y_occupation_proportion) {
return target_rect.Height() *
kMostlyFillViewportThresholdOfVisibleProportion <
intersection_rect.Height();
}
return target_rect.Width() * kMostlyFillViewportThresholdOfVisibleProportion <
intersection_rect.Width();
}
void MediaCustomControlsFullscreenDetector::handleEvent(
ExecutionContext* context,
Event* event) {
DCHECK(event->type() == EventTypeNames::loadedmetadata ||
event->type() == EventTypeNames::webkitfullscreenchange ||
event->type() == EventTypeNames::fullscreenchange);
// Video is not loaded yet.
if (VideoElement().getReadyState() < HTMLMediaElement::kHaveMetadata)
return;
if (!VideoElement().isConnected() || !IsVideoOrParentFullscreen()) {
check_viewport_intersection_timer_.Stop();
if (VideoElement().GetWebMediaPlayer()) {
VideoElement().GetWebMediaPlayer()->SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus::kNotEffectivelyFullscreen);
}
return;
}
check_viewport_intersection_timer_.StartOneShot(
kCheckFullscreenIntervalSeconds, FROM_HERE);
}
void MediaCustomControlsFullscreenDetector::ContextDestroyed() {
// This method is called by HTMLVideoElement when it observes context destroy.
// The reason is that when HTMLMediaElement observes context destroy, it will
// destroy webMediaPlayer() thus the final
// setIsEffectivelyFullscreen(kNotEffectivelyFullscreen) is not called.
Detach();
}
void MediaCustomControlsFullscreenDetector::
OnCheckViewportIntersectionTimerFired(TimerBase*) {
DCHECK(IsVideoOrParentFullscreen());
IntersectionGeometry geometry(nullptr, VideoElement(), Vector<Length>(),
true);
geometry.ComputeGeometry();
bool is_dominant = ComputeIsDominantVideoForTests(
geometry.TargetIntRect(), geometry.RootIntRect(),
geometry.IntersectionIntRect());
if (!VideoElement().GetWebMediaPlayer())
return;
if (!is_dominant) {
VideoElement().GetWebMediaPlayer()->SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus::kNotEffectivelyFullscreen);
return;
}
// Picture-in-Picture can be disabled by the website when the API is enabled.
bool picture_in_picture_allowed =
!RuntimeEnabledFeatures::PictureInPictureEnabled() &&
!VideoElement().FastHasAttribute(HTMLNames::disablepictureinpictureAttr);
if (picture_in_picture_allowed) {
VideoElement().GetWebMediaPlayer()->SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus::kFullscreenAndPictureInPictureEnabled);
} else {
VideoElement().GetWebMediaPlayer()->SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus::
kFullscreenAndPictureInPictureDisabled);
}
}
bool MediaCustomControlsFullscreenDetector::IsVideoOrParentFullscreen() {
Element* fullscreen_element =
Fullscreen::FullscreenElementFrom(VideoElement().GetDocument());
if (!fullscreen_element)
return false;
return fullscreen_element->contains(&VideoElement());
}
void MediaCustomControlsFullscreenDetector::Trace(blink::Visitor* visitor) {
EventListener::Trace(visitor);
visitor->Trace(video_element_);
}
} // namespace blink
|
#include <iostream>
#include <vector>
using namespace std;
int binarySearchIterative(vector<int> vctr, int target)
{
int min = 0;
int max = vctr.size() - 1;
while (min < max)
{
int guess = (min + max) / 2;
if (vctr.at(guess) == target)
{
return guess;
}
else if (vctr.at(guess) < target)
{
min = guess + 1;
}
else
{
max = guess - 1;
}
}
return -1;
} |
Worm: DB $00
DW $2649
DW WormEdges
DB WormEdgesSize
DB $00, $12
DB WormVertSize /6
DB WormVertSize
DB WormEdgesCnt
DB $00, $00
DB WormNormalsSize
DB $13, $1E, $17
DW WormNormals
DB $03, $08
DW WormVertices
DB 0,0 ; Type and Tactics
DB ShipCanAnger
WormVertices: DB $0A, $0A, $23, $5F, $02, $77
DB $0A, $0A, $23, $DF, $03, $77
DB $05, $06, $0F, $1F, $01, $24
DB $05, $06, $0F, $9F, $01, $35
DB $0F, $0A, $19, $5F, $24, $77
DB $0F, $0A, $19, $DF, $35, $77
DB $1A, $0A, $19, $7F, $46, $77
DB $1A, $0A, $19, $FF, $56, $77
DB $08, $0E, $19, $3F, $14, $66
DB $08, $0E, $19, $BF, $15, $66
WormVertSize: equ $ - WormVertices
WormEdges: DB $1F, $07, $00, $04
DB $1F, $37, $04, $14
DB $1F, $57, $14, $1C
DB $1F, $67, $1C, $18
DB $1F, $47, $18, $10
DB $1F, $27, $10, $00
DB $1F, $02, $00, $08
DB $1F, $03, $04, $0C
DB $1F, $24, $10, $08
DB $1F, $35, $14, $0C
DB $1F, $14, $08, $20
DB $1F, $46, $20, $18
DB $1F, $15, $0C, $24
DB $1F, $56, $24, $1C
DB $1F, $01, $08, $0C
DB $1F, $16, $20, $24
WormEdgesSize: equ $ - WormEdges
WormEdgesCnt: equ WormEdgesSize/4
WormNormals: DB $1F, $00, $58, $46
DB $1F, $00, $45, $0E
DB $1F, $46, $42, $23
DB $9F, $46, $42, $23
DB $1F, $40, $31, $0E
DB $9F, $40, $31, $0E
DB $3F, $00, $00, $C8
DB $5F, $00, $50, $00
WormNormalsSize: equ $ - WormNormals
WormLen: equ $ - Worm
|
; A178873: Partial sums of round(5^n/7).
; 0,1,5,23,112,558,2790,13951,69755,348773,1743862,8719308,43596540,217982701,1089913505,5449567523,27247837612,136239188058,681195940290,3405979701451,17029898507255,85149492536273,425747462681362,2128737313406808
mov $2,$0
mov $5,$0
lpb $2,1
mov $0,$5
sub $2,1
sub $0,$2
mov $3,5
mov $4,$0
mul $0,6
pow $3,$4
add $3,3
div $3,7
lpb $0,1
mov $0,4
mov $6,$3
lpe
add $1,$6
lpe
|
; A024525: 1^2+prime(1)^2+prime(2)^2+...+prime(n)^2.
; 1,5,14,39,88,209,378,667,1028,1557,2398,3359,4728,6409,8258,10467,13276,16757,20478,24967,30008,35337,41578,48467,56388,65797,75998,86607,98056,109937,122706,138835,155996,174765,194086,216287,239088,263737,290306,318195,348124
lpb $0
sub $0,1
mov $2,$0
max $2,0
seq $2,79704 ; 2p^2 where p runs through the primes.
add $1,$2
lpe
div $1,2
add $1,1
mov $0,$1
|
//===- Pragma.cpp - Pragma registration and handling ----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the PragmaHandler/PragmaTable interfaces and implements
// pragma related methods of the Preprocessor class.
//
//===----------------------------------------------------------------------===//
#include "clang/Lex/Pragma.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/LexDiagnostic.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/MacroInfo.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/PreprocessorLexer.h"
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Lex/Token.h"
#include "clang/Lex/TokenLexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Timer.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <string>
#include <utility>
#include <vector>
using namespace clang;
// Out-of-line destructor to provide a home for the class.
PragmaHandler::~PragmaHandler() = default;
//===----------------------------------------------------------------------===//
// EmptyPragmaHandler Implementation.
//===----------------------------------------------------------------------===//
EmptyPragmaHandler::EmptyPragmaHandler(StringRef Name) : PragmaHandler(Name) {}
void EmptyPragmaHandler::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer,
Token &FirstToken) {}
//===----------------------------------------------------------------------===//
// PragmaNamespace Implementation.
//===----------------------------------------------------------------------===//
/// FindHandler - Check to see if there is already a handler for the
/// specified name. If not, return the handler for the null identifier if it
/// exists, otherwise return null. If IgnoreNull is true (the default) then
/// the null handler isn't returned on failure to match.
PragmaHandler *PragmaNamespace::FindHandler(StringRef Name,
bool IgnoreNull) const {
auto I = Handlers.find(Name);
if (I != Handlers.end())
return I->getValue().get();
if (IgnoreNull)
return nullptr;
I = Handlers.find(StringRef());
if (I != Handlers.end())
return I->getValue().get();
return nullptr;
}
void PragmaNamespace::AddPragma(PragmaHandler *Handler) {
assert(!Handlers.count(Handler->getName()) &&
"A handler with this name is already registered in this namespace");
Handlers[Handler->getName()].reset(Handler);
}
void PragmaNamespace::RemovePragmaHandler(PragmaHandler *Handler) {
auto I = Handlers.find(Handler->getName());
assert(I != Handlers.end() &&
"Handler not registered in this namespace");
// Release ownership back to the caller.
I->getValue().release();
Handlers.erase(I);
}
void PragmaNamespace::HandlePragma(Preprocessor &PP,
PragmaIntroducer Introducer, Token &Tok) {
// Read the 'namespace' that the directive is in, e.g. STDC. Do not macro
// expand it, the user can have a STDC #define, that should not affect this.
PP.LexUnexpandedToken(Tok);
// Get the handler for this token. If there is no handler, ignore the pragma.
PragmaHandler *Handler
= FindHandler(Tok.getIdentifierInfo() ? Tok.getIdentifierInfo()->getName()
: StringRef(),
/*IgnoreNull=*/false);
if (!Handler) {
PP.Diag(Tok, diag::warn_pragma_ignored);
return;
}
// Otherwise, pass it down.
Handler->HandlePragma(PP, Introducer, Tok);
}
//===----------------------------------------------------------------------===//
// Preprocessor Pragma Directive Handling.
//===----------------------------------------------------------------------===//
namespace {
// TokenCollector provides the option to collect tokens that were "read"
// and return them to the stream to be read later.
// Currently used when reading _Pragma/__pragma directives.
struct TokenCollector {
Preprocessor &Self;
bool Collect;
SmallVector<Token, 3> Tokens;
Token &Tok;
void lex() {
if (Collect)
Tokens.push_back(Tok);
Self.Lex(Tok);
}
void revert() {
assert(Collect && "did not collect tokens");
assert(!Tokens.empty() && "collected unexpected number of tokens");
// Push the ( "string" ) tokens into the token stream.
auto Toks = std::make_unique<Token[]>(Tokens.size());
std::copy(Tokens.begin() + 1, Tokens.end(), Toks.get());
Toks[Tokens.size() - 1] = Tok;
Self.EnterTokenStream(std::move(Toks), Tokens.size(),
/*DisableMacroExpansion*/ true,
/*IsReinject*/ true);
// ... and return the pragma token unchanged.
Tok = *Tokens.begin();
}
};
} // namespace
/// HandlePragmaDirective - The "\#pragma" directive has been parsed. Lex the
/// rest of the pragma, passing it to the registered pragma handlers.
void Preprocessor::HandlePragmaDirective(PragmaIntroducer Introducer) {
if (Callbacks)
Callbacks->PragmaDirective(Introducer.Loc, Introducer.Kind);
if (!PragmasEnabled)
return;
++NumPragma;
// Invoke the first level of pragma handlers which reads the namespace id.
Token Tok;
PragmaHandlers->HandlePragma(*this, Introducer, Tok);
// If the pragma handler didn't read the rest of the line, consume it now.
if ((CurTokenLexer && CurTokenLexer->isParsingPreprocessorDirective())
|| (CurPPLexer && CurPPLexer->ParsingPreprocessorDirective))
DiscardUntilEndOfDirective();
}
/// Handle_Pragma - Read a _Pragma directive, slice it up, process it, then
/// return the first token after the directive. The _Pragma token has just
/// been read into 'Tok'.
void Preprocessor::Handle_Pragma(Token &Tok) {
// C11 6.10.3.4/3:
// all pragma unary operator expressions within [a completely
// macro-replaced preprocessing token sequence] are [...] processed [after
// rescanning is complete]
//
// This means that we execute _Pragma operators in two cases:
//
// 1) on token sequences that would otherwise be produced as the output of
// phase 4 of preprocessing, and
// 2) on token sequences formed as the macro-replaced token sequence of a
// macro argument
//
// Case #2 appears to be a wording bug: only _Pragmas that would survive to
// the end of phase 4 should actually be executed. Discussion on the WG14
// mailing list suggests that a _Pragma operator is notionally checked early,
// but only pragmas that survive to the end of phase 4 should be executed.
//
// In Case #2, we check the syntax now, but then put the tokens back into the
// token stream for later consumption.
TokenCollector Toks = {*this, InMacroArgPreExpansion, {}, Tok};
// Remember the pragma token location.
SourceLocation PragmaLoc = Tok.getLocation();
// Read the '('.
Toks.lex();
if (Tok.isNot(tok::l_paren)) {
Diag(PragmaLoc, diag::err__Pragma_malformed);
return;
}
// Read the '"..."'.
Toks.lex();
if (!tok::isStringLiteral(Tok.getKind())) {
Diag(PragmaLoc, diag::err__Pragma_malformed);
// Skip bad tokens, and the ')', if present.
if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::eof))
Lex(Tok);
while (Tok.isNot(tok::r_paren) &&
!Tok.isAtStartOfLine() &&
Tok.isNot(tok::eof))
Lex(Tok);
if (Tok.is(tok::r_paren))
Lex(Tok);
return;
}
if (Tok.hasUDSuffix()) {
Diag(Tok, diag::err_invalid_string_udl);
// Skip this token, and the ')', if present.
Lex(Tok);
if (Tok.is(tok::r_paren))
Lex(Tok);
return;
}
// Remember the string.
Token StrTok = Tok;
// Read the ')'.
Toks.lex();
if (Tok.isNot(tok::r_paren)) {
Diag(PragmaLoc, diag::err__Pragma_malformed);
return;
}
// If we're expanding a macro argument, put the tokens back.
if (InMacroArgPreExpansion) {
Toks.revert();
return;
}
SourceLocation RParenLoc = Tok.getLocation();
std::string StrVal = getSpelling(StrTok);
// The _Pragma is lexically sound. Destringize according to C11 6.10.9.1:
// "The string literal is destringized by deleting any encoding prefix,
// deleting the leading and trailing double-quotes, replacing each escape
// sequence \" by a double-quote, and replacing each escape sequence \\ by a
// single backslash."
if (StrVal[0] == 'L' || StrVal[0] == 'U' ||
(StrVal[0] == 'u' && StrVal[1] != '8'))
StrVal.erase(StrVal.begin());
else if (StrVal[0] == 'u')
StrVal.erase(StrVal.begin(), StrVal.begin() + 2);
if (StrVal[0] == 'R') {
// FIXME: C++11 does not specify how to handle raw-string-literals here.
// We strip off the 'R', the quotes, the d-char-sequences, and the parens.
assert(StrVal[1] == '"' && StrVal[StrVal.size() - 1] == '"' &&
"Invalid raw string token!");
// Measure the length of the d-char-sequence.
unsigned NumDChars = 0;
while (StrVal[2 + NumDChars] != '(') {
assert(NumDChars < (StrVal.size() - 5) / 2 &&
"Invalid raw string token!");
++NumDChars;
}
assert(StrVal[StrVal.size() - 2 - NumDChars] == ')');
// Remove 'R " d-char-sequence' and 'd-char-sequence "'. We'll replace the
// parens below.
StrVal.erase(0, 2 + NumDChars);
StrVal.erase(StrVal.size() - 1 - NumDChars);
} else {
assert(StrVal[0] == '"' && StrVal[StrVal.size()-1] == '"' &&
"Invalid string token!");
// Remove escaped quotes and escapes.
unsigned ResultPos = 1;
for (size_t i = 1, e = StrVal.size() - 1; i != e; ++i) {
// Skip escapes. \\ -> '\' and \" -> '"'.
if (StrVal[i] == '\\' && i + 1 < e &&
(StrVal[i + 1] == '\\' || StrVal[i + 1] == '"'))
++i;
StrVal[ResultPos++] = StrVal[i];
}
StrVal.erase(StrVal.begin() + ResultPos, StrVal.end() - 1);
}
// Remove the front quote, replacing it with a space, so that the pragma
// contents appear to have a space before them.
StrVal[0] = ' ';
// Replace the terminating quote with a \n.
StrVal[StrVal.size()-1] = '\n';
// Plop the string (including the newline and trailing null) into a buffer
// where we can lex it.
Token TmpTok;
TmpTok.startToken();
CreateString(StrVal, TmpTok);
SourceLocation TokLoc = TmpTok.getLocation();
// Make and enter a lexer object so that we lex and expand the tokens just
// like any others.
Lexer *TL = Lexer::Create_PragmaLexer(TokLoc, PragmaLoc, RParenLoc,
StrVal.size(), *this);
EnterSourceFileWithLexer(TL, nullptr);
// With everything set up, lex this as a #pragma directive.
HandlePragmaDirective({PIK__Pragma, PragmaLoc});
// Finally, return whatever came after the pragma directive.
return Lex(Tok);
}
/// HandleMicrosoft__pragma - Like Handle_Pragma except the pragma text
/// is not enclosed within a string literal.
void Preprocessor::HandleMicrosoft__pragma(Token &Tok) {
// During macro pre-expansion, check the syntax now but put the tokens back
// into the token stream for later consumption. Same as Handle_Pragma.
TokenCollector Toks = {*this, InMacroArgPreExpansion, {}, Tok};
// Remember the pragma token location.
SourceLocation PragmaLoc = Tok.getLocation();
// Read the '('.
Toks.lex();
if (Tok.isNot(tok::l_paren)) {
Diag(PragmaLoc, diag::err__Pragma_malformed);
return;
}
// Get the tokens enclosed within the __pragma(), as well as the final ')'.
SmallVector<Token, 32> PragmaToks;
int NumParens = 0;
Toks.lex();
while (Tok.isNot(tok::eof)) {
PragmaToks.push_back(Tok);
if (Tok.is(tok::l_paren))
NumParens++;
else if (Tok.is(tok::r_paren) && NumParens-- == 0)
break;
Toks.lex();
}
if (Tok.is(tok::eof)) {
Diag(PragmaLoc, diag::err_unterminated___pragma);
return;
}
// If we're expanding a macro argument, put the tokens back.
if (InMacroArgPreExpansion) {
Toks.revert();
return;
}
PragmaToks.front().setFlag(Token::LeadingSpace);
// Replace the ')' with an EOD to mark the end of the pragma.
PragmaToks.back().setKind(tok::eod);
Token *TokArray = new Token[PragmaToks.size()];
std::copy(PragmaToks.begin(), PragmaToks.end(), TokArray);
// Push the tokens onto the stack.
EnterTokenStream(TokArray, PragmaToks.size(), true, true,
/*IsReinject*/ false);
// With everything set up, lex this as a #pragma directive.
HandlePragmaDirective({PIK___pragma, PragmaLoc});
// Finally, return whatever came after the pragma directive.
return Lex(Tok);
}
/// HandlePragmaOnce - Handle \#pragma once. OnceTok is the 'once'.
void Preprocessor::HandlePragmaOnce(Token &OnceTok) {
// Don't honor the 'once' when handling the primary source file, unless
// this is a prefix to a TU, which indicates we're generating a PCH file, or
// when the main file is a header (e.g. when -xc-header is provided on the
// commandline).
if (isInPrimaryFile() && TUKind != TU_Prefix && !getLangOpts().IsHeaderFile) {
Diag(OnceTok, diag::pp_pragma_once_in_main_file);
return;
}
// Get the current file lexer we're looking at. Ignore _Pragma 'files' etc.
// Mark the file as a once-only file now.
HeaderInfo.MarkFileIncludeOnce(getCurrentFileLexer()->getFileEntry());
}
void Preprocessor::HandlePragmaMark() {
assert(CurPPLexer && "No current lexer?");
CurLexer->ReadToEndOfLine();
}
/// HandlePragmaPoison - Handle \#pragma GCC poison. PoisonTok is the 'poison'.
void Preprocessor::HandlePragmaPoison() {
Token Tok;
while (true) {
// Read the next token to poison. While doing this, pretend that we are
// skipping while reading the identifier to poison.
// This avoids errors on code like:
// #pragma GCC poison X
// #pragma GCC poison X
if (CurPPLexer) CurPPLexer->LexingRawMode = true;
LexUnexpandedToken(Tok);
if (CurPPLexer) CurPPLexer->LexingRawMode = false;
// If we reached the end of line, we're done.
if (Tok.is(tok::eod)) return;
// Can only poison identifiers.
if (Tok.isNot(tok::raw_identifier)) {
Diag(Tok, diag::err_pp_invalid_poison);
return;
}
// Look up the identifier info for the token. We disabled identifier lookup
// by saying we're skipping contents, so we need to do this manually.
IdentifierInfo *II = LookUpIdentifierInfo(Tok);
// Already poisoned.
if (II->isPoisoned()) continue;
// If this is a macro identifier, emit a warning.
if (isMacroDefined(II))
Diag(Tok, diag::pp_poisoning_existing_macro);
// Finally, poison it!
II->setIsPoisoned();
if (II->isFromAST())
II->setChangedSinceDeserialization();
}
}
/// HandlePragmaSystemHeader - Implement \#pragma GCC system_header. We know
/// that the whole directive has been parsed.
void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) {
if (isInPrimaryFile()) {
Diag(SysHeaderTok, diag::pp_pragma_sysheader_in_main_file);
return;
}
// Get the current file lexer we're looking at. Ignore _Pragma 'files' etc.
PreprocessorLexer *TheLexer = getCurrentFileLexer();
// Mark the file as a system header.
HeaderInfo.MarkFileSystemHeader(TheLexer->getFileEntry());
PresumedLoc PLoc = SourceMgr.getPresumedLoc(SysHeaderTok.getLocation());
if (PLoc.isInvalid())
return;
unsigned FilenameID = SourceMgr.getLineTableFilenameID(PLoc.getFilename());
// Notify the client, if desired, that we are in a new source file.
if (Callbacks)
Callbacks->FileChanged(SysHeaderTok.getLocation(),
PPCallbacks::SystemHeaderPragma, SrcMgr::C_System);
// Emit a line marker. This will change any source locations from this point
// forward to realize they are in a system header.
// Create a line note with this information.
SourceMgr.AddLineNote(SysHeaderTok.getLocation(), PLoc.getLine() + 1,
FilenameID, /*IsEntry=*/false, /*IsExit=*/false,
SrcMgr::C_System);
}
/// HandlePragmaDependency - Handle \#pragma GCC dependency "foo" blah.
void Preprocessor::HandlePragmaDependency(Token &DependencyTok) {
Token FilenameTok;
if (LexHeaderName(FilenameTok, /*AllowConcatenation*/false))
return;
// If the next token wasn't a header-name, diagnose the error.
if (FilenameTok.isNot(tok::header_name)) {
Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
return;
}
// Reserve a buffer to get the spelling.
SmallString<128> FilenameBuffer;
bool Invalid = false;
StringRef Filename = getSpelling(FilenameTok, FilenameBuffer, &Invalid);
if (Invalid)
return;
bool isAngled =
GetIncludeFilenameSpelling(FilenameTok.getLocation(), Filename);
// If GetIncludeFilenameSpelling set the start ptr to null, there was an
// error.
if (Filename.empty())
return;
// Search include directories for this file.
const DirectoryLookup *CurDir;
Optional<FileEntryRef> File =
LookupFile(FilenameTok.getLocation(), Filename, isAngled, nullptr,
nullptr, CurDir, nullptr, nullptr, nullptr, nullptr, nullptr);
if (!File) {
if (!SuppressIncludeNotFoundError)
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
return;
}
const FileEntry *CurFile = getCurrentFileLexer()->getFileEntry();
// If this file is older than the file it depends on, emit a diagnostic.
if (CurFile && CurFile->getModificationTime() < File->getModificationTime()) {
// Lex tokens at the end of the message and include them in the message.
std::string Message;
Lex(DependencyTok);
while (DependencyTok.isNot(tok::eod)) {
Message += getSpelling(DependencyTok) + " ";
Lex(DependencyTok);
}
// Remove the trailing ' ' if present.
if (!Message.empty())
Message.erase(Message.end()-1);
Diag(FilenameTok, diag::pp_out_of_date_dependency) << Message;
}
}
/// ParsePragmaPushOrPopMacro - Handle parsing of pragma push_macro/pop_macro.
/// Return the IdentifierInfo* associated with the macro to push or pop.
IdentifierInfo *Preprocessor::ParsePragmaPushOrPopMacro(Token &Tok) {
// Remember the pragma token location.
Token PragmaTok = Tok;
// Read the '('.
Lex(Tok);
if (Tok.isNot(tok::l_paren)) {
Diag(PragmaTok.getLocation(), diag::err_pragma_push_pop_macro_malformed)
<< getSpelling(PragmaTok);
return nullptr;
}
// Read the macro name string.
Lex(Tok);
if (Tok.isNot(tok::string_literal)) {
Diag(PragmaTok.getLocation(), diag::err_pragma_push_pop_macro_malformed)
<< getSpelling(PragmaTok);
return nullptr;
}
if (Tok.hasUDSuffix()) {
Diag(Tok, diag::err_invalid_string_udl);
return nullptr;
}
// Remember the macro string.
std::string StrVal = getSpelling(Tok);
// Read the ')'.
Lex(Tok);
if (Tok.isNot(tok::r_paren)) {
Diag(PragmaTok.getLocation(), diag::err_pragma_push_pop_macro_malformed)
<< getSpelling(PragmaTok);
return nullptr;
}
assert(StrVal[0] == '"' && StrVal[StrVal.size()-1] == '"' &&
"Invalid string token!");
// Create a Token from the string.
Token MacroTok;
MacroTok.startToken();
MacroTok.setKind(tok::raw_identifier);
CreateString(StringRef(&StrVal[1], StrVal.size() - 2), MacroTok);
// Get the IdentifierInfo of MacroToPushTok.
return LookUpIdentifierInfo(MacroTok);
}
/// Handle \#pragma push_macro.
///
/// The syntax is:
/// \code
/// #pragma push_macro("macro")
/// \endcode
void Preprocessor::HandlePragmaPushMacro(Token &PushMacroTok) {
// Parse the pragma directive and get the macro IdentifierInfo*.
IdentifierInfo *IdentInfo = ParsePragmaPushOrPopMacro(PushMacroTok);
if (!IdentInfo) return;
// Get the MacroInfo associated with IdentInfo.
MacroInfo *MI = getMacroInfo(IdentInfo);
if (MI) {
// Allow the original MacroInfo to be redefined later.
MI->setIsAllowRedefinitionsWithoutWarning(true);
}
// Push the cloned MacroInfo so we can retrieve it later.
PragmaPushMacroInfo[IdentInfo].push_back(MI);
}
/// Handle \#pragma pop_macro.
///
/// The syntax is:
/// \code
/// #pragma pop_macro("macro")
/// \endcode
void Preprocessor::HandlePragmaPopMacro(Token &PopMacroTok) {
SourceLocation MessageLoc = PopMacroTok.getLocation();
// Parse the pragma directive and get the macro IdentifierInfo*.
IdentifierInfo *IdentInfo = ParsePragmaPushOrPopMacro(PopMacroTok);
if (!IdentInfo) return;
// Find the vector<MacroInfo*> associated with the macro.
llvm::DenseMap<IdentifierInfo *, std::vector<MacroInfo *>>::iterator iter =
PragmaPushMacroInfo.find(IdentInfo);
if (iter != PragmaPushMacroInfo.end()) {
// Forget the MacroInfo currently associated with IdentInfo.
if (MacroInfo *MI = getMacroInfo(IdentInfo)) {
if (MI->isWarnIfUnused())
WarnUnusedMacroLocs.erase(MI->getDefinitionLoc());
appendMacroDirective(IdentInfo, AllocateUndefMacroDirective(MessageLoc));
}
// Get the MacroInfo we want to reinstall.
MacroInfo *MacroToReInstall = iter->second.back();
if (MacroToReInstall)
// Reinstall the previously pushed macro.
appendDefMacroDirective(IdentInfo, MacroToReInstall, MessageLoc);
// Pop PragmaPushMacroInfo stack.
iter->second.pop_back();
if (iter->second.empty())
PragmaPushMacroInfo.erase(iter);
} else {
Diag(MessageLoc, diag::warn_pragma_pop_macro_no_push)
<< IdentInfo->getName();
}
}
void Preprocessor::HandlePragmaIncludeAlias(Token &Tok) {
// We will either get a quoted filename or a bracketed filename, and we
// have to track which we got. The first filename is the source name,
// and the second name is the mapped filename. If the first is quoted,
// the second must be as well (cannot mix and match quotes and brackets).
// Get the open paren
Lex(Tok);
if (Tok.isNot(tok::l_paren)) {
Diag(Tok, diag::warn_pragma_include_alias_expected) << "(";
return;
}
// We expect either a quoted string literal, or a bracketed name
Token SourceFilenameTok;
if (LexHeaderName(SourceFilenameTok))
return;
StringRef SourceFileName;
SmallString<128> FileNameBuffer;
if (SourceFilenameTok.is(tok::header_name)) {
SourceFileName = getSpelling(SourceFilenameTok, FileNameBuffer);
} else {
Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
return;
}
FileNameBuffer.clear();
// Now we expect a comma, followed by another include name
Lex(Tok);
if (Tok.isNot(tok::comma)) {
Diag(Tok, diag::warn_pragma_include_alias_expected) << ",";
return;
}
Token ReplaceFilenameTok;
if (LexHeaderName(ReplaceFilenameTok))
return;
StringRef ReplaceFileName;
if (ReplaceFilenameTok.is(tok::header_name)) {
ReplaceFileName = getSpelling(ReplaceFilenameTok, FileNameBuffer);
} else {
Diag(Tok, diag::warn_pragma_include_alias_expected_filename);
return;
}
// Finally, we expect the closing paren
Lex(Tok);
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::warn_pragma_include_alias_expected) << ")";
return;
}
// Now that we have the source and target filenames, we need to make sure
// they're both of the same type (angled vs non-angled)
StringRef OriginalSource = SourceFileName;
bool SourceIsAngled =
GetIncludeFilenameSpelling(SourceFilenameTok.getLocation(),
SourceFileName);
bool ReplaceIsAngled =
GetIncludeFilenameSpelling(ReplaceFilenameTok.getLocation(),
ReplaceFileName);
if (!SourceFileName.empty() && !ReplaceFileName.empty() &&
(SourceIsAngled != ReplaceIsAngled)) {
unsigned int DiagID;
if (SourceIsAngled)
DiagID = diag::warn_pragma_include_alias_mismatch_angle;
else
DiagID = diag::warn_pragma_include_alias_mismatch_quote;
Diag(SourceFilenameTok.getLocation(), DiagID)
<< SourceFileName
<< ReplaceFileName;
return;
}
// Now we can let the include handler know about this mapping
getHeaderSearchInfo().AddIncludeAlias(OriginalSource, ReplaceFileName);
}
// Lex a component of a module name: either an identifier or a string literal;
// for components that can be expressed both ways, the two forms are equivalent.
static bool LexModuleNameComponent(
Preprocessor &PP, Token &Tok,
std::pair<IdentifierInfo *, SourceLocation> &ModuleNameComponent,
bool First) {
PP.LexUnexpandedToken(Tok);
if (Tok.is(tok::string_literal) && !Tok.hasUDSuffix()) {
StringLiteralParser Literal(Tok, PP);
if (Literal.hadError)
return true;
ModuleNameComponent = std::make_pair(
PP.getIdentifierInfo(Literal.GetString()), Tok.getLocation());
} else if (!Tok.isAnnotation() && Tok.getIdentifierInfo()) {
ModuleNameComponent =
std::make_pair(Tok.getIdentifierInfo(), Tok.getLocation());
} else {
PP.Diag(Tok.getLocation(), diag::err_pp_expected_module_name) << First;
return true;
}
return false;
}
static bool LexModuleName(
Preprocessor &PP, Token &Tok,
llvm::SmallVectorImpl<std::pair<IdentifierInfo *, SourceLocation>>
&ModuleName) {
while (true) {
std::pair<IdentifierInfo*, SourceLocation> NameComponent;
if (LexModuleNameComponent(PP, Tok, NameComponent, ModuleName.empty()))
return true;
ModuleName.push_back(NameComponent);
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::period))
return false;
}
}
void Preprocessor::HandlePragmaModuleBuild(Token &Tok) {
SourceLocation Loc = Tok.getLocation();
std::pair<IdentifierInfo *, SourceLocation> ModuleNameLoc;
if (LexModuleNameComponent(*this, Tok, ModuleNameLoc, true))
return;
IdentifierInfo *ModuleName = ModuleNameLoc.first;
LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod)) {
Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
DiscardUntilEndOfDirective();
}
CurLexer->LexingRawMode = true;
auto TryConsumeIdentifier = [&](StringRef Ident) -> bool {
if (Tok.getKind() != tok::raw_identifier ||
Tok.getRawIdentifier() != Ident)
return false;
CurLexer->Lex(Tok);
return true;
};
// Scan forward looking for the end of the module.
const char *Start = CurLexer->getBufferLocation();
const char *End = nullptr;
unsigned NestingLevel = 1;
while (true) {
End = CurLexer->getBufferLocation();
CurLexer->Lex(Tok);
if (Tok.is(tok::eof)) {
Diag(Loc, diag::err_pp_module_build_missing_end);
break;
}
if (Tok.isNot(tok::hash) || !Tok.isAtStartOfLine()) {
// Token was part of module; keep going.
continue;
}
// We hit something directive-shaped; check to see if this is the end
// of the module build.
CurLexer->ParsingPreprocessorDirective = true;
CurLexer->Lex(Tok);
if (TryConsumeIdentifier("pragma") && TryConsumeIdentifier("clang") &&
TryConsumeIdentifier("module")) {
if (TryConsumeIdentifier("build"))
// #pragma clang module build -> entering a nested module build.
++NestingLevel;
else if (TryConsumeIdentifier("endbuild")) {
// #pragma clang module endbuild -> leaving a module build.
if (--NestingLevel == 0)
break;
}
// We should either be looking at the EOD or more of the current directive
// preceding the EOD. Either way we can ignore this token and keep going.
assert(Tok.getKind() != tok::eof && "missing EOD before EOF");
}
}
CurLexer->LexingRawMode = false;
// Load the extracted text as a preprocessed module.
assert(CurLexer->getBuffer().begin() <= Start &&
Start <= CurLexer->getBuffer().end() &&
CurLexer->getBuffer().begin() <= End &&
End <= CurLexer->getBuffer().end() &&
"module source range not contained within same file buffer");
TheModuleLoader.createModuleFromSource(Loc, ModuleName->getName(),
StringRef(Start, End - Start));
}
void Preprocessor::HandlePragmaHdrstop(Token &Tok) {
Lex(Tok);
if (Tok.is(tok::l_paren)) {
Diag(Tok.getLocation(), diag::warn_pp_hdrstop_filename_ignored);
std::string FileName;
if (!LexStringLiteral(Tok, FileName, "pragma hdrstop", false))
return;
if (Tok.isNot(tok::r_paren)) {
Diag(Tok, diag::err_expected) << tok::r_paren;
return;
}
Lex(Tok);
}
if (Tok.isNot(tok::eod))
Diag(Tok.getLocation(), diag::ext_pp_extra_tokens_at_eol)
<< "pragma hdrstop";
if (creatingPCHWithPragmaHdrStop() &&
SourceMgr.isInMainFile(Tok.getLocation())) {
assert(CurLexer && "no lexer for #pragma hdrstop processing");
Token &Result = Tok;
Result.startToken();
CurLexer->FormTokenWithChars(Result, CurLexer->BufferEnd, tok::eof);
CurLexer->cutOffLexing();
}
if (usingPCHWithPragmaHdrStop())
SkippingUntilPragmaHdrStop = false;
}
/// AddPragmaHandler - Add the specified pragma handler to the preprocessor.
/// If 'Namespace' is non-null, then it is a token required to exist on the
/// pragma line before the pragma string starts, e.g. "STDC" or "GCC".
void Preprocessor::AddPragmaHandler(StringRef Namespace,
PragmaHandler *Handler) {
PragmaNamespace *InsertNS = PragmaHandlers.get();
// If this is specified to be in a namespace, step down into it.
if (!Namespace.empty()) {
// If there is already a pragma handler with the name of this namespace,
// we either have an error (directive with the same name as a namespace) or
// we already have the namespace to insert into.
if (PragmaHandler *Existing = PragmaHandlers->FindHandler(Namespace)) {
InsertNS = Existing->getIfNamespace();
assert(InsertNS != nullptr && "Cannot have a pragma namespace and pragma"
" handler with the same name!");
} else {
// Otherwise, this namespace doesn't exist yet, create and insert the
// handler for it.
InsertNS = new PragmaNamespace(Namespace);
PragmaHandlers->AddPragma(InsertNS);
}
}
// Check to make sure we don't already have a pragma for this identifier.
assert(!InsertNS->FindHandler(Handler->getName()) &&
"Pragma handler already exists for this identifier!");
InsertNS->AddPragma(Handler);
}
/// RemovePragmaHandler - Remove the specific pragma handler from the
/// preprocessor. If \arg Namespace is non-null, then it should be the
/// namespace that \arg Handler was added to. It is an error to remove
/// a handler that has not been registered.
void Preprocessor::RemovePragmaHandler(StringRef Namespace,
PragmaHandler *Handler) {
PragmaNamespace *NS = PragmaHandlers.get();
// If this is specified to be in a namespace, step down into it.
if (!Namespace.empty()) {
PragmaHandler *Existing = PragmaHandlers->FindHandler(Namespace);
assert(Existing && "Namespace containing handler does not exist!");
NS = Existing->getIfNamespace();
assert(NS && "Invalid namespace, registered as a regular pragma handler!");
}
NS->RemovePragmaHandler(Handler);
// If this is a non-default namespace and it is now empty, remove it.
if (NS != PragmaHandlers.get() && NS->IsEmpty()) {
PragmaHandlers->RemovePragmaHandler(NS);
delete NS;
}
}
bool Preprocessor::LexOnOffSwitch(tok::OnOffSwitch &Result) {
Token Tok;
LexUnexpandedToken(Tok);
if (Tok.isNot(tok::identifier)) {
Diag(Tok, diag::ext_on_off_switch_syntax);
return true;
}
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II->isStr("ON"))
Result = tok::OOS_ON;
else if (II->isStr("OFF"))
Result = tok::OOS_OFF;
else if (II->isStr("DEFAULT"))
Result = tok::OOS_DEFAULT;
else {
Diag(Tok, diag::ext_on_off_switch_syntax);
return true;
}
// Verify that this is followed by EOD.
LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod))
Diag(Tok, diag::ext_pragma_syntax_eod);
return false;
}
namespace {
/// PragmaOnceHandler - "\#pragma once" marks the file as atomically included.
struct PragmaOnceHandler : public PragmaHandler {
PragmaOnceHandler() : PragmaHandler("once") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &OnceTok) override {
PP.CheckEndOfDirective("pragma once");
PP.HandlePragmaOnce(OnceTok);
}
};
/// PragmaMarkHandler - "\#pragma mark ..." is ignored by the compiler, and the
/// rest of the line is not lexed.
struct PragmaMarkHandler : public PragmaHandler {
PragmaMarkHandler() : PragmaHandler("mark") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &MarkTok) override {
PP.HandlePragmaMark();
}
};
/// PragmaPoisonHandler - "\#pragma poison x" marks x as not usable.
struct PragmaPoisonHandler : public PragmaHandler {
PragmaPoisonHandler() : PragmaHandler("poison") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &PoisonTok) override {
PP.HandlePragmaPoison();
}
};
/// PragmaSystemHeaderHandler - "\#pragma system_header" marks the current file
/// as a system header, which silences warnings in it.
struct PragmaSystemHeaderHandler : public PragmaHandler {
PragmaSystemHeaderHandler() : PragmaHandler("system_header") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &SHToken) override {
PP.HandlePragmaSystemHeader(SHToken);
PP.CheckEndOfDirective("pragma");
}
};
struct PragmaDependencyHandler : public PragmaHandler {
PragmaDependencyHandler() : PragmaHandler("dependency") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &DepToken) override {
PP.HandlePragmaDependency(DepToken);
}
};
struct PragmaDebugHandler : public PragmaHandler {
PragmaDebugHandler() : PragmaHandler("__debug") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &DebugToken) override {
Token Tok;
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::identifier)) {
PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
return;
}
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II->isStr("assert")) {
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash)
llvm_unreachable("This is an assertion!");
} else if (II->isStr("crash")) {
llvm::Timer T("crash", "pragma crash");
llvm::TimeRegion R(&T);
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash)
LLVM_BUILTIN_TRAP;
} else if (II->isStr("parser_crash")) {
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash) {
Token Crasher;
Crasher.startToken();
Crasher.setKind(tok::annot_pragma_parser_crash);
Crasher.setAnnotationRange(SourceRange(Tok.getLocation()));
PP.EnterToken(Crasher, /*IsReinject*/ false);
}
} else if (II->isStr("dump")) {
Token Identifier;
PP.LexUnexpandedToken(Identifier);
if (auto *DumpII = Identifier.getIdentifierInfo()) {
Token DumpAnnot;
DumpAnnot.startToken();
DumpAnnot.setKind(tok::annot_pragma_dump);
DumpAnnot.setAnnotationRange(
SourceRange(Tok.getLocation(), Identifier.getLocation()));
DumpAnnot.setAnnotationValue(DumpII);
PP.DiscardUntilEndOfDirective();
PP.EnterToken(DumpAnnot, /*IsReinject*/false);
} else {
PP.Diag(Identifier, diag::warn_pragma_debug_missing_argument)
<< II->getName();
}
} else if (II->isStr("diag_mapping")) {
Token DiagName;
PP.LexUnexpandedToken(DiagName);
if (DiagName.is(tok::eod))
PP.getDiagnostics().dump();
else if (DiagName.is(tok::string_literal) && !DiagName.hasUDSuffix()) {
StringLiteralParser Literal(DiagName, PP);
if (Literal.hadError)
return;
PP.getDiagnostics().dump(Literal.GetString());
} else {
PP.Diag(DiagName, diag::warn_pragma_debug_missing_argument)
<< II->getName();
}
} else if (II->isStr("llvm_fatal_error")) {
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash)
llvm::report_fatal_error("#pragma clang __debug llvm_fatal_error");
} else if (II->isStr("llvm_unreachable")) {
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash)
llvm_unreachable("#pragma clang __debug llvm_unreachable");
} else if (II->isStr("macro")) {
Token MacroName;
PP.LexUnexpandedToken(MacroName);
auto *MacroII = MacroName.getIdentifierInfo();
if (MacroII)
PP.dumpMacroInfo(MacroII);
else
PP.Diag(MacroName, diag::warn_pragma_debug_missing_argument)
<< II->getName();
} else if (II->isStr("module_map")) {
llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 8>
ModuleName;
if (LexModuleName(PP, Tok, ModuleName))
return;
ModuleMap &MM = PP.getHeaderSearchInfo().getModuleMap();
Module *M = nullptr;
for (auto IIAndLoc : ModuleName) {
M = MM.lookupModuleQualified(IIAndLoc.first->getName(), M);
if (!M) {
PP.Diag(IIAndLoc.second, diag::warn_pragma_debug_unknown_module)
<< IIAndLoc.first;
return;
}
}
M->dump();
} else if (II->isStr("overflow_stack")) {
if (!PP.getPreprocessorOpts().DisablePragmaDebugCrash)
DebugOverflowStack();
} else if (II->isStr("captured")) {
HandleCaptured(PP);
} else if (II->isStr("modules")) {
struct ModuleVisitor {
Preprocessor &PP;
void visit(Module *M, bool VisibleOnly) {
SourceLocation ImportLoc = PP.getModuleImportLoc(M);
if (!VisibleOnly || ImportLoc.isValid()) {
llvm::errs() << M->getFullModuleName() << " ";
if (ImportLoc.isValid()) {
llvm::errs() << M << " visible ";
ImportLoc.print(llvm::errs(), PP.getSourceManager());
}
llvm::errs() << "\n";
}
for (Module *Sub : M->submodules()) {
if (!VisibleOnly || ImportLoc.isInvalid() || Sub->IsExplicit)
visit(Sub, VisibleOnly);
}
}
void visitAll(bool VisibleOnly) {
for (auto &NameAndMod :
PP.getHeaderSearchInfo().getModuleMap().modules())
visit(NameAndMod.second, VisibleOnly);
}
} Visitor{PP};
Token Kind;
PP.LexUnexpandedToken(Kind);
auto *DumpII = Kind.getIdentifierInfo();
if (!DumpII) {
PP.Diag(Kind, diag::warn_pragma_debug_missing_argument)
<< II->getName();
} else if (DumpII->isStr("all")) {
Visitor.visitAll(false);
} else if (DumpII->isStr("visible")) {
Visitor.visitAll(true);
} else if (DumpII->isStr("building")) {
for (auto &Building : PP.getBuildingSubmodules()) {
llvm::errs() << "in " << Building.M->getFullModuleName();
if (Building.ImportLoc.isValid()) {
llvm::errs() << " imported ";
if (Building.IsPragma)
llvm::errs() << "via pragma ";
llvm::errs() << "at ";
Building.ImportLoc.print(llvm::errs(), PP.getSourceManager());
llvm::errs() << "\n";
}
}
} else {
PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command)
<< DumpII->getName();
}
} else {
PP.Diag(Tok, diag::warn_pragma_debug_unexpected_command)
<< II->getName();
}
PPCallbacks *Callbacks = PP.getPPCallbacks();
if (Callbacks)
Callbacks->PragmaDebug(Tok.getLocation(), II->getName());
}
void HandleCaptured(Preprocessor &PP) {
Token Tok;
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol)
<< "pragma clang __debug captured";
return;
}
SourceLocation NameLoc = Tok.getLocation();
MutableArrayRef<Token> Toks(
PP.getPreprocessorAllocator().Allocate<Token>(1), 1);
Toks[0].startToken();
Toks[0].setKind(tok::annot_pragma_captured);
Toks[0].setLocation(NameLoc);
PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true,
/*IsReinject=*/false);
}
// Disable MSVC warning about runtime stack overflow.
#ifdef _MSC_VER
#pragma warning(disable : 4717)
#endif
static void DebugOverflowStack(void (*P)() = nullptr) {
void (*volatile Self)(void(*P)()) = DebugOverflowStack;
Self(reinterpret_cast<void(*)()>(Self));
}
#ifdef _MSC_VER
#pragma warning(default : 4717)
#endif
};
/// PragmaDiagnosticHandler - e.g. '\#pragma GCC diagnostic ignored "-Wformat"'
struct PragmaDiagnosticHandler : public PragmaHandler {
private:
const char *Namespace;
public:
explicit PragmaDiagnosticHandler(const char *NS)
: PragmaHandler("diagnostic"), Namespace(NS) {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &DiagToken) override {
SourceLocation DiagLoc = DiagToken.getLocation();
Token Tok;
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::identifier)) {
PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
return;
}
IdentifierInfo *II = Tok.getIdentifierInfo();
PPCallbacks *Callbacks = PP.getPPCallbacks();
if (II->isStr("pop")) {
if (!PP.getDiagnostics().popMappings(DiagLoc))
PP.Diag(Tok, diag::warn_pragma_diagnostic_cannot_pop);
else if (Callbacks)
Callbacks->PragmaDiagnosticPop(DiagLoc, Namespace);
return;
} else if (II->isStr("push")) {
PP.getDiagnostics().pushMappings(DiagLoc);
if (Callbacks)
Callbacks->PragmaDiagnosticPush(DiagLoc, Namespace);
return;
}
diag::Severity SV = llvm::StringSwitch<diag::Severity>(II->getName())
.Case("ignored", diag::Severity::Ignored)
.Case("warning", diag::Severity::Warning)
.Case("error", diag::Severity::Error)
.Case("fatal", diag::Severity::Fatal)
.Default(diag::Severity());
if (SV == diag::Severity()) {
PP.Diag(Tok, diag::warn_pragma_diagnostic_invalid);
return;
}
PP.LexUnexpandedToken(Tok);
SourceLocation StringLoc = Tok.getLocation();
std::string WarningName;
if (!PP.FinishLexStringLiteral(Tok, WarningName, "pragma diagnostic",
/*AllowMacroExpansion=*/false))
return;
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_diagnostic_invalid_token);
return;
}
if (WarningName.size() < 3 || WarningName[0] != '-' ||
(WarningName[1] != 'W' && WarningName[1] != 'R')) {
PP.Diag(StringLoc, diag::warn_pragma_diagnostic_invalid_option);
return;
}
diag::Flavor Flavor = WarningName[1] == 'W' ? diag::Flavor::WarningOrError
: diag::Flavor::Remark;
StringRef Group = StringRef(WarningName).substr(2);
bool unknownDiag = false;
if (Group == "everything") {
// Special handling for pragma clang diagnostic ... "-Weverything".
// There is no formal group named "everything", so there has to be a
// special case for it.
PP.getDiagnostics().setSeverityForAll(Flavor, SV, DiagLoc);
} else
unknownDiag = PP.getDiagnostics().setSeverityForGroup(Flavor, Group, SV,
DiagLoc);
if (unknownDiag)
PP.Diag(StringLoc, diag::warn_pragma_diagnostic_unknown_warning)
<< WarningName;
else if (Callbacks)
Callbacks->PragmaDiagnostic(DiagLoc, Namespace, SV, WarningName);
}
};
/// "\#pragma hdrstop [<header-name-string>]"
struct PragmaHdrstopHandler : public PragmaHandler {
PragmaHdrstopHandler() : PragmaHandler("hdrstop") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &DepToken) override {
PP.HandlePragmaHdrstop(DepToken);
}
};
/// "\#pragma warning(...)". MSVC's diagnostics do not map cleanly to clang's
/// diagnostics, so we don't really implement this pragma. We parse it and
/// ignore it to avoid -Wunknown-pragma warnings.
struct PragmaWarningHandler : public PragmaHandler {
PragmaWarningHandler() : PragmaHandler("warning") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
// Parse things like:
// warning(push, 1)
// warning(pop)
// warning(disable : 1 2 3 ; error : 4 5 6 ; suppress : 7 8 9)
SourceLocation DiagLoc = Tok.getLocation();
PPCallbacks *Callbacks = PP.getPPCallbacks();
PP.Lex(Tok);
if (Tok.isNot(tok::l_paren)) {
PP.Diag(Tok, diag::warn_pragma_warning_expected) << "(";
return;
}
PP.Lex(Tok);
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II && II->isStr("push")) {
// #pragma warning( push[ ,n ] )
int Level = -1;
PP.Lex(Tok);
if (Tok.is(tok::comma)) {
PP.Lex(Tok);
uint64_t Value;
if (Tok.is(tok::numeric_constant) &&
PP.parseSimpleIntegerLiteral(Tok, Value))
Level = int(Value);
if (Level < 0 || Level > 4) {
PP.Diag(Tok, diag::warn_pragma_warning_push_level);
return;
}
}
if (Callbacks)
Callbacks->PragmaWarningPush(DiagLoc, Level);
} else if (II && II->isStr("pop")) {
// #pragma warning( pop )
PP.Lex(Tok);
if (Callbacks)
Callbacks->PragmaWarningPop(DiagLoc);
} else {
// #pragma warning( warning-specifier : warning-number-list
// [; warning-specifier : warning-number-list...] )
while (true) {
II = Tok.getIdentifierInfo();
if (!II && !Tok.is(tok::numeric_constant)) {
PP.Diag(Tok, diag::warn_pragma_warning_spec_invalid);
return;
}
// Figure out which warning specifier this is.
bool SpecifierValid;
StringRef Specifier;
llvm::SmallString<1> SpecifierBuf;
if (II) {
Specifier = II->getName();
SpecifierValid = llvm::StringSwitch<bool>(Specifier)
.Cases("default", "disable", "error", "once",
"suppress", true)
.Default(false);
// If we read a correct specifier, snatch next token (that should be
// ":", checked later).
if (SpecifierValid)
PP.Lex(Tok);
} else {
// Token is a numeric constant. It should be either 1, 2, 3 or 4.
uint64_t Value;
Specifier = PP.getSpelling(Tok, SpecifierBuf);
if (PP.parseSimpleIntegerLiteral(Tok, Value)) {
SpecifierValid = (Value >= 1) && (Value <= 4);
} else
SpecifierValid = false;
// Next token already snatched by parseSimpleIntegerLiteral.
}
if (!SpecifierValid) {
PP.Diag(Tok, diag::warn_pragma_warning_spec_invalid);
return;
}
if (Tok.isNot(tok::colon)) {
PP.Diag(Tok, diag::warn_pragma_warning_expected) << ":";
return;
}
// Collect the warning ids.
SmallVector<int, 4> Ids;
PP.Lex(Tok);
while (Tok.is(tok::numeric_constant)) {
uint64_t Value;
if (!PP.parseSimpleIntegerLiteral(Tok, Value) || Value == 0 ||
Value > INT_MAX) {
PP.Diag(Tok, diag::warn_pragma_warning_expected_number);
return;
}
Ids.push_back(int(Value));
}
if (Callbacks)
Callbacks->PragmaWarning(DiagLoc, Specifier, Ids);
// Parse the next specifier if there is a semicolon.
if (Tok.isNot(tok::semi))
break;
PP.Lex(Tok);
}
}
if (Tok.isNot(tok::r_paren)) {
PP.Diag(Tok, diag::warn_pragma_warning_expected) << ")";
return;
}
PP.Lex(Tok);
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma warning";
}
};
/// "\#pragma execution_character_set(...)". MSVC supports this pragma only
/// for "UTF-8". We parse it and ignore it if UTF-8 is provided and warn
/// otherwise to avoid -Wunknown-pragma warnings.
struct PragmaExecCharsetHandler : public PragmaHandler {
PragmaExecCharsetHandler() : PragmaHandler("execution_character_set") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
// Parse things like:
// execution_character_set(push, "UTF-8")
// execution_character_set(pop)
SourceLocation DiagLoc = Tok.getLocation();
PPCallbacks *Callbacks = PP.getPPCallbacks();
PP.Lex(Tok);
if (Tok.isNot(tok::l_paren)) {
PP.Diag(Tok, diag::warn_pragma_exec_charset_expected) << "(";
return;
}
PP.Lex(Tok);
IdentifierInfo *II = Tok.getIdentifierInfo();
if (II && II->isStr("push")) {
// #pragma execution_character_set( push[ , string ] )
PP.Lex(Tok);
if (Tok.is(tok::comma)) {
PP.Lex(Tok);
std::string ExecCharset;
if (!PP.FinishLexStringLiteral(Tok, ExecCharset,
"pragma execution_character_set",
/*AllowMacroExpansion=*/false))
return;
// MSVC supports either of these, but nothing else.
if (ExecCharset != "UTF-8" && ExecCharset != "utf-8") {
PP.Diag(Tok, diag::warn_pragma_exec_charset_push_invalid) << ExecCharset;
return;
}
}
if (Callbacks)
Callbacks->PragmaExecCharsetPush(DiagLoc, "UTF-8");
} else if (II && II->isStr("pop")) {
// #pragma execution_character_set( pop )
PP.Lex(Tok);
if (Callbacks)
Callbacks->PragmaExecCharsetPop(DiagLoc);
} else {
PP.Diag(Tok, diag::warn_pragma_exec_charset_spec_invalid);
return;
}
if (Tok.isNot(tok::r_paren)) {
PP.Diag(Tok, diag::warn_pragma_exec_charset_expected) << ")";
return;
}
PP.Lex(Tok);
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma execution_character_set";
}
};
/// PragmaIncludeAliasHandler - "\#pragma include_alias("...")".
struct PragmaIncludeAliasHandler : public PragmaHandler {
PragmaIncludeAliasHandler() : PragmaHandler("include_alias") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &IncludeAliasTok) override {
PP.HandlePragmaIncludeAlias(IncludeAliasTok);
}
};
/// PragmaMessageHandler - Handle the microsoft and gcc \#pragma message
/// extension. The syntax is:
/// \code
/// #pragma message(string)
/// \endcode
/// OR, in GCC mode:
/// \code
/// #pragma message string
/// \endcode
/// string is a string, which is fully macro expanded, and permits string
/// concatenation, embedded escape characters, etc... See MSDN for more details.
/// Also handles \#pragma GCC warning and \#pragma GCC error which take the same
/// form as \#pragma message.
struct PragmaMessageHandler : public PragmaHandler {
private:
const PPCallbacks::PragmaMessageKind Kind;
const StringRef Namespace;
static const char* PragmaKind(PPCallbacks::PragmaMessageKind Kind,
bool PragmaNameOnly = false) {
switch (Kind) {
case PPCallbacks::PMK_Message:
return PragmaNameOnly ? "message" : "pragma message";
case PPCallbacks::PMK_Warning:
return PragmaNameOnly ? "warning" : "pragma warning";
case PPCallbacks::PMK_Error:
return PragmaNameOnly ? "error" : "pragma error";
}
llvm_unreachable("Unknown PragmaMessageKind!");
}
public:
PragmaMessageHandler(PPCallbacks::PragmaMessageKind Kind,
StringRef Namespace = StringRef())
: PragmaHandler(PragmaKind(Kind, true)), Kind(Kind),
Namespace(Namespace) {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
SourceLocation MessageLoc = Tok.getLocation();
PP.Lex(Tok);
bool ExpectClosingParen = false;
switch (Tok.getKind()) {
case tok::l_paren:
// We have a MSVC style pragma message.
ExpectClosingParen = true;
// Read the string.
PP.Lex(Tok);
break;
case tok::string_literal:
// We have a GCC style pragma message, and we just read the string.
break;
default:
PP.Diag(MessageLoc, diag::err_pragma_message_malformed) << Kind;
return;
}
std::string MessageString;
if (!PP.FinishLexStringLiteral(Tok, MessageString, PragmaKind(Kind),
/*AllowMacroExpansion=*/true))
return;
if (ExpectClosingParen) {
if (Tok.isNot(tok::r_paren)) {
PP.Diag(Tok.getLocation(), diag::err_pragma_message_malformed) << Kind;
return;
}
PP.Lex(Tok); // eat the r_paren.
}
if (Tok.isNot(tok::eod)) {
PP.Diag(Tok.getLocation(), diag::err_pragma_message_malformed) << Kind;
return;
}
// Output the message.
PP.Diag(MessageLoc, (Kind == PPCallbacks::PMK_Error)
? diag::err_pragma_message
: diag::warn_pragma_message) << MessageString;
// If the pragma is lexically sound, notify any interested PPCallbacks.
if (PPCallbacks *Callbacks = PP.getPPCallbacks())
Callbacks->PragmaMessage(MessageLoc, Namespace, Kind, MessageString);
}
};
/// Handle the clang \#pragma module import extension. The syntax is:
/// \code
/// #pragma clang module import some.module.name
/// \endcode
struct PragmaModuleImportHandler : public PragmaHandler {
PragmaModuleImportHandler() : PragmaHandler("import") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
SourceLocation ImportLoc = Tok.getLocation();
// Read the module name.
llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 8>
ModuleName;
if (LexModuleName(PP, Tok, ModuleName))
return;
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
// If we have a non-empty module path, load the named module.
Module *Imported =
PP.getModuleLoader().loadModule(ImportLoc, ModuleName, Module::Hidden,
/*IsInclusionDirective=*/false);
if (!Imported)
return;
PP.makeModuleVisible(Imported, ImportLoc);
PP.EnterAnnotationToken(SourceRange(ImportLoc, ModuleName.back().second),
tok::annot_module_include, Imported);
if (auto *CB = PP.getPPCallbacks())
CB->moduleImport(ImportLoc, ModuleName, Imported);
}
};
/// Handle the clang \#pragma module begin extension. The syntax is:
/// \code
/// #pragma clang module begin some.module.name
/// ...
/// #pragma clang module end
/// \endcode
struct PragmaModuleBeginHandler : public PragmaHandler {
PragmaModuleBeginHandler() : PragmaHandler("begin") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
SourceLocation BeginLoc = Tok.getLocation();
// Read the module name.
llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 8>
ModuleName;
if (LexModuleName(PP, Tok, ModuleName))
return;
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
// We can only enter submodules of the current module.
StringRef Current = PP.getLangOpts().CurrentModule;
if (ModuleName.front().first->getName() != Current) {
PP.Diag(ModuleName.front().second, diag::err_pp_module_begin_wrong_module)
<< ModuleName.front().first << (ModuleName.size() > 1)
<< Current.empty() << Current;
return;
}
// Find the module we're entering. We require that a module map for it
// be loaded or implicitly loadable.
auto &HSI = PP.getHeaderSearchInfo();
Module *M = HSI.lookupModule(Current);
if (!M) {
PP.Diag(ModuleName.front().second,
diag::err_pp_module_begin_no_module_map) << Current;
return;
}
for (unsigned I = 1; I != ModuleName.size(); ++I) {
auto *NewM = M->findOrInferSubmodule(ModuleName[I].first->getName());
if (!NewM) {
PP.Diag(ModuleName[I].second, diag::err_pp_module_begin_no_submodule)
<< M->getFullModuleName() << ModuleName[I].first;
return;
}
M = NewM;
}
// If the module isn't available, it doesn't make sense to enter it.
if (Preprocessor::checkModuleIsAvailable(
PP.getLangOpts(), PP.getTargetInfo(), PP.getDiagnostics(), M)) {
PP.Diag(BeginLoc, diag::note_pp_module_begin_here)
<< M->getTopLevelModuleName();
return;
}
// Enter the scope of the submodule.
PP.EnterSubmodule(M, BeginLoc, /*ForPragma*/true);
PP.EnterAnnotationToken(SourceRange(BeginLoc, ModuleName.back().second),
tok::annot_module_begin, M);
}
};
/// Handle the clang \#pragma module end extension.
struct PragmaModuleEndHandler : public PragmaHandler {
PragmaModuleEndHandler() : PragmaHandler("end") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
SourceLocation Loc = Tok.getLocation();
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
Module *M = PP.LeaveSubmodule(/*ForPragma*/true);
if (M)
PP.EnterAnnotationToken(SourceRange(Loc), tok::annot_module_end, M);
else
PP.Diag(Loc, diag::err_pp_module_end_without_module_begin);
}
};
/// Handle the clang \#pragma module build extension.
struct PragmaModuleBuildHandler : public PragmaHandler {
PragmaModuleBuildHandler() : PragmaHandler("build") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
PP.HandlePragmaModuleBuild(Tok);
}
};
/// Handle the clang \#pragma module load extension.
struct PragmaModuleLoadHandler : public PragmaHandler {
PragmaModuleLoadHandler() : PragmaHandler("load") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &Tok) override {
SourceLocation Loc = Tok.getLocation();
// Read the module name.
llvm::SmallVector<std::pair<IdentifierInfo *, SourceLocation>, 8>
ModuleName;
if (LexModuleName(PP, Tok, ModuleName))
return;
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
// Load the module, don't make it visible.
PP.getModuleLoader().loadModule(Loc, ModuleName, Module::Hidden,
/*IsInclusionDirective=*/false);
}
};
/// PragmaPushMacroHandler - "\#pragma push_macro" saves the value of the
/// macro on the top of the stack.
struct PragmaPushMacroHandler : public PragmaHandler {
PragmaPushMacroHandler() : PragmaHandler("push_macro") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &PushMacroTok) override {
PP.HandlePragmaPushMacro(PushMacroTok);
}
};
/// PragmaPopMacroHandler - "\#pragma pop_macro" sets the value of the
/// macro to the value on the top of the stack.
struct PragmaPopMacroHandler : public PragmaHandler {
PragmaPopMacroHandler() : PragmaHandler("pop_macro") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &PopMacroTok) override {
PP.HandlePragmaPopMacro(PopMacroTok);
}
};
/// PragmaARCCFCodeAuditedHandler -
/// \#pragma clang arc_cf_code_audited begin/end
struct PragmaARCCFCodeAuditedHandler : public PragmaHandler {
PragmaARCCFCodeAuditedHandler() : PragmaHandler("arc_cf_code_audited") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &NameTok) override {
SourceLocation Loc = NameTok.getLocation();
bool IsBegin;
Token Tok;
// Lex the 'begin' or 'end'.
PP.LexUnexpandedToken(Tok);
const IdentifierInfo *BeginEnd = Tok.getIdentifierInfo();
if (BeginEnd && BeginEnd->isStr("begin")) {
IsBegin = true;
} else if (BeginEnd && BeginEnd->isStr("end")) {
IsBegin = false;
} else {
PP.Diag(Tok.getLocation(), diag::err_pp_arc_cf_code_audited_syntax);
return;
}
// Verify that this is followed by EOD.
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
// The start location of the active audit.
SourceLocation BeginLoc = PP.getPragmaARCCFCodeAuditedInfo().second;
// The start location we want after processing this.
SourceLocation NewLoc;
if (IsBegin) {
// Complain about attempts to re-enter an audit.
if (BeginLoc.isValid()) {
PP.Diag(Loc, diag::err_pp_double_begin_of_arc_cf_code_audited);
PP.Diag(BeginLoc, diag::note_pragma_entered_here);
}
NewLoc = Loc;
} else {
// Complain about attempts to leave an audit that doesn't exist.
if (!BeginLoc.isValid()) {
PP.Diag(Loc, diag::err_pp_unmatched_end_of_arc_cf_code_audited);
return;
}
NewLoc = SourceLocation();
}
PP.setPragmaARCCFCodeAuditedInfo(NameTok.getIdentifierInfo(), NewLoc);
}
};
/// PragmaAssumeNonNullHandler -
/// \#pragma clang assume_nonnull begin/end
struct PragmaAssumeNonNullHandler : public PragmaHandler {
PragmaAssumeNonNullHandler() : PragmaHandler("assume_nonnull") {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &NameTok) override {
SourceLocation Loc = NameTok.getLocation();
bool IsBegin;
Token Tok;
// Lex the 'begin' or 'end'.
PP.LexUnexpandedToken(Tok);
const IdentifierInfo *BeginEnd = Tok.getIdentifierInfo();
if (BeginEnd && BeginEnd->isStr("begin")) {
IsBegin = true;
} else if (BeginEnd && BeginEnd->isStr("end")) {
IsBegin = false;
} else {
PP.Diag(Tok.getLocation(), diag::err_pp_assume_nonnull_syntax);
return;
}
// Verify that this is followed by EOD.
PP.LexUnexpandedToken(Tok);
if (Tok.isNot(tok::eod))
PP.Diag(Tok, diag::ext_pp_extra_tokens_at_eol) << "pragma";
// The start location of the active audit.
SourceLocation BeginLoc = PP.getPragmaAssumeNonNullLoc();
// The start location we want after processing this.
SourceLocation NewLoc;
PPCallbacks *Callbacks = PP.getPPCallbacks();
if (IsBegin) {
// Complain about attempts to re-enter an audit.
if (BeginLoc.isValid()) {
PP.Diag(Loc, diag::err_pp_double_begin_of_assume_nonnull);
PP.Diag(BeginLoc, diag::note_pragma_entered_here);
}
NewLoc = Loc;
if (Callbacks)
Callbacks->PragmaAssumeNonNullBegin(NewLoc);
} else {
// Complain about attempts to leave an audit that doesn't exist.
if (!BeginLoc.isValid()) {
PP.Diag(Loc, diag::err_pp_unmatched_end_of_assume_nonnull);
return;
}
NewLoc = SourceLocation();
if (Callbacks)
Callbacks->PragmaAssumeNonNullEnd(NewLoc);
}
PP.setPragmaAssumeNonNullLoc(NewLoc);
}
};
/// Handle "\#pragma region [...]"
///
/// The syntax is
/// \code
/// #pragma region [optional name]
/// #pragma endregion [optional comment]
/// \endcode
///
/// \note This is
/// <a href="http://msdn.microsoft.com/en-us/library/b6xkz944(v=vs.80).aspx">editor-only</a>
/// pragma, just skipped by compiler.
struct PragmaRegionHandler : public PragmaHandler {
PragmaRegionHandler(const char *pragma) : PragmaHandler(pragma) {}
void HandlePragma(Preprocessor &PP, PragmaIntroducer Introducer,
Token &NameTok) override {
// #pragma region: endregion matches can be verified
// __pragma(region): no sense, but ignored by msvc
// _Pragma is not valid for MSVC, but there isn't any point
// to handle a _Pragma differently.
}
};
} // namespace
/// RegisterBuiltinPragmas - Install the standard preprocessor pragmas:
/// \#pragma GCC poison/system_header/dependency and \#pragma once.
void Preprocessor::RegisterBuiltinPragmas() {
AddPragmaHandler(new PragmaOnceHandler());
AddPragmaHandler(new PragmaMarkHandler());
AddPragmaHandler(new PragmaPushMacroHandler());
AddPragmaHandler(new PragmaPopMacroHandler());
AddPragmaHandler(new PragmaMessageHandler(PPCallbacks::PMK_Message));
// #pragma GCC ...
AddPragmaHandler("GCC", new PragmaPoisonHandler());
AddPragmaHandler("GCC", new PragmaSystemHeaderHandler());
AddPragmaHandler("GCC", new PragmaDependencyHandler());
AddPragmaHandler("GCC", new PragmaDiagnosticHandler("GCC"));
AddPragmaHandler("GCC", new PragmaMessageHandler(PPCallbacks::PMK_Warning,
"GCC"));
AddPragmaHandler("GCC", new PragmaMessageHandler(PPCallbacks::PMK_Error,
"GCC"));
// #pragma clang ...
AddPragmaHandler("clang", new PragmaPoisonHandler());
AddPragmaHandler("clang", new PragmaSystemHeaderHandler());
AddPragmaHandler("clang", new PragmaDebugHandler());
AddPragmaHandler("clang", new PragmaDependencyHandler());
AddPragmaHandler("clang", new PragmaDiagnosticHandler("clang"));
AddPragmaHandler("clang", new PragmaARCCFCodeAuditedHandler());
AddPragmaHandler("clang", new PragmaAssumeNonNullHandler());
// #pragma clang module ...
auto *ModuleHandler = new PragmaNamespace("module");
AddPragmaHandler("clang", ModuleHandler);
ModuleHandler->AddPragma(new PragmaModuleImportHandler());
ModuleHandler->AddPragma(new PragmaModuleBeginHandler());
ModuleHandler->AddPragma(new PragmaModuleEndHandler());
ModuleHandler->AddPragma(new PragmaModuleBuildHandler());
ModuleHandler->AddPragma(new PragmaModuleLoadHandler());
// Add region pragmas.
AddPragmaHandler(new PragmaRegionHandler("region"));
AddPragmaHandler(new PragmaRegionHandler("endregion"));
// MS extensions.
if (LangOpts.MicrosoftExt) {
AddPragmaHandler(new PragmaWarningHandler());
AddPragmaHandler(new PragmaExecCharsetHandler());
AddPragmaHandler(new PragmaIncludeAliasHandler());
AddPragmaHandler(new PragmaHdrstopHandler());
AddPragmaHandler(new PragmaSystemHeaderHandler());
}
// Pragmas added by plugins
for (const PragmaHandlerRegistry::entry &handler :
PragmaHandlerRegistry::entries()) {
AddPragmaHandler(handler.instantiate().release());
}
}
/// Ignore all pragmas, useful for modes such as -Eonly which would otherwise
/// warn about those pragmas being unknown.
void Preprocessor::IgnorePragmas() {
AddPragmaHandler(new EmptyPragmaHandler());
// Also ignore all pragmas in all namespaces created
// in Preprocessor::RegisterBuiltinPragmas().
AddPragmaHandler("GCC", new EmptyPragmaHandler());
AddPragmaHandler("clang", new EmptyPragmaHandler());
}
|
/*
* Copyright (c) 2017 Daniel Koch and James Jackson, BYU MAGICC Lab.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \file time_manager.cpp
* \author Daniel Koch <daniel.koch@byu.edu>
*/
#include <functional>
#include <rosflight/mavrosflight/interface_adapter.h>
#include <rosflight/mavrosflight/logger_interface.h>
#include <rosflight/mavrosflight/time_interface.h>
#include <rosflight/mavrosflight/time_manager.h>
namespace mavrosflight
{
template <typename DerivedLogger>
TimeManager<DerivedLogger>::TimeManager(MavlinkComm *comm,
LoggerInterface<DerivedLogger> &logger,
const TimeInterface &time_interface,
TimerProviderInterface &timer_provider) :
comm_(comm),
offset_alpha_(0.95),
offset_ns_(0),
initialized_(false),
logger_(logger),
time_interface_(time_interface),
timer_provider_(timer_provider)
{
comm_->register_mavlink_listener(this);
std::function<void()> bound_callback = std::bind(&TimeManager<DerivedLogger>::timer_callback, this);
time_sync_timer_ = timer_provider_.create_timer(std::chrono::milliseconds(100), bound_callback);
}
template <typename DerivedLogger>
void TimeManager<DerivedLogger>::handle_mavlink_message(const mavlink_message_t &msg)
{
std::chrono::nanoseconds now = time_interface_.now();
if (msg.msgid == MAVLINK_MSG_ID_TIMESYNC)
{
mavlink_timesync_t tsync;
mavlink_msg_timesync_decode(&msg, &tsync);
std::chrono::nanoseconds tc1_chrono(tsync.tc1);
if (tsync.tc1 > 0) // check that this is a response, not a request
{
std::chrono::nanoseconds ts1_chrono(tsync.ts1);
std::chrono::nanoseconds offset_ns((ts1_chrono + now - 2 * tc1_chrono) / 2);
// if difference > 10ms, use it directly
if (!initialized_ || (offset_ns_ - offset_ns) > std::chrono::milliseconds(10)
|| (offset_ns_ - offset_ns) < std::chrono::milliseconds(-10))
{
offset_ns_ = offset_ns;
logger_.info("Detected time offset of %0.3f s.", std::chrono::duration<double>(offset_ns).count());
logger_.debug("FCU time: %0.3f, System time: %0.3f", tsync.tc1 * 1e-9, tsync.ts1 * 1e-9);
initialized_ = true;
}
else // otherwise low-pass filter the offset
{
offset_ns_ = std::chrono::duration_cast<std::chrono::nanoseconds>(offset_alpha_ * offset_ns
+ (1.0 - offset_alpha_) * offset_ns_);
}
}
}
}
template <typename DerivedLogger>
std::chrono::nanoseconds TimeManager<DerivedLogger>::fcu_time_to_system_time(std::chrono::nanoseconds fcu_time)
{
if (!initialized_)
return time_interface_.now();
std::chrono::nanoseconds ns = fcu_time + offset_ns_;
if (ns < std::chrono::nanoseconds::zero())
{
logger_.error_throttle(1, "negative time calculated from FCU: fcu_time=%ld, offset_ns=%ld. Using system time",
fcu_time, offset_ns_);
return time_interface_.now();
}
return ns;
}
template <typename DerivedLogger>
void TimeManager<DerivedLogger>::timer_callback()
{
mavlink_message_t msg;
mavlink_msg_timesync_pack(1, 50, &msg, 0, time_interface_.now().count());
comm_->send_message(msg);
}
template class TimeManager<DerivedLoggerType>;
} // namespace mavrosflight
|
; Substitute for the z80 ldi instruction
; Doesn't emulate the flags correctly
SECTION code_crt0_sccz80
PUBLIC __z80asm__ldi
__z80asm__ldi:
push af ;Save incoming flags
IF __CPU_GBZ80__
ld a, (hl+)
ELSE
ld a, (hl)
inc hl
ENDIF
ld (de), a
inc de
dec bc
IF !__CPU_GBZ80__
; There's no point setting PV flag on a gbz80 since flag doesn't exist
ex (sp), hl ;incoming af in hl, outgoing hl on stack
push bc ;Save bc, we need a temporary
ld a, b
or c
ld c, 4
jr nz, set_pv
ld c, 0
set_pv:
ld a, l
and @11101001 ;Knock out H + N flags as well
or c ;Add in PV flag required
ld l, a
pop bc
ex (sp), hl ;Get hl back
ENDIF
pop af ;And restore our modified af
ret
|
#include <fstream>
#include <iostream>
#include <string>
#include <gtkmm.h>
#include "simple_gtk_snap_app/settings.hpp"
int main(int argc, char *argv[]) {
std::cout << "Hello world\n";
const std::string home_path = simple_gtk_snap_app::root_directory;
std::cout << home_path << std::endl;
auto app =
Gtk::Application::create(argc, argv,
"ch.martinho.simple-gtk-snap-app");
Gtk::Window window;
window.set_default_size(200, 200);
return app->run(window);
return 0;
}
|
; QL RAM disk MDV Emulation V2.02 1985 Tony Tebby QJUMP
section rd
xdef rd_emul emulation check
xdef rd_mdv emulate MDV
include 'dev8_keys_sys'
include 'dev8_keys_iod'
include 'dev8_keys_hdr'
include 'dev8_keys_err'
include 'dev8_keys_qdos_sms'
include 'dev8_dd_rd_data'
include 'dev8_mac_assert'
rde_mdv dc.l 'MDVZ'
rde.mdvs equ 254 mdv sectors
rde.maps equ 2 map sectors
rde_offs equ rdb.slen+rde.maps*rdb.len
;+++
; Checks for RAM disk emulation of other directory drive.
; If so, returns the address of the emulation routine in D0 and sets
; the emulated drive number / drive size (sectors) in D2
; If the RAM disk name is not recognised, it returns ERR.INAM.
;
; ******************************************************************
;
; This version is QL MDV ONLY
;
; ******************************************************************
;
; d0 r error status or address of emulation routine
; d1 c p length of name
; d2 cr 0 / preserved or set to drive nr/size
; a1 c p pointer to start of name
;
; status return according to d0
;---
rd_emul
rde.reg reg d1/d3/a0/a1
movem.l rde.reg,-(sp)
cmp.w #4,d1 ; could it be 'MDVn'
blt.s rde_inam ; ... no
lea rde_mdv,a0
moveq #2,d0
rde_cklp
moveq #$ffffffdf,d3
and.b (a1)+,d3 ; mask out lc
cmp.b (a0)+,d3 ; match?
bne.s rde_inam ; ... no
dbra d0,rde_cklp
moveq #-'0',d3
add.b (a1)+,d3 ; drive number
ble.s rde_inam ; ... bad
cmp.b #8,d3
bgt.s rde_inam ; ... bad
cmp.w #5,d1 ; ... just mdv?
blt.s rde_set
bgt.s rde_inam
cmp.b #'_',(a1) ; must be underscore
beq.s rde_set ; ... it is
rde_inam
moveq #err.inam,d0
bra.s rde_exit
rde_set
moveq #0,d2
move.b d3,d2 ; emulate drive number
swap d2
move.w #rde.mdvs+rde.maps,d2 ; and number of sectors
lea rd_mdv,a0 ; emulator address
move.l a0,d0
rde_exit
movem.l (sp)+,rde.reg
rts
page
sv_tmode equ $a0 current transmit mode
sv_mdrun equ $ee drive currently running
md.read equ $124
md.write equ $126
md.verin equ $128
md.sectr equ $12a
md.retry equ $100 retry
md.bdtry equ $20 amount taken from retry count every bad medium return
md.rtall equ $02 retry all sectors twice
md.bad equ $ff bad sector
md.empty equ $fd empty sector
md.map equ $f8 map sector
pc_tctrl equ $18002
pc_mctrl equ $18020
;+++
; Set up MDV emulating RAM disk. The total number of sectors is preset.
; The number of free sectors is set to 2 fewer. The first map sector is set
; to point to itself and it is marked static.
;
; d1 cr microdrive number to load / good sectors
; d2 r total sectors
; a0 c base address of fixed RAM disk header
; a1 c s base of first map sector
; a3 s microdrive control register
; a4 s
; a5 c p pointer to pointer to RAM disk
;---
rd_mdv
lea rdb.len(a1),a3 next sector of map
move.l a3,rdb_slst(a1)
addq.l #1,rdb_sect(a3) ... it's sector 1
st rdb_stat(a1) (mark as static as well)
lea rde_offs(a0),a1 base of normal area
move.w #rde.mdvs-1,d0 preset bad sectors
rmd_badloop
move.b #md.bad,rdb_id+1(a1) set true bad
add.w #rdb.len,a1
dbra d0,rmd_badloop
rmd_wstop
tst.b sv_mdrun(a6) wait until stopped
bne.s rmd_wstop
or.w #$0700,sr disable interrupts
dbne d0,* wait
move.l #pc_mctrl,a3
moveq #$ffffff00+%11100111,d0 mask out transmit mode
and.b sv_tmode(a6),d0 ... from composite mode
or.b #%00010000,d0 set to microdrive mode
move.b d0,pc_tctrl-pc_mctrl(a3) ... in peripheral chip
move.b d0,sv_tmode(a6) ... and sysvars
moveq #md.rtall,d6 count of retries of all sectors read
bsr.l select
; read all sectors in
rmd_retry
move.l #pc_mctrl,a3 reset pointer to microdrive control
bsr.l read_all read all sectors
; scrabble through pointers
rmd_sptr
moveq #0,d4 sectors used
moveq #0,d5 highest file number
moveq #0,d7 bad sectors required
cmp.b #md.bad,rdb_id+1+rde_offs(a0) bad map?
beq.s rmd_bmed ... yes
moveq #-1,d1 start at file 0
rmd_mfloop
addq.w #1,d1 next file
cmp.b #md.map,d1 ... up to map?
beq.s rmd_tsts ... yes
moveq #1,d0 files start at 1 (directory)
add.w d1,d0 ... start link pointer
asl.w #2,d0 ... long words
lea rdb.slen+rdb_data(a0,d0.w),a3 in map sector 0
divu #rdb.data,d0
assert rdb_data,$10
lsl.w #4,d0
add.w d0,a3 ... or other sector
moveq #-1,d2 start at sector 0
rmd_msloop
addq.w #1,d2 next sector
lea rde_offs(a0),a1 pointer to first sector
lea rdb_data(a1),a2 pointer to map
move.w #$fe,d3 limit of map
moveq #0,d0
rmd_mploop
move.b (a2)+,d0 file number
cmp.b (a2)+,d2 block number
bne.s rmd_mplend ... different
cmp.b d0,d1 file number
beq.s rmd_mpfound ... matches
rmd_mplend
add.w #rdb.len,a1 next actual sector
dbra d3,rmd_mploop
bra.s rmd_mfloop
rmd_mpfound
addq.b #1,d0 file+1
move.w d1,d5 highest file found
cmp.b rdb_id+1(a1),d0 correct?
bne.s rmd_bsect ... no
cmp.b rdb_sect+1(a1),d2 ditto
beq.s rmd_lsect ... yes
rmd_bsect
addq.w #1,d7 one more bad sector
move.b #md.bad,rdb_id+1(a1) set true bad
tst.w d6 last attempt?
bgt.s rmd_lsect ... no
move.b d0,rdb_id+1(a1) ... yes, blotch out the bad sectors
move.b d2,rdb_sect+1(a1)
st rdb_bad(a1) and mark invisble bad
rmd_lsect
addq.w #1,d4 one more sector used
assert rdb_slst,0
move.l a1,(a3) ... yes
move.l a1,a3
bra.s rmd_msloop ... next sector
; bad medium
rmd_bmed
subq.w #1,d6 one fewer attempts
bge.l rmd_retry try again
moveq #err.fmtf,d0 fail, cannot recover
bra.l rmd_done
; bad sectors?
rmd_tsts
tst.w d7 any bad sectors?
beq.s rmd_free ... no
subq.w #1,d6 one fewer attempts
bge.l rmd_retry
; all done if possible, now create free sector linked list
rmd_free
assert rdb_free+rdb.slen,0
lea (a0),a3 free sector linked list
lea rde_offs(a0),a1 first data sector pointer
lea rdb_data(a1),a2 mdv map
moveq #0,d0 free sectors
move.w #rde.mdvs-1,d3 total size (-1)
rmd_frloop
cmp.b #md.map,(a2) map, free or bad?
blo.s rmd_frend ... no
addq.w #1,d0 ... yes, one more free
move.l a1,(a3) link in
move.l a1,a3
rmd_frend
add.w #rdb.len,a1 next sector
addq.w #2,a2 next map entry
dbra d3,rmd_frloop
move.w d0,rdb_fsec+rdb.slen(a0) free sectors
move.l #rde.mdvs+rde.maps,d1 set good
move.l d1,d2 and total
sub.w d7,d1
; move.l d5,d0 highest file number
; lsl.l #6,d0
; move.l rdb.slen+rdb_data+4(a0),a1 first directory sector
; move.l d0,rdb_data(a1) set length
; copy headers into directory
move.l d5,d4 starting at last file
rmd_nhdr
moveq #1,d3 internal files start at 1 (directory)
add.w d4,d3
move.l d3,d0 ... start link pointer
asl.w #2,d0 ... long words
lea rdb.slen+rdb_data(a0,d0.w),a3 in map sector 0
divu #rdb.data,d0
assert rdb_data,$10
lsl.w #4,d0
move.l (a3,d0.w),a3 ... or other sector
move.l d4,d0
ror.l #3,d0 8 files per dir sector
move.l rdb.slen+rdb_data+4(a0),a1 first directory sector
bra.s rmd_hdel
rmd_hdlp
move.l rdb_slst(a1),a1 next dir sector
rmd_hdel
dbra d0,rmd_hdlp
clr.w d0
rol.l #3,d0 file within directory
lsl.w #6,d0 position
lea rdb_data(a1,d0.w),a1
cmp.w d4,d5 last file?
bne.s rmd_lfsect ... no
lea hdr.len(a1),a2
sub.w #rdb.data-hdr.len,d0 - amount left in last directory sector
bge.s rmd_rmls ... none
rmd_clrls
clr.l (a2)+ clear rest of last sector
addq.w #4,d0
blt.s rmd_clrls
rmd_rmls
lea -rdb.len(a2),a2 back to start
move.l (a2),d0 next sector
beq.s rmd_lfsect ... none
clr.l (a2) end of directory
rmd_rmlp
move.l d0,a2
move.l (a2),d0
move.l rdb_free+rdb.slen(a0),(a2)
move.l a2,rdb_free+rdb.slen(a0) ... link into free list
addq.w #1,rdb_fsec+rdb.slen(a0)
tst.l d0 another?
bne.s rmd_rmlp
rmd_lfsect
move.l a1,a2
moveq #hdr.len/4-1,d0
cmp.w rdb_id(a3),d3 the right file?
bne.s rmd_clloop ... no, clear
tst.b rdb_bad(a3) ... yes, bad?
bne.s rmd_bfile ... yes, set bad file
lea rdb_data(a3),a3 ... no, copy
rmd_chloop
move.l (a3)+,(a2)+ copy header
dbra d0,rmd_chloop
move.w d3,hdr_flid-hdr.len(a2) and set file ID
; check for bad file
lea rdb_slst-rdb_data-hdr.len(a3),a3 check file for bad sectors
rmd_bfloop
tst.b rdb_bad-rdb_slst(a3) bad sector?
bne.s rmd_bfile
move.l (a3),d0 another sector?
beq.s rmd_xhdr
move.l d0,a3
bra.s rmd_bfloop ... no
rmd_bfile
add.w #hdr_name,a1 move to name in directory
move.w (a1),d0 length
addq.w #1,(a1)+ ... longer
move.b #'*',(a1,d0.w) set blotch in name
bra.s rmd_xhdr
rmd_clloop
clr.l (a1)+ clear header
dbra d0,rmd_clloop
rmd_xhdr
subq.w #1,d4 previous file
bgt.l rmd_nhdr
moveq #0,d0 all ok
; close down drive
retregs reg d0/d1/d2
rmd_done
movem.l retregs,-(sp) save return regs
move.l #pc_mctrl,a3 set microdrive control reg value
bsr.l deselect
moveq #$ffffff00+%11100111,d0 mask out transmit mode
and.b sv_tmode(a6),d0 ... from composite mode
move.b d0,pc_tctrl-pc_mctrl(a3) ... in peripheral chip
move.b d0,sv_tmode(a6) ... and sysvars
and.w #$f8ff,sr interrupts enabled
movem.l (sp)+,retregs restore return regs
move.l d0,d4 error code
beq.s rmd_exit ... ok
clr.l (a5) clear pointer to RAM disk
moveq #sms.rchp,d0 and return it to heap
trap #1
move.l d4,d0
rmd_exit
rts
page
reglist reg d6/a0/a5
sct.head equ $0e sector header
stk_rtry equ $0e retry word
frame equ $10
stk_d6 equ $10
stk_a0 equ $14
stk_a5 equ $18
read_all
movem.l reglist,-(sp)
moveq #-1,d6 first sector read
dbra d6,* and pause
move.w d6,(sp) smash top half of call d6
sub.w #frame,sp room for sector header and retry
rmr_nsect
move.w #md.retry+md.bdtry,stk_rtry(sp) do not carry on for ever
rmr_bsect
sub.w #md.bdtry,stk_rtry(sp) bad medium ... not so many retries
rmr_rsect
subq.w #1,stk_rtry(sp)
blt.s rmr_exit ... tried too many times
move.w md.sectr,a2 read sector header
move.l sp,a1 onto stack
jsr $4000(a2)
bra.s rmr_bsect ... bad medium
bra.s rmr_rsect ... not a sector header, read next
and.w #$00ff,d7 make sector number a word
move.w stk_d6(sp),d6 first sector
bpl.s rmr_ckend ... already set
move.w d7,stk_d6(sp) ... no, set it
rmr_ckend
cmp.w d7,d6 all sectors read?
beq.s rmr_exit ... done
rmr_saddr
mulu #rdb.len,d7
move.l stk_a0(sp),a0
lea rdb_data+rde_offs(a0),a1
add.l d7,a1 pointer to sector in RAM disk
cmp.b #md.bad,rdb_id+1-rdb_data(a1) already read?
bne.s rmr_nsect ... yes, do next sector
move.w md.read,a2 ... no, read
jsr $4000(a2)
bra.s rmr_nsect ... oops, try next sector
addq.w #1,d1
move.b d1,rdb_id+1-rdb.len(a1) set file
move.b d2,rdb_sect+1-rdb.len(a1) ... and block
bra.s rmr_nsect read next sector
rmr_exit
add.w #frame,sp
movem.l (sp)+,reglist
rts
; select and deselect
select
moveq #%11,d2 clock high / select bit set
subq.w #1,d1
bra.s sel_loop
deselect
moveq #%10,d2 clock high / select bit not set
moveq #7,d1
sel_loop
move.b d2,(a3) clock high
moveq #32,d0 wait
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
and.b #%01,d2 clock low
move.b d2,(a3)
moveq #32,d0 wait
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
ror.l d0,d0 ... 70 cycles (10 us)
moveq #%10,d2 clock high again
dbra d1,sel_loop
rts
end
|
OPTION DOTNAME
.text$ SEGMENT ALIGN(256) 'CODE'
EXTERN OPENSSL_ia32cap_P:NEAR
PUBLIC sha512_block_data_order
ALIGN 16
sha512_block_data_order PROC PUBLIC
mov QWORD PTR[8+rsp],rdi ;WIN64 prologue
mov QWORD PTR[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_sha512_block_data_order::
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rax,rsp
push rbx
push rbp
push r12
push r13
push r14
push r15
shl rdx,4
sub rsp,16*8+4*8
lea rdx,QWORD PTR[rdx*8+rsi]
and rsp,-64
mov QWORD PTR[((128+0))+rsp],rdi
mov QWORD PTR[((128+8))+rsp],rsi
mov QWORD PTR[((128+16))+rsp],rdx
mov QWORD PTR[152+rsp],rax
$L$prologue::
mov rax,QWORD PTR[rdi]
mov rbx,QWORD PTR[8+rdi]
mov rcx,QWORD PTR[16+rdi]
mov rdx,QWORD PTR[24+rdi]
mov r8,QWORD PTR[32+rdi]
mov r9,QWORD PTR[40+rdi]
mov r10,QWORD PTR[48+rdi]
mov r11,QWORD PTR[56+rdi]
jmp $L$loop
ALIGN 16
$L$loop::
mov rdi,rbx
lea rbp,QWORD PTR[K512]
xor rdi,rcx
mov r12,QWORD PTR[rsi]
mov r13,r8
mov r14,rax
bswap r12
ror r13,23
mov r15,r9
xor r13,r8
ror r14,5
xor r15,r10
mov QWORD PTR[rsp],r12
xor r14,rax
and r15,r8
ror r13,4
add r12,r11
xor r15,r10
ror r14,6
xor r13,r8
add r12,r15
mov r15,rax
add r12,QWORD PTR[rbp]
xor r14,rax
xor r15,rbx
ror r13,14
mov r11,rbx
and rdi,r15
ror r14,28
add r12,r13
xor r11,rdi
add rdx,r12
add r11,r12
lea rbp,QWORD PTR[8+rbp]
add r11,r14
mov r12,QWORD PTR[8+rsi]
mov r13,rdx
mov r14,r11
bswap r12
ror r13,23
mov rdi,r8
xor r13,rdx
ror r14,5
xor rdi,r9
mov QWORD PTR[8+rsp],r12
xor r14,r11
and rdi,rdx
ror r13,4
add r12,r10
xor rdi,r9
ror r14,6
xor r13,rdx
add r12,rdi
mov rdi,r11
add r12,QWORD PTR[rbp]
xor r14,r11
xor rdi,rax
ror r13,14
mov r10,rax
and r15,rdi
ror r14,28
add r12,r13
xor r10,r15
add rcx,r12
add r10,r12
lea rbp,QWORD PTR[24+rbp]
add r10,r14
mov r12,QWORD PTR[16+rsi]
mov r13,rcx
mov r14,r10
bswap r12
ror r13,23
mov r15,rdx
xor r13,rcx
ror r14,5
xor r15,r8
mov QWORD PTR[16+rsp],r12
xor r14,r10
and r15,rcx
ror r13,4
add r12,r9
xor r15,r8
ror r14,6
xor r13,rcx
add r12,r15
mov r15,r10
add r12,QWORD PTR[rbp]
xor r14,r10
xor r15,r11
ror r13,14
mov r9,r11
and rdi,r15
ror r14,28
add r12,r13
xor r9,rdi
add rbx,r12
add r9,r12
lea rbp,QWORD PTR[8+rbp]
add r9,r14
mov r12,QWORD PTR[24+rsi]
mov r13,rbx
mov r14,r9
bswap r12
ror r13,23
mov rdi,rcx
xor r13,rbx
ror r14,5
xor rdi,rdx
mov QWORD PTR[24+rsp],r12
xor r14,r9
and rdi,rbx
ror r13,4
add r12,r8
xor rdi,rdx
ror r14,6
xor r13,rbx
add r12,rdi
mov rdi,r9
add r12,QWORD PTR[rbp]
xor r14,r9
xor rdi,r10
ror r13,14
mov r8,r10
and r15,rdi
ror r14,28
add r12,r13
xor r8,r15
add rax,r12
add r8,r12
lea rbp,QWORD PTR[24+rbp]
add r8,r14
mov r12,QWORD PTR[32+rsi]
mov r13,rax
mov r14,r8
bswap r12
ror r13,23
mov r15,rbx
xor r13,rax
ror r14,5
xor r15,rcx
mov QWORD PTR[32+rsp],r12
xor r14,r8
and r15,rax
ror r13,4
add r12,rdx
xor r15,rcx
ror r14,6
xor r13,rax
add r12,r15
mov r15,r8
add r12,QWORD PTR[rbp]
xor r14,r8
xor r15,r9
ror r13,14
mov rdx,r9
and rdi,r15
ror r14,28
add r12,r13
xor rdx,rdi
add r11,r12
add rdx,r12
lea rbp,QWORD PTR[8+rbp]
add rdx,r14
mov r12,QWORD PTR[40+rsi]
mov r13,r11
mov r14,rdx
bswap r12
ror r13,23
mov rdi,rax
xor r13,r11
ror r14,5
xor rdi,rbx
mov QWORD PTR[40+rsp],r12
xor r14,rdx
and rdi,r11
ror r13,4
add r12,rcx
xor rdi,rbx
ror r14,6
xor r13,r11
add r12,rdi
mov rdi,rdx
add r12,QWORD PTR[rbp]
xor r14,rdx
xor rdi,r8
ror r13,14
mov rcx,r8
and r15,rdi
ror r14,28
add r12,r13
xor rcx,r15
add r10,r12
add rcx,r12
lea rbp,QWORD PTR[24+rbp]
add rcx,r14
mov r12,QWORD PTR[48+rsi]
mov r13,r10
mov r14,rcx
bswap r12
ror r13,23
mov r15,r11
xor r13,r10
ror r14,5
xor r15,rax
mov QWORD PTR[48+rsp],r12
xor r14,rcx
and r15,r10
ror r13,4
add r12,rbx
xor r15,rax
ror r14,6
xor r13,r10
add r12,r15
mov r15,rcx
add r12,QWORD PTR[rbp]
xor r14,rcx
xor r15,rdx
ror r13,14
mov rbx,rdx
and rdi,r15
ror r14,28
add r12,r13
xor rbx,rdi
add r9,r12
add rbx,r12
lea rbp,QWORD PTR[8+rbp]
add rbx,r14
mov r12,QWORD PTR[56+rsi]
mov r13,r9
mov r14,rbx
bswap r12
ror r13,23
mov rdi,r10
xor r13,r9
ror r14,5
xor rdi,r11
mov QWORD PTR[56+rsp],r12
xor r14,rbx
and rdi,r9
ror r13,4
add r12,rax
xor rdi,r11
ror r14,6
xor r13,r9
add r12,rdi
mov rdi,rbx
add r12,QWORD PTR[rbp]
xor r14,rbx
xor rdi,rcx
ror r13,14
mov rax,rcx
and r15,rdi
ror r14,28
add r12,r13
xor rax,r15
add r8,r12
add rax,r12
lea rbp,QWORD PTR[24+rbp]
add rax,r14
mov r12,QWORD PTR[64+rsi]
mov r13,r8
mov r14,rax
bswap r12
ror r13,23
mov r15,r9
xor r13,r8
ror r14,5
xor r15,r10
mov QWORD PTR[64+rsp],r12
xor r14,rax
and r15,r8
ror r13,4
add r12,r11
xor r15,r10
ror r14,6
xor r13,r8
add r12,r15
mov r15,rax
add r12,QWORD PTR[rbp]
xor r14,rax
xor r15,rbx
ror r13,14
mov r11,rbx
and rdi,r15
ror r14,28
add r12,r13
xor r11,rdi
add rdx,r12
add r11,r12
lea rbp,QWORD PTR[8+rbp]
add r11,r14
mov r12,QWORD PTR[72+rsi]
mov r13,rdx
mov r14,r11
bswap r12
ror r13,23
mov rdi,r8
xor r13,rdx
ror r14,5
xor rdi,r9
mov QWORD PTR[72+rsp],r12
xor r14,r11
and rdi,rdx
ror r13,4
add r12,r10
xor rdi,r9
ror r14,6
xor r13,rdx
add r12,rdi
mov rdi,r11
add r12,QWORD PTR[rbp]
xor r14,r11
xor rdi,rax
ror r13,14
mov r10,rax
and r15,rdi
ror r14,28
add r12,r13
xor r10,r15
add rcx,r12
add r10,r12
lea rbp,QWORD PTR[24+rbp]
add r10,r14
mov r12,QWORD PTR[80+rsi]
mov r13,rcx
mov r14,r10
bswap r12
ror r13,23
mov r15,rdx
xor r13,rcx
ror r14,5
xor r15,r8
mov QWORD PTR[80+rsp],r12
xor r14,r10
and r15,rcx
ror r13,4
add r12,r9
xor r15,r8
ror r14,6
xor r13,rcx
add r12,r15
mov r15,r10
add r12,QWORD PTR[rbp]
xor r14,r10
xor r15,r11
ror r13,14
mov r9,r11
and rdi,r15
ror r14,28
add r12,r13
xor r9,rdi
add rbx,r12
add r9,r12
lea rbp,QWORD PTR[8+rbp]
add r9,r14
mov r12,QWORD PTR[88+rsi]
mov r13,rbx
mov r14,r9
bswap r12
ror r13,23
mov rdi,rcx
xor r13,rbx
ror r14,5
xor rdi,rdx
mov QWORD PTR[88+rsp],r12
xor r14,r9
and rdi,rbx
ror r13,4
add r12,r8
xor rdi,rdx
ror r14,6
xor r13,rbx
add r12,rdi
mov rdi,r9
add r12,QWORD PTR[rbp]
xor r14,r9
xor rdi,r10
ror r13,14
mov r8,r10
and r15,rdi
ror r14,28
add r12,r13
xor r8,r15
add rax,r12
add r8,r12
lea rbp,QWORD PTR[24+rbp]
add r8,r14
mov r12,QWORD PTR[96+rsi]
mov r13,rax
mov r14,r8
bswap r12
ror r13,23
mov r15,rbx
xor r13,rax
ror r14,5
xor r15,rcx
mov QWORD PTR[96+rsp],r12
xor r14,r8
and r15,rax
ror r13,4
add r12,rdx
xor r15,rcx
ror r14,6
xor r13,rax
add r12,r15
mov r15,r8
add r12,QWORD PTR[rbp]
xor r14,r8
xor r15,r9
ror r13,14
mov rdx,r9
and rdi,r15
ror r14,28
add r12,r13
xor rdx,rdi
add r11,r12
add rdx,r12
lea rbp,QWORD PTR[8+rbp]
add rdx,r14
mov r12,QWORD PTR[104+rsi]
mov r13,r11
mov r14,rdx
bswap r12
ror r13,23
mov rdi,rax
xor r13,r11
ror r14,5
xor rdi,rbx
mov QWORD PTR[104+rsp],r12
xor r14,rdx
and rdi,r11
ror r13,4
add r12,rcx
xor rdi,rbx
ror r14,6
xor r13,r11
add r12,rdi
mov rdi,rdx
add r12,QWORD PTR[rbp]
xor r14,rdx
xor rdi,r8
ror r13,14
mov rcx,r8
and r15,rdi
ror r14,28
add r12,r13
xor rcx,r15
add r10,r12
add rcx,r12
lea rbp,QWORD PTR[24+rbp]
add rcx,r14
mov r12,QWORD PTR[112+rsi]
mov r13,r10
mov r14,rcx
bswap r12
ror r13,23
mov r15,r11
xor r13,r10
ror r14,5
xor r15,rax
mov QWORD PTR[112+rsp],r12
xor r14,rcx
and r15,r10
ror r13,4
add r12,rbx
xor r15,rax
ror r14,6
xor r13,r10
add r12,r15
mov r15,rcx
add r12,QWORD PTR[rbp]
xor r14,rcx
xor r15,rdx
ror r13,14
mov rbx,rdx
and rdi,r15
ror r14,28
add r12,r13
xor rbx,rdi
add r9,r12
add rbx,r12
lea rbp,QWORD PTR[8+rbp]
add rbx,r14
mov r12,QWORD PTR[120+rsi]
mov r13,r9
mov r14,rbx
bswap r12
ror r13,23
mov rdi,r10
xor r13,r9
ror r14,5
xor rdi,r11
mov QWORD PTR[120+rsp],r12
xor r14,rbx
and rdi,r9
ror r13,4
add r12,rax
xor rdi,r11
ror r14,6
xor r13,r9
add r12,rdi
mov rdi,rbx
add r12,QWORD PTR[rbp]
xor r14,rbx
xor rdi,rcx
ror r13,14
mov rax,rcx
and r15,rdi
ror r14,28
add r12,r13
xor rax,r15
add r8,r12
add rax,r12
lea rbp,QWORD PTR[24+rbp]
jmp $L$rounds_16_xx
ALIGN 16
$L$rounds_16_xx::
mov r13,QWORD PTR[8+rsp]
mov r15,QWORD PTR[112+rsp]
mov r12,r13
ror r13,7
add rax,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[72+rsp]
add r12,QWORD PTR[rsp]
mov r13,r8
add r12,r15
mov r14,rax
ror r13,23
mov r15,r9
xor r13,r8
ror r14,5
xor r15,r10
mov QWORD PTR[rsp],r12
xor r14,rax
and r15,r8
ror r13,4
add r12,r11
xor r15,r10
ror r14,6
xor r13,r8
add r12,r15
mov r15,rax
add r12,QWORD PTR[rbp]
xor r14,rax
xor r15,rbx
ror r13,14
mov r11,rbx
and rdi,r15
ror r14,28
add r12,r13
xor r11,rdi
add rdx,r12
add r11,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[16+rsp]
mov rdi,QWORD PTR[120+rsp]
mov r12,r13
ror r13,7
add r11,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[80+rsp]
add r12,QWORD PTR[8+rsp]
mov r13,rdx
add r12,rdi
mov r14,r11
ror r13,23
mov rdi,r8
xor r13,rdx
ror r14,5
xor rdi,r9
mov QWORD PTR[8+rsp],r12
xor r14,r11
and rdi,rdx
ror r13,4
add r12,r10
xor rdi,r9
ror r14,6
xor r13,rdx
add r12,rdi
mov rdi,r11
add r12,QWORD PTR[rbp]
xor r14,r11
xor rdi,rax
ror r13,14
mov r10,rax
and r15,rdi
ror r14,28
add r12,r13
xor r10,r15
add rcx,r12
add r10,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[24+rsp]
mov r15,QWORD PTR[rsp]
mov r12,r13
ror r13,7
add r10,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[88+rsp]
add r12,QWORD PTR[16+rsp]
mov r13,rcx
add r12,r15
mov r14,r10
ror r13,23
mov r15,rdx
xor r13,rcx
ror r14,5
xor r15,r8
mov QWORD PTR[16+rsp],r12
xor r14,r10
and r15,rcx
ror r13,4
add r12,r9
xor r15,r8
ror r14,6
xor r13,rcx
add r12,r15
mov r15,r10
add r12,QWORD PTR[rbp]
xor r14,r10
xor r15,r11
ror r13,14
mov r9,r11
and rdi,r15
ror r14,28
add r12,r13
xor r9,rdi
add rbx,r12
add r9,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[32+rsp]
mov rdi,QWORD PTR[8+rsp]
mov r12,r13
ror r13,7
add r9,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[96+rsp]
add r12,QWORD PTR[24+rsp]
mov r13,rbx
add r12,rdi
mov r14,r9
ror r13,23
mov rdi,rcx
xor r13,rbx
ror r14,5
xor rdi,rdx
mov QWORD PTR[24+rsp],r12
xor r14,r9
and rdi,rbx
ror r13,4
add r12,r8
xor rdi,rdx
ror r14,6
xor r13,rbx
add r12,rdi
mov rdi,r9
add r12,QWORD PTR[rbp]
xor r14,r9
xor rdi,r10
ror r13,14
mov r8,r10
and r15,rdi
ror r14,28
add r12,r13
xor r8,r15
add rax,r12
add r8,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[40+rsp]
mov r15,QWORD PTR[16+rsp]
mov r12,r13
ror r13,7
add r8,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[104+rsp]
add r12,QWORD PTR[32+rsp]
mov r13,rax
add r12,r15
mov r14,r8
ror r13,23
mov r15,rbx
xor r13,rax
ror r14,5
xor r15,rcx
mov QWORD PTR[32+rsp],r12
xor r14,r8
and r15,rax
ror r13,4
add r12,rdx
xor r15,rcx
ror r14,6
xor r13,rax
add r12,r15
mov r15,r8
add r12,QWORD PTR[rbp]
xor r14,r8
xor r15,r9
ror r13,14
mov rdx,r9
and rdi,r15
ror r14,28
add r12,r13
xor rdx,rdi
add r11,r12
add rdx,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[48+rsp]
mov rdi,QWORD PTR[24+rsp]
mov r12,r13
ror r13,7
add rdx,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[112+rsp]
add r12,QWORD PTR[40+rsp]
mov r13,r11
add r12,rdi
mov r14,rdx
ror r13,23
mov rdi,rax
xor r13,r11
ror r14,5
xor rdi,rbx
mov QWORD PTR[40+rsp],r12
xor r14,rdx
and rdi,r11
ror r13,4
add r12,rcx
xor rdi,rbx
ror r14,6
xor r13,r11
add r12,rdi
mov rdi,rdx
add r12,QWORD PTR[rbp]
xor r14,rdx
xor rdi,r8
ror r13,14
mov rcx,r8
and r15,rdi
ror r14,28
add r12,r13
xor rcx,r15
add r10,r12
add rcx,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[56+rsp]
mov r15,QWORD PTR[32+rsp]
mov r12,r13
ror r13,7
add rcx,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[120+rsp]
add r12,QWORD PTR[48+rsp]
mov r13,r10
add r12,r15
mov r14,rcx
ror r13,23
mov r15,r11
xor r13,r10
ror r14,5
xor r15,rax
mov QWORD PTR[48+rsp],r12
xor r14,rcx
and r15,r10
ror r13,4
add r12,rbx
xor r15,rax
ror r14,6
xor r13,r10
add r12,r15
mov r15,rcx
add r12,QWORD PTR[rbp]
xor r14,rcx
xor r15,rdx
ror r13,14
mov rbx,rdx
and rdi,r15
ror r14,28
add r12,r13
xor rbx,rdi
add r9,r12
add rbx,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[64+rsp]
mov rdi,QWORD PTR[40+rsp]
mov r12,r13
ror r13,7
add rbx,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[rsp]
add r12,QWORD PTR[56+rsp]
mov r13,r9
add r12,rdi
mov r14,rbx
ror r13,23
mov rdi,r10
xor r13,r9
ror r14,5
xor rdi,r11
mov QWORD PTR[56+rsp],r12
xor r14,rbx
and rdi,r9
ror r13,4
add r12,rax
xor rdi,r11
ror r14,6
xor r13,r9
add r12,rdi
mov rdi,rbx
add r12,QWORD PTR[rbp]
xor r14,rbx
xor rdi,rcx
ror r13,14
mov rax,rcx
and r15,rdi
ror r14,28
add r12,r13
xor rax,r15
add r8,r12
add rax,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[72+rsp]
mov r15,QWORD PTR[48+rsp]
mov r12,r13
ror r13,7
add rax,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[8+rsp]
add r12,QWORD PTR[64+rsp]
mov r13,r8
add r12,r15
mov r14,rax
ror r13,23
mov r15,r9
xor r13,r8
ror r14,5
xor r15,r10
mov QWORD PTR[64+rsp],r12
xor r14,rax
and r15,r8
ror r13,4
add r12,r11
xor r15,r10
ror r14,6
xor r13,r8
add r12,r15
mov r15,rax
add r12,QWORD PTR[rbp]
xor r14,rax
xor r15,rbx
ror r13,14
mov r11,rbx
and rdi,r15
ror r14,28
add r12,r13
xor r11,rdi
add rdx,r12
add r11,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[80+rsp]
mov rdi,QWORD PTR[56+rsp]
mov r12,r13
ror r13,7
add r11,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[16+rsp]
add r12,QWORD PTR[72+rsp]
mov r13,rdx
add r12,rdi
mov r14,r11
ror r13,23
mov rdi,r8
xor r13,rdx
ror r14,5
xor rdi,r9
mov QWORD PTR[72+rsp],r12
xor r14,r11
and rdi,rdx
ror r13,4
add r12,r10
xor rdi,r9
ror r14,6
xor r13,rdx
add r12,rdi
mov rdi,r11
add r12,QWORD PTR[rbp]
xor r14,r11
xor rdi,rax
ror r13,14
mov r10,rax
and r15,rdi
ror r14,28
add r12,r13
xor r10,r15
add rcx,r12
add r10,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[88+rsp]
mov r15,QWORD PTR[64+rsp]
mov r12,r13
ror r13,7
add r10,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[24+rsp]
add r12,QWORD PTR[80+rsp]
mov r13,rcx
add r12,r15
mov r14,r10
ror r13,23
mov r15,rdx
xor r13,rcx
ror r14,5
xor r15,r8
mov QWORD PTR[80+rsp],r12
xor r14,r10
and r15,rcx
ror r13,4
add r12,r9
xor r15,r8
ror r14,6
xor r13,rcx
add r12,r15
mov r15,r10
add r12,QWORD PTR[rbp]
xor r14,r10
xor r15,r11
ror r13,14
mov r9,r11
and rdi,r15
ror r14,28
add r12,r13
xor r9,rdi
add rbx,r12
add r9,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[96+rsp]
mov rdi,QWORD PTR[72+rsp]
mov r12,r13
ror r13,7
add r9,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[32+rsp]
add r12,QWORD PTR[88+rsp]
mov r13,rbx
add r12,rdi
mov r14,r9
ror r13,23
mov rdi,rcx
xor r13,rbx
ror r14,5
xor rdi,rdx
mov QWORD PTR[88+rsp],r12
xor r14,r9
and rdi,rbx
ror r13,4
add r12,r8
xor rdi,rdx
ror r14,6
xor r13,rbx
add r12,rdi
mov rdi,r9
add r12,QWORD PTR[rbp]
xor r14,r9
xor rdi,r10
ror r13,14
mov r8,r10
and r15,rdi
ror r14,28
add r12,r13
xor r8,r15
add rax,r12
add r8,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[104+rsp]
mov r15,QWORD PTR[80+rsp]
mov r12,r13
ror r13,7
add r8,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[40+rsp]
add r12,QWORD PTR[96+rsp]
mov r13,rax
add r12,r15
mov r14,r8
ror r13,23
mov r15,rbx
xor r13,rax
ror r14,5
xor r15,rcx
mov QWORD PTR[96+rsp],r12
xor r14,r8
and r15,rax
ror r13,4
add r12,rdx
xor r15,rcx
ror r14,6
xor r13,rax
add r12,r15
mov r15,r8
add r12,QWORD PTR[rbp]
xor r14,r8
xor r15,r9
ror r13,14
mov rdx,r9
and rdi,r15
ror r14,28
add r12,r13
xor rdx,rdi
add r11,r12
add rdx,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[112+rsp]
mov rdi,QWORD PTR[88+rsp]
mov r12,r13
ror r13,7
add rdx,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[48+rsp]
add r12,QWORD PTR[104+rsp]
mov r13,r11
add r12,rdi
mov r14,rdx
ror r13,23
mov rdi,rax
xor r13,r11
ror r14,5
xor rdi,rbx
mov QWORD PTR[104+rsp],r12
xor r14,rdx
and rdi,r11
ror r13,4
add r12,rcx
xor rdi,rbx
ror r14,6
xor r13,r11
add r12,rdi
mov rdi,rdx
add r12,QWORD PTR[rbp]
xor r14,rdx
xor rdi,r8
ror r13,14
mov rcx,r8
and r15,rdi
ror r14,28
add r12,r13
xor rcx,r15
add r10,r12
add rcx,r12
lea rbp,QWORD PTR[24+rbp]
mov r13,QWORD PTR[120+rsp]
mov r15,QWORD PTR[96+rsp]
mov r12,r13
ror r13,7
add rcx,r14
mov r14,r15
ror r15,42
xor r13,r12
shr r12,7
ror r13,1
xor r15,r14
shr r14,6
ror r15,19
xor r12,r13
xor r15,r14
add r12,QWORD PTR[56+rsp]
add r12,QWORD PTR[112+rsp]
mov r13,r10
add r12,r15
mov r14,rcx
ror r13,23
mov r15,r11
xor r13,r10
ror r14,5
xor r15,rax
mov QWORD PTR[112+rsp],r12
xor r14,rcx
and r15,r10
ror r13,4
add r12,rbx
xor r15,rax
ror r14,6
xor r13,r10
add r12,r15
mov r15,rcx
add r12,QWORD PTR[rbp]
xor r14,rcx
xor r15,rdx
ror r13,14
mov rbx,rdx
and rdi,r15
ror r14,28
add r12,r13
xor rbx,rdi
add r9,r12
add rbx,r12
lea rbp,QWORD PTR[8+rbp]
mov r13,QWORD PTR[rsp]
mov rdi,QWORD PTR[104+rsp]
mov r12,r13
ror r13,7
add rbx,r14
mov r14,rdi
ror rdi,42
xor r13,r12
shr r12,7
ror r13,1
xor rdi,r14
shr r14,6
ror rdi,19
xor r12,r13
xor rdi,r14
add r12,QWORD PTR[64+rsp]
add r12,QWORD PTR[120+rsp]
mov r13,r9
add r12,rdi
mov r14,rbx
ror r13,23
mov rdi,r10
xor r13,r9
ror r14,5
xor rdi,r11
mov QWORD PTR[120+rsp],r12
xor r14,rbx
and rdi,r9
ror r13,4
add r12,rax
xor rdi,r11
ror r14,6
xor r13,r9
add r12,rdi
mov rdi,rbx
add r12,QWORD PTR[rbp]
xor r14,rbx
xor rdi,rcx
ror r13,14
mov rax,rcx
and r15,rdi
ror r14,28
add r12,r13
xor rax,r15
add r8,r12
add rax,r12
lea rbp,QWORD PTR[24+rbp]
cmp BYTE PTR[7+rbp],0
jnz $L$rounds_16_xx
mov rdi,QWORD PTR[((128+0))+rsp]
add rax,r14
lea rsi,QWORD PTR[128+rsi]
add rax,QWORD PTR[rdi]
add rbx,QWORD PTR[8+rdi]
add rcx,QWORD PTR[16+rdi]
add rdx,QWORD PTR[24+rdi]
add r8,QWORD PTR[32+rdi]
add r9,QWORD PTR[40+rdi]
add r10,QWORD PTR[48+rdi]
add r11,QWORD PTR[56+rdi]
cmp rsi,QWORD PTR[((128+16))+rsp]
mov QWORD PTR[rdi],rax
mov QWORD PTR[8+rdi],rbx
mov QWORD PTR[16+rdi],rcx
mov QWORD PTR[24+rdi],rdx
mov QWORD PTR[32+rdi],r8
mov QWORD PTR[40+rdi],r9
mov QWORD PTR[48+rdi],r10
mov QWORD PTR[56+rdi],r11
jb $L$loop
mov rsi,QWORD PTR[152+rsp]
mov r15,QWORD PTR[((-48))+rsi]
mov r14,QWORD PTR[((-40))+rsi]
mov r13,QWORD PTR[((-32))+rsi]
mov r12,QWORD PTR[((-24))+rsi]
mov rbp,QWORD PTR[((-16))+rsi]
mov rbx,QWORD PTR[((-8))+rsi]
lea rsp,QWORD PTR[rsi]
$L$epilogue::
mov rdi,QWORD PTR[8+rsp] ;WIN64 epilogue
mov rsi,QWORD PTR[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_sha512_block_data_order::
sha512_block_data_order ENDP
ALIGN 64
K512::
DQ 0428a2f98d728ae22h,07137449123ef65cdh
DQ 0428a2f98d728ae22h,07137449123ef65cdh
DQ 0b5c0fbcfec4d3b2fh,0e9b5dba58189dbbch
DQ 0b5c0fbcfec4d3b2fh,0e9b5dba58189dbbch
DQ 03956c25bf348b538h,059f111f1b605d019h
DQ 03956c25bf348b538h,059f111f1b605d019h
DQ 0923f82a4af194f9bh,0ab1c5ed5da6d8118h
DQ 0923f82a4af194f9bh,0ab1c5ed5da6d8118h
DQ 0d807aa98a3030242h,012835b0145706fbeh
DQ 0d807aa98a3030242h,012835b0145706fbeh
DQ 0243185be4ee4b28ch,0550c7dc3d5ffb4e2h
DQ 0243185be4ee4b28ch,0550c7dc3d5ffb4e2h
DQ 072be5d74f27b896fh,080deb1fe3b1696b1h
DQ 072be5d74f27b896fh,080deb1fe3b1696b1h
DQ 09bdc06a725c71235h,0c19bf174cf692694h
DQ 09bdc06a725c71235h,0c19bf174cf692694h
DQ 0e49b69c19ef14ad2h,0efbe4786384f25e3h
DQ 0e49b69c19ef14ad2h,0efbe4786384f25e3h
DQ 00fc19dc68b8cd5b5h,0240ca1cc77ac9c65h
DQ 00fc19dc68b8cd5b5h,0240ca1cc77ac9c65h
DQ 02de92c6f592b0275h,04a7484aa6ea6e483h
DQ 02de92c6f592b0275h,04a7484aa6ea6e483h
DQ 05cb0a9dcbd41fbd4h,076f988da831153b5h
DQ 05cb0a9dcbd41fbd4h,076f988da831153b5h
DQ 0983e5152ee66dfabh,0a831c66d2db43210h
DQ 0983e5152ee66dfabh,0a831c66d2db43210h
DQ 0b00327c898fb213fh,0bf597fc7beef0ee4h
DQ 0b00327c898fb213fh,0bf597fc7beef0ee4h
DQ 0c6e00bf33da88fc2h,0d5a79147930aa725h
DQ 0c6e00bf33da88fc2h,0d5a79147930aa725h
DQ 006ca6351e003826fh,0142929670a0e6e70h
DQ 006ca6351e003826fh,0142929670a0e6e70h
DQ 027b70a8546d22ffch,02e1b21385c26c926h
DQ 027b70a8546d22ffch,02e1b21385c26c926h
DQ 04d2c6dfc5ac42aedh,053380d139d95b3dfh
DQ 04d2c6dfc5ac42aedh,053380d139d95b3dfh
DQ 0650a73548baf63deh,0766a0abb3c77b2a8h
DQ 0650a73548baf63deh,0766a0abb3c77b2a8h
DQ 081c2c92e47edaee6h,092722c851482353bh
DQ 081c2c92e47edaee6h,092722c851482353bh
DQ 0a2bfe8a14cf10364h,0a81a664bbc423001h
DQ 0a2bfe8a14cf10364h,0a81a664bbc423001h
DQ 0c24b8b70d0f89791h,0c76c51a30654be30h
DQ 0c24b8b70d0f89791h,0c76c51a30654be30h
DQ 0d192e819d6ef5218h,0d69906245565a910h
DQ 0d192e819d6ef5218h,0d69906245565a910h
DQ 0f40e35855771202ah,0106aa07032bbd1b8h
DQ 0f40e35855771202ah,0106aa07032bbd1b8h
DQ 019a4c116b8d2d0c8h,01e376c085141ab53h
DQ 019a4c116b8d2d0c8h,01e376c085141ab53h
DQ 02748774cdf8eeb99h,034b0bcb5e19b48a8h
DQ 02748774cdf8eeb99h,034b0bcb5e19b48a8h
DQ 0391c0cb3c5c95a63h,04ed8aa4ae3418acbh
DQ 0391c0cb3c5c95a63h,04ed8aa4ae3418acbh
DQ 05b9cca4f7763e373h,0682e6ff3d6b2b8a3h
DQ 05b9cca4f7763e373h,0682e6ff3d6b2b8a3h
DQ 0748f82ee5defb2fch,078a5636f43172f60h
DQ 0748f82ee5defb2fch,078a5636f43172f60h
DQ 084c87814a1f0ab72h,08cc702081a6439ech
DQ 084c87814a1f0ab72h,08cc702081a6439ech
DQ 090befffa23631e28h,0a4506cebde82bde9h
DQ 090befffa23631e28h,0a4506cebde82bde9h
DQ 0bef9a3f7b2c67915h,0c67178f2e372532bh
DQ 0bef9a3f7b2c67915h,0c67178f2e372532bh
DQ 0ca273eceea26619ch,0d186b8c721c0c207h
DQ 0ca273eceea26619ch,0d186b8c721c0c207h
DQ 0eada7dd6cde0eb1eh,0f57d4f7fee6ed178h
DQ 0eada7dd6cde0eb1eh,0f57d4f7fee6ed178h
DQ 006f067aa72176fbah,00a637dc5a2c898a6h
DQ 006f067aa72176fbah,00a637dc5a2c898a6h
DQ 0113f9804bef90daeh,01b710b35131c471bh
DQ 0113f9804bef90daeh,01b710b35131c471bh
DQ 028db77f523047d84h,032caab7b40c72493h
DQ 028db77f523047d84h,032caab7b40c72493h
DQ 03c9ebe0a15c9bebch,0431d67c49c100d4ch
DQ 03c9ebe0a15c9bebch,0431d67c49c100d4ch
DQ 04cc5d4becb3e42b6h,0597f299cfc657e2ah
DQ 04cc5d4becb3e42b6h,0597f299cfc657e2ah
DQ 05fcb6fab3ad6faech,06c44198c4a475817h
DQ 05fcb6fab3ad6faech,06c44198c4a475817h
DQ 00001020304050607h,008090a0b0c0d0e0fh
DQ 00001020304050607h,008090a0b0c0d0e0fh
DB 83,72,65,53,49,50,32,98,108,111,99,107,32,116,114,97
DB 110,115,102,111,114,109,32,102,111,114,32,120,56,54,95,54
DB 52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
DB 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
DB 111,114,103,62,0
EXTERN __imp_RtlVirtualUnwind:NEAR
ALIGN 16
se_handler PROC PRIVATE
push rsi
push rdi
push rbx
push rbp
push r12
push r13
push r14
push r15
pushfq
sub rsp,64
mov rax,QWORD PTR[120+r8]
mov rbx,QWORD PTR[248+r8]
mov rsi,QWORD PTR[8+r9]
mov r11,QWORD PTR[56+r9]
mov r10d,DWORD PTR[r11]
lea r10,QWORD PTR[r10*1+rsi]
cmp rbx,r10
jb $L$in_prologue
mov rax,QWORD PTR[152+r8]
mov r10d,DWORD PTR[4+r11]
lea r10,QWORD PTR[r10*1+rsi]
cmp rbx,r10
jae $L$in_prologue
mov rsi,rax
mov rax,QWORD PTR[((128+24))+rax]
mov rbx,QWORD PTR[((-8))+rax]
mov rbp,QWORD PTR[((-16))+rax]
mov r12,QWORD PTR[((-24))+rax]
mov r13,QWORD PTR[((-32))+rax]
mov r14,QWORD PTR[((-40))+rax]
mov r15,QWORD PTR[((-48))+rax]
mov QWORD PTR[144+r8],rbx
mov QWORD PTR[160+r8],rbp
mov QWORD PTR[216+r8],r12
mov QWORD PTR[224+r8],r13
mov QWORD PTR[232+r8],r14
mov QWORD PTR[240+r8],r15
lea r10,QWORD PTR[$L$epilogue]
cmp rbx,r10
jb $L$in_prologue
lea rsi,QWORD PTR[((128+32))+rsi]
lea rdi,QWORD PTR[512+r8]
mov ecx,12
DD 0a548f3fch
$L$in_prologue::
mov rdi,QWORD PTR[8+rax]
mov rsi,QWORD PTR[16+rax]
mov QWORD PTR[152+r8],rax
mov QWORD PTR[168+r8],rsi
mov QWORD PTR[176+r8],rdi
mov rdi,QWORD PTR[40+r9]
mov rsi,r8
mov ecx,154
DD 0a548f3fch
mov rsi,r9
xor rcx,rcx
mov rdx,QWORD PTR[8+rsi]
mov r8,QWORD PTR[rsi]
mov r9,QWORD PTR[16+rsi]
mov r10,QWORD PTR[40+rsi]
lea r11,QWORD PTR[56+rsi]
lea r12,QWORD PTR[24+rsi]
mov QWORD PTR[32+rsp],r10
mov QWORD PTR[40+rsp],r11
mov QWORD PTR[48+rsp],r12
mov QWORD PTR[56+rsp],rcx
call QWORD PTR[__imp_RtlVirtualUnwind]
mov eax,1
add rsp,64
popfq
pop r15
pop r14
pop r13
pop r12
pop rbp
pop rbx
pop rdi
pop rsi
DB 0F3h,0C3h ;repret
se_handler ENDP
.text$ ENDS
.pdata SEGMENT READONLY ALIGN(4)
ALIGN 4
DD imagerel $L$SEH_begin_sha512_block_data_order
DD imagerel $L$SEH_end_sha512_block_data_order
DD imagerel $L$SEH_info_sha512_block_data_order
.pdata ENDS
.xdata SEGMENT READONLY ALIGN(8)
ALIGN 8
$L$SEH_info_sha512_block_data_order::
DB 9,0,0,0
DD imagerel se_handler
DD imagerel $L$prologue,imagerel $L$epilogue
.xdata ENDS
END
|
; A190843: [2ne]-2[ne], where [ ]=floor.
; 1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1
mov $2,1
sub $2,$0
mul $0,3
add $0,$2
cal $0,572 ; A Beatty sequence: [ n(e+1) ].
mod $0,2
mov $1,$0
|
#note: r40 (the exception handler) and r46 (the start of usermode code) must
#be specified in hex (0xwhatever)
#I just don't see any reason not to, and it makes programming the script
#much nicer to deal with...
#load exception handler
lc r40, 0x80000050
leh r40
#enable exceptions
cle
#load TLB entries
#virtual page 0 is for instructions
#virtual page 1 is for data
lc r46, 0x0000005c #usermode start address
lc r47, 1 #interrupts off
lc r48, 1 #in user mode
lc r42, 0x00000000 #denotes VPN 0
lc r43, 0x0000000d #denotes VPN 0 maps to physical page 0
#and is fetchable, readable, and valid
tlbse r0, r42 #load into entry 0
lc r42, 0x00001000 #denotes VPN 1
lc r43, 0x0000101e #denotes VPN 1 maps to physical page 1
#and is readable, writable, valid, and dirty
#(dirty to prevent taking a
#read-only exception)
tlbse r48, r42 #load into entry 1
#this last tlb entry is designed to produce a bus error
lc r44, 2 #load into TLB entry 2
lc r42, 0x3fffe000 #denotes VPN 0x3fffe
lc r43, 0x3fffe01f #map VPN 0x3fffe to page 0x3fffe
#and is readable, writable, valid, and dirty
#(dirty to prevent taking a
#read-only exception)
tlbse r44, r42
#warp to user mode
rfe r46, r47, r48
#handle exceptions
lc r49, 0xdeadbeef
halt #or rather don't =)
lc r30, 1
bnz r30, k2, r30
trap
#@expected values
#e3 = 0x000000a0
#mode = S
#interrupts = off
#exceptions = off
#r40 = 0x80000050
#r46 = 0x0000005c
#r47 = 1
#r48 = 1
#r42 = 0x3fffe000
#r43 = 0x3fffe01f
#r44 = 2
#r49 = 0xdeadbeef
#pc = 0x8000005c
#e0 = 0x00000060
#e2 = 0x00000060
#e1 = 0x00000001
#tlb 0:
# vpn = 0x00000
# os = 0x000
# ppn = 0x00000
# at = 0x00d
#tlb 1:
# vpn = 0x00001
# os = 0x000
# ppn = 0x00001
# at = 0x01e
#tlb 2:
# vpn = 0x3fffe
# os = 0x000
# ppn = 0x3fffe
# at = 0x01f
|
/*
Copyright (c) 2005-2019 Intel Corporation
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.
*/
#if _MSC_VER && !defined(__INTEL_COMPILER)
#pragma warning(disable: 4180) // "qualifier applied to function type has no meaning; ignored"
#endif
#ifndef TBB_PREVIEW_VARIADIC_PARALLEL_INVOKE
#define TBB_PREVIEW_VARIADIC_PARALLEL_INVOKE __TBB_CPF_BUILD
#endif
#include "tbb/parallel_invoke.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/atomic.h"
#include "tbb/tbb_exception.h"
#include "harness.h"
#if !__INTEL_COMPILER && (_MSC_VER && _MSC_VER <= 1400 || __GNUC__==3 && __GNUC_MINOR__<=3 || __SUNPRO_CC)
#define __TBB_FUNCTION_BY_CONSTREF_IN_TEMPLATE_BROKEN 1
#endif
tbb::atomic<size_t> function_counter;
// Some macros to make the test easier to read
// 10 functions test0 ... test9 are defined
// pointer to each function is also defined
#define TEST_FUNCTION(value) void test##value () \
{ \
ASSERT(!(function_counter & (1 << value)), "Test function has already been called"); \
function_counter += 1 << value; \
} \
void (*test_pointer##value)(void) = test##value;
TEST_FUNCTION(0)
TEST_FUNCTION(1)
TEST_FUNCTION(2)
TEST_FUNCTION(3)
TEST_FUNCTION(4)
TEST_FUNCTION(5)
TEST_FUNCTION(6)
TEST_FUNCTION(7)
TEST_FUNCTION(8)
TEST_FUNCTION(9)
// The same with functors
#define TEST_FUNCTOR(value) class test_functor##value \
{ \
public: \
void operator() () const { \
function_counter += 1 << value; \
} \
} functor##value;
TEST_FUNCTOR(0)
TEST_FUNCTOR(1)
TEST_FUNCTOR(2)
TEST_FUNCTOR(3)
TEST_FUNCTOR(4)
TEST_FUNCTOR(5)
TEST_FUNCTOR(6)
TEST_FUNCTOR(7)
TEST_FUNCTOR(8)
TEST_FUNCTOR(9)
#define INIT_TEST function_counter = 0;
#define VALIDATE_INVOKE_RUN(number_of_args, test_type) \
ASSERT( size_t(function_counter) == (size_t(1) << number_of_args) - 1, "parallel_invoke called with " #number_of_args " arguments didn't process all " #test_type);
// Calls parallel_invoke for different number of arguments
// It can be called with and without user context
template <typename F0, typename F1, typename F2, typename F3, typename F4, typename F5,
typename F6, typename F7, typename F8, typename F9>
void call_parallel_invoke( size_t n, F0& f0, F1& f1, F2& f2, F3& f3, F4 &f4, F5 &f5,
F6& f6, F7 &f7, F8 &f8, F9 &f9, tbb::task_group_context* context) {
switch(n) {
case 2:
if (context)
tbb::parallel_invoke (f0, f1, *context);
else
tbb::parallel_invoke (f0, f1);
break;
case 3:
if (context)
tbb::parallel_invoke (f0, f1, f2, *context);
else
tbb::parallel_invoke (f0, f1, f2);
break;
case 4:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3);
break;
case 5:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4);
break;
case 6:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5);
break;
case 7:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6);
break;
case 8:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7);
break;
case 9:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8);
break;
case 10:
if(context)
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, *context);
else
tbb::parallel_invoke (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9);
break;
default:
ASSERT(false, "number of arguments must be between 2 and 10");
}
}
#if !__TBB_FUNCTION_BY_CONSTREF_IN_TEMPLATE_BROKEN
template<typename function> void aux_invoke(const function& f) {
f();
}
bool function_by_constref_in_template_codegen_broken() {
function_counter = 0;
aux_invoke(test1);
return function_counter==0;
}
#endif /* !__TBB_FUNCTION_BY_CONSTREF_IN_TEMPLATE_BROKEN */
void test_parallel_invoke()
{
REMARK (__FUNCTION__);
// Testing with pointers to functions
for (int n = 2; n <=10; n++)
{
INIT_TEST;
call_parallel_invoke(n, test_pointer0, test_pointer1, test_pointer2, test_pointer3, test_pointer4,
test_pointer5, test_pointer6, test_pointer7, test_pointer8, test_pointer9, NULL);
VALIDATE_INVOKE_RUN(n, "pointers to function");
}
// Testing parallel_invoke with functors
for (int n = 2; n <=10; n++)
{
INIT_TEST;
call_parallel_invoke(n, functor0, functor1, functor2, functor3, functor4,
functor5, functor6, functor7, functor8, functor9, NULL);
VALIDATE_INVOKE_RUN(n, "functors");
}
#if __TBB_FUNCTION_BY_CONSTREF_IN_TEMPLATE_BROKEN
// some old compilers can't cope with passing function name into parallel_invoke
#else
// and some compile but generate broken code that does not call the function
if (function_by_constref_in_template_codegen_broken())
return;
// Testing parallel_invoke with functions
for (int n = 2; n <=10; n++)
{
INIT_TEST;
call_parallel_invoke(n, test0, test1, test2, test3, test4, test5, test6, test7, test8, test9, NULL);
VALIDATE_INVOKE_RUN(n, "functions");
}
#endif
}
// Exception handling support test
#if __TBB_TASK_GROUP_CONTEXT
#define HARNESS_EH_SIMPLE_MODE 1
#include "harness_eh.h"
#if TBB_USE_EXCEPTIONS
volatile size_t exception_mask; // each bit represents whether the function should throw exception or not
// throws exception if corresponding exception_mask bit is set
#define TEST_FUNCTOR_WITH_THROW(value) \
struct throwing_functor##value { \
void operator() () const { \
if (exception_mask & (1 << value)) \
ThrowTestException(); \
} \
} test_with_throw##value;
TEST_FUNCTOR_WITH_THROW(0)
TEST_FUNCTOR_WITH_THROW(1)
TEST_FUNCTOR_WITH_THROW(2)
TEST_FUNCTOR_WITH_THROW(3)
TEST_FUNCTOR_WITH_THROW(4)
TEST_FUNCTOR_WITH_THROW(5)
TEST_FUNCTOR_WITH_THROW(6)
TEST_FUNCTOR_WITH_THROW(7)
TEST_FUNCTOR_WITH_THROW(8)
TEST_FUNCTOR_WITH_THROW(9)
void TestExceptionHandling()
{
REMARK (__FUNCTION__);
for( size_t n = 2; n <= 10; ++n ) {
for( exception_mask = 1; exception_mask < (size_t(1) << n); ++exception_mask ) {
ResetEhGlobals();
TRY();
REMARK("Calling parallel_invoke, number of functions = %d, exception_mask = %d\n", n, exception_mask);
call_parallel_invoke(n, test_with_throw0, test_with_throw1, test_with_throw2, test_with_throw3,
test_with_throw4, test_with_throw5, test_with_throw6, test_with_throw7, test_with_throw8, test_with_throw9, NULL);
CATCH_AND_ASSERT();
}
}
}
#endif /* TBB_USE_EXCEPTIONS */
// Cancellation support test
void function_to_cancel() {
++g_CurExecuted;
CancellatorTask::WaitUntilReady();
}
// The function is used to test cancellation
void simple_test_nothrow (){
++g_CurExecuted;
}
size_t g_numFunctions,
g_functionToCancel;
class ParInvokeLauncherTask : public tbb::task
{
tbb::task_group_context &my_ctx;
void(*func_array[10])(void);
tbb::task* execute () __TBB_override {
func_array[g_functionToCancel] = &function_to_cancel;
call_parallel_invoke(g_numFunctions, func_array[0], func_array[1], func_array[2], func_array[3],
func_array[4], func_array[5], func_array[6], func_array[7], func_array[8], func_array[9], &my_ctx);
return NULL;
}
public:
ParInvokeLauncherTask ( tbb::task_group_context& ctx ) : my_ctx(ctx) {
for (int i = 0; i <=9; ++i)
func_array[i] = &simple_test_nothrow;
}
};
void TestCancellation ()
{
REMARK (__FUNCTION__);
for ( int n = 2; n <= 10; ++n ) {
for ( int m = 0; m <= n - 1; ++m ) {
g_numFunctions = n;
g_functionToCancel = m;
ResetEhGlobals();
RunCancellationTest<ParInvokeLauncherTask, CancellatorTask>();
}
}
}
#endif /* __TBB_TASK_GROUP_CONTEXT */
//------------------------------------------------------------------------
// Entry point
//------------------------------------------------------------------------
#include "harness_cpu.h"
int TestMain () {
MinThread = min(MinThread, MaxThread);
ASSERT (MinThread>=1, "Minimal number of threads must be 1 or more");
for ( int p = MinThread; p <= MaxThread; ++p ) {
tbb::task_scheduler_init init(p);
test_parallel_invoke();
if (p > 1) {
#if __TBB_THROW_ACROSS_MODULE_BOUNDARY_BROKEN
REPORT("Known issue: exception handling tests are skipped.\n");
#elif TBB_USE_EXCEPTIONS
TestExceptionHandling();
#endif /* TBB_USE_EXCEPTIONS */
#if __TBB_TASK_GROUP_CONTEXT
TestCancellation();
#endif /* __TBB_TASK_GROUP_CONTEXT */
}
TestCPUUserTime(p);
}
return Harness::Done;
}
|
; int tape_load_block(void *addr, size_t len, unsigned char type)
; CALLER linkage for function pointers
XLIB tape_load_block
LIB tape_load_block_callee
XREF ASMDISP_TAPE_LOAD_BLOCK_CALLEE
.tape_load_block
pop de
pop bc
ld a,c
pop bc
pop hl
push hl
push bc
push bc ; altered !
push de
jp tape_load_block_callee + ASMDISP_TAPE_LOAD_BLOCK_CALLEE
|
Entity start
No options
Constants
0 S start
1 S var1
2 R 10.990000
End
Valid context (always)
No properties
Def start
No parameters
Local variables
0 real var1
End
No results
ldconst 2 --> [10.990000]
stvar 0 --> [var1]
stop
End
End
|
//%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// 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.
//
//////////////////////////////////////////////////////////////////////////
//
//%/////////////////////////////////////////////////////////////////////////
UNIX_PrintInputTray::UNIX_PrintInputTray(void)
{
}
UNIX_PrintInputTray::~UNIX_PrintInputTray(void)
{
}
Boolean UNIX_PrintInputTray::getInstanceID(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_INSTANCE_ID, getInstanceID());
return true;
}
String UNIX_PrintInputTray::getInstanceID() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getCaption(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_CAPTION, getCaption());
return true;
}
String UNIX_PrintInputTray::getCaption() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getDescription(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_DESCRIPTION, getDescription());
return true;
}
String UNIX_PrintInputTray::getDescription() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getElementName(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_ELEMENT_NAME, getElementName());
return true;
}
String UNIX_PrintInputTray::getElementName() const
{
return String("PrintInputTray");
}
Boolean UNIX_PrintInputTray::getInstallDate(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_INSTALL_DATE, getInstallDate());
return true;
}
CIMDateTime UNIX_PrintInputTray::getInstallDate() const
{
struct tm* clock; // create a time structure
time_t val = time(NULL);
clock = gmtime(&(val)); // Get the last modified time and put it into the time structure
return CIMDateTime(
clock->tm_year + 1900,
clock->tm_mon + 1,
clock->tm_mday,
clock->tm_hour,
clock->tm_min,
clock->tm_sec,
0,0,
clock->tm_gmtoff);
}
Boolean UNIX_PrintInputTray::getName(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_NAME, getName());
return true;
}
String UNIX_PrintInputTray::getName() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getOperationalStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_OPERATIONAL_STATUS, getOperationalStatus());
return true;
}
Array<Uint16> UNIX_PrintInputTray::getOperationalStatus() const
{
Array<Uint16> as;
return as;
}
Boolean UNIX_PrintInputTray::getStatusDescriptions(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_STATUS_DESCRIPTIONS, getStatusDescriptions());
return true;
}
Array<String> UNIX_PrintInputTray::getStatusDescriptions() const
{
Array<String> as;
return as;
}
Boolean UNIX_PrintInputTray::getStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_STATUS, getStatus());
return true;
}
String UNIX_PrintInputTray::getStatus() const
{
return String(DEFAULT_STATUS);
}
Boolean UNIX_PrintInputTray::getHealthState(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_HEALTH_STATE, getHealthState());
return true;
}
Uint16 UNIX_PrintInputTray::getHealthState() const
{
return Uint16(DEFAULT_HEALTH_STATE);
}
Boolean UNIX_PrintInputTray::getCommunicationStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_COMMUNICATION_STATUS, getCommunicationStatus());
return true;
}
Uint16 UNIX_PrintInputTray::getCommunicationStatus() const
{
return Uint16(0);
}
Boolean UNIX_PrintInputTray::getDetailedStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_DETAILED_STATUS, getDetailedStatus());
return true;
}
Uint16 UNIX_PrintInputTray::getDetailedStatus() const
{
return Uint16(0);
}
Boolean UNIX_PrintInputTray::getOperatingStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_OPERATING_STATUS, getOperatingStatus());
return true;
}
Uint16 UNIX_PrintInputTray::getOperatingStatus() const
{
return Uint16(DEFAULT_OPERATING_STATUS);
}
Boolean UNIX_PrintInputTray::getPrimaryStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_PRIMARY_STATUS, getPrimaryStatus());
return true;
}
Uint16 UNIX_PrintInputTray::getPrimaryStatus() const
{
return Uint16(DEFAULT_PRIMARY_STATUS);
}
Boolean UNIX_PrintInputTray::getSNMPRowId(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_S_N_M_P_ROW_ID, getSNMPRowId());
return true;
}
Uint32 UNIX_PrintInputTray::getSNMPRowId() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getIsDefault(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_IS_DEFAULT, getIsDefault());
return true;
}
Boolean UNIX_PrintInputTray::getIsDefault() const
{
return Boolean(false);
}
Boolean UNIX_PrintInputTray::getLocalizedDescription(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_LOCALIZED_DESCRIPTION, getLocalizedDescription());
return true;
}
String UNIX_PrintInputTray::getLocalizedDescription() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getType(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_TYPE, getType());
return true;
}
Uint32 UNIX_PrintInputTray::getType() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getOtherTypeDescription(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_OTHER_TYPE_DESCRIPTION, getOtherTypeDescription());
return true;
}
String UNIX_PrintInputTray::getOtherTypeDescription() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getCapacityUnit(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_CAPACITY_UNIT, getCapacityUnit());
return true;
}
Uint32 UNIX_PrintInputTray::getCapacityUnit() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getOtherCapacityUnit(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_OTHER_CAPACITY_UNIT, getOtherCapacityUnit());
return true;
}
String UNIX_PrintInputTray::getOtherCapacityUnit() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getMaxCapacityBasis(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MAX_CAPACITY_BASIS, getMaxCapacityBasis());
return true;
}
Uint16 UNIX_PrintInputTray::getMaxCapacityBasis() const
{
return Uint16(0);
}
Boolean UNIX_PrintInputTray::getMaxCapacity(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MAX_CAPACITY, getMaxCapacity());
return true;
}
Uint32 UNIX_PrintInputTray::getMaxCapacity() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getCurrentLevelBasis(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_CURRENT_LEVEL_BASIS, getCurrentLevelBasis());
return true;
}
Uint16 UNIX_PrintInputTray::getCurrentLevelBasis() const
{
return Uint16(0);
}
Boolean UNIX_PrintInputTray::getCurrentLevel(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_CURRENT_LEVEL, getCurrentLevel());
return true;
}
Uint32 UNIX_PrintInputTray::getCurrentLevel() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getAvailabilityStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_AVAILABILITY_STATUS, getAvailabilityStatus());
return true;
}
Uint32 UNIX_PrintInputTray::getAvailabilityStatus() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getOtherAvailabilityStatus(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_OTHER_AVAILABILITY_STATUS, getOtherAvailabilityStatus());
return true;
}
String UNIX_PrintInputTray::getOtherAvailabilityStatus() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getNonCriticalAlertsPresent(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_NON_CRITICAL_ALERTS_PRESENT, getNonCriticalAlertsPresent());
return true;
}
Boolean UNIX_PrintInputTray::getNonCriticalAlertsPresent() const
{
return Boolean(false);
}
Boolean UNIX_PrintInputTray::getCriticalAlertsPresent(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_CRITICAL_ALERTS_PRESENT, getCriticalAlertsPresent());
return true;
}
Boolean UNIX_PrintInputTray::getCriticalAlertsPresent() const
{
return Boolean(false);
}
Boolean UNIX_PrintInputTray::getMediaSizeName(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_SIZE_NAME, getMediaSizeName());
return true;
}
String UNIX_PrintInputTray::getMediaSizeName() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getMediaName(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_NAME, getMediaName());
return true;
}
String UNIX_PrintInputTray::getMediaName() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getMediaWeightBasis(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_WEIGHT_BASIS, getMediaWeightBasis());
return true;
}
Uint16 UNIX_PrintInputTray::getMediaWeightBasis() const
{
return Uint16(0);
}
Boolean UNIX_PrintInputTray::getMediaWeight(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_WEIGHT, getMediaWeight());
return true;
}
Uint32 UNIX_PrintInputTray::getMediaWeight() const
{
return Uint32(0);
}
Boolean UNIX_PrintInputTray::getMediaType(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_TYPE, getMediaType());
return true;
}
String UNIX_PrintInputTray::getMediaType() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::getMediaColor(CIMProperty &p) const
{
p = CIMProperty(PROPERTY_MEDIA_COLOR, getMediaColor());
return true;
}
String UNIX_PrintInputTray::getMediaColor() const
{
return String ("");
}
Boolean UNIX_PrintInputTray::initialize()
{
return false;
}
Boolean UNIX_PrintInputTray::load(int &pIndex)
{
return false;
}
Boolean UNIX_PrintInputTray::finalize()
{
return false;
}
Boolean UNIX_PrintInputTray::find(Array<CIMKeyBinding> &kbArray)
{
CIMKeyBinding kb;
String instanceIDKey;
for(Uint32 i = 0; i < kbArray.size(); i++)
{
kb = kbArray[i];
CIMName keyName = kb.getName();
if (keyName.equal(PROPERTY_INSTANCE_ID)) instanceIDKey = kb.getValue();
}
/* EXecute find with extracted keys */
return false;
}
|
#include <qttokenedit/DropIndicator.h>
#include <cmath>
#include <QtGui/QPaintDevice>
#include <QtGui/QPainter>
namespace mjendruk {
void DropIndicator::draw(DropIndicatorPosition position, QRect const& rect,
QBrush const& brush, QPainter* painter) const {
if (position == DropIndicatorPosition::None) {
return;
}
painter->save();
auto const rectf = QRectF{rect};
#ifdef Q_OS_MACOS
auto scaling = 1.0;
#else
auto scaling = std::round(painter->device()->logicalDpiX() / 96.0);
#endif
auto const width = scaling * 1.0;
auto const height = rectf.height();
auto const size = QSizeF{width, height};
auto pos = QPointF{0.0, 0.0};
if (position == DropIndicatorPosition::Before) {
pos.setX(0.0);
} else {
pos.setX(rectf.width() - size.width());
}
painter->setBrush(brush);
painter->setPen(Qt::NoPen);
painter->drawRect(QRectF{pos, size});
painter->restore();
}
} // namespace mjendruk
|
#include "core.h"
#include "wbcompeldsensordamage.h"
#include "wbevent.h"
#include "Components/wbcomprodinknowledge.h"
#include "wbcompeldtransform.h"
WBCompEldSensorDamage::WBCompEldSensorDamage()
{
}
WBCompEldSensorDamage::~WBCompEldSensorDamage()
{
}
/*virtual*/ void WBCompEldSensorDamage::HandleEvent( const WBEvent& Event )
{
XTRACE_FUNCTION;
Super::HandleEvent( Event );
STATIC_HASHED_STRING( OnDamaged );
const HashedString EventName = Event.GetEventName();
if( EventName == sOnDamaged )
{
STATIC_HASHED_STRING( Damager );
WBEntity* const pDamager = Event.GetEntity( sDamager );
ASSERT( pDamager );
HandleDamage( pDamager );
}
}
// TODO: Account for deferred damage like trap bolts.
// Maybe just make that a parameter of damage dealer, that it doesn't trigger sensor, because how could the AI know anything about it?
void WBCompEldSensorDamage::HandleDamage( WBEntity* const pDamager ) const
{
XTRACE_FUNCTION;
if( !pDamager )
{
return;
}
WBCompEldTransform* const pTransform = pDamager->GetTransformComponent<WBCompEldTransform>();
DEVASSERT( pTransform );
WBCompRodinKnowledge* const pKnowledge = GET_WBCOMP( GetEntity(), RodinKnowledge );
ASSERT( pKnowledge );
WBCompRodinKnowledge::TKnowledge& Knowledge = pKnowledge->UpdateEntity( pDamager );
STATIC_HASHED_STRING( RegardAsHostile );
Knowledge.SetBool( sRegardAsHostile, true );
STATIC_HASHED_STRING( IsDamager );
Knowledge.SetBool( sIsDamager, true );
STATIC_HASHED_STRING( LastKnownLocation );
Knowledge.SetVector( sLastKnownLocation, pTransform->GetLocation() );
ASSERT( !pTransform->GetLocation().IsZero() );
STATIC_HASHED_STRING( KnowledgeType );
STATIC_HASHED_STRING( Target );
Knowledge.SetHash( sKnowledgeType, sTarget );
} |
#ifndef STATIC_LINK
#define IMPLEMENT_API
#endif
#if defined(HX_WINDOWS) || defined(HX_MACOS) || defined(HX_LINUX)
#define NEKO_COMPATIBLE
#endif
#include <hx/CFFI.h>
#include "GameCenterManagerBindings.h"
using namespace gamecentermanager;
AutoGCRoot* gameCenterManagerEventHandle = 0;
static value set_listener(value onEvent)
{
gameCenterManagerEventHandle = new AutoGCRoot(onEvent);
return alloc_null();
}
DEFINE_PRIM(set_listener, 1);
static value setup_manager()
{
setupManager();
return alloc_null();
}
DEFINE_PRIM(setup_manager, 0);
static value setup_manager_and_set_should_crypt_with_key(value key)
{
setupManagerAndSetShouldCryptWithKey(val_string(key));
return alloc_null();
}
DEFINE_PRIM(setup_manager_and_set_should_crypt_with_key, 1);
static value authenticate_user()
{
authenticateUser();
return alloc_null();
}
DEFINE_PRIM(authenticate_user, 0);
static value sync_game_center()
{
syncGameCenter();
return alloc_null();
}
DEFINE_PRIM(sync_game_center, 0);
static value save_and_report_score(value leaderboardId, value score, value sortOrder)
{
saveAndReportScore(val_string(leaderboardId), val_int(score), val_int(sortOrder));
return alloc_null();
}
DEFINE_PRIM(save_and_report_score, 3);
static value save_and_report_achievement(value identifier, value percentComplete, value shouldDisplayNotification)
{
saveAndReportAchievement(val_string(identifier), val_float(percentComplete), val_bool(shouldDisplayNotification));
return alloc_null();
}
DEFINE_PRIM(save_and_report_achievement, 3);
static value report_saved_scores_and_achievements()
{
reportSavedScoresAndAchievements();
return alloc_null();
}
DEFINE_PRIM(report_saved_scores_and_achievements, 0);
static value save_score_to_report_later(value leaderboardId, value score)
{
saveScoreToReportLater(val_string(leaderboardId), val_int(score));
return alloc_null();
}
DEFINE_PRIM(save_score_to_report_later, 2);
static value save_achievement_to_report_later(value identifier, value percentComplete)
{
saveAchievementToReportLater(val_string(identifier), val_float(percentComplete));
return alloc_null();
}
DEFINE_PRIM(save_achievement_to_report_later, 2);
static value high_score_for_leaderboard(value identifier)
{
return alloc_int(highScoreForLeaderboard(val_string(identifier)));
}
DEFINE_PRIM(high_score_for_leaderboard, 1);
static value progress_for_achievement(value identifier)
{
return alloc_float(progressForAchievement(val_string(identifier)));
}
DEFINE_PRIM(progress_for_achievement, 1);
static value request_challenges()
{
requestChallenges();
return alloc_null();
}
DEFINE_PRIM(request_challenges, 0);
static value present_achievements()
{
presentAchievements();
return alloc_null();
}
DEFINE_PRIM(present_achievements, 0);
static value present_leaderboards()
{
presentLeaderboards();
return alloc_null();
}
DEFINE_PRIM(present_leaderboards, 0);
static value present_challenges()
{
presentChallenges();
return alloc_null();
}
DEFINE_PRIM(present_challenges, 0);
static value reset_achievements()
{
resetAchievements();
return alloc_null();
}
DEFINE_PRIM(reset_achievements, 0);
static value is_internet_available()
{
return alloc_bool(isInternetAvailable());
}
DEFINE_PRIM(is_internet_available, 0);
static value is_game_center_available()
{
return alloc_bool(isGameCenterAvailable());
}
DEFINE_PRIM(is_game_center_available, 0);
static value local_player_id()
{
return alloc_string(localPlayerId());
}
DEFINE_PRIM(local_player_id, 0);
static value local_player_display_name()
{
return alloc_string(localPlayerDisplayName());
}
DEFINE_PRIM(local_player_display_name, 0);
static value should_crypt_data()
{
return alloc_bool(shouldCryptData());
}
DEFINE_PRIM(should_crypt_data, 0);
static value crypt_key()
{
return alloc_string(cryptKey());
}
DEFINE_PRIM(crypt_key, 0);
extern "C" void gamecentermanager_main()
{
val_int(0);
}
DEFINE_ENTRY_POINT(gamecentermanager_main);
extern "C" int gamecentermanager_register_prims()
{
return 0;
}
extern "C" void sendGameCenterManagerEvent(const char* type, GameCenterManagerEventData data)
{
if(gameCenterManagerEventHandle == 0)
{
return;
}
// TODO could be faster to only alloc the required fields
value o = alloc_empty_object();
alloc_field(o, val_id("type"), alloc_string(type));
alloc_field(o, val_id("availabilityState"), alloc_string(data.availabilityState));
alloc_field(o, val_id("error"), alloc_int(data.error));
alloc_field(o, val_id("identifier"), alloc_string(data.identifier));
alloc_field(o, val_id("value"), alloc_int(data.value));
alloc_field(o, val_id("rank"), alloc_int(data.rank));
alloc_field(o, val_id("percentComplete"), alloc_float(data.percentComplete));
alloc_field(o, val_id("showsCompletionBanner"), alloc_bool(data.showsCompletionBanner));
val_call1(gameCenterManagerEventHandle->get(), o);
}
// UNIMPLEMENTED
//static value local_player_data()
//{
//}
//DEFINE_PRIM(local_player_data, 1); |
#include "QSchedulingTask.h"
#include "QSchedulingTask_p.h"
#include <QDataStream>
#include <QCoreApplication>
#include <QTimer>
#include <QLoggingCategory>
Q_LOGGING_CATEGORY(lcSchedulingTask, "QScheduler")
// class QSchedulingTask
QSchedulingTask::QSchedulingTask(const QString &route, QObject *parent)
: QObject(parent)
, d_ptr(new QSchedulingTaskPrivate(route))
{
d_ptr->q_ptr = this;
Q_D(QSchedulingTask);
d->callTimer = new QTimer(this);
d->callTimer->setSingleShot(true);
d->callTimer->setInterval(50);
d->stopTimer = new QTimer(this);
d->stopTimer->setInterval(50);
connect(d->callTimer, &QTimer::timeout,
this, QOverload<>::of(&QSchedulingTask::call));
connect(d->stopTimer, &QTimer::timeout,
this, &QSchedulingTask::quit);
}
QSchedulingTask::~QSchedulingTask()
{
}
const QString &QSchedulingTask::route() const
{
Q_D(const QSchedulingTask);
return d->route;
}
void QSchedulingTask::setMode(QSchedulingTask::Mode mode)
{
Q_D(QSchedulingTask);
d->mode = mode;
if (Program == mode) {
qInfo(lcSchedulingTask, "program: %s", qPrintable(d->route));
} else {
qInfo(lcSchedulingTask, "service: %s", qPrintable(d->route));
}
}
QSchedulingTask::Mode QSchedulingTask::mode() const
{
Q_D(const QSchedulingTask);
return d->mode;
}
void QSchedulingTask::call()
{
Q_D(QSchedulingTask);
if (d->isDirty) {
return;
}
if (d->retries <= 0) {
return;
} else if (d->process) {
if (d->node) {
QByteArray datagram;
QDataStream ds(&datagram, QIODevice::WriteOnly);
ds << d->arguments;
d->node->writeDatagram(5, datagram);
}
return;
}
--d->retries;
QString program = QCoreApplication::applicationFilePath();
d->process = new QProcess(this);
d->process->setProgram(program);
d->process->setArguments(d->arguments);
connect(d->process, QOverload<QProcess::ProcessError>::of(&QProcess::errorOccurred),
this, &QSchedulingTask::onError);
connect(d->process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
this, &QSchedulingTask::onFinished);
d->isQuitAll = true;
d->process->start();
}
void QSchedulingTask::call(const QStringList &arguments)
{
Q_D(QSchedulingTask);
if (d->isDirty) {
return;
}
if (Program == d->mode) {
d->retries = 1;
} else {
d->retries = 5;
}
d->arguments = arguments;
QSchedulingTask::call();
}
void QSchedulingTask::quit()
{
Q_D(QSchedulingTask);
d->retries = 0;
if (d->process && (QProcess::NotRunning != d->process->state())) {
d->isQuitAll = false;
if (d->stopTimer->isActive()) {
QDateTime now = QDateTime::currentDateTime();
if (d->deadline <= now) {
qInfo(lcSchedulingTask, "kill: %s",
qPrintable(d->route));
d->isQuitAll = false;
d->process->kill();
d->stopTimer->stop();
} else {
qInfo(lcSchedulingTask, "wait: %s",
qPrintable(d->route));
if (d->node)
d->node->quit();
}
} else {
qInfo(lcSchedulingTask, "wait: %s",
qPrintable(d->route));
if (d->node)
d->node->quit();
QDateTime now = QDateTime::currentDateTime();
d->deadline = now.addMSecs(7500);
d->stopTimer->start();
}
} else {
qInfo(lcSchedulingTask, "skip: %s",
qPrintable(d->route));
}
}
void QSchedulingTask::attachNode(QSchedulingNode *node)
{
Q_D(QSchedulingTask);
qInfo(lcSchedulingTask, "connect: %s",
qPrintable(d->route));
d->node = node;
}
QSchedulingNode *QSchedulingTask::node() const
{
Q_D(const QSchedulingTask);
return d->node;
}
bool QSchedulingTask::isClosed() const
{
Q_D(const QSchedulingTask);
return d->process.isNull();
}
void QSchedulingTask::clear()
{
Q_D(QSchedulingTask);
if (d->isDirty) {
return;
}
d->isDirty = true;
quit();
}
void QSchedulingTask::onError(QProcess::ProcessError error)
{
Q_D(QSchedulingTask);
if (d->process) {
QStringList arguments = d->process->arguments();
int ii = arguments.indexOf("--scheduling-name");
if (ii >= 0)
arguments = arguments.mid(0, ii);
QByteArray reason;
switch (error) {
case QProcess::FailedToStart:
reason = "FailedToStart";
break;
case QProcess::Crashed:
reason = "Crashed";
break;
case QProcess::Timedout:
reason = "Timedout";
break;
case QProcess::ReadError:
reason = "ReadError";
break;
case QProcess::WriteError:
reason = "WriteError";
break;
case QProcess::UnknownError:
reason = "UnknownError";
break;
}
if (arguments.isEmpty()) {
qCritical(lcSchedulingTask, "error(%s): %s",
reason.constData(), qPrintable(d->route));
} else {
qCritical(lcSchedulingTask, "error(%s): %s %s", reason.constData(),
qPrintable(d->route), qUtf8Printable(arguments.join(' ')));
}
d->stopTimer->stop();
d->process->deleteLater();
d->process = nullptr;
if (d->retries > 0) {
if (!d->isDirty && !d->callTimer->isActive()) {
if (arguments.isEmpty()) {
qInfo(lcSchedulingTask, "restart: %s", qPrintable(d->route));
} else {
qInfo(lcSchedulingTask, "restart: %s %s", qPrintable(d->route),
qUtf8Printable(arguments.join(' ')));
}
d->callTimer->start();
}
} else if ("/" == d->route) {
emit quitAll();
} else if (Service == d->mode) {
if (d->isQuitAll) {
emit quitAll();
}
}
}
}
void QSchedulingTask::onFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
Q_D(QSchedulingTask);
if (d->process) {
QStringList arguments = d->process->arguments();
int ii = arguments.indexOf("--scheduling-name");
if (ii >= 0)
arguments = arguments.mid(0, ii);
switch (exitStatus) {
case QProcess::NormalExit:
if (arguments.isEmpty()) {
qInfo(lcSchedulingTask, "exit(Normal %d): %s", exitCode, qPrintable(d->route));
} else {
qInfo(lcSchedulingTask, "exit(Normal %d): %s %s", exitCode,
qPrintable(d->route), qUtf8Printable(arguments.join(' ')));
}
break;
case QProcess::CrashExit:
if (arguments.isEmpty()) {
qCritical(lcSchedulingTask, "exit(Crash %d): %s", exitCode, qPrintable(d->route));
} else {
qCritical(lcSchedulingTask, "exit(Crash %d): %s %s", exitCode,
qPrintable(d->route), qUtf8Printable(arguments.join(' ')));
}
break;
}
d->stopTimer->stop();
d->process->deleteLater();
d->process = nullptr;
if (d->retries > 0) {
if (!d->isDirty && !d->callTimer->isActive()) {
if (arguments.isEmpty()) {
qInfo(lcSchedulingTask, "restart: %s", qPrintable(d->route));
} else {
qInfo(lcSchedulingTask, "restart: %s %s", qPrintable(d->route),
qUtf8Printable(arguments.join(' ')));
}
d->callTimer->start();
}
} else if ("/" == d->route) {
emit quitAll();
} else if (Service == d->mode) {
if (d->isQuitAll) {
emit quitAll();
}
}
}
}
// class QSchedulingTaskPrivate
QSchedulingTaskPrivate::QSchedulingTaskPrivate(const QString &route)
: q_ptr(nullptr)
, route(route)
, retries(0)
, mode(QSchedulingTask::Program)
, callTimer(nullptr)
, stopTimer(nullptr)
, isQuitAll(false)
, isDirty(false)
{
}
QSchedulingTaskPrivate::~QSchedulingTaskPrivate()
{
}
|
; A094013: Expansion of (1-4*x)/(1-4*x-4*x^2).
; 1,0,4,16,80,384,1856,8960,43264,208896,1008640,4870144,23515136,113541120,548225024,2647064576,12781158400,61712891904,297976201216,1438756372480,6946930294784,33542746669056,161958707855360
mov $4,2
mov $5,$0
lpb $4
mov $0,$5
sub $4,1
add $0,$4
sub $0,1
cal $0,189743 ; a(1)=4, a(2)=4, a(n)=4*a(n-1) + 4*a(n-2)
mov $2,3
add $2,$0
mov $3,$4
mov $6,$2
lpb $3
mov $1,$6
sub $3,1
lpe
lpe
lpb $5
sub $1,$6
mov $5,0
lpe
div $1,7
|
; A291004: p-INVERT of (1,1,1,1,1,...), where p(S) = (1 - 3*S)^2.
; 6,33,168,816,3840,17664,79872,356352,1572864,6881280,29884416,128974848,553648128,2365587456,10066329600,42681237504,180388626432,760209211392,3195455668224,13400297963520,56075093016576,234195976716288,976366325465088,4063794976260096,16888498602639360,70087269200953344,290482175965396992,1202461100507922432,4971973988617027584,20536414300809461760,84739730588603252736,349335215895874633728,1438846037749345026048,5921404847660766068736,24349702177296608133120,100055139855800607965184
mov $1,$0
mul $0,3
add $0,4
mov $2,4
pow $2,$1
mul $0,$2
div $0,4
add $0,$2
mul $0,3
|
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#include <map>
#include <memory>
#include <vector>
#include "rocksdb/comparator.h"
#include "rocksdb/iterator.h"
#include "rocksdb/slice_transform.h"
#include "table/block_hash_index.h"
#include "table/internal_iterator.h"
#include "util/testharness.h"
#include "util/testutil.h"
namespace rocksdb {
typedef std::map<std::string, std::string> Data;
class MapIterator : public InternalIterator {
public:
explicit MapIterator(const Data& data) : data_(data), pos_(data_.end()) {}
virtual bool Valid() const override { return pos_ != data_.end(); }
virtual void SeekToFirst() override { pos_ = data_.begin(); }
virtual void SeekToLast() override {
pos_ = data_.end();
--pos_;
}
virtual void Seek(const Slice& target) override {
pos_ = data_.find(target.ToString());
}
virtual void Next() override { ++pos_; }
virtual void Prev() override { --pos_; }
virtual Slice key() const override { return pos_->first; }
virtual Slice value() const override { return pos_->second; }
virtual Status status() const override { return Status::OK(); }
private:
const Data& data_;
Data::const_iterator pos_;
};
class BlockTest : public testing::Test {};
TEST_F(BlockTest, BasicTest) {
const size_t keys_per_block = 4;
const size_t prefix_size = 2;
std::vector<std::string> keys = {/* block 1 */
"0101", "0102", "0103", "0201",
/* block 2 */
"0202", "0203", "0301", "0401",
/* block 3 */
"0501", "0601", "0701", "0801",
/* block 4 */
"0802", "0803", "0804", "0805",
/* block 5 */
"0806", "0807", "0808", "0809", };
Data data_entries;
for (const auto key : keys) {
data_entries.insert({key, key});
}
Data index_entries;
for (size_t i = 3; i < keys.size(); i += keys_per_block) {
// simply ignore the value part
index_entries.insert({keys[i], ""});
}
MapIterator data_iter(data_entries);
MapIterator index_iter(index_entries);
auto prefix_extractor = NewFixedPrefixTransform(prefix_size);
std::unique_ptr<BlockHashIndex> block_hash_index(CreateBlockHashIndexOnTheFly(
&index_iter, &data_iter, static_cast<uint32_t>(index_entries.size()),
BytewiseComparator(), prefix_extractor));
std::map<std::string, BlockHashIndex::RestartIndex> expected = {
{"01xx", BlockHashIndex::RestartIndex(0, 1)},
{"02yy", BlockHashIndex::RestartIndex(0, 2)},
{"03zz", BlockHashIndex::RestartIndex(1, 1)},
{"04pp", BlockHashIndex::RestartIndex(1, 1)},
{"05ww", BlockHashIndex::RestartIndex(2, 1)},
{"06xx", BlockHashIndex::RestartIndex(2, 1)},
{"07pp", BlockHashIndex::RestartIndex(2, 1)},
{"08xz", BlockHashIndex::RestartIndex(2, 3)}, };
const BlockHashIndex::RestartIndex* index = nullptr;
// search existed prefixes
for (const auto& item : expected) {
index = block_hash_index->GetRestartIndex(item.first);
ASSERT_TRUE(index != nullptr);
ASSERT_EQ(item.second.first_index, index->first_index);
ASSERT_EQ(item.second.num_blocks, index->num_blocks);
}
// search non exist prefixes
ASSERT_TRUE(!block_hash_index->GetRestartIndex("00xx"));
ASSERT_TRUE(!block_hash_index->GetRestartIndex("10yy"));
ASSERT_TRUE(!block_hash_index->GetRestartIndex("20zz"));
delete prefix_extractor;
}
} // namespace rocksdb
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
|
;
; Copyright (c) 2010 The WebM project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license and patent
; grant that can be found in the LICENSE file in the root of the source
; tree. All contributing project authors may be found in the AUTHORS
; file in the root of the source tree.
;
EXPORT |vp8_dc_only_idct_add_neon|
ARM
REQUIRE8
PRESERVE8
AREA ||.text||, CODE, READONLY, ALIGN=2
;void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr,
; int pred_stride, unsigned char *dst_ptr,
; int dst_stride)
; r0 input_dc
; r1 pred_ptr
; r2 pred_stride
; r3 dst_ptr
; sp dst_stride
|vp8_dc_only_idct_add_neon| PROC
add r0, r0, #4
asr r0, r0, #3
ldr r12, [sp]
vdup.16 q0, r0
vld1.32 {d2[0]}, [r1], r2
vld1.32 {d2[1]}, [r1], r2
vld1.32 {d4[0]}, [r1], r2
vld1.32 {d4[1]}, [r1]
vaddw.u8 q1, q0, d2
vaddw.u8 q2, q0, d4
vqmovun.s16 d2, q1
vqmovun.s16 d4, q2
vst1.32 {d2[0]}, [r3], r12
vst1.32 {d2[1]}, [r3], r12
vst1.32 {d4[0]}, [r3], r12
vst1.32 {d4[1]}, [r3]
bx lr
ENDP
END
|
; A270851: Number of 2X2X2 triangular 0..n arrays with some element plus some adjacent element totalling n+1, n or n-1 exactly once.
; 0,0,6,24,66,120,198,288,402,528,678,840,1026,1224,1446,1680,1938,2208,2502,2808,3138,3480,3846,4224,4626,5040,5478,5928,6402,6888,7398,7920,8466,9024,9606,10200,10818,11448,12102,12768,13458,14160,14886,15624,16386,17160,17958,18768,19602,20448,21318,22200,23106,24024,24966,25920,26898,27888,28902,29928,30978,32040,33126,34224,35346,36480,37638,38808,40002,41208,42438,43680,44946,46224,47526,48840,50178,51528,52902,54288,55698,57120,58566,60024,61506,63000,64518,66048,67602,69168,70758,72360,73986,75624,77286,78960,80658,82368,84102,85848
lpb $0
add $2,2
sub $0,$2
mov $1,$0
max $1,0
seq $1,212959 ; Number of (w,x,y) such that w,x,y are all in {0,...,n} and |w-x| = |x-y|.
add $2,$1
lpe
mul $1,6
mov $0,$1
|
// Geometric Tools, LLC
// Copyright (c) 1998-2014
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
//
// File Version: 5.0.0 (2010/01/01)
#include "PhysicsModule.h"
#include "Wm5Math.h"
using namespace Wm5;
//----------------------------------------------------------------------------
PhysicsModule::PhysicsModule ()
:
MuGravity(0.0),
XLocExt(0.0),
YLocExt(0.0),
mTime(0.0),
mDeltaTime(0.0),
mX(0.0),
mY(0.0),
mTheta(0.0),
mXDer(0.0),
mYDer(0.0),
mThetaDer(0.0),
mX0(0.0),
mY0(0.0),
mTheta0(0.0),
mXDer0(0.0),
mYDer0(0.0),
mThetaDer0(0.0),
mLinVelCoeff(0.0),
mAngVelCoeff(0.0)
{
}
//----------------------------------------------------------------------------
PhysicsModule::~PhysicsModule ()
{
}
//----------------------------------------------------------------------------
void PhysicsModule::Initialize (double time, double deltaTime, double x,
double y, double theta, double xDer, double yDer, double thetaDer)
{
mTime = time;
mDeltaTime = deltaTime;
mX = x;
mY = y;
mTheta = theta;
mXDer = xDer;
mYDer = yDer;
mThetaDer = thetaDer;
mX0 = mX;
mY0 = mY;
mTheta0 = mTheta;
mXDer0 = mXDer;
mYDer0 = mYDer;
mThetaDer0 = mThetaDer;
double linSpeed = Mathd::Sqrt(xDer*xDer + yDer*yDer);
if (linSpeed > Mathd::ZERO_TOLERANCE)
{
mLinVelCoeff = MuGravity/linSpeed;
}
else
{
mLinVelCoeff = 0.0;
}
double xx = XLocExt*XLocExt;
double xy = XLocExt*YLocExt;
double yy = YLocExt*YLocExt;
double tmp1 = xx + yy;
double tmp2 = Mathd::Sqrt(tmp1);
double tmp3 = 4.0*xy/3.0;
double tmp4 = 0.5*Mathd::Log((tmp2 + XLocExt)/(tmp2 - XLocExt));
double tmp5 = 0.5*Mathd::Log((tmp2 + YLocExt)/(tmp2 - YLocExt));
double numer = tmp3*tmp2 + XLocExt*xx*tmp5 + YLocExt*yy*tmp4;
double denom = tmp3*tmp1;
double coeff = MuGravity*numer/denom;
double angSpeed = Mathd::FAbs(thetaDer);
if (angSpeed > Mathd::ZERO_TOLERANCE)
{
mAngVelCoeff = coeff/angSpeed;
}
else
{
mAngVelCoeff = 0.0;
}
}
//----------------------------------------------------------------------------
void PhysicsModule::GetRectangle (double& x00, double& y00, double& x10,
double& y10, double& x11, double& y11, double& x01, double& y01) const
{
// P = (x,y) + sx*XLocExt*(cos(A),sin(A)) + sy*YLocExt*(-sin(A),cos(A))
// where |sx| = 1 and |sy| = 1 (four choices on sign)
double cs = Mathd::Cos(mTheta);
double sn = Mathd::Sin(mTheta);
// sx = -1, sy = -1
x00 = mX - XLocExt*cs + YLocExt*sn;
y00 = mY - XLocExt*sn - YLocExt*cs;
// sx = +1, sy = -1
x10 = mX + XLocExt*cs + YLocExt*sn;
y10 = mY + XLocExt*sn - YLocExt*cs;
// sx = +1, sy = +1
x11 = mX + XLocExt*cs - YLocExt*sn;
y11 = mY + XLocExt*sn + YLocExt*cs;
// sx = -1, sy = +1
x01 = mX - XLocExt*cs - YLocExt*sn;
y01 = mY - XLocExt*sn + YLocExt*cs;
}
//----------------------------------------------------------------------------
void PhysicsModule::Update ()
{
mTime += mDeltaTime;
double linTmp = mLinVelCoeff*mTime;
double linVelMult = 1.0 - linTmp;
if (linVelMult > 0.0)
{
mXDer = linVelMult*mXDer0;
mYDer = linVelMult*mYDer0;
mX = mX0 + mTime*(1.0 - 0.5*linTmp)*mXDer0;
mY = mY0 + mTime*(1.0 - 0.5*linTmp)*mYDer0;
}
else
{
mXDer = 0.0;
mYDer = 0.0;
}
double angTmp = mAngVelCoeff*mTime;
double angVelMult = 1.0 - angTmp;
if (angVelMult > 0.0)
{
mThetaDer = angVelMult*mThetaDer0;
mTheta = mTheta0 + mTime*(1.0 - 0.5*angTmp)*mThetaDer0;
}
else
{
mThetaDer = 0.0;
}
}
//----------------------------------------------------------------------------
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/animation/square_ink_drop_ripple.h"
#include <algorithm>
#include "base/logging.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/vector3d_f.h"
#include "ui/gfx/transform_util.h"
#include "ui/views/animation/ink_drop_painted_layer_delegates.h"
#include "ui/views/view.h"
namespace {
// The minimum scale factor to use when scaling rectangle layers. Smaller values
// were causing visual anomalies.
const float kMinimumRectScale = 0.0001f;
// The minimum scale factor to use when scaling circle layers. Smaller values
// were causing visual anomalies.
const float kMinimumCircleScale = 0.001f;
// All the sub animations that are used to animate each of the InkDropStates.
// These are used to get time durations with
// GetAnimationDuration(InkDropSubAnimations). Note that in general a sub
// animation defines the duration for either a transformation animation or an
// opacity animation but there are some exceptions where an entire InkDropState
// animation consists of only 1 sub animation and it defines the duration for
// both the transformation and opacity animations.
enum InkDropSubAnimations {
// HIDDEN sub animations.
// The HIDDEN sub animation that is fading out to a hidden opacity.
HIDDEN_FADE_OUT,
// The HIDDEN sub animation that transforms the shape to a |small_size_|
// circle.
HIDDEN_TRANSFORM,
// ACTION_PENDING sub animations.
// The ACTION_PENDING sub animation that fades in to the visible opacity.
ACTION_PENDING_FADE_IN,
// The ACTION_PENDING sub animation that transforms the shape to a
// |large_size_| circle.
ACTION_PENDING_TRANSFORM,
// ACTION_TRIGGERED sub animations.
// The ACTION_TRIGGERED sub animation that is fading out to a hidden opacity.
ACTION_TRIGGERED_FADE_OUT,
// The ACTION_TRIGGERED sub animation that transforms the shape to a
// |large_size_|
// circle.
ACTION_TRIGGERED_TRANSFORM,
// ALTERNATE_ACTION_PENDING sub animations.
// The ALTERNATE_ACTION_PENDING animation has only one sub animation which
// animates
// to a |small_size_| rounded rectangle at visible opacity.
ALTERNATE_ACTION_PENDING,
// ALTERNATE_ACTION_TRIGGERED sub animations.
// The ALTERNATE_ACTION_TRIGGERED sub animation that is fading out to a hidden
// opacity.
ALTERNATE_ACTION_TRIGGERED_FADE_OUT,
// The ALTERNATE_ACTION_TRIGGERED sub animation that transforms the shape to a
// |large_size_|
// rounded rectangle.
ALTERNATE_ACTION_TRIGGERED_TRANSFORM,
// ACTIVATED sub animations.
// The ACTIVATED sub animation that transforms the shape to a |large_size_|
// circle. This is used when the ink drop is in a HIDDEN state prior to
// animating to the ACTIVATED state.
ACTIVATED_CIRCLE_TRANSFORM,
// The ACTIVATED sub animation that transforms the shape to a |small_size_|
// rounded rectangle.
ACTIVATED_RECT_TRANSFORM,
// DEACTIVATED sub animations.
// The DEACTIVATED sub animation that is fading out to a hidden opacity.
DEACTIVATED_FADE_OUT,
// The DEACTIVATED sub animation that transforms the shape to a |large_size_|
// rounded rectangle.
DEACTIVATED_TRANSFORM,
};
// The scale factor used to burst the ACTION_TRIGGERED bubble as it fades out.
const float kQuickActionBurstScale = 1.3f;
// Duration constants for InkDropStateSubAnimations. See the
// InkDropStateSubAnimations enum documentation for more info.
int kAnimationDurationInMs[] = {
150, // HIDDEN_FADE_OUT
200, // HIDDEN_TRANSFORM
0, // ACTION_PENDING_FADE_IN
160, // ACTION_PENDING_TRANSFORM
150, // ACTION_TRIGGERED_FADE_OUT
160, // ACTION_TRIGGERED_TRANSFORM
200, // ALTERNATE_ACTION_PENDING
150, // ALTERNATE_ACTION_TRIGGERED_FADE_OUT
200, // ALTERNATE_ACTION_TRIGGERED_TRANSFORM
200, // ACTIVATED_CIRCLE_TRANSFORM
160, // ACTIVATED_RECT_TRANSFORM
150, // DEACTIVATED_FADE_OUT
200, // DEACTIVATED_TRANSFORM
};
// Returns the InkDropState sub animation duration for the given |state|.
base::TimeDelta GetAnimationDuration(InkDropSubAnimations state) {
return base::TimeDelta::FromMilliseconds(
(views::InkDropRipple::UseFastAnimations()
? 1
: views::InkDropRipple::kSlowAnimationDurationFactor) *
kAnimationDurationInMs[state]);
}
// Calculates a Transform for a circle layer. The transform will be set up to
// translate by -|center_offset|, scale, and then translate to the target point
// defined by |target_center_x| and |target_center_y|.
gfx::Transform CalculateCircleTransform(const gfx::Vector2dF& center_offset,
float scale,
float target_center_x,
float target_center_y) {
gfx::Transform transform;
transform.Translate(target_center_x, target_center_y);
transform.Scale(scale, scale);
transform.Translate(-center_offset.x(), -center_offset.y());
return transform;
}
// Calculates a Transform for a rectangle layer. The transform will be set up to
// translate by -|center_offset| and then scale by the |x_scale| and |y_scale|
// factors.
gfx::Transform CalculateRectTransform(const gfx::Vector2dF& center_offset,
float x_scale,
float y_scale) {
gfx::Transform transform;
transform.Scale(x_scale, y_scale);
transform.Translate(-center_offset.x(), -center_offset.y());
return transform;
}
} // namespace
namespace views {
SquareInkDropRipple::SquareInkDropRipple(const gfx::Size& large_size,
int large_corner_radius,
const gfx::Size& small_size,
int small_corner_radius,
const gfx::Point& center_point,
SkColor color,
float visible_opacity)
: SquareInkDropRipple(large_size,
large_corner_radius,
small_size,
small_corner_radius,
center_point,
center_point,
color,
visible_opacity) {}
SquareInkDropRipple::SquareInkDropRipple(const gfx::Size& large_size,
int large_corner_radius,
const gfx::Size& small_size,
int small_corner_radius,
const gfx::Point& initial_center_point,
const gfx::Point& target_center_point,
SkColor color,
float visible_opacity)
: activated_shape_(ROUNDED_RECT),
visible_opacity_(visible_opacity),
target_center_point_(target_center_point),
large_size_(large_size),
large_corner_radius_(large_corner_radius),
small_size_(small_size),
small_corner_radius_(small_corner_radius),
circle_layer_delegate_(new CircleLayerDelegate(
color,
std::min(large_size_.width(), large_size_.height()) / 2)),
rect_layer_delegate_(new RectangleLayerDelegate(color, large_size_)),
root_layer_(ui::LAYER_NOT_DRAWN) {
root_layer_.set_name("SquareInkDropRipple:ROOT_LAYER");
for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i)
AddPaintLayer(static_cast<PaintedShape>(i));
root_layer_.SetMasksToBounds(false);
root_layer_.SetBounds(gfx::Rect(large_size_));
gfx::Transform transform;
transform.Translate(initial_center_point.x(), initial_center_point.y());
root_layer_.SetTransform(transform);
SetStateToHidden();
}
SquareInkDropRipple::~SquareInkDropRipple() {
// Explicitly aborting all the animations ensures all callbacks are invoked
// while this instance still exists.
AbortAllAnimations();
}
void SquareInkDropRipple::SnapToActivated() {
InkDropRipple::SnapToActivated();
SetOpacity(visible_opacity_);
InkDropTransforms transforms;
GetActivatedTargetTransforms(&transforms);
SetTransforms(transforms);
}
ui::Layer* SquareInkDropRipple::GetRootLayer() {
return &root_layer_;
}
float SquareInkDropRipple::GetCurrentOpacity() const {
return root_layer_.opacity();
}
std::string SquareInkDropRipple::ToLayerName(PaintedShape painted_shape) {
switch (painted_shape) {
case TOP_LEFT_CIRCLE:
return "TOP_LEFT_CIRCLE";
case TOP_RIGHT_CIRCLE:
return "TOP_RIGHT_CIRCLE";
case BOTTOM_RIGHT_CIRCLE:
return "BOTTOM_RIGHT_CIRCLE";
case BOTTOM_LEFT_CIRCLE:
return "BOTTOM_LEFT_CIRCLE";
case HORIZONTAL_RECT:
return "HORIZONTAL_RECT";
case VERTICAL_RECT:
return "VERTICAL_RECT";
case PAINTED_SHAPE_COUNT:
NOTREACHED() << "The PAINTED_SHAPE_COUNT value should never be used.";
return "PAINTED_SHAPE_COUNT";
}
return "UNKNOWN";
}
void SquareInkDropRipple::AnimateStateChange(
InkDropState old_ink_drop_state,
InkDropState new_ink_drop_state,
ui::LayerAnimationObserver* animation_observer) {
InkDropTransforms transforms;
switch (new_ink_drop_state) {
case InkDropState::HIDDEN:
if (!IsVisible()) {
SetStateToHidden();
break;
} else {
AnimateToOpacity(kHiddenOpacity, GetAnimationDuration(HIDDEN_FADE_OUT),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
CalculateCircleTransforms(small_size_, &transforms);
AnimateToTransforms(
transforms, GetAnimationDuration(HIDDEN_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
}
break;
case InkDropState::ACTION_PENDING:
DCHECK(old_ink_drop_state == InkDropState::HIDDEN);
AnimateToOpacity(visible_opacity_,
GetAnimationDuration(ACTION_PENDING_FADE_IN),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
AnimateToOpacity(visible_opacity_,
GetAnimationDuration(ACTION_PENDING_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
CalculateCircleTransforms(large_size_, &transforms);
AnimateToTransforms(transforms,
GetAnimationDuration(ACTION_PENDING_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(ACTION_PENDING_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
break;
case InkDropState::ACTION_TRIGGERED: {
DCHECK(old_ink_drop_state == InkDropState::HIDDEN ||
old_ink_drop_state == InkDropState::ACTION_PENDING);
if (old_ink_drop_state == InkDropState::HIDDEN) {
AnimateStateChange(old_ink_drop_state, InkDropState::ACTION_PENDING,
animation_observer);
}
AnimateToOpacity(kHiddenOpacity,
GetAnimationDuration(ACTION_TRIGGERED_FADE_OUT),
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
gfx::Tween::EASE_IN_OUT, animation_observer);
gfx::Size s = ScaleToRoundedSize(large_size_, kQuickActionBurstScale);
CalculateCircleTransforms(s, &transforms);
AnimateToTransforms(transforms,
GetAnimationDuration(ACTION_TRIGGERED_TRANSFORM),
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(ACTION_TRIGGERED_TRANSFORM),
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
gfx::Tween::EASE_IN, animation_observer);
break;
}
case InkDropState::ALTERNATE_ACTION_PENDING:
DCHECK(old_ink_drop_state == InkDropState::ACTION_PENDING);
AnimateToOpacity(visible_opacity_,
GetAnimationDuration(ALTERNATE_ACTION_PENDING),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
CalculateRectTransforms(small_size_, small_corner_radius_, &transforms);
AnimateToTransforms(transforms,
GetAnimationDuration(ALTERNATE_ACTION_PENDING),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(ALTERNATE_ACTION_PENDING),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
break;
case InkDropState::ALTERNATE_ACTION_TRIGGERED: {
DCHECK(old_ink_drop_state == InkDropState::ALTERNATE_ACTION_PENDING);
base::TimeDelta visible_duration =
GetAnimationDuration(ALTERNATE_ACTION_TRIGGERED_TRANSFORM) -
GetAnimationDuration(ALTERNATE_ACTION_TRIGGERED_FADE_OUT);
AnimateToOpacity(visible_opacity_, visible_duration,
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateToOpacity(kHiddenOpacity, GetAnimationDuration(
ALTERNATE_ACTION_TRIGGERED_FADE_OUT),
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
gfx::Tween::EASE_IN_OUT, animation_observer);
CalculateRectTransforms(large_size_, large_corner_radius_, &transforms);
AnimateToTransforms(transforms, GetAnimationDuration(
ALTERNATE_ACTION_TRIGGERED_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(
target_center_point_,
GetAnimationDuration(ALTERNATE_ACTION_TRIGGERED_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
break;
}
case InkDropState::ACTIVATED: {
// Animate the opacity so that it cancels any opacity animations already
// in progress.
AnimateToOpacity(visible_opacity_, base::TimeDelta(),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
ui::LayerAnimator::PreemptionStrategy rect_transform_preemption_strategy =
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET;
if (old_ink_drop_state == InkDropState::HIDDEN) {
rect_transform_preemption_strategy =
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION;
CalculateCircleTransforms(large_size_, &transforms);
AnimateToTransforms(
transforms, GetAnimationDuration(ACTIVATED_CIRCLE_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(ACTIVATED_CIRCLE_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
} else if (old_ink_drop_state == InkDropState::ACTION_PENDING) {
rect_transform_preemption_strategy =
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION;
}
GetActivatedTargetTransforms(&transforms);
AnimateToTransforms(transforms,
GetAnimationDuration(ACTIVATED_RECT_TRANSFORM),
rect_transform_preemption_strategy,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(ACTIVATED_RECT_TRANSFORM),
rect_transform_preemption_strategy,
gfx::Tween::EASE_IN, animation_observer);
break;
}
case InkDropState::DEACTIVATED: {
base::TimeDelta visible_duration =
GetAnimationDuration(DEACTIVATED_TRANSFORM) -
GetAnimationDuration(DEACTIVATED_FADE_OUT);
AnimateToOpacity(visible_opacity_, visible_duration,
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateToOpacity(kHiddenOpacity,
GetAnimationDuration(DEACTIVATED_FADE_OUT),
ui::LayerAnimator::ENQUEUE_NEW_ANIMATION,
gfx::Tween::EASE_IN_OUT, animation_observer);
GetDeactivatedTargetTransforms(&transforms);
AnimateToTransforms(transforms,
GetAnimationDuration(DEACTIVATED_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN_OUT, animation_observer);
AnimateCenterPoint(target_center_point_,
GetAnimationDuration(DEACTIVATED_TRANSFORM),
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET,
gfx::Tween::EASE_IN, animation_observer);
break;
}
}
}
void SquareInkDropRipple::SetStateToHidden() {
InkDropTransforms transforms;
// Use non-zero size to avoid visual anomalies.
CalculateCircleTransforms(gfx::Size(1, 1), &transforms);
SetTransforms(transforms);
root_layer_.SetOpacity(InkDropRipple::kHiddenOpacity);
root_layer_.SetVisible(false);
}
void SquareInkDropRipple::AbortAllAnimations() {
root_layer_.GetAnimator()->AbortAllAnimations();
for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i)
painted_layers_[i]->GetAnimator()->AbortAllAnimations();
}
void SquareInkDropRipple::AnimateCenterPoint(
const gfx::Point& center_point,
base::TimeDelta duration,
ui::LayerAnimator::PreemptionStrategy preemption_strategy,
gfx::Tween::Type tween,
ui::LayerAnimationObserver* observer) {
ui::LayerAnimator* animator = root_layer_.GetAnimator();
ui::ScopedLayerAnimationSettings animation(animator);
animation.SetPreemptionStrategy(preemption_strategy);
animation.SetTweenType(tween);
gfx::Transform transform;
transform.Translate(target_center_point_.x(), target_center_point_.y());
ui::LayerAnimationElement* element =
ui::LayerAnimationElement::CreateTransformElement(transform, duration);
ui::LayerAnimationSequence* sequence =
new ui::LayerAnimationSequence(element);
if (observer)
sequence->AddObserver(observer);
animator->StartAnimation(sequence);
}
void SquareInkDropRipple::AnimateToTransforms(
const InkDropTransforms transforms,
base::TimeDelta duration,
ui::LayerAnimator::PreemptionStrategy preemption_strategy,
gfx::Tween::Type tween,
ui::LayerAnimationObserver* animation_observer) {
for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i) {
ui::LayerAnimator* animator = painted_layers_[i]->GetAnimator();
ui::ScopedLayerAnimationSettings animation(animator);
animation.SetPreemptionStrategy(preemption_strategy);
animation.SetTweenType(tween);
ui::LayerAnimationElement* element =
ui::LayerAnimationElement::CreateTransformElement(transforms[i],
duration);
ui::LayerAnimationSequence* sequence =
new ui::LayerAnimationSequence(element);
if (animation_observer)
sequence->AddObserver(animation_observer);
animator->StartAnimation(sequence);
}
}
void SquareInkDropRipple::SetTransforms(const InkDropTransforms transforms) {
for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i)
painted_layers_[i]->SetTransform(transforms[i]);
}
void SquareInkDropRipple::SetOpacity(float opacity) {
root_layer_.SetOpacity(opacity);
}
void SquareInkDropRipple::AnimateToOpacity(
float opacity,
base::TimeDelta duration,
ui::LayerAnimator::PreemptionStrategy preemption_strategy,
gfx::Tween::Type tween,
ui::LayerAnimationObserver* animation_observer) {
ui::LayerAnimator* animator = root_layer_.GetAnimator();
ui::ScopedLayerAnimationSettings animation_settings(animator);
animation_settings.SetPreemptionStrategy(preemption_strategy);
animation_settings.SetTweenType(tween);
ui::LayerAnimationElement* animation_element =
ui::LayerAnimationElement::CreateOpacityElement(opacity, duration);
ui::LayerAnimationSequence* animation_sequence =
new ui::LayerAnimationSequence(animation_element);
if (animation_observer)
animation_sequence->AddObserver(animation_observer);
animator->StartAnimation(animation_sequence);
}
void SquareInkDropRipple::CalculateCircleTransforms(
const gfx::Size& size,
InkDropTransforms* transforms_out) const {
CalculateRectTransforms(size, std::min(size.width(), size.height()) / 2.0f,
transforms_out);
}
void SquareInkDropRipple::CalculateRectTransforms(
const gfx::Size& size,
float corner_radius,
InkDropTransforms* transforms_out) const {
DCHECK_GE(size.width() / 2.0f, corner_radius)
<< "The circle's diameter should not be greater than the total width.";
DCHECK_GE(size.height() / 2.0f, corner_radius)
<< "The circle's diameter should not be greater than the total height.";
// The shapes are drawn such that their center points are not at the origin.
// Thus we use the CalculateCircleTransform() and CalculateRectTransform()
// methods to calculate the complex Transforms.
const float circle_scale = std::max(
kMinimumCircleScale,
corner_radius / static_cast<float>(circle_layer_delegate_->radius()));
const float circle_target_x_offset = size.width() / 2.0f - corner_radius;
const float circle_target_y_offset = size.height() / 2.0f - corner_radius;
const gfx::Vector2dF circle_center_offset =
circle_layer_delegate_->GetCenteringOffset();
(*transforms_out)[TOP_LEFT_CIRCLE] = CalculateCircleTransform(
circle_center_offset, circle_scale, -circle_target_x_offset,
-circle_target_y_offset);
(*transforms_out)[TOP_RIGHT_CIRCLE] =
CalculateCircleTransform(circle_center_offset, circle_scale,
circle_target_x_offset, -circle_target_y_offset);
(*transforms_out)[BOTTOM_RIGHT_CIRCLE] =
CalculateCircleTransform(circle_center_offset, circle_scale,
circle_target_x_offset, circle_target_y_offset);
(*transforms_out)[BOTTOM_LEFT_CIRCLE] =
CalculateCircleTransform(circle_center_offset, circle_scale,
-circle_target_x_offset, circle_target_y_offset);
const float rect_delegate_width =
static_cast<float>(rect_layer_delegate_->size().width());
const float rect_delegate_height =
static_cast<float>(rect_layer_delegate_->size().height());
const gfx::Vector2dF rect_center_offset =
rect_layer_delegate_->GetCenteringOffset();
(*transforms_out)[HORIZONTAL_RECT] = CalculateRectTransform(
rect_center_offset,
std::max(kMinimumRectScale, size.width() / rect_delegate_width),
std::max(kMinimumRectScale,
(size.height() - 2.0f * corner_radius) / rect_delegate_height));
(*transforms_out)[VERTICAL_RECT] = CalculateRectTransform(
rect_center_offset,
std::max(kMinimumRectScale,
(size.width() - 2.0f * corner_radius) / rect_delegate_width),
std::max(kMinimumRectScale, size.height() / rect_delegate_height));
}
void SquareInkDropRipple::GetCurrentTransforms(
InkDropTransforms* transforms_out) const {
for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i)
(*transforms_out)[i] = painted_layers_[i]->transform();
}
void SquareInkDropRipple::GetActivatedTargetTransforms(
InkDropTransforms* transforms_out) const {
switch (activated_shape_) {
case CIRCLE:
CalculateCircleTransforms(small_size_, transforms_out);
break;
case ROUNDED_RECT:
CalculateRectTransforms(small_size_, small_corner_radius_,
transforms_out);
break;
}
}
void SquareInkDropRipple::GetDeactivatedTargetTransforms(
InkDropTransforms* transforms_out) const {
switch (activated_shape_) {
case CIRCLE:
CalculateCircleTransforms(large_size_, transforms_out);
break;
case ROUNDED_RECT:
CalculateRectTransforms(large_size_, small_corner_radius_,
transforms_out);
break;
}
}
void SquareInkDropRipple::AddPaintLayer(PaintedShape painted_shape) {
ui::LayerDelegate* delegate = nullptr;
switch (painted_shape) {
case TOP_LEFT_CIRCLE:
case TOP_RIGHT_CIRCLE:
case BOTTOM_RIGHT_CIRCLE:
case BOTTOM_LEFT_CIRCLE:
delegate = circle_layer_delegate_.get();
break;
case HORIZONTAL_RECT:
case VERTICAL_RECT:
delegate = rect_layer_delegate_.get();
break;
case PAINTED_SHAPE_COUNT:
NOTREACHED() << "PAINTED_SHAPE_COUNT is not an actual shape type.";
break;
}
ui::Layer* layer = new ui::Layer();
root_layer_.Add(layer);
layer->SetBounds(gfx::Rect(large_size_));
layer->SetFillsBoundsOpaquely(false);
layer->set_delegate(delegate);
layer->SetVisible(true);
layer->SetOpacity(1.0);
layer->SetMasksToBounds(false);
layer->set_name("PAINTED_SHAPE_COUNT:" + ToLayerName(painted_shape));
painted_layers_[painted_shape].reset(layer);
}
} // namespace views
|
; A161381: Triangle read by rows: T(n,k) = n!*2^k/(n-k)! (n >= 0, 0 <= k <= n).
; Submitted by Christian Krause
; 1,1,2,1,4,8,1,6,24,48,1,8,48,192,384,1,10,80,480,1920,3840,1,12,120,960,5760,23040,46080,1,14,168,1680,13440,80640,322560,645120,1,16,224,2688,26880,215040,1290240,5160960,10321920,1,18,288,4032,48384,483840,3870720,23224320,92897280,185794560
lpb $0
add $1,1
sub $0,$1
lpe
bin $1,$0
mul $1,3
lpb $0
mul $1,$0
sub $0,1
mul $1,2
lpe
mov $0,$1
div $0,3
|
; A169332: Number of reduced words of length n in Coxeter group on 31 generators S_i with relations (S_i)^2 = (S_i S_j)^30 = I.
; 1,31,930,27900,837000,25110000,753300000,22599000000,677970000000,20339100000000,610173000000000,18305190000000000,549155700000000000,16474671000000000000,494240130000000000000,14827203900000000000000
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
div $3,$2
mul $2,30
lpe
mov $0,$2
div $0,30
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/glue/model/UpdateCrawlerRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Glue::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
UpdateCrawlerRequest::UpdateCrawlerRequest() :
m_nameHasBeenSet(false),
m_roleHasBeenSet(false),
m_databaseNameHasBeenSet(false),
m_descriptionHasBeenSet(false),
m_targetsHasBeenSet(false),
m_scheduleHasBeenSet(false),
m_classifiersHasBeenSet(false),
m_tablePrefixHasBeenSet(false),
m_schemaChangePolicyHasBeenSet(false),
m_recrawlPolicyHasBeenSet(false),
m_configurationHasBeenSet(false),
m_crawlerSecurityConfigurationHasBeenSet(false)
{
}
Aws::String UpdateCrawlerRequest::SerializePayload() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("Name", m_name);
}
if(m_roleHasBeenSet)
{
payload.WithString("Role", m_role);
}
if(m_databaseNameHasBeenSet)
{
payload.WithString("DatabaseName", m_databaseName);
}
if(m_descriptionHasBeenSet)
{
payload.WithString("Description", m_description);
}
if(m_targetsHasBeenSet)
{
payload.WithObject("Targets", m_targets.Jsonize());
}
if(m_scheduleHasBeenSet)
{
payload.WithString("Schedule", m_schedule);
}
if(m_classifiersHasBeenSet)
{
Array<JsonValue> classifiersJsonList(m_classifiers.size());
for(unsigned classifiersIndex = 0; classifiersIndex < classifiersJsonList.GetLength(); ++classifiersIndex)
{
classifiersJsonList[classifiersIndex].AsString(m_classifiers[classifiersIndex]);
}
payload.WithArray("Classifiers", std::move(classifiersJsonList));
}
if(m_tablePrefixHasBeenSet)
{
payload.WithString("TablePrefix", m_tablePrefix);
}
if(m_schemaChangePolicyHasBeenSet)
{
payload.WithObject("SchemaChangePolicy", m_schemaChangePolicy.Jsonize());
}
if(m_recrawlPolicyHasBeenSet)
{
payload.WithObject("RecrawlPolicy", m_recrawlPolicy.Jsonize());
}
if(m_configurationHasBeenSet)
{
payload.WithString("Configuration", m_configuration);
}
if(m_crawlerSecurityConfigurationHasBeenSet)
{
payload.WithString("CrawlerSecurityConfiguration", m_crawlerSecurityConfiguration);
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection UpdateCrawlerRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSGlue.UpdateCrawler"));
return headers;
}
|
; A022978: 22-n.
; 22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11,-12,-13,-14,-15,-16,-17,-18,-19,-20,-21,-22,-23,-24,-25,-26,-27,-28,-29,-30,-31,-32,-33,-34,-35,-36,-37,-38
sub $1,$0
add $1,22
mov $0,$1
|
;
; ZX IF1 & Microdrive functions
;
; int if1_init_file (int drive, int name, struct M_CHAN buffer);
;
; This is the original BASIC structure with no added values/flags.
;
;
; Open a file for writing
;
; $Id: if1_init_file.asm,v 1.3 2016/07/01 22:08:20 dom Exp $
;
SECTION code_clib
PUBLIC if1_init_file
PUBLIC _if1_init_file
EXTERN if1_setname
if1_init_file:
_if1_init_file:
rst 8
defb 31h ; Create Interface 1 system vars if required
pop af
pop hl ;buffer
pop de ;filename
pop bc ;driveno
push bc
push de
push hl
push af
push ix ;save callers
push hl
ld a,c
ld ($5cd6),a
push de
ld hl,filename ; filename location
push hl
call if1_setname
ld ($5cda),hl ; length
pop hl
ld ($5cdc),hl ; pointer to filename
pop de
;rst 8 ; Erase if file exists ?
;defb 24h
rst 8
defb 22h ; Open temporary 'M' channel (touch)
; Now IX points to the newly created channel
push ix
pop hl
;ld a,h
;or l
;and a
;ld de,4 ; Experimentally corrected
;add hl,de ; with this offset
pop de ; buffer
ld bc,253h
;ld bc,37h
ldir ; take a copy of the file buffer header
xor a
rst 8
defb 21h ; stop microdrive motor
rst 8
defb 2Ch ; Reclaim the channel
; ..I need the initialized buffer only
; here we could check for free space
; and eventually give the "microdrive full" error
ld hl,0
pop ix ;restore callers
ret
SECTION bss_clib
filename: defs 10
|
[org 0x7c00]
mov bx, OS_NAME
call print
call print_nl
mov bx, AUTHOR_NAME
call print
call print_nl
mov dx, 0x12fe
call print_hex
call print_nl
jmp $
; Subroutines inclusion
%include "boot_sect_print.asm"
%include "boot_sect_print_hex.asm"
; Data Segment
OS_NAME:
db 'TindaOS', 0
AUTHOR_NAME:
db 'Mukesh Chaurasiya', 0
; Padding and magic number
times 510 - ($ - $$) db 0
dw 0xAA55
|
//------------------------------------------------------------------------------
// NKUI.cc
//------------------------------------------------------------------------------
#include "Pre.h"
#include "NKUI.h"
#include "Core/Assertion.h"
#include "Core/Memory/Memory.h"
namespace Oryol {
NKUI::_state* NKUI::state = nullptr;
//------------------------------------------------------------------------------
void
NKUI::Setup(const NKUISetup& setup) {
o_assert_dbg(!IsValid());
state = Memory::New<_state>();
state->nkuiWrapper.Setup(setup);
}
//------------------------------------------------------------------------------
void
NKUI::Discard() {
o_assert_dbg(IsValid());
state->nkuiWrapper.Discard();
Memory::Delete(state);
state = nullptr;
}
//------------------------------------------------------------------------------
bool
NKUI::IsValid() {
return nullptr != state;
}
//------------------------------------------------------------------------------
nk_context*
NKUI::NewFrame() {
o_assert_dbg(IsValid());
state->nkuiWrapper.NewFrame();
return &state->nkuiWrapper.ctx;
}
//------------------------------------------------------------------------------
void
NKUI::Draw() {
o_assert_dbg(IsValid());
state->nkuiWrapper.Draw();
}
//------------------------------------------------------------------------------
struct nk_image
NKUI::AllocImage() {
o_assert_dbg(IsValid());
return state->nkuiWrapper.AllocImage();
}
//------------------------------------------------------------------------------
void
NKUI::FreeImage(const struct nk_image& image) {
o_assert_dbg(IsValid());
state->nkuiWrapper.FreeImage(image);
}
//------------------------------------------------------------------------------
void
NKUI::BindImage(const struct nk_image& image, Id texId) {
o_assert_dbg(IsValid());
state->nkuiWrapper.BindImage(image, texId);
}
//------------------------------------------------------------------------------
void
NKUI::BeginFontAtlas() {
o_assert_dbg(IsValid());
state->nkuiWrapper.BeginFontAtlas();
}
//------------------------------------------------------------------------------
nk_font*
NKUI::AddFont(const Buffer& ttfData, float fontHeight) {
o_assert_dbg(IsValid());
return state->nkuiWrapper.AddFont(ttfData, fontHeight);
}
//------------------------------------------------------------------------------
void
NKUI::EndFontAtlas() {
o_assert_dbg(IsValid());
state->nkuiWrapper.EndFontAtlas();
}
} // namespace Oryol
|
; A112751: Number of numbers less than or equal to n of the form 3^i*5^j.
; 1,1,2,2,3,3,3,3,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
mov $2,$0
mov $4,$0
add $4,1
lpb $4
mov $0,$2
sub $4,1
sub $0,$4
add $0,1
mov $5,$0
mov $0,4
mov $3,2025
mod $3,$5
trn $0,$3
mov $5,$0
div $5,4
add $1,$5
lpe
mov $0,$1
|
; A228261: Number of third differences of arrays of length 5 of numbers in 0..n.
; 31,143,319,565,881,1267,1723,2249,2845,3511,4247,5053,5929,6875,7891,8977,10133,11359,12655,14021,15457,16963,18539,20185,21901,23687,25543,27469,29465,31531,33667,35873,38149,40495,42911,45397,47953,50579,53275,56041,58877,61783,64759,67805,70921,74107,77363,80689,84085,87551,91087,94693,98369,102115,105931,109817,113773,117799,121895,126061,130297,134603,138979,143425,147941,152527,157183,161909,166705,171571,176507,181513,186589,191735,196951,202237,207593,213019,218515,224081,229717,235423,241199,247045,252961,258947,265003,271129,277325,283591,289927,296333,302809,309355,315971,322657,329413,336239,343135,350101
pow $1,$0
gcd $1,7
add $1,30
mov $2,$0
mul $2,71
add $1,$2
mov $3,$0
mul $3,$0
mov $2,$3
mul $2,35
add $1,$2
mov $0,$1
|
; A128134: A128132 * A007318.
; Submitted by Jon Maiga
; 1,1,2,2,5,3,3,10,11,4,4,17,27,19,5,5,26,54,56,29,6,6,37,95,130,100,41,7,7,50,153,260,265,162,55,8,8,65,231,469,595,483,245,71,9,9,82,332,784,1190,1204,812,352,89,10
lpb $0
add $2,1
sub $0,$2
add $1,1
lpe
bin $1,$0
sub $0,1
mul $1,$2
sub $2,1
bin $2,$0
add $2,$1
mov $0,$2
|
age:
db 0
amount_of_wood:
dl 0
amount_of_food:
dl 0
amount_of_gold:
dl 0
amount_of_stone:
dl 0
amount_of_people:
dl 3
amount_of_max_people:
dl 10
amount_of_buildings:
db 0
map_data_ptr:
dl 0
scheduling_events:
rb MAX_AMOUNT_PEOPLE * 2 * EVENT.size
amount_of_events:
db 0
temp_unit_data:
db 0
db 0
buildings_stack: ; A stack with all the buildings in the game, with its properties
rb MAX_AMOUNT_BUILDINGS * 2 * BUILDING_ENTRY.size
buildings_sprites_base: ; Pointer to the end of AoCE which is the start of dynamically loading buildings
dl 0
buildings_sprites_ptr: ; Pointer to the end of all the building sprites
dl 0
buildings_loaded: ; A stack with all the buildings with pointers to the sprites in RAM
rb BUILDING_SPRITE.size * 18
units_stack:
rb MAX_AMOUNT_PEOPLE * 2 * UNIT_ENTRY.size
units_sprites_base: ; Pointer to the loaded graphics start
dl 0
units_sprites_ptr: ; Pointer to the loaded graphics end
dl 0
units_loaded: ; Stack with which unit is loaded in RAM (graphics)
rb UNIT_SPRITE.size * 22
units_per_tile:
rb MAX_UNITS_PER_TILE * 3 ; Bytes: <type> <x offset> <y offset>
virtual at iy
x_start: dl -10 - 2 - 2 ; (-10, -3) is the begin position measured from the top left
y_start: dl -3 + 2 + 2 ; We start with 4 columns to the left, because buildings can be 4 tiles width
cursor_x: dl lcdWidth / 2 - 12
cursor_y: db lcdHeight / 2 - 16
x_offset: db 0
y_offset: db 0
load iy_data: $ - $$ from $$
end virtual
iy_base db iy_data
resource_type_1:
db 0, 1, 0
db 0, 1, 1
db 1, 1, 1
resource_type_2:
db 1, 0, 0
db 0, 1, 0
db 0, 1, 1
resource_type_3:
db 0, 0, 0
db 1, 1, 0
db 0, 0, 0
resource_type_4:
db 1, 1, 1
db 0, 1, 0
db 0, 0, 0
resource_type_5:
db 0, 0, 0
db 0, 0, 1
db 1, 1, 1
resource_type_6:
db 0, 0, 0
db 0, 1, 0
db 0, 0, 0
resource_type_7:
db 0, 0, 0
db 0, 0, 1
db 0, 1, 1
pal_sprites: ; Don't worry, it's just the xLIBC palette
dw $0000, $0081, $0102, $0183, $0204, $0285, $0306, $0387
dw $0408, $0489, $050A, $058B, $060C, $068D, $070E, $078F
dw $0810, $0891, $0912, $0993, $0A14, $0A95, $0B16, $0B97
dw $0C18, $0C99, $0D1A, $0D9B, $0E1C, $0E9D, $0F1E, $0F9F
dw $1000, $1081, $1102, $1183, $1204, $1285, $1306, $1387
dw $1408, $1489, $150A, $158B, $160C, $168D, $170E, $178F
dw $1810, $1891, $1912, $1993, $1A14, $1A95, $1B16, $1B97
dw $1C18, $1C99, $1D1A, $1D9B, $1E1C, $1E9D, $1F1E, $1F9F
dw $2020, $20A1, $2122, $21A3, $2224, $22A5, $2326, $23A7
dw $2428, $24A9, $252A, $25AB, $262C, $26AD, $272E, $27AF
dw $2830, $28B1, $2932, $29B3, $2A34, $2AB5, $2B36, $2BB7
dw $2C38, $2CB9, $2D3A, $2DBB, $2E3C, $2EBD, $2F3E, $2FBF
dw $3020, $30A1, $3122, $31A3, $3224, $32A5, $3326, $33A7
dw $3428, $34A9, $352A, $35AB, $362C, $36AD, $372E, $37AF
dw $3830, $38B1, $3932, $39B3, $3A34, $3AB5, $3B36, $3BB7
dw $3C38, $3CB9, $3D3A, $3DBB, $3E3C, $3EBD, $3F3E, $3FBF
dw $4040, $40C1, $4142, $41C3, $4244, $42C5, $4346, $43C7
dw $4448, $44C9, $454A, $45CB, $464C, $46CD, $474E, $47CF
dw $4850, $48D1, $4952, $49D3, $4A54, $4AD5, $4B56, $4BD7
dw $4C58, $4CD9, $4D5A, $4DDB, $4E5C, $4EDD, $4F5E, $4FDF
dw $5040, $50C1, $5142, $51C3, $5244, $52C5, $5346, $53C7
dw $5448, $54C9, $554A, $55CB, $564C, $56CD, $574E, $57CF
dw $5850, $58D1, $5952, $59D3, $5A54, $5AD5, $5B56, $5BD7
dw $5C58, $5CD9, $5D5A, $5DDB, $5E5C, $5EDD, $5F5E, $5FDF
dw $6060, $60E1, $6162, $61E3, $6264, $62E5, $6366, $63E7
dw $6468, $64E9, $656A, $65EB, $666C, $66ED, $676E, $67EF
dw $6870, $68F1, $6972, $69F3, $6A74, $6AF5, $6B76, $6BF7
dw $6C78, $6CF9, $6D7A, $6DFB, $6E7C, $6EFD, $6F7E, $6FFF
dw $7060, $70E1, $7162, $71E3, $7264, $72E5, $7366, $73E7
dw $7468, $74E9, $756A, $75EB, $766C, $76ED, $776E, $77EF
dw $7870, $78F1, $7972, $79F3, $7A74, $7AF5, $7B76, $7BF7
dw $7C78, $7CF9, $7D7A, $7DFB, $7E7C, $7EFD, $7F7E, $FFFF
default_char_spacing:
; 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
db 8,8,8,8,8,8,8,8,8,8,8,8,8,2,8,8
db 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
db 3,4,6,8,8,8,8,5,5,5,8,7,4,7,3,8
db 8,7,8,8,8,8,8,8,8,8,3,4,6,7,6,7
db 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
db 8,8,8,8,8,8,8,8,8,8,8,5,8,5,8,8
db 4,8,8,8,8,8,8,8,8,5,8,8,5,8,8,8
db 8,8,8,8,7,8,8,8,8,8,8,7,3,7,8,8
db 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
db 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
;-------------------------------------------------------------------------------
default_text_data:
Char000: db $00,$00,$00,$00,$00,$00,$00,$00 ; .
Char001: db $7E,$81,$A5,$81,$BD,$BD,$81,$7E ; .
Char002: db $7E,$FF,$DB,$FF,$C3,$C3,$FF,$7E ; .
Char003: db $6C,$FE,$FE,$FE,$7C,$38,$10,$00 ; .
Char004: db $10,$38,$7C,$FE,$7C,$38,$10,$00 ; .
Char005: db $38,$7C,$38,$FE,$FE,$10,$10,$7C ; .
Char006: db $00,$18,$3C,$7E,$FF,$7E,$18,$7E ; .
Char007: db $00,$00,$18,$3C,$3C,$18,$00,$00 ; .
Char008: db $FF,$FF,$E7,$C3,$C3,$E7,$FF,$FF ; .
Char009: db $00,$3C,$66,$42,$42,$66,$3C,$00 ; .
Char010: db $FF,$C3,$99,$BD,$BD,$99,$C3,$FF ; .
Char011: db $0F,$07,$0F,$7D,$CC,$CC,$CC,$78 ; .
Char012: db $3C,$66,$66,$66,$3C,$18,$7E,$18 ; .
Char013: db $3F,$33,$3F,$30,$30,$70,$F0,$E0 ; .
Char014: db $7F,$63,$7F,$63,$63,$67,$E6,$C0 ; .
Char015: db $99,$5A,$3C,$E7,$E7,$3C,$5A,$99 ; .
Char016: db $80,$E0,$F8,$FE,$F8,$E0,$80,$00 ; .
Char017: db $02,$0E,$3E,$FE,$3E,$0E,$02,$00 ; .
Char018: db $18,$3C,$7E,$18,$18,$7E,$3C,$18 ; .
Char019: db $66,$66,$66,$66,$66,$00,$66,$00 ; .
Char020: db $7F,$DB,$DB,$7B,$1B,$1B,$1B,$00 ; .
Char021: db $3F,$60,$7C,$66,$66,$3E,$06,$FC ; .
Char022: db $00,$00,$00,$00,$7E,$7E,$7E,$00 ; .
Char023: db $18,$3C,$7E,$18,$7E,$3C,$18,$FF ; .
Char024: db $18,$3C,$7E,$18,$18,$18,$18,$00 ; .
Char025: db $18,$18,$18,$18,$7E,$3C,$18,$00 ; .
Char026: db $00,$18,$0C,$FE,$0C,$18,$00,$00 ; .
Char027: db $00,$30,$60,$FE,$60,$30,$00,$00 ; .
Char028: db $00,$00,$C0,$C0,$C0,$FE,$00,$00 ; .
Char029: db $00,$24,$66,$FF,$66,$24,$00,$00 ; .
Char030: db $00,$18,$3C,$7E,$FF,$FF,$00,$00 ; .
Char031: db $00,$FF,$FF,$7E,$3C,$18,$00,$00 ; .
Char032: db $00,$00,$00,$00,$00,$00,$00,$00 ;
Char033: db $C0,$C0,$C0,$C0,$C0,$00,$C0,$00 ; !
Char034: db $D8,$D8,$D8,$00,$00,$00,$00,$00 ; "
Char035: db $6C,$6C,$FE,$6C,$FE,$6C,$6C,$00 ; #
Char036: db $18,$7E,$C0,$7C,$06,$FC,$18,$00 ; $
Char037: db $00,$C6,$CC,$18,$30,$66,$C6,$00 ; %
Char038: db $38,$6C,$38,$76,$DC,$CC,$76,$00 ; &
Char039: db $30,$30,$60,$00,$00,$00,$00,$00 ; '
Char040: db $30,$60,$C0,$C0,$C0,$60,$30,$00 ; (
Char041: db $C0,$60,$30,$30,$30,$60,$C0,$00 ; )
Char042: db $00,$66,$3C,$FF,$3C,$66,$00,$00 ; *
Char043: db $00,$30,$30,$FC,$FC,$30,$30,$00 ; +
Char044: db $00,$00,$00,$00,$00,$60,$60,$C0 ; ,
Char045: db $00,$00,$00,$FC,$00,$00,$00,$00 ; -
Char046: db $00,$00,$00,$00,$00,$C0,$C0,$00 ; .
Char047: db $06,$0C,$18,$30,$60,$C0,$80,$00 ; /
Char048: db $7C,$CE,$DE,$F6,$E6,$C6,$7C,$00 ; 0
Char049: db $30,$70,$30,$30,$30,$30,$FC,$00 ; 1
Char050: db $7C,$C6,$06,$7C,$C0,$C0,$FE,$00 ; 2
Char051: db $FC,$06,$06,$3C,$06,$06,$FC,$00 ; 3
Char052: db $0C,$CC,$CC,$CC,$FE,$0C,$0C,$00 ; 4
Char053: db $FE,$C0,$FC,$06,$06,$C6,$7C,$00 ; 5
Char054: db $7C,$C0,$C0,$FC,$C6,$C6,$7C,$00 ; 6
Char055: db $FE,$06,$06,$0C,$18,$30,$30,$00 ; 7
Char056: db $7C,$C6,$C6,$7C,$C6,$C6,$7C,$00 ; 8
Char057: db $7C,$C6,$C6,$7E,$06,$06,$7C,$00 ; 9
Char058: db $00,$C0,$C0,$00,$00,$C0,$C0,$00 ; :
Char059: db $00,$60,$60,$00,$00,$60,$60,$C0 ; ;
Char060: db $18,$30,$60,$C0,$60,$30,$18,$00 ; <
Char061: db $00,$00,$FC,$00,$FC,$00,$00,$00 ; =
Char062: db $C0,$60,$30,$18,$30,$60,$C0,$00 ; >
Char063: db $78,$CC,$18,$30,$30,$00,$30,$00 ; ?
Char064: db $7C,$C6,$DE,$DE,$DE,$C0,$7E,$00 ; @
Char065: db $38,$6C,$C6,$C6,$FE,$C6,$C6,$00 ; A
Char066: db $FC,$C6,$C6,$FC,$C6,$C6,$FC,$00 ; B
Char067: db $7C,$C6,$C0,$C0,$C0,$C6,$7C,$00 ; C
Char068: db $F8,$CC,$C6,$C6,$C6,$CC,$F8,$00 ; D
Char069: db $FE,$C0,$C0,$F8,$C0,$C0,$FE,$00 ; E
Char070: db $FE,$C0,$C0,$F8,$C0,$C0,$C0,$00 ; F
Char071: db $7C,$C6,$C0,$C0,$CE,$C6,$7C,$00 ; G
Char072: db $C6,$C6,$C6,$FE,$C6,$C6,$C6,$00 ; H
Char073: db $7E,$18,$18,$18,$18,$18,$7E,$00 ; I
Char074: db $06,$06,$06,$06,$06,$C6,$7C,$00 ; J
Char075: db $C6,$CC,$D8,$F0,$D8,$CC,$C6,$00 ; K
Char076: db $C0,$C0,$C0,$C0,$C0,$C0,$FE,$00 ; L
Char077: db $C6,$EE,$FE,$FE,$D6,$C6,$C6,$00 ; M
Char078: db $C6,$E6,$F6,$DE,$CE,$C6,$C6,$00 ; N
Char079: db $7C,$C6,$C6,$C6,$C6,$C6,$7C,$00 ; O
Char080: db $FC,$C6,$C6,$FC,$C0,$C0,$C0,$00 ; P
Char081: db $7C,$C6,$C6,$C6,$D6,$DE,$7C,$06 ; Q
Char082: db $FC,$C6,$C6,$FC,$D8,$CC,$C6,$00 ; R
Char083: db $7C,$C6,$C0,$7C,$06,$C6,$7C,$00 ; S
Char084: db $FF,$18,$18,$18,$18,$18,$18,$00 ; T
Char085: db $C6,$C6,$C6,$C6,$C6,$C6,$FE,$00 ; U
Char086: db $C6,$C6,$C6,$C6,$C6,$7C,$38,$00 ; V
Char087: db $C6,$C6,$C6,$C6,$D6,$FE,$6C,$00 ; W
Char088: db $C6,$C6,$6C,$38,$6C,$C6,$C6,$00 ; X
Char089: db $C6,$C6,$C6,$7C,$18,$30,$E0,$00 ; Y
Char090: db $FE,$06,$0C,$18,$30,$60,$FE,$00 ; Z
Char091: db $F0,$C0,$C0,$C0,$C0,$C0,$F0,$00 ; [
Char092: db $C0,$60,$30,$18,$0C,$06,$02,$00 ; \
Char093: db $F0,$30,$30,$30,$30,$30,$F0,$00 ; ]
Char094: db $10,$38,$6C,$C6,$00,$00,$00,$00 ; ^
Char095: db $00,$00,$00,$00,$00,$00,$00,$FF ; _
Char096: db $C0,$C0,$60,$00,$00,$00,$00,$00 ; `
Char097: db $00,$00,$7C,$06,$7E,$C6,$7E,$00 ; a
Char098: db $C0,$C0,$C0,$FC,$C6,$C6,$FC,$00 ; b
Char099: db $00,$00,$7C,$C6,$C0,$C6,$7C,$00 ; c
Char100: db $06,$06,$06,$7E,$C6,$C6,$7E,$00 ; d
Char101: db $00,$00,$7C,$C6,$FE,$C0,$7C,$00 ; e
Char102: db $1C,$36,$30,$78,$30,$30,$78,$00 ; f
Char103: db $00,$00,$7E,$C6,$C6,$7E,$06,$FC ; g
Char104: db $C0,$C0,$FC,$C6,$C6,$C6,$C6,$00 ; h
Char105: db $60,$00,$E0,$60,$60,$60,$F0,$00 ; i
Char106: db $06,$00,$06,$06,$06,$06,$C6,$7C ; j
Char107: db $C0,$C0,$CC,$D8,$F8,$CC,$C6,$00 ; k
Char108: db $E0,$60,$60,$60,$60,$60,$F0,$00 ; l
Char109: db $00,$00,$CC,$FE,$FE,$D6,$D6,$00 ; m
Char110: db $00,$00,$FC,$C6,$C6,$C6,$C6,$00 ; n
Char111: db $00,$00,$7C,$C6,$C6,$C6,$7C,$00 ; o
Char112: db $00,$00,$FC,$C6,$C6,$FC,$C0,$C0 ; p
Char113: db $00,$00,$7E,$C6,$C6,$7E,$06,$06 ; q
Char114: db $00,$00,$FC,$C6,$C0,$C0,$C0,$00 ; r
Char115: db $00,$00,$7E,$C0,$7C,$06,$FC,$00 ; s
Char116: db $30,$30,$FC,$30,$30,$30,$1C,$00 ; t
Char117: db $00,$00,$C6,$C6,$C6,$C6,$7E,$00 ; u
Char118: db $00,$00,$C6,$C6,$C6,$7C,$38,$00 ; v
Char119: db $00,$00,$C6,$C6,$D6,$FE,$6C,$00 ; w
Char120: db $00,$00,$C6,$6C,$38,$6C,$C6,$00 ; x
Char121: db $00,$00,$C6,$C6,$C6,$7E,$06,$FC ; y
Char122: db $00,$00,$FE,$0C,$38,$60,$FE,$00 ; z
Char123: db $1C,$30,$30,$E0,$30,$30,$1C,$00 ; {
Char124: db $C0,$C0,$C0,$00,$C0,$C0,$C0,$00 ; |
Char125: db $E0,$30,$30,$1C,$30,$30,$E0,$00 ; }
Char126: db $76,$DC,$00,$00,$00,$00,$00,$00 ; ~
Char127: db $00,$10,$38,$6C,$C6,$C6,$FE,$00 ; . |
.xlist
include grep.mac
include grep.hm
include word.inc
ifdef OPUS
externFP <AnsiUpper>
externFP <AnsiLower>
externFP <FUpper>
externFP <FLower>
createSeg docman2_PCODE,CODE,byte,public,CODE
else
externNC ChUpper
externNC ChLower
externNC isupper
externNC islower
endif
.list
;------------------------------------------------------------------------
; PUBLICS
;------------------------------------------------------------------------
PUBLIC read_in_file, suck_in_file, bgrep, gimme_a_piece_a_buff
PUBLIC bgrep_for_expression, make_the_bitmaps
PUBLIC build_bitmap, get_RE_char, put_bit, test_bit
ifdef NOT_USED
PUBLIC free_bytes
endif
PUBLIC allocmem
;externFP CchReadOsfnLp
;externFP FSetFilePointer
externFP DwSeekDw
externFP CchReadDoshnd
;------------------------------------------------------------------------
; The Word data segment. The strings to search for are here as well
;------------------------------------------------------------------------
sBegin DATA
ifdef NOT_USED
previous_free_memory_off dw 0
previous_free_memory_size dw 0 ; bytes now, not paras
endif
pword input_file_handle
pword first_bitmap_off
pword free_memory_off
pword free_memory_size ; bytes now, not paras
pword current_bitmap_off
pword bit_flags
pdword fcFirst
pdword cfcSearch
pword file_buffer_off
pword file_buffer_size
pword pStrings
pword cStrings
pword rgchResult
pword abort_stack_ptr
pword buffer_seg ; in case we need to restore a seg for BUFFER
sEnd DATA
;------------------------------------------------------------------------
; This is a fake segment. All references to variables in the
; buffer passed from word are prefixed with BUFFER: , and at
; least one of the segment registers better point here then!
;------------------------------------------------------------------------
createSeg buffer, BUFFER, at, 0
sBegin BUFFER
sEnd BUFFER
ifdef REVIEW
externFP <DOSREAD, DOSCHGFILEPTR>
externNC ChUpper
externNC ChLower
externNC isupper
externNC islower
endif
sBegin CODE
assumes cs, CODE
assumes ss, DATA
assumes ds,DATA
assumes es,nothing
farPtr ss_bx, ss, bx
farPtr ss_ax, ss, ax
bitmap_of_special_chars label byte
db 0,0,0,0,10h,22h,0,0,0,0,0,0,0,0,0,0 ;#*.
rept 16
db 0
endm
;-----------------------------------------------------------------------
; This module thoroughly hacked,
; 1. 12/86 to extract from the DSR grep code
; 2. 6/88 rewritten to remove OS/2 incompatable segment kludges & speed hacks
;
; Throughout this module, unless otherwise stated, the code has been
; modified to assume the following:
; DS: Points to the buffer passed in from Word
; ES: "
; CS: Points to code
; SS: Points to the word stack (and data) segment.
; Offsets of various items into the buffer are stored, and
; then accessed as DS:BX.foo
;-----------------------------------------------------------------------
;.............................................................................
;..............................PROGRAM..BEGINS................................
;.............................................................................
assumes ss,DATA
assumes ds,DATA
assumes es,DATA
; %%Function:wordgrep %%Owner:chic
cProc wordgrep,<PUBLIC, FAR>,<DI,SI>,,1
ParmD fpMemory ; far pointer to memory buffer
ParmW cbMemory ; number of bytes of memory
ParmW wpStrings ; pointer to array of near pointers
; each of which points to a string
ParmW wcStrings ; number of strings in above array
ParmW wpResult ; pointer to array of chars in which
; to put the results
ParmW handle ; handle of file to search.
ParmW wordflags ; case?
ParmD fcWStart ; Where to start in file
ParmD cfc ; Where to end in file
cBegin wordgrep
mov ax, handle
mov word ptr input_file_handle,ax
mov ax, wpStrings ; move these off the stack for
mov pStrings, ax ;
mov ax, wcStrings ; global use
mov cStrings, ax ;
mov ax, wpResult
mov rgchResult, ax
mov bit_flags,DASH_Y_FLAG ; Assume case insensitive.
test wordflags,1
jne Case_insens
mov bit_flags, 0
Case_insens:
mov ax, SEG_fpMemory
mov ds, ax
assumes ds, BUFFER
mov buffer_seg, ax
mov bx,cbMemory
mov ax, SEG_fcWStart
mov word ptr fcFirst[2], ax
mov ax, OFF_fcWStart
mov word ptr fcFirst[0], ax
mov ax, SEG_cfc
mov word ptr cfcSearch[2], ax
mov ax, OFF_cfc
mov word ptr cfcSearch[0], ax
;------------------------------------save stack pointer for global aborts
mov abort_stack_ptr, sp
;------------------------------------------------------------------------
xor ax,ax
mov free_memory_off, ax ; offset into BUFFER
mov free_memory_size, bx
;-----------------------------------------------BUILD-BITMAPS---------------
call make_the_bitmaps
mov ax, es ; make the bitmaps swapped es and ds
mov ds, ax
mov ax, ss
mov es, ax
;-----------------------------------Allocate-Buffers----------------
call allocmem
mov file_buffer_off,ax
dec bx ;leave room for crlf at eof
dec bx ;leave room for crlf at eof
mov file_buffer_size,bx
do_find_first:
;-----------------------------------Seek to starting position in file--
call seek_to_fcFirst
;----------------------------------------SUCK-IN-FILE------------------
get_more:
mov ax,file_buffer_off
mov bx,file_buffer_size
mov cx,input_file_handle
call read_in_file
jc end_of_file_buffer ;jmp if null file
;------------------------------------------BGREP--------------------------;
call bgrep
mov ax, ss ; bgrep set es=BUFFER
mov es, ax
;------------------------------------------------------------------------;
end_of_file_buffer:
test bit_flags,GET_MORE_OF_FILE_FLAG
jz the_finish
jmp get_more ;get more of this file
;------------------------------------------------------------------------;
the_finish:
;------------------------------------------------------------------------;
; return answer to word
;------------------------------------------------------------------------;
xor ax,ax ; 0 means everything is okay
jmp short return_to_word
ret_error_to_word:
;---------------------------------------------------------------------------
; We can jump here from just about anywhere, so don't assume any of
; the segment registers except cs and ss are correct
;--------------------------------------------------------------------------
mov sp, abort_stack_ptr
; xor ax,ax ; until we get some error codes
return_to_word:
mov bx,ss ; restore the word segment regs
mov ds,bx
assumes ds,data
mov es,bx
assumes es,data
cEnd wordgrep ; time to go home.
;-----------------------------------------------------------------------;
; read_in_file ;
; ;
; Sucks in file, lseeks as necessay, checks if it's null ;
; ;
; Arguments: ;
; ax = file_buffer_off
; bx = file_buffer_size
; cx = input_file_handle
; DS = data buffer
; Returns: ;
; CF = 0 file not null ;
; DS:DX = last file byte + 1 ;
; CF = 1 file is null ;
; Alters: ;
; AX,BX,CX,DX,DS,SI,DI,BP ;
; Calls: ;
; suck_in_file ;
; lseek ;
; History: ;
; ;
; Thu Aug 22 14:33:49 1985 -by- Wesley O. Rupel [wesleyr] ;
; Amassed it ;
;-----------------------------------------------------------------------;
assumes es, DATA
assumes ds,BUFFER
read_in_file proc near
call suck_in_file ;Alters AX,BX,CX,DX,DS,SI,DI,BP
; DS:DX pts one byte past the last entry in file-buffer
jnc no_err
jz platos_retreat
jmp ret_error_to_word
platos_retreat:
; We fall thru to here if we did not get the whole file because of memry limits
or bit_flags,GET_MORE_OF_FILE_FLAG
jmp short check_for_null_file
no_err:
and bit_flags,not GET_MORE_OF_FILE_FLAG
;------------------------------------check-for-file-of-zero-length-----
check_for_null_file:
; or dx,dx ;DS:DX minus one = last file byte in buffer.
cmp dx, file_buffer_off
jne no_problem
stc ;file is null
ret
no_problem:
clc
ret
read_in_file endp
;-----------------------------------------------------------------------;
; suck_in_file ;
; ;
; Reads in file. Returns DS:DX pointing one byte past the end of the ;
; file in the buffer. If out-of-memory you may process what you've ;
; got and then simply call this routine again to get more. ;
; ;
; Arguments: ;
; AX = buffer offset in DS ;
; BX = bytes of available memory ;
; CX = file handle ;
; DS = data buffer segment
; Returns: ;
; CF = 0 if no error ;
; DS:DX = end of region read in ;
; CF = 1 if error ;
; ZF = 1 if out of memory ;
; ZF = 0 if input read error ;
; Alters: ;
; AX, BX, CX, DX, DS, SI, DI, BP ;
; Calls: ;
; DOS function 3F ;
; OS/2 DOSREAD
; History: ;
; ;
; Mon Jun 10 04:28:21 1985 -by- Wesley O. Rupel [wesleyr] ;
; Wrote it. ;
;-----------------------------------------------------------------------;
assumes ds, BUFFER
assumes es, DATA
local_variables
local_word cbRead
local_word last_read
suck_in_file proc near
push bp
mov bp,sp
add sp,local_space
ifdef PROFILE
cCall StartNMeas,<>
endif ;PROFILE
mov dx,ax ; initialize dx to free mem buffer
mov di,bx ; initialize di to # of bytes of available memory
mov bx,cx ; input file handle
mov word ptr last_read[bp],0 ; zero low memory flag
mov cx,di ; put number of bytes requested in cx
;-------------------------------------------
; Make sure we don't go past cfcSearch
;-------------------------------------------
cmp word ptr cfcSearch[2], 0
jnz get_more_of_request ; more than 64K to go, fill whole buffer
cmp cx, word ptr cfcSearch[0]
jna get_more_of_request ; asking for <= amount to go
mov cx, word ptr cfcSearch[0] ; asking for more, reset to =
or cx,cx
jz end_of_file
inc word ptr last_read[bp]
get_more_of_request:
mov di, ds
push ds
mov ax, ss
mov ds, ax ; pcode requires ss==ds
farPtr di_dx, di, dx
save <bx, cx, dx>
cCall CchReadDoshnd,<bx, di_dx, cx>
pop ds
cmp ax, cx
ja error_reading_stdin
or ax, ax
jz end_of_file ; if we got no chars then it
; means EOF.
;-----------------------------------------------------
; Subtract the amount we read from cfcSearch.
;-----------------------------------------------------
sub word ptr cfcSearch[0], ax
jnc check_for_all
dec word ptr cfcSearch[2] ; borrow from high word
check_for_all:
sub cx,ax ; # of chars requested minus # received.
jz got_it_all
assumes ss,DATA
add dx,ax ; point dx to where next byte goes.
jmp get_more_of_request
got_it_all:
dec word ptr last_read[bp]
jnz insufficient__memory
end_of_file:
add dx,ax ; Now ds:dx pts one byte past last char in buffer.
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
clc ; clc indicates no errors
mov sp,bp
pop bp
ret
insufficient__memory:
add dx,ax ; Now ds:dx pts one byte past last char in buffer.
xor ax,ax ; set the zero flag.
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
stc ; carry and zero set signifies this error condition.
mov sp,bp
pop bp
ret
error_reading_stdin:
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
or ax,1 ; set not zero.
stc ; carry and not zero indicate this error.
mov sp,bp
pop bp
ret
suck_in_file endp
;-----------------------------------------------;
; End of suck_in_file ;
;-----------------------------------------------;
;-----------------------------------------------------------------------;
; bgrep ;
; ;
; Arguments: ;
; ES = DATA_SEG ;
; DS:DX = file end + 1 ;
; Returns: ;
; ;
; Alters: ;
; ;
; Calls: ;
; gimme_a_piece_a_buff ;
; History: ;
; ;
; Thu Aug 22 16:19:36 1985 -by- Wesley O. Rupel [wesleyr] ;
; Ripped out of grep main ;
;-----------------------------------------------------------------------;
assumes es, DATA
assumes ds, BUFFER
bgrep proc near
mov bx, first_bitmap_off
mov cx, BUFFER:anchor_string_length_minus_one[bx]
mov si, BUFFER:anchor_string_offset[bx]
mov ax, file_buffer_off
call gimme_a_piece_a_buff
ret
bgrep endp
;-----------------------------------------------------------------------;
; gimme_a_piece_a_buff ;
; ;
; Arguments: ;
; DS:bx bitmap ;
; DS:ax beginning of buffer. ;
; DS:DX pts one byte past last entry in buffer ;
; Returns: ;
; Nothing ;
; Alters: ;
; ES, DS, AX, BX, CX, DX, SI, DI ;
; Calls: ;
; bgrep_for_expression ;
; History: ;
; ;
; Sun Aug 18 03:26:31 1985 -by- Wesley O. Rupel [wesleyr] ;
;-----------------------------------------------------------------------;
local_variables
local_word buffer_beg_offset
local_word buffer_end_offset
local_word bit_map_off
local_word buffer_piece_end
local_word number_of_bytes_to_lseek
assumes es,nothing
assumes ds,BUFFER
gimme_a_piece_a_buff proc near
push bp
mov bp,sp
add sp,local_space
ifdef PROFILE
cCall StartNMeas,<>
endif ;PROFILE
mov word ptr number_of_bytes_to_lseek[bp],0
mov word ptr buffer_end_offset[bp],dx
mov word ptr buffer_beg_offset[bp],ax
mov cx, ds
mov es, cx
assumes es, BUFFER
mov cx, BUFFER:index_of_string_this_bitmap_belongs_to[bx]
inc cx ; test for -1
jz previous_setting_is_most_significant ; skip this one.
bitmap_next:
mov bit_map_off[bp],bx ; save for later restore
mov di,word ptr buffer_beg_offset[bp] ; start of the buffer
mov si,word ptr buffer_end_offset[bp] ; end of the buffer
finished_with_this_buffer_piece:
mov cx,si
sub cx,di ; CX = number of bytes left
mov buffer_piece_end[bp],si
bgrep1:
call bgrep_for_expression
jc finished_with_entire_buffer
;-------------------------------------------------------------------------
; We have a match, set rgchResult[index_this_string] to true
;-------------------------------------------------------------------------
; REVIEW
mov bx, bit_map_off[bp]
push di
mov di, rgchResult
add di, BUFFER:index_of_string_this_bitmap_belongs_to[bx]
inc byte ptr ss:[di]
; set index to ffff so we don't look for this one again.
mov BUFFER:index_of_string_this_bitmap_belongs_to[bx], 0ffffh
pop di
;-------------------------------------------------------------------------
jmp short previous_setting_is_most_significant
finished_with_entire_buffer:
mov bx, bit_map_off[bp]
sub ax,buffer_piece_end[bp]
neg ax
cmp ax,number_of_bytes_to_lseek[bp]
jbe previous_setting_is_most_significant
mov number_of_bytes_to_lseek[bp],ax
previous_setting_is_most_significant:
mov cx,BUFFER:next_bitmap[bx]
or cx,cx
je really_finished
mov bx, cx
mov cx, BUFFER:index_of_string_this_bitmap_belongs_to[bx]
inc cx ; test for -1
jz previous_setting_is_most_significant ; skip this one.
jmp bitmap_next
really_finished:
mov ax,number_of_bytes_to_lseek[bp]
call lseek_for_bgrep
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
mov sp,bp
pop bp
ret
gimme_a_piece_a_buff endp
;-----------------------------------------------------------------------;
; lseek_for_bgrep ;
; ;
; Arguments: ;
; ;
; Returns: ;
; ;
; Alters: ;
; ;
; Calls: ;
; ;
; History: ;
; ;
; Mon Aug 26 20:22:30 1985 -by- Wesley O. Rupel [wesleyr] ;
;-----------------------------------------------------------------------;
assumes ds,CODE
assumes es,nothing
; %%Function:lseek_for_bgrep %%Owner:chic
cProc lseek_for_bgrep,<NEAR,PUBLIC>, <ds>
cBegin
mov dx,cs
mov ds,dx
test bit_flags,GET_MORE_OF_FILE_FLAG
jz no_reason_to_lseek
neg ax
jz no_reason_to_lseek
;AX = minus the number of bytes which
;we must set the file ptr back.
cwd ; dx:ax = offset to move in bytes
farPtr dx_ax, dx, ax
mov bx, 1 ; seek from current position
cCall DwSeekDw,<input_file_handle, dx_ax, bx>
cmp dx, 0FFFFh
je lseek_problems
no_reason_to_lseek:
cEnd
seek_to_fcFirst_problems:
lseek_problems:
jmp ret_error_to_word
;-----------------------------------------------------------------------;
; seek_to_fcFirst
; Moves the file pointer for input_file_handle to fcFirst
;-----------------------------------------------------------------------;
assumes ds, BUFFER
assumes es, DATA
; %%Function:seek_to_fcfirst %%Owner:chic
cProc seek_to_fcfirst, <NEAR, PUBLIC>
cBegin
mov dx, wHigh (fcFirst)
mov ax, wLow (fcFirst)
xor bx, bx ; Move from start of file
cCall DwSeekDw,<input_file_handle, dx_ax, bx>
cmp dx, 0FFFFh
je lseek_problems
done_with_seek_to_fcFirst:
cEnd
;-----------------------------------------------------------------------;
; bgrep_for_expression ;
; ;
; Seaches for a match in the buffer piece pointed to by ES:DI using ;
; the bitmap pointed to by DS:00. ;
; ;
; Arguments: ;
; ES:DI = buffer piece ;
; DS:BX = bitmap ;
; SI = stop value ;
; Returns: ;
; CX = # of used buffer bytes. ;
; CF = 0 => A match was found. ;
; ES:AX = beginning of match in line. ;
; ES:DI = end of match in line. ;
; CF = 1 => No match found. ;
; ES:AX = last pt where we began looking for match ;
; ES:DI = end of buffer ;
; Alters: ;
; AX, BX, CX, DX, SI, DI ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Mon Aug 19 05:01:59 1985 -by- Wesley O. Rupel [wesleyr] ;
; Wrote it! Modified from check_line_for_match ;
;-----------------------------------------------------------------------;
local_variables
local_word stack_bottom
local_word stop_value
local_word bitmap_start
assumes ds, BUFFER
assumes es, BUFFER
bgrep_for_expression proc near
;---------------------------------------
push bp
mov bp,sp
add sp,local_space
ifdef PROFILE
cCall StartNMeas,<>
endif ;PROFILE
mov stop_value[bp],si
mov bitmap_start[bp], bx ; save start of this bitmap
;---------------------------------------
mov dx,BUFFER:bitmap_flags[bx]
test dl,ANCHOR_FLAG
jz b_no_anchor
test dl,BOL_FLAG
jnz b_no_anchor
test dl,POSITION_NOT_MEANINGFUL_FLAG
jnz b_no_anchor
;--------------------------------------------------------------------------
; CX has the buffer piece size. We will pt DS:SI to the anchor string and
; repne scasb for it (this uses ES:DI) in the current line.
b_scan_for_anchor_char:
push di ;save ptr to BOL
mov ah,BUFFER:byte ptr anchor_string_length_minus_one[bx]
mov si,BUFFER:anchor_string_offset[bx]
;Now DS:SI pts to the anchor string
lodsb ;AL = first char in anchor string
mov dx,si ;Save SI in DX
b_rpmore:
mov si,dx ;Restore SI (pts to 2nd char in anchor string)
repne scasb ;Scan for the first char in anchor string
jcxz b_we_did_not_match_fast
push cx ;save cx
mov bx,di ;save di
xor ch,ch
mov cl,ah ;mov into cx the length of the anchor string minus one
repe cmpsb ;What happens if cx is already zero?
jcxz b_anchor_string_found ;prepare to do bitmap
b_false_alarm:
mov di,bx ;restore di
mov bx, bitmap_start[bp]
pop cx ;restore cx
jmp b_rpmore
b_anchor_string_found: ;prepare to do bitmap
jnz b_false_alarm
pop cx
pop si ;old di (BOL)
push si ;we may be branching back up
mov bx, bitmap_start[bp]
; Check if anchor is too close to the front.
; DI = one past end of anchor string in current line
; SI = bol
; DI - "length" - SI gives how far into the line the anchor string begins.
; "position" is how far in it must be to be part of the sought expression.
;---------
mov cx, BUFFER:bitmap_flags[bx]
test cl, POSITION_NOT_MEANINGFUL_FLAG
jnz b_qm_asterisk_plus
;The expression includes a "?", "*", or "+".
;---------
mov cx,di
sub cx, BUFFER:anchor_string_length_minus_one[bx]
sub cx,si ;This puts into CX how far into the line we are.
cmp cx, BUFFER:position_in_expression_of_anchor_string[bx]
jbe b_false_alarm
add sp,2 ;We didn't take the branch so put SP back.
sub di, BUFFER:position_in_expression_of_anchor_string[bx]
sub di, BUFFER:anchor_string_length_minus_one[bx]
dec di
;--------------------------------------
b_no_anchor:
mov dx, BUFFER:bitmap_flags[bx] ;Flags in dl.
dec di
mov ax,di
test dl,POSITION_NOT_MEANINGFUL_FLAG
jnz b_qm_asterisk_plus1
jmp short b_litle
b_we_did_not_match_fast:
add sp,2 ;pop di
mov sp,bp
pop bp
mov ax,di
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
stc
ret
b_qm_asterisk_plus:
add sp,2 ;undo the push 'si'
mov di,si ;point DI to BOL
dec di
mov ax,di
mov dl,cl ;flags
b_qm_asterisk_plus1: ;WORRY did we jumped here correctly
mov stack_bottom[bp],sp
jmp short b_litle_ast
;The expression includes a "?", "*", or "+".
;----------------------------------------------------------------------------
; The following is the search routine which uses the bitmap.
; Entry Point = litle
; Arguments:
; AX pts one byte before first char in line to search.
; DL = flags
;----------------------------------------------------------------------------
b_char_does_not_match:
; test dl,BOL_FLAG ;Set means 1 failure and we're out.
; jnz b_we_did_not_match
b_litle: mov si,BITMAP_HEADER_LENGTH + TFB
add si,bx ;reset SI to beg. of bitmap (1st template)
mov di,ax ;AX keeps our current char position in the line which
inc ax ;must match the first char in the expression. Once
;first char is matched then DI steps forward checking
;the rest of the expression against the line w/o
b_check_next_char: ;incrementing AX -- We need to return to AX if we were
inc di ;on a false lead.
cmp di,stop_value[bp]
je b_we_did_not_match
mov cl,es:[di]
;-----------------------------------------------------------------------------
; This is the routine test_bit inserted here to save the 35 cycles of call-ret
push bx ; painful, but we need to preserve bx
mov bl,cl
shr bl,1
shr bl,1
shr bl,1
and cl,07h
mov ch,80h
shr ch,cl
xor bh,bh
test [si+bx],ch
pop bx
;-----------------------------------------------------------------------------
jz b_char_does_not_match
cmp byte ptr BUFFER:[si-TFB].last_template_in_this_bitmap,LAST_TEMPLATE
je b_we_matched
add si,TS+TFB
jmp b_check_next_char
b_we_matched:
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
mov sp,bp
pop bp
clc ;ES:DI is pointing to the last matching char.
ret ;CF=0 => we matched.
b_we_in_an_asterisk:
; Make it appear that asterisk failure occured at the cr
dec di
jmp short b_push_asterisk_failure_state
b_we_did_not_match_ast1:
test dl,01h ;test asterisk flag
jnz b_we_in_an_asterisk
b_we_did_not_match:
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
stc
mov sp,bp
pop bp
ret
;-----------------------------------------------------------------------------
; We use the following if the position-not-meaningful flag was set -- that is
; if the expression contained a "?", "+", or "*".
;-----------------------------------------------------------------------------
; Asterisk and plus are the main reasons for the more complicated code here.
; Software Tools by Kernighan and Plauger discusses the algorithm used here
; for asterisk in their discussion of "find". They refer to the asterisk
; as a "closure" (it's in the index). My plus algorithm is similer.
;-----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; The following is the search routine which uses the bitmap. :
; Entry Point = litle_ast :
; Arguments: :
; AX pts one byte before first char in line to search. :
; DL = flags :
; BP = SP????? :
;----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
b_char_does_not_match_ast:
cmp dh,'?'
je b_push_asterisk_failure_state
cmp dh,'*'
je b_push_asterisk_failure_state
cmp dh,'+'
je b_push_plus_failure_state
b_as_b4:
cmp stack_bottom[bp],sp
jne b_asterisk_encountered_previously
; test dl,BOL_FLAG ;Set means 1 failure and we're out.
; jnz b_we_did_not_match
b_litle_ast:
mov si,BITMAP_HEADER_LENGTH + TFB
add si,bx ;reset SI to beg. of bitmap (1st template)
mov di,ax ;AX keeps our current char position in the line which
inc ax ;must match the first char in the expression. Once
;first char is matched then DI steps forward checking
;the rest of the expression against the line w/o
b_check_next_char_ast: ;incrementing AX -- We need to return to AX if we were
inc di ;on a false lead.
b_question_mark_reentry_point:
cmp di,stop_value[bp]
je b_we_did_not_match_ast1
mov cl,es:[di]
mov dh,BUFFER:[si-TFB].asterisk_location
cmp dh,'*'
je b_push_asterisk_initial_state_info
cmp dh,'?'
je b_push_asterisk_initial_state_info
b_this_was_pointless:
;-----------------------------------------------------------------------------
; This is the routine test_bit inserted here to save the 35 cycles of call-ret
push bx
mov bl,cl
shr bl,1
shr bl,1
shr bl,1
and cl,07h
mov ch,80h
shr ch,cl
xor bh,bh
test [si+bx],ch
pop bx
;-----------------------------------------------------------------------------
jz b_char_does_not_match_ast
cmp byte ptr BUFFER:[si-TFB].last_template_in_this_bitmap,LAST_TEMPLATE
je b_we_matched_ast
cmp dh,'+'
je b_set_plus_flag_and_push_initial_state
cmp dh,'*'
je b_set_asterisk_flag
cmp dh,'?'
je b_fail_the_question_mark
add si,TS+TFB
jmp b_check_next_char_ast
b_fail_the_question_mark:
; We came here because we had a success with the question mark. The rules are
; that we must not have more than one success. We are using all the apparatus
; of asterisk so we will just make it look as if we went thru one more pass and
; it failed to match.
inc di
jmp b_char_does_not_match_ast
b_set_asterisk_flag:
or dl,01h ;set asterisk flag
jmp b_check_next_char_ast
b_push_plus_failure_state:
test dl,01h ;If flag not set then we did not get at
jz b_as_b4 ;least one match as required.
b_push_asterisk_failure_state:
push di
and dl,not 01h ;clear asterisk flag
b_failure_okay:
add si,TS+TFB
jmp b_question_mark_reentry_point
b_asterisk_encountered_previously:
pop di
pop si
pop cx
cmp cx,di ;Have we back tracked as far as we can?
je b_as_b4
dec di
push cx
push si
push di
jmp b_question_mark_reentry_point
b_set_plus_flag_and_push_initial_state:
; We only come here if we have already succeeded at matching the current char
; in the current line with the current template (char class).
test dl,01h ;test asterisk flag
jnz b_check_next_char_ast ;Jmp if we already pushed the initial
;state of this plus.
cmp byte ptr BUFFER:[si-TFB].last_template_in_this_bitmap,LAST_TEMPLATE
je b_we_matched_ast ;Jump if this is the end of the
;expression => line matches.
or dl,01h ;set asterisk flag
inc di
push di
add si,TS+TFB
push si
sub si,TS+TFB
jmp b_question_mark_reentry_point
b_push_asterisk_initial_state_info:
test dl,01h ;test asterisk flag
jnz b_this_was_pointless
; There is no reason to ever put an asterisk at the end of a regular expression
; since the line will match even if the asterisked char is absent. Nevertheless
; people like Tony are apt to do it anyway so the following 2 lines are present
; to avoid the associated problems that would otherwise occur.
cmp byte ptr BUFFER:[si-TFB].last_template_in_this_bitmap,LAST_TEMPLATE
je b_we_matched_ast
push di
mov bx,si
add bx,TS+TFB
push bx
mov bx, bitmap_start[bp]
jmp b_this_was_pointless ;actually from here it was pointful.
b_we_matched_ast:
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
mov sp,bp
pop bp
clc ;ES:DI is pointing to the last matching char.
ret ;CF=0 => we matched.
bgrep_for_expression endp
;-----------------------------------------------------------------------;
; make_the_bitmaps ;
; ;
; Arguments: ;
; ES = DATA_SEG ;
; Returns: ;
; DS:SI = filename ;
; Alters: ;
; AX,BX,CX,DX,SI,DI,DS ;
; Calls: ;
; allocmem ;
; build_bitmap ;
; History: ;
; ;
; Wed Aug 14 23:38:41 1985 -by- Wesley O. Rupel [wesleyr] ;
; Sequestered it from grep.asm main ;
;-----------------------------------------------------------------------;
local_variables
local_word bm_seg
local_word number_of_available_bytes
local_word index_of_current_string
assumes es, DATA
assumes ds,nothing
make_the_bitmaps proc near
; Our next arg should be the regular expression.
push bp
mov bp,sp
add sp,local_space
ifdef PROFILE
cCall StartNMeas,<>
endif ;PROFILE
call allocmem
mov first_bitmap_off,ax
mov current_bitmap_off,ax
mov number_of_available_bytes[bp],bx
mov word ptr index_of_current_string[bp],00h
build_a_bitmap:
mov bx, ss
mov ds, bx
assumes ds, DATA
mov es, buffer_seg
assumes es, BUFFER
mov bx, index_of_current_string[bp]
shl bx,1 ; bx is a word count, this makes it a byte offset
mov di, pStrings
mov si, [di][bx] ;Now DS:SI pts to the expression
mov di,number_of_available_bytes[bp]
mov ax,bit_flags
mov cx,current_bitmap_off
shr bx, 1 ; back to a real index
call build_bitmap
jnc foorj
jmp ret_error_to_word
foorj:
mov al,dh ;flags
and al,80h
shl al,1 ;make CF = BOL flag
jnc no_bol ;We won't do super_grep if BOL flag set
or bit_flags,BOL_SET_FLAG
no_bol:
inc word ptr index_of_current_string[bp]
mov bx, index_of_current_string[bp]
cmp bx, cStrings ; do we have anymore strings to do?
je out_of_args ; nope
jmp short or_it_is ; yup
out_of_args:
mov bx, current_bitmap_off
mov word ptr BUFFER:[bx],0 ;Set last-bitmap mark
jmp short no_more_bitmaps
or_it_is:
mov bx,current_bitmap_off
mov current_bitmap_off,di ;DI = next free byte
sub number_of_available_bytes[bp], di
add number_of_available_bytes[bp], bx ; start of last one
mov ax,current_bitmap_off
mov Word Ptr BUFFER:[bx], ax ;store seg of next bitmap at beginning
jmp build_a_bitmap ;of current bitmap
no_more_bitmaps:
mov bx,current_bitmap_off
sub number_of_available_bytes[bp], di ; end of last one
add number_of_available_bytes[bp], bx ; start of last one
mov bx,number_of_available_bytes[bp]
mov free_memory_off, di ; offset into BUFFER
mov free_memory_size, bx
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
mov sp,bp
pop bp
ret
make_the_bitmaps endp
assumes cs,CODE
assumes ds,DATA
assumes es,BUFFER
assumes ss,DATA
;-----------------------------------------------------------------------;
; build_bitmap ;
; ;
; Builds bitmap from regular expression. ;
; ;
; Arguments: ;
; DS:SI = Expression ;
; ES:CX = Where bitmap will be made. ;
; DI = # of bytes available ;
; BX = index of current string ;
; AX = bit_flags ;
; Returns: ;
; CF = 0 ;
; DI = offset of next free byte ;
; DH = flags ;
; CF = 1 ;
; ZF = 0 => Out of memory ;
; ZF = 1 => Illegal expression ;
; Alters: ;
; AX,BX,CX,DX,SI,DI ;
; Calls: ;
; test_bit, put_bit, get_RE_char ;
; History: ;
; ;
; Thu Jul 25 18:50:57 1985 -by- Wesley O. Rupel [wesleyr] ;
; Wrote it for GREP ;
;-----------------------------------------------------------------------;
local_variables
local_word lw_bit_flags
local_word current_pointer
local_word index_of_current_string
local_word bitmap_start
build_bitmap proc near
;--------------------------------------------------------------------
;_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*
; BIT-MAP BUILDING ROUTINE
;
; Thruout this routine in general:
; ES:DI pts to current template (the portion of the bitmap against which a
; single char in the file will be compared -- single char class).
; DS:SI pts to current char in expression (in command line).
; DH will contain internal flags.
; BP is used as always, the other registers are free to fuck with.
push bp
mov bp,sp
add sp,local_space
ifdef PROFILE
cCall StartNMeas,<>
endif ;PROFILE
mov lw_bit_flags[bp],ax ;initialize
mov index_of_current_string[bp],bx
mov bitmap_start[bp], cx
;-------------------------------Check-if-there-is-enuf-memory------
mem_check:
push di
push es
mov ax, ss
mov es, ax ; repne scasb insists on es
mov di,si
xor ax,ax
mov cx,0FFFFh
repne scasb
pop es
sub ax,cx ; Now AX has the number of chars in the expression.
xor dx,dx
mov cx,30h ; We will ask for 3 paragraphs per char for templates
mul cx
or dx,dx
je another_fucking_out_of_range_jump
jmp not__enuf__memory
another_fucking_out_of_range_jump:
pop di
cmp ax,di ; AX has # of bytes we need
jnb not_enuf_memory
;------------------------------------------------------------------
mov di,BITMAP_HEADER_LENGTH - TEMPLATE_SIZE
add di, bitmap_start[bp]
xor dh,dh ;initialize (internal) flags
; sub di,TEMPLATE_SIZE
next_template:
add di,TEMPLATE_SIZE ;pt to next template
ifdef debug
mov cx,TFB/2
mov ax,09999h ;this is for easy debugging
debugaa:
add ax,1111h
stosw
loop debugaa
xor ax,ax ;Now we zero out the template (before marking
mov cx,TS/2 ;any bits in it).
else
xor ax,ax ;Now we zero out the template (before marking
mov cx,(TS+4)/2 ;any bits in it).
endif
rep stosw
sub di,TS ;restore di to what it was before rep stosw
next_char:
call get_RE_char ; returns char in al
jc illegal_expression
cmp dl,"\"
jz can_not_be_real_zero
or al,al ; we want \00 to work!
je end_of_expression_
can_not_be_real_zero:
; is the char in AL special?
mov cl,al ;test_bit wants the char in CL.
push di
push es
mov di,offset bitmap_of_special_chars
mov bx,cs
mov es,bx
call test_bit
pop es
pop di
jnz its_special
not_special:
mov cl,al ; put_bit wants its char in cl
call put_bit ; mark char in bit-map
test word ptr lw_bit_flags[bp],DASH_Y_FLAG
jnz y_flag_set
googoogahgah:
test dh,BRACKET_FLAG
jnz next_char
test word ptr lw_bit_flags[bp],DASH_Y_FLAG
jnz next_template
mov es:[di-TFB].the_literal_char,al
mov ah,LIT_CHAR_INDICATOR
mov es:[di-TFB].literal_char_indicator,ah
or dh,ANCHOR_FLAG ;set anchor flag
jmp next_template
not__enuf__memory:
add sp,4 ;account for the two pushes (ES & DI).
not_enuf_memory:
or sp,sp ;clear the zero flag (SP is not 0)
oh_dude:
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
stc
mov sp,bp
pop bp
ret
end_of_expression_:
jmp end_of_expression
its_special:
cmp dl,"\"
je not_special
mov bx,ax ; pick-up the special char
cmp bx,2ah ; is it an asterix?
je asterisk
cmp bx, "." ; is it a dot?
je punkt
jmp pound
illegal_expression:
xor al,al ;set the zero flag to indicate this
jmp oh_dude
y_flag_set:
or dh,EXPRESSION_FLAG ;set expression flag
push es ; we need to set es=ds=data for calls
push ds ; into the word routines. We can restore
mov bx, ss
mov es, bx ; them when we get back
mov ds, bx
assumes es,DATA
assumes ds,DATA
push dx ; save non-scratch registers
push ax ; save char, islower will kill it
xor ah,ah ; FLower expects this.
cCall FLower, ax, 0
or ax, ax
pop ax ; restore char
jz NotLower
xor bx,bx
xor ah,ah ; So AnsiUpper doesn't take this as a string
cCall AnsiUpper,<bx,ax>,0
jmp short not_special2
NotLower:
push ax ; isUpper will hammer it
xor ah,ah ; FUpper expects this.
cCall FUpper, ax, 0
or ax, ax
pop ax ; restore char
jz not_alpha
xor bx,bx
xor ah,ah ; So AnsiLower doesn't take this as a string
cCall AnsiLower,<bx,ax>,0
clc
jmp short not_special2
not_alpha:
stc
not_special2:
pop dx ; restore non-scratch registers
pop ds
pop es
assumes es, BUFFER
assumes ds,DATA
jc done_putting_bits
mov cl,al
call put_bit
done_putting_bits:
jmp googoogahgah
err_illegal_expression:
jmp illegal_expression ; I hate out of range jumps!
asterisk:
question_mark:
plus_sign:
jnz_not_special:
or dh,POSITION_NOT_MEANINGFUL_FLAG OR EXPRESSION_FLAG ;set expression flag
mov BUFFER:[di-(TS+TFB)-TFB].asterisk_location,al
jmp next_char
punkt:
or dh,EXPRESSION_FLAG ;set expression flag
mov ax,0ffffh
mov cx,TS/2
rep stosw
sub di,TS
jmp next_template
pound:
or dh,EXPRESSION_FLAG ;set expression flag
mov ax,0ffffh ;first set all the bits to true
mov cx,TS/2
rep stosw
sub di,TS
mov byte ptr BUFFER:[di]+4,07fh ; now turn off space,
mov byte ptr BUFFER:[di]+1,09bh ; tab,carriage return, newline,
mov byte ptr BUFFER:[di],07fh ; and Null
jmp next_template
not_special_:
jmp not_special
end_of_expression:
;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Now we will store info about the bitmap (in particular, what the best
; anchor string is) in the first few bytes of the bitmap, before the
; first template.
mov si,di
test dh,ANCHOR_FLAG ;test if at least one anchor char exists
jz love
sub di,TS+TFB
mov bx,BITMAP_HEADER_LENGTH - TS
add bx, bitmap_start[bp]
xor ax,ax ;AX will hold the len. of the longest lit-string
xor cx,cx ;zero the count
not_ff: cmp ax,cx
jae dowah
mov ax,cx
mov si,current_pointer[bp]
dowah: cmp bx,di ;is this the last template?
je now_we_know
add bx,TS + TFB
xor cx,cx ;zero count
mov current_pointer[bp],bx ;zero the count
cam: cmp byte ptr BUFFER:[bx-TFB].literal_char_indicator,LIT_CHAR_INDICATOR
jne not_ff
; Use of *,+, or ? precludes use of the corresponding template in
; the anchor string
cmp byte ptr BUFFER:[bx-TFB].asterisk_location,'*'
je not_ff
; only * is still used as a repeating wildcard
; cmp byte ptr BUFFER:[bx-TFB].asterisk_location,'?'
; je not_ff
; cmp byte ptr BUFFER:[bx-TFB].asterisk_location,'+'
; je not_ff
inc cx
cmp bx,di ;is this the last template?
je not_ff
add bx, TS + TFB
jmp cam
now_we_know:
add di,TS+TFB ;point DI to one template past the last one
;used.
;------------
mov bx, bitmap_start[bp]
mov BUFFER:anchor_string_offset[bx],di
;store position of its template in bitmap.
push ax
mov ax,si ;template of 1st char in anchor
sub ax,BITMAP_HEADER_LENGTH
sub ax, bx
mov cl,TS+TFB
div cl
xor ah,ah
mov BUFFER:position_in_expression_of_anchor_string[bx],ax
pop cx
dec cx
mov BUFFER:anchor_string_length_minus_one[bx],cx
;--------------
mov bx,si ;SI pts to the template of the 1st char in anchor
push di
inc cx
jcxz plus_on_only_anchor_char
build_the_anchor_string:
mov al, BUFFER:[bx-TFB].the_literal_char
stosb
add bx,TS+TFB
dec cx
or cx,cx
jnz build_the_anchor_string
mov si,di
pop di
love:
mov bx, bitmap_start[bp]
mov al,LAST_TEMPLATE
mov BUFFER:[di-(TS+TFB)-TFB].last_template_in_this_bitmap,al
mov byte ptr BUFFER:bitmap_flags[bx],dh
; Put index of string in the header.
mov cx, index_of_current_string[bp]
mov BUFFER:index_of_string_this_bitmap_belongs_to[bx],cx
; Now put next free byte in di
mov di,si ;SI pts 1 past the last char in anchor string
ifdef PROFILE
cCall StopNMeas,<>
endif ;PROFILE
mov sp,bp
pop bp
clc
ret
plus_on_only_anchor_char:
and dh,not ANCHOR_FLAG ;no anchor after all
jmp short love
build_bitmap endp
;_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*
;-----------------------------------------------------------------------;
; valid_hex_digit? ;
; ;
; Converts ASCII digits [0-9,a-f or A-F] to the appropriate binary value.;
; ;
; Arguments: ;
; AL = Char ;
; Returns: ;
; CF = 0 ;
; BH = binary value ;
; CF = 1 ;
; Char was not a valid hex digit. ;
; Alters: ;
; BH ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Sat Jun 08 08:47:53 1985 -by- Wesley O. Rupel [wesleyr] ;
; Created for use in GREP ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
valid_hex_digit? proc near
mov bh,al
sub bh,'0'
cmp bh,10
jb valid
sub bh,'A'-'9'-1
cmp bh,10
jb invalid
cmp bh,16
jb valid
sub bh,32 ; 32 = the diff. between smalls and caps
cmp bh,10
jb invalid
cmp bh,16
jnb invalid
valid: clc
ret
invalid:stc
ret
valid_hex_digit? endp
;-----------------------------------------------------------------------;
; get_RE_char ;
; ;
; Get a logical char pointed to by DS:SI and send it back in AL. ;
; By logical char I mean the chars are interpreted according to the ;
; rules for Regular Expressions. Thus \. and \* are one char ;
; ;
; Arguments: ;
; DS:SI = char to be read. ;
; Returns: ;
; CF = 0 ;
; AL = Char ;
; DS:SI = next logical char ;
; DL = the first actual char (so the calling routine can check if;
; it was a "\"). ;
; CF = 1 ;
; Invalid expression. ;
; Alters: ;
; SI,BH,CX,DL ;
; Calls: ;
; valid_hex_digit? ;
; History: ;
; ;
; Sat Jun 08 09:13:42 1985 -by- Wesley O. Rupel [wesleyr] ;
; Produced for use in GREP ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
get_RE_char proc near
cld
lodsb
mov dl,al ;calling routine can check dl to see if there was a "\"
cmp al,'\'
jne not_a_backslash
lodsb
not_a_backslash:
clc
ret
invalid_expression:
stc
ret
get_RE_char endp
;-----------------------------------------------------------------------;
; put_bit ;
; ;
; Puts bit in bit-map corresponding to the char in cl. ;
; ;
; Arguments: ;
; ES:DI = bitmap template ;
; CL = the char whose bit is to be turned on ;
; Returns: ;
; Nothing ;
; Alters: ;
; CX, BX ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Sat Jun 08 10:24:17 1985 -by- Wesley O. Rupel [wesleyr] ;
; Written for use in GREP. The algorithm was stolen from Nathan. ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
put_bit proc near
mov bl,cl
shr bl,1
shr bl,1
shr bl,1
and cl,07h
mov ch,80h
shr ch,cl
xor bh,bh
or es:[di+bx],ch
ret
put_bit endp
;-----------------------------------------------------------------------;
; test_bit ;
; ;
; Just like put_bit but tests rather than puts. ;
; ;
; Arguments: ;
; ES:DI = bitmap template ;
; CL = the char whose bit is to be tested ;
; Returns: ;
; Nothing ;
; Alters: ;
; BX,CX ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Sat Jun 08 13:47:10 1985 -by- Wesley O. Rupel [wesleyr] ;
; Written for use in GREP ;
;-----------------------------------------------------------------------;
assumes ds,nothing
assumes es,nothing
test_bit proc near
mov bl,cl
shr bl,1
shr bl,1
shr bl,1
and cl,07h
mov ch,80h
shr ch,cl
xor bh,bh
test es:[di+bx],ch
ret
test_bit endp
ifdef NOT_USED
;-----------------------------------------------------------------------;
; free_bytes ;
; ;
; Frees unused portion of memory given by last allocmem ;
; ;
; Arguments: ;
; AX = # of bytes used ;
; Returns: ;
; Nothing ;
; Alters: ;
; AX ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Sun Aug 25 15:46:51 1985 -by- Wesley O. Rupel [wesleyr] ;
; Wrote it! ;
;-----------------------------------------------------------------------;
assumes es,nothing
assumes ds,nothing
free_bytes proc near
mov cx,ax
add ax,previous_free_memory_off
mov free_memory_off,ax
sub cx,previous_free_memory_size
ja process_used_too_much_memory
neg cx
mov free_memory_size,cx
ret
process_used_too_much_memory:
jmp ret_error_to_word
free_bytes endp
endif ; NOT_USED
;-----------------------------------------------------------------------;
; allocmem ;
; ;
; Arguments: ;
; None ;
; Returns: ;
; AX = first free byte ;
; BX = # of free bytes ;
; Alters: ;
; AX,BX ;
; Calls: ;
; Nothing ;
; History: ;
; ;
; Sun Aug 25 17:14:19 1985 -by- Wesley O. Rupel [wesleyr] ;
; Wrote it! ;
; 6/88 RICKS modified to be byte based instead of para based ;
;-----------------------------------------------------------------------;
assumes es,DATA
assumes ds,nothing
allocmem proc near
mov ax,free_memory_off
mov bx,free_memory_size
or bx,bx
jz insuff_mem
ifdef NOT_USED
mov previous_free_memory_off,ax
mov previous_free_memory_size,bx
endif
add free_memory_off,bx
mov free_memory_size,0
ret
insuff_mem:
jmp ret_error_to_word
allocmem endp
sEnd CODE ; end of code segment
end
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Calendar/Alarm
FILE: alarmReminder.asm
AUTHOR: Don Reeves, August 23, 1990
ROUTINES:
Name Description
---- -----------
AlarmCheckActive Bring down alarm if matches criteria
AlarmToScreen Puts an alarm on the screen
AlarmDestroy Destroys a reminder previosuly created
AlarmSnooze Causes alarm to come down; resets alarm time
ReminderStoreEvent Stores event with associated reminder
ReminderStoreDateTime Stores date/time with associated reminder
ReminderSnooze Pass snooze method onto process for action
ReminderDestroy Visually remove myself, ask process to destroy
ReminderSelfDestruct Possibly kill myself or nuke snooze
ReminderReset Reset time/date strings - format change
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial revision
Don 2/26/91 Moved to different file/module
DESCRIPTION:
$Id: alarmReminder.asm,v 1.1 97/04/04 14:47:14 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
idata segment
ReminderClass
idata ends
CommonCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AlarmCheckActive
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to see if an alarm needs to br brought down at all.
CALLED BY: GLOBAL (Running in the GeoPlanner thread)
PASS: CX:DX = EventStruct Group:Item
CX = -1 (Bring down all reminders)
DX = -1 (Disable snooze on all reminders)
ES = DGroup
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AlarmCheckActive proc far
ifndef GCM
.enter
; Check if any alarm boxes are showing. If none, do nothing
;
EC < VerifyDGroupES ; verify it >
tst es:[alarmsUp] ; any alarms visible ??
jz done
push ax, bx, cx, dx, di, si, bp
mov ax, MSG_CALENDAR_KILL_REMINDER ; method to send to window list
; entries
push es
GetResourceSegmentNS ReminderClass, es
mov bx, es ; method is for Reminder objs
pop es
mov si, offset ReminderClass
mov di, mask MF_RECORD
call ObjMessage ; di = event handle
mov dx, size GCNListMessageParams
sub sp, dx
mov bp, sp
mov ss:[bp].GCNLMP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS
mov ss:[bp].GCNLMP_ID.GCNLT_type, GAGCNLT_WINDOWS
mov ss:[bp].GCNLMP_block, 0
mov ss:[bp].GCNLMP_event, di
mov ss:[bp].GCNLMP_flags, 0
mov ax, MSG_META_GCN_LIST_SEND
GetResourceHandleNS Calendar, bx
mov si, offset Calendar ; send to my application
mov di, mask MF_CALL or mask MF_STACK or mask MF_FIXUP_DS
call ObjMessage
add sp, size GCNListMessageParams
pop ax, bx, cx, dx, di, si, bp
done:
.leave
endif
ret
AlarmCheckActive endp
CommonCode ends
ifndef GCM
ReminderCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AlarmToScreen
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Puts an alarm up on the screen
CALLED BY: AlarmClockTick
This is run in the GeoPlanner's thread
PASS: DS = DGroup
AX = EventStruct : Group #
BP = EventStruct : Item #
RETURN: ES:*DI = EventStruct
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/6/89 Initial version
Don 11/5/90 Fixed problem with moving events in update
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AlarmToScreen proc far
uses ax, bx, cx, dx, si, bp, ds
.enter
; Call for update (if necessary) of the event if on screen
;
push ax, bp ; save EventStruct group & item
GetResourceHandleNS DPResource, bx
mov si, offset DPResource:DayPlanObject
movdw cxdx, axbp ; cx:dx = Gr:It to update
mov ax, MSG_DP_ETE_FORCE_UPDATE
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
; First duplicate the alarm block
;
EC < cmp ds:[alarmsUp], 255 ; check for overflow >
EC < ERROR_E ALARM_UP_VALUE_TOO_LARGE >
inc ds:[alarmsUp] ; increase the alarm up count
mov bx, handle AlarmTemplate ; block to duplicate
clr ax ; have current geode own block
mov cx, -1 ; copy running thread from
; template block
call ObjDuplicateResource ; duplicate this block
; Stuff the triggers with the group & item #
;
pop cx, dx ; CX:DX = group:item
mov si, offset AlarmTemplate:AlarmBox
mov ax, MSG_REMINDER_STORE_EVENT
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; CX, DX are preserved
; Now let's stuff the data into the block
;
mov ax, cx ; group => AX
mov di, dx ; item => DI
call GP_DBLock ; re-lock the EventStruct
push di, di ; save the EventStruct handle
mov bp, es:[di] ; dereference the event
mov cx, es:[bp].ES_dataLength ; length of data in CX
DBCS < shr cx, 1 ; # bytes -> # chars >
add bp, offset ES_data ; get the data
mov dx, es ; DX:BP points to the data
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
mov si, offset AlarmTemplate:AlarmMessage
call ObjMessage_reminder_call ; stuff the text
; Create & stuff the date string
;
pop di ; restore event handle
mov si, es:[di] ; dereference the event handle
mov bp, es:[si].ES_timeYear ; year to BP
mov dx, {word} es:[si].ES_timeDay ; month/day to DX
mov cx, {word} es:[si].ES_timeMinute ; hour/minute to CX
mov si, offset AlarmTemplate:AlarmBox
mov ax, MSG_REMINDER_STORE_DATE_TIME
call ObjMessage_reminder_call
repeatEvent::
mov ax, MSG_CALENDAR_RESET_REMINDER
call ObjMessage_reminder_call
; Now set the alarm window usable
;
mov cx, bx ; AlarmBox OD => CX:DX
mov dx, si
clr bx
call GeodeGetAppObject ; application object => BX:SI
mov bp, mask CCF_MARK_DIRTY or CCO_LAST ; make it the last child
mov ax, MSG_GEN_ADD_CHILD ; yes - we're adding a child
call ObjMessage_reminder_call ; link window to parent
mov bx, cx
mov si, dx ; BX:SI is our object
mov ax, MSG_GEN_SET_USABLE
mov dl, VUM_NOW ; update the screen now!
call ObjMessage_reminder_call ; set the new window usable
mov ax, MSG_GEN_INTERACTION_INITIATE
call ObjMessage_reminder_call
; Ensure we can always interact with the window
;
mov ax, MSG_META_GCN_LIST_ADD
call ReminderAddRemoveAlwaysInteractibleWindowsGCNList
; Finally, make some noise to alert user of the alarm
;
pop di ; EventStruct => ES:*DI
;
; NON responder
;
mov bx, es:[di]
mov bl, es:[bx].ES_flags ; EventInfoFlags => BL
and bx, mask EIF_ALARM_SOUND
shl bx, 1 ; word offset => BX
mov ax, SST_CUSTOM_BUFFER ; play my own noise
mov dx, cs
mov si, cs:[alarmSounds][bx] ; sound buffer => DX:SI
mov cx, cs:[alarmLength][bx] ; buffer length => CX
call UserStandardSound ; play the sound
.leave
ret
AlarmToScreen endp
alarmSounds nptr \
normalAlarmBuffer,
silentAlarmBuffer,
quietAlarmBuffer,
panicAlarmBuffer
alarmLength word \
NORMAL_ALARM_BUFFER_SIZE,
SILENT_ALARM_BUFFER_SIZE,
QUIET_ALARM_BUFFER_SIZE,
PANIC_ALARM_BUFFER_SIZE
silentAlarmBuffer label word
General GE_END_OF_SONG
SILENT_ALARM_BUFFER_SIZE equ $ - (offset silentAlarmBuffer)
quietAlarmBuffer label word
ChangeEnvelope 0, IP_ACOUSTIC_GRAND_PIANO
DeltaTick 1
VoiceOn 0, HIGH_C, DYNAMIC_MF
DeltaTick 7
VoiceOff 0
DeltaTick 1
VoiceOn 0, HIGH_E, DYNAMIC_MF
DeltaTick 7
VoiceOff 0
DeltaTick 1
VoiceOn 0, HIGH_D, DYNAMIC_MF
DeltaTick 7
VoiceOff 0
DeltaTick 1
VoiceOn 0, HIGH_C, DYNAMIC_MF
DeltaTick 7
VoiceOff 0
General GE_END_OF_SONG
QUIET_ALARM_BUFFER_SIZE equ $ - (offset quietAlarmBuffer)
normalAlarmBuffer label word
ChangeEnvelope 0, IP_FLUTE
DeltaTick 1
VoiceOn 0, HIGH_A, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_G, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_F, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_A, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_G, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_F, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_A, DYNAMIC_F
DeltaTick 8
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_G, DYNAMIC_F
DeltaTick 10
VoiceOff 0
DeltaTick 2
VoiceOn 0, HIGH_F, DYNAMIC_F
DeltaTick 12
VoiceOff 0
General GE_END_OF_SONG
NORMAL_ALARM_BUFFER_SIZE equ $ - (offset normalAlarmBuffer)
panicAlarmBuffer label word
ChangeEnvelope 0, IP_TINKLE_BELL
DeltaTick 1
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 18
VoiceOff 0
DeltaTick 6
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_C, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
VoiceOn 0, LOW_D, DYNAMIC_FF
DeltaTick 5
VoiceOff 0
General GE_END_OF_SONG
PANIC_ALARM_BUFFER_SIZE equ $ - (offset panicAlarmBuffer)
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AlarmDestroy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destroy an alarm we previosuly created
CALLED BY: UI (MSG_CALENDAR_ALARM_DESTROY)
PASS: DS, ES = DGroup
CX:DX = OD of the alarm to destroy
RETURN: Nothing
DESTROYED: TBD
PSEUDO CODE/STRATEGY:
The Alarm/Reminder is already set not usable at this point
KNOWN BUGS/SIDE EFFECTS/IDEAS:
None
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AlarmDestroy proc far
.enter
; Remove it from the visual linkage
;
EC < tst ds:[alarmsUp] ; check for underflow >
EC < ERROR_E ALARM_UP_VALUE_TOO_SMALL >
dec ds:[alarmsUp] ; decrease the alarm up count
GetResourceHandleNS AppResource, bx
mov si, offset AppResource:Calendar ; BX:SI = parent of the window
mov ax, MSG_GEN_REMOVE_CHILD
mov bp, mask CCF_MARK_DIRTY ; mark the links as dirty
clr di
call ObjMessage
; Remove object from GCN list
;
mov ax, MSG_META_GCN_LIST_REMOVE
mov bx, cx
mov si, dx ; object in the block to free
call ReminderAddRemoveAlwaysInteractibleWindowsGCNList
; Now free up the block
;
mov ax, MSG_META_BLOCK_FREE
clr di
call ObjMessage
.leave
ret
AlarmDestroy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AlarmSnooze
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Cause the alarm to go away for 5 minutes
CALLED BY: UI (MSG_CALENDAR_ALARM_SNOOZE)
This is run in the GeoPlanner's thread
PASS: CX:DX = Group:Item of the EventStruct
DS, ES = DGroup
RETURN: Nothing
DESTROYED: TBD
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/17/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ALARM_SNOOZE_TIME = 5
AlarmSnooze proc far
; Reset the alarm time
;
push cx, dx ; save the group & item #'s
call TimerGetDateAndTime
mov cl, dl ; Hour/Minute to CX
mov dx, bx
xchg dh, dl ; Month/Day to DX
mov bp, ax ; year to BP
add cl, ALARM_SNOOZE_TIME ; add on the snooze time
cmp cl, 60
jl reset
sub cl, 60 ; go to the next hour
inc ch ;
cmp ch, 24
jl reset
push cx ; save the time
mov cx, 1 ; increment by one day
call CalcDateAltered ; calculate
pop cx ; restore the time
; See if the DayPlan has this event loaded
reset:
pop ax, di ; group:item => AX:DI
test ds:[systemStatus], SF_VALID_FILE ; are we exiting ??
jz done ; yes, so ignore
push cx, dx, bp ; save the time values
mov cx, ax
mov dx, di ; goup:item => CX:DX
GetResourceHandleNS DayPlanObject, bx
mov si, offset DayPlanObject ; DayPlan OD => BX:SI
mov ax, MSG_DP_ETE_FIND_EVENT
call ObjMessage_reminder_call ; is the event present ??
mov si, ax ; DayEvent handle => SI
mov ax, cx ; group => AX
mov di, dx ; item => DI
pop cx, dx, bp ; restore the time data
jnc manualChange ; if carry clear, not found
tst si ; is it on screen ??
jz manualChange ; if not, do it ourself
mov ax, MSG_DE_SET_ALARM ; set the alarm remotely
clr di ; not a call
call ObjMessage ; send the method
jmp done ; we're done
; Reset the alarm time
manualChange:
call DBDeleteAlarm ; remove the linkage
push di
call GP_DBLockDerefDI ; lock the item & mark it dirty
mov es:[di].ES_alarmYear, bp
mov {word} es:[di].ES_alarmDay, dx
mov {word} eS:[di].ES_alarmMinute, cx
call GP_DBDirtyUnlock ; unlock after storing data
pop di ; restore the item #
call DBInsertAlarm ; re-insert alarm
done:
ret
AlarmSnooze endp
if _TODO
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AlarmTodo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Put alarmed event into To Do list
CALLED BY: MSG_CALENDAR_ALARM_TODO
run by process thread
PASS: cx:dx = Group:Item of alarm event
RETURN: nothing
DESTROYED: ax,bx,cx,dx,di,si,bp,es
SIDE EFFECTS: alters database by adding a To-do EventStruct
PSEUDO CODE/STRATEGY:
Allocate new EventStruct
Copy old EventStruct to new EventStruct
Move To-do values to new EventStruct
Add new EventStruct to To-do list in DB
if(To-do list showing)
Reshow events
Put up flashing note
Note: In the long run, code inside AlarmToDo should
be replaced by a call to CreateEvent anyway, since
it is really identical. The way to do that is to create
a bogus DayEvent and call the CreateEvent. As a quick
fix right here for the unique ID, I just added the
UniqueID part from CreateEvent. (kliu -- 3/27/97)
REVISION HISTORY:
Name Date Description
---- ---- -----------
sean 3/23/95 Initial version
sean 10/26/95 completely changed
kliu 3/27/97 Added unique ID
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AlarmTodo proc far
.enter
; First we create an EventStruct & copy the event text to
; this new EventStruct.
;
push cx, dx ; save Gr:It of old EventStruct
movdw axdi, cxdx ; ax:di = Gr:It of old EventStruct
call GetEventStructSize ; cx = size of EventStruct
call DBGetToDoMap ; ax:di = Gr:It of To Do map
mov bx, di ; ax:bx = Gr:It of To Do map
call GP_DBAlloc ; ax:di = Gr:It of new EventStruct
pop cx, dx ; restore Gr:It of old EventStruct
call StuffEventText
; Then we stuff it with To-do item values, and insert
; it into the database as a To-do event.
;
call StuffToDoEvent ; new EventStruct <- To-do item values
; cxdx = unqiue ID (if UNIQUE_ID)
;
; Insert the IDArray for the event's unique ID
;
if SEARCH_EVENT_BY_ID
call DBInsertEventIDArray
endif
mov cx, (TODO_DUMMY_HOUR shl 8) or TODO_NORMAL_PRIORITY
call DBInsertEvent ; insert w/ normal priority
;
; We reset the DayPlan's UI if the Calendar happens to
; be showing the To-do list when we add this To-do item.
; Therefore, the To-do list will show this new To-do item.
;
GetResourceSegmentNS dgroup, es
cmp es:[viewInfo], VT_TODO ; To-do list showing ?
jne continue
mov ax, MSG_DP_RESET_UI
GetResourceHandleNS DayPlanObject, bx
mov si, offset DayPlanObject
mov di, mask MF_FORCE_QUEUE
call ObjMessage
; Put up flashing note telling that event was moved
; to To-do list.
;
; It should be a flashing note -- kho, 11/20/95
;
; GetResourceHandleNS MovedToToDoListString, cx
; mov dx, offset MovedToToDoListString
; call FoamDisplayNoteNoBlock
continue:
GetResourceHandleNS MovedToToDoNote, bx
mov si, offset MovedToToDoNote
mov ax, MSG_GEN_INTERACTION_INITIATE
mov di, mask MF_FORCE_QUEUE
call ObjMessage
.leave
ret
AlarmTodo endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StuffEventText
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copies event text in source EventStruct to new
destination EventStruct.
CALLED BY: AlarmTodo
PASS: cx:dx = Gr:It of source event text
ax:di = Gr:It of desitination event text
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
sean 10/26/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StuffEventText proc near
uses ax,bx,cx,dx,si,di,bp
.enter
xchgdw axdi, cxdx
test ax, REPEAT_MASK
jnz repeatEvent
call GP_DBLockDerefDI ; es:di = source EventStruct
segmov ds, es, si
mov si, di ; ds:si = source EventStruct
movdw axdi, cxdx ; ax:di = Gr:It of dest EventStuct
call GP_DBLockDerefDI ; es:di = dest EventStruct
mov cx, ds:[si].ES_dataLength
mov es:[di].ES_dataLength, cx ; store dataLength
add di, offset ES_data ; es:di = ptr dest event text
add si, offset ES_data ; ds:si = ptr source event text
copyIt:
rep movsb ; copy the text
call GP_DBDirtyUnlock ; write/unlock new EventStruct
segmov es, ds, di
call DBUnlock ; unlock source
.leave
ret
repeatEvent:
and ax, not (REPEAT_MASK)
call GP_DBLockDerefDI ; es:di = source EventStruct
segmov ds, es, si
mov si, di ; ds:si = source EventStruct
movdw axdi, cxdx ; ax:di = Gr:It of dest EventStuct
call GP_DBLockDerefDI ; es:di = dest EventStruct
mov cx, ds:[si].RES_dataLength
mov es:[di].ES_dataLength, cx ; store dataLength
add di, offset ES_data ; es:di = ptr dest event text
add si, offset RES_data ; ds:si = ptr source event text
jmp copyIt
StuffEventText endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetEventStructSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Returns size of EventStruct + size of data in
EventStruct, so we can allocate a new EventStruct.
CALLED BY: AlarmTodo
PASS: ax:di = Gr:It of old EventStruct
RETURN: cx = size of EventStruct to allocate
DESTROYED: es
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
sean 10/26/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetEventStructSize proc near
uses ax,si,di
.enter
mov cx, size EventStruct
test ax, REPEAT_MASK ; repeat event ?
jnz repeatEvent
call GP_DBLockDerefDI ; es:di = old EventStruct
add cx, es:[di].ES_dataLength
jmp exit
repeatEvent:
and ax, not REPEAT_MASK
call GP_DBLockDerefDI ; es:di = old EventStruct
add cx, es:[di].RES_dataLength
exit:
call DBUnlock
.leave
ret
GetEventStructSize endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StuffToDoEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Stuffs EventStruct with To-do list values.
CALLED BY: AlarmTodo
PASS: ax:di = Gr:It of new EventStruct
bx = It # for To-Do list map
RETURN: cxdx = unique ID (if UNIQUE_EVENT_ID)
DESTROYED: nothing
SIDE EFFECTS: none
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
sean 10/26/95 Initial version
kliu 3/28/97 added unique_event_id
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StuffToDoEvent proc near
uses ax,bx,si,di,bp
.enter
call GP_DBLockDerefDI ; es:di = new EventStruct
mov es:[di].ES_flags, mask EIF_TODO
mov es:[di].ES_parentMap, bx ; store parent map
mov es:[di].ES_timeYear, TODO_DUMMY_YEAR
mov {word} es:[di].ES_timeDay, TODO_DUMMY_MONTH_DAY
mov es:[di].ES_timeHour, TODO_DUMMY_HOUR
mov es:[di].ES_timeMinute, TODO_NORMAL_PRIORITY
clr es:[di].ES_endTimeMinute
clr es:[di].ES_endTimeHour
clr es:[di].ES_varFlags
mov es:[di].ES_memoToken, NO_MEMO_TOKEN
clr es:[di].ES_alarmYear
clr es:[di].ES_alarmDay
clr es:[di].ES_alarmMonth
clr es:[di].ES_alarmHour
mov es:[di].ES_alarmMinute, TODO_NOT_COMPLETED
clr es:[di].ES_repeatID
if UNIQUE_EVENT_ID
call UseNextEventID ; cxdx <- next event id
movdw es:[di].ES_uniqueID, cxdx
endif
if HANDLE_MAILBOX_MSG
clr es:[di].ES_sentToArrayBlock
clr es:[di].ES_sentToArrayChunk
clr es:[di].ES_nextBookID
endif
call GP_DBDirtyUnlock
.leave
ret
StuffToDoEvent endp
endif ; if To Do list
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderStoreEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Store the corresponding EventStruct for this reminder
CALLED BY: AlarmToScreen (MSG_REMINDER_STORE_EVENT)
This is run in the UI thread
PASS: DS:DI = ReminderClass specific instance data
CX:DX = EventStruct Group:Item
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderStoreEvent method ReminderClass, MSG_REMINDER_STORE_EVENT
.enter
mov ds:[di].RCI_group, cx ; store the group #
mov ds:[di].RCI_item, dx ; store the item #
.leave
ret
ReminderStoreEvent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderStoreDateTime
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Stores the date & time of the Reminder being displayed
CALLED BY: GLOBAL (MSG_REMINDER_STORE_DATE_TIME)
PASS: DS:DI = ReminderClass specific instance data
ES = DGroup
BP = Year
DX = Month/day
CX = Hour/minute
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderStoreDateTime method ReminderClass, MSG_REMINDER_STORE_DATE_TIME
.enter
mov {word} ds:[di].RCI_minute, cx
mov {word} ds:[di].RCI_day, dx
mov ds:[di].RCI_year, bp
.leave
ret
ReminderStoreDateTime endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderSnooze
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: The user wants the reminder to re-appear in five minutes.
Call the process to do the real work
Or the user wants to put an Alarmed event into the
To Do list. (MSG_REMINDER_TODO)
CALLED BY: UI (MSG_REMINDER_SNOOZE)
(MSG_REMINDER_TODO)
This is run in the UI thread
PASS: DS:DI = ReminderClass specific instance data
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, DI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial version
sean 4/5/95 To do list changes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _TODO
ReminderSnooze method ReminderClass, MSG_REMINDER_SNOOZE,
MSG_REMINDER_TODO
else
ReminderSnooze method ReminderClass, MSG_REMINDER_SNOOZE
endif
.enter
TODO < mov bp, ax ; bp = message >
mov cx, ds:[di].RCI_group
tst cx ; any group
jz done ; no, so do nothing
mov dx, ds:[di].RCI_item
mov bx, ds:[LMBH_handle] ; block handle => BX
call MemOwner ; owner => BX
mov ax, MSG_CALENDAR_ALARM_SNOOZE
TODO < cmp bp, MSG_REMINDER_SNOOZE ; which message are >
TODO < je notToDo ; we responding to ? >
TODO < mov ax, MSG_CALENDAR_ALARM_TODO ; if To Do message >
notToDo::
clr di
call ObjMessage
done:
.leave
ret
ReminderSnooze endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderDestroy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Destroy a reminder when it is closed by the user
CALLED BY: UI (MSG_GEN_GUP_INTERACTION_COMMAND)
This is run in the UI thread
PASS: DS:DI = ReminderClass specific instance data
DS:*SI = ReminderClass instance data
AX = MSG_GEN_GUP_INTERACTION_COMMAND
CX = InteractionCommand
RETURN: Nothing
DESTROYED: AX, BX, CX, DX, DI, SI, BP
(Responder)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/17/89 Initial version
Don 8/23/90 Changed name & thread its running under
sean 10/27/95 Responder focus/target code
sean 11/30/95 Responder change. Make sure all
alarms gone before releasing focus.
sean 1/11/96 Kill Responder code(use sys-modal
dialog instead)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderDestroy method ReminderClass, MSG_GEN_GUP_INTERACTION_COMMAND
; First complete the method
;
push cx
mov di, offset ReminderClass
call ObjCallSuperNoLock
pop cx
cmp cx, IC_DISMISS
jne done
; Ensure the dialog box is no longer usable
;
mov ax, MSG_GEN_SET_NOT_USABLE
mov dl, VUM_NOW
call ObjCallInstanceNoLock
; Now kill the alarm entirely
;
mov cx, ds:[LMBH_handle]
mov dx, si ; CX:DX = object to remove
mov bx, cx
call MemOwner ; process => BX
mov ax, MSG_CALENDAR_ALARM_DESTROY
clr di
call ObjMessage
done:
ret
ReminderDestroy endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderSelfDestruct
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: A reminder must destroy itself if the corresponding
EventStruct is being altered or deleted.
CALLED BY: AlarmCheckActive()
PASS: DS:DI = ReminderClass specific instance data
DS:*SI = ReminderClass instance data
CX:DX = EventStruct group:item that is changing
- or -
CX = -1 to always destroy reminder
DX = -1 to disable the snooze trigger
RETURN: Nothing
DESTROYED: AX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 8/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderSelfDestruct method ReminderClass, MSG_CALENDAR_KILL_REMINDER
.enter
; If the group & item numbers match, destroy me...
;
cmp cx, -1 ; destroy regardless ??
je destroyMe
cmp dx, -1 ; just disable Snooze?
je nukeSnooze
cmp cx, ds:[di].RCI_group
jne done
cmp dx, ds:[di].RCI_item
jne done
destroyMe:
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call ObjCallInstanceNoLock
jmp done
nukeSnooze:
mov ds:[di].RCI_group, 0 ; remove the group
mov ds:[di].RCI_item, 0 ; remove the item
mov si, offset AlarmSnoozeTrigger ; snooze trigger OD => DS:*SI
mov ax, MSG_GEN_SET_NOT_ENABLED ; disable the trigger
mov dl, VUM_NOW ; update now to ensure state
call ObjCallInstanceNoLock ; send the method
done:
.leave
ret
ReminderSelfDestruct endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderReset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the time & date string for a reminder
CALLED BY: GLOBAL
PASS: DS:DI = specific instance data
ES = DGroup
RETURN: Nothing
DESTROYED: TBD
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 12/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderReset method ReminderClass, MSG_CALENDAR_RESET_REMINDER
.enter
; Reset the time & date strings
;
mov bp, ds:[di].RCI_year ; year => BP
mov dx, {word} ds:[di].RCI_day ; month/day => DX
push {word} ds:[di].RCI_minute ; push hour/minute
mov cx, DTF_LONG_CONDENSED or USES_DAY_OF_WEEK
mov di, ds:[LMBH_handle] ; text object OD => DI:SI
mov si, offset AlarmTemplate:AlarmDate
call DateToTextObject ; stuff the date
pop cx ; put hour/minute to CX
mov si, offset AlarmTemplate:AlarmTime ; text object OD => DI:SI
call TimeToTextObject ; stuff the time
.leave
ret
ReminderReset endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReminderAddRemovelwaysInteractibleWindowsGCNList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends an add or remove message to the application object's
GCN list
CALLED BY: INTERNAL
PASS: AX = Message to send
MSG_META_GCN_LIST_ADD
MSG_META_GCN_LIST_REMOVE
BX:SI = OD of ReminderClass object
RETURN: Nothing
DESTROYED: AX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/ 1/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReminderAddRemoveAlwaysInteractibleWindowsGCNList proc near
uses bx, cx, dx, di, si, bp
.enter
mov dx, size GCNListParams
sub sp, dx
mov bp, sp ; GCNListParams => SS:BP
mov ss:[bp].GCNLP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS
mov ss:[bp].GCNLP_ID.GCNLT_type, GAGCNLT_ALWAYS_INTERACTABLE_WINDOWS
mov ss:[bp].GCNLP_optr.handle, bx
mov ss:[bp].GCNLP_optr.chunk, si
clr bx ; use this geode!
call GeodeGetAppObject ; application object => BX:SI
mov di, mask MF_STACK
call ObjMessage_reminder ; send it!!
add sp, dx ; clean up the stack
.leave
ret
ReminderAddRemoveAlwaysInteractibleWindowsGCNList endp
ObjMessage_reminder_send proc near
clr di
GOTO ObjMessage_reminder
ObjMessage_reminder_send endp
ObjMessage_reminder_call proc near
mov di, mask MF_CALL or mask MF_FIXUP_DS or mask MF_FIXUP_DS
FALL_THRU ObjMessage_reminder
ObjMessage_reminder_call endp
ObjMessage_reminder proc near
call ObjMessage
ret
ObjMessage_reminder endp
ReminderCode ends
endif
|
// 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.
//
// Created by chunxiao ma on 2022/1/21.
//
#include "json.hh"
namespace edb {} |
; A145677: Triangle T(n,m) read by rows: T(n,0) =1; T(n,n) =n, n>0; T(n,k) =0, 0<k<n-1 .
; 1,1,1,1,0,2,1,0,0,3,1,0,0,0,4,1,0,0,0,0,5,1,0,0,0,0,0,6,1,0,0,0,0,0,0,7,1,0,0,0,0,0,0,0,8,1,0,0,0,0,0,0,0,0,9,1,0,0,0,0,0,0,0,0,0,10,1,0,0,0,0,0,0,0,0,0,0,11
sub $0,1
cal $0,128229 ; A natural number transform, inverse of signed A094587.
mov $1,$0
|
#ifndef word_db_hh_INCLUDED
#define word_db_hh_INCLUDED
#include "buffer.hh"
#include "shared_string.hh"
#include "hash_map.hh"
#include "vector.hh"
#include "ranked_match.hh"
namespace Kakoune
{
using RankedMatchList = Vector<RankedMatch>;
// maintain a database of words available in a buffer
class WordDB : public OptionManagerWatcher
{
public:
WordDB(const Buffer& buffer);
~WordDB();
WordDB(const WordDB&) = delete;
WordDB(WordDB&&) noexcept;
RankedMatchList find_matching(StringView str);
int get_word_occurences(StringView word) const;
private:
void update_db();
void add_words(StringView line);
void remove_words(StringView line);
void rebuild_db();
void on_option_changed(const Option& option) override;
struct WordInfo
{
StringDataPtr word;
UsedLetters letters;
int refcount;
};
using WordToInfo = HashMap<StringView, WordInfo, MemoryDomain::WordDB>;
using Lines = Vector<StringDataPtr, MemoryDomain::WordDB>;
SafePtr<const Buffer> m_buffer;
size_t m_timestamp;
WordToInfo m_words;
Lines m_lines;
};
WordDB& get_word_db(const Buffer& buffer);
}
#endif // word_db_hh_INCLUDED
|
; A164541: a(n) = 6*a(n-1) - a(n-2) for n > 1; a(0) = 1, a(1) = 15.
; 1,15,89,519,3025,17631,102761,598935,3490849,20346159,118586105,691170471,4028436721,23479449855,136848262409,797610124599,4648812485185,27095264786511,157922776233881,920441392616775,5364725579466769
mul $0,2
lpb $0
sub $0,1
add $1,1
mov $2,$1
add $3,$1
mov $1,$3
add $1,5
add $2,$3
mov $3,$2
lpe
add $1,1
|
; A008610: Molien series of 4-dimensional representation of cyclic group of order 4 over GF(2) (not Cohen-Macaulay).
; 1,1,3,5,10,14,22,30,43,55,73,91,116,140,172,204,245,285,335,385,446,506,578,650,735,819,917,1015,1128,1240,1368,1496,1641,1785,1947,2109,2290,2470,2670,2870,3091,3311,3553,3795,4060,4324,4612,4900,5213,5525,5863,6201,6566,6930,7322,7714,8135,8555,9005,9455,9936,10416,10928,11440,11985,12529,13107,13685,14298,14910,15558,16206,16891,17575,18297,19019,19780,20540,21340,22140,22981,23821,24703,25585,26510,27434,28402,29370,30383,31395,32453,33511,34616,35720,36872,38024,39225,40425,41675,42925
add $0,1
mov $1,3
lpb $0
mov $2,$0
trn $0,2
seq $2,982 ; a(n) = ceiling(n^2/2).
add $1,$2
lpe
div $1,2
sub $1,1
mov $0,$1
|
; ===============================================================
; Apr 2014
; ===============================================================
;
; void heap_info_unlocked(void *heap, void *callback)
;
; Visit each block in the heap and pass information about
; the block to the callback function.
;
; ===============================================================
SECTION code_alloc_malloc
PUBLIC asm_heap_info_unlocked
EXTERN l_jpix, l_inc_sp
asm_heap_info_unlocked:
; enter : ix = void *callback
; de = void *heap
;
; exit : none
;
; uses : af, bc, de, hl + callback
ld hl,6 ; sizeof(mutex)
add hl,de ; hl = & heap.hdr
block_loop:
; hl = & hdr
ld e,(hl)
inc hl
ld d,(hl) ; de = hdr->next
dec hl
ld a,d
or e
ret z ; if end of heap reached
push de ; save hdr->next
push de ; save hdr->next
push hl ; save hdr
push ix ; save callback
call header
pop ix ; restore callback
pop hl ; hl = & hdr
push hl ; save & hdr
inc hl
inc hl
ld e,(hl)
inc hl
ld d,(hl) ; de = hdr->committed
inc hl
inc hl
inc hl ; hl = hdr->mem[]
pop bc
ld a,d
or e
jr z, committed_zero ; if hdr->committed == 0
push bc
; hl = hdr->mem[]
; de = hdr->committed
; stack = hdr->next, hdr->next, hdr
push de ; save hdr->committed
ex de,hl
ld bc,-6
add hl,bc ; hl = hdr->committed - 6 = allocated size
push ix ; save callback
call allocated
pop ix ; restore callback
pop hl ; hl = hdr->committed
pop de ; de = hdr
add hl,de
committed_zero:
; hl = & free memory block
; stack = hdr->next, hdr->next
ex de,hl ; de = & free memory in block
pop hl ; hl = hdr->next
; de = & free memory block
; hl = hdr->next
; stack = hdr->next
or a
sbc hl,de ; hl = free memory size
jr z, free_zero ; if no free memory available
; hl = free memory size
; de = & free memory block
; stack = hdr->next
push ix ; save callback
call free
pop ix ; restore callback
free_zero:
pop hl ; hl = hdr->next
jr block_loop
header:
; HEADER BLOCK
; hl = & hdr
ld de,6
push de ; size = 6
push hl ; address = hdr
ld e,0
push de ; type = 0
invoke:
ld hl,0
add hl,sp
push hl
call l_jpix ; invoke callback
jp l_inc_sp - 8
allocated:
; ALLOCATED BLOCK
; hl = allocated size
; de = hdr->mem[]
ld bc,1
push hl ; size
push de ; address
push bc ; type
jr invoke
free:
; FREE BLOCK
; hl = free memory size
; de = & free memory block
ld bc,2
push hl ; size
push de ; address
push bc ; type
jr invoke
|
; A247309: Rectangular array read upwards by columns: T = T(n,k) = number of paths from (0,1) to (n,k), where 0 <= k <= 2, consisting of segments given by the vectors (1,1), (1,0), (1,-1), (1,-2).
; 1,0,0,1,1,1,2,3,3,5,8,8,13,21,21,34,55,55,89,144,144,233,377,377,610,987,987,1597,2584,2584,4181,6765,6765,10946,17711,17711,28657,46368,46368,75025,121393,121393,196418,317811,317811,514229,832040,832040,1346269,2178309,2178309,3524578,5702887,5702887,9227465,14930352,14930352,24157817,39088169,39088169,63245986,102334155,102334155,165580141,267914296,267914296,433494437,701408733,701408733,1134903170,1836311903,1836311903,2971215073,4807526976,4807526976,7778742049,12586269025,12586269025,20365011074,32951280099,32951280099,53316291173,86267571272,86267571272,139583862445,225851433717,225851433717,365435296162,591286729879,591286729879,956722026041,1548008755920,1548008755920,2504730781961,4052739537881,4052739537881,6557470319842,10610209857723,10610209857723,17167680177565
mul $0,2
trn $0,1
seq $0,247049 ; Rectangular array read upwards by columns: T = T(n,k) = number of paths from (0,0) to (n,k), where 0 >= k <= 2, consisting of segments given by the vectors (1,1), (1,2), (1,-1).
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/desktop_media_picker_views_deprecated.h"
#include <utility>
#include "base/bind.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/media/webrtc/fake_desktop_media_list.h"
#include "components/web_modal/test_web_contents_modal_dialog_host.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/events/event_utils.h"
#include "ui/views/test/scoped_views_test_helper.h"
#include "ui/views/widget/widget.h"
#include "ui/views/window/dialog_client_view.h"
#include "ui/views/window/dialog_delegate.h"
namespace deprecated {
class DesktopMediaPickerViewsDeprecatedTest : public testing::Test {
public:
DesktopMediaPickerViewsDeprecatedTest() {}
~DesktopMediaPickerViewsDeprecatedTest() override {}
void SetUp() override {
screen_list_ = new FakeDesktopMediaList();
window_list_ = new FakeDesktopMediaList();
tab_list_ = new FakeDesktopMediaList();
std::unique_ptr<FakeDesktopMediaList> screen_list(screen_list_);
std::unique_ptr<FakeDesktopMediaList> window_list(window_list_);
std::unique_ptr<FakeDesktopMediaList> tab_list(tab_list_);
base::string16 app_name = base::ASCIIToUTF16("foo");
picker_views_.reset(new DesktopMediaPickerViews());
picker_views_->Show(
NULL, test_helper_.GetContext(), NULL, app_name, app_name,
std::move(screen_list), std::move(window_list), std::move(tab_list),
false, base::Bind(&DesktopMediaPickerViewsDeprecatedTest::OnPickerDone,
base::Unretained(this)));
}
void TearDown() override {
if (GetPickerDialogView()) {
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID()));
GetPickerDialogView()->GetWidget()->CloseNow();
}
}
DesktopMediaPickerDialogView* GetPickerDialogView() const {
return picker_views_->GetDialogViewForTesting();
}
MOCK_METHOD1(OnPickerDone, void(content::DesktopMediaID));
protected:
content::TestBrowserThreadBundle thread_bundle_;
views::ScopedViewsTestHelper test_helper_;
FakeDesktopMediaList* screen_list_;
FakeDesktopMediaList* window_list_;
FakeDesktopMediaList* tab_list_;
std::unique_ptr<DesktopMediaPickerViews> picker_views_;
};
TEST_F(DesktopMediaPickerViewsDeprecatedTest,
DoneCallbackCalledWhenWindowClosed) {
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID()));
GetPickerDialogView()->GetWidget()->Close();
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsDeprecatedTest,
DoneCallbackCalledOnOkButtonPressed) {
const int kFakeId = 222;
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
window_list_->AddSource(kFakeId);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->GetDialogClientView()->AcceptWindow();
base::RunLoop().RunUntilIdle();
}
// Verifies that a MediaSourceView is selected with mouse left click and
// original selected MediaSourceView gets unselected.
TEST_F(DesktopMediaPickerViewsDeprecatedTest,
SelectMediaSourceViewOnSingleClick) {
window_list_->AddSource(0);
window_list_->AddSource(1);
DesktopMediaSourceView* source_view_0 =
GetPickerDialogView()->GetMediaSourceViewForTesting(0);
DesktopMediaSourceView* source_view_1 =
GetPickerDialogView()->GetMediaSourceViewForTesting(1);
// Both media source views are not selected initially.
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_FALSE(source_view_1->is_selected());
// Source view 0 is selected with mouse click.
ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed(press);
EXPECT_TRUE(source_view_0->is_selected());
EXPECT_FALSE(source_view_1->is_selected());
// Source view 1 is selected and source view 0 is unselected with mouse click.
GetPickerDialogView()->GetMediaSourceViewForTesting(1)->OnMousePressed(press);
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_TRUE(source_view_1->is_selected());
}
TEST_F(DesktopMediaPickerViewsDeprecatedTest, DoneCallbackCalledOnDoubleClick) {
const int kFakeId = 222;
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
window_list_->AddSource(kFakeId);
ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(),
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK,
ui::EF_LEFT_MOUSE_BUTTON);
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed(
double_click);
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsDeprecatedTest, DoneCallbackCalledOnDoubleTap) {
const int kFakeId = 222;
EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID(
content::DesktopMediaID::TYPE_WINDOW, kFakeId)));
window_list_->AddSource(kFakeId);
ui::GestureEventDetails details(ui::ET_GESTURE_TAP);
details.set_tap_count(2);
ui::GestureEvent double_tap(10, 10, 0, base::TimeTicks(), details);
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent(
&double_tap);
base::RunLoop().RunUntilIdle();
}
TEST_F(DesktopMediaPickerViewsDeprecatedTest, CancelButtonAlwaysEnabled) {
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL));
}
// Verifies that the MediaSourceView is added or removed when |media_list_| is
// updated.
TEST_F(DesktopMediaPickerViewsDeprecatedTest, AddAndRemoveMediaSource) {
// No media source at first.
EXPECT_EQ(NULL, GetPickerDialogView()->GetMediaSourceViewForTesting(0));
for (int i = 0; i < 3; ++i) {
window_list_->AddSource(i);
EXPECT_TRUE(GetPickerDialogView()->GetMediaSourceViewForTesting(i));
}
for (int i = 2; i >= 0; --i) {
window_list_->RemoveSource(i);
EXPECT_EQ(NULL, GetPickerDialogView()->GetMediaSourceViewForTesting(i));
}
}
// Verifies that focusing the MediaSourceView marks it selected and the
// original selected MediaSourceView gets unselected.
TEST_F(DesktopMediaPickerViewsDeprecatedTest, FocusMediaSourceViewToSelect) {
window_list_->AddSource(0);
window_list_->AddSource(1);
DesktopMediaSourceView* source_view_0 =
GetPickerDialogView()->GetMediaSourceViewForTesting(0);
DesktopMediaSourceView* source_view_1 =
GetPickerDialogView()->GetMediaSourceViewForTesting(1);
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_FALSE(source_view_1->is_selected());
source_view_0->OnFocus();
EXPECT_TRUE(source_view_0->is_selected());
// Removing the focus does not undo the selection.
source_view_0->OnBlur();
EXPECT_TRUE(source_view_0->is_selected());
source_view_1->OnFocus();
EXPECT_FALSE(source_view_0->is_selected());
EXPECT_TRUE(source_view_1->is_selected());
}
TEST_F(DesktopMediaPickerViewsDeprecatedTest, OkButtonDisabledWhenNoSelection) {
window_list_->AddSource(111);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
EXPECT_TRUE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
window_list_->RemoveSource(0);
EXPECT_FALSE(
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
}
// Verifies that the MediaListView get the initial focus.
TEST_F(DesktopMediaPickerViewsDeprecatedTest, ListViewHasInitialFocus) {
EXPECT_TRUE(GetPickerDialogView()->GetMediaListViewForTesting()->HasFocus());
}
} // namespace deprecated
|
; A306279: Numbers congruent to 3 or 18 mod 22.
; 3,18,25,40,47,62,69,84,91,106,113,128,135,150,157,172,179,194,201,216,223,238,245,260,267,282,289,304,311,326,333,348,355,370,377,392,399,414,421,436,443,458,465,480,487,502,509,524,531,546,553,568
mov $1,32
add $1,$0
div $0,2
mul $0,8
mul $1,15
sub $1,$0
sub $1,477
|
; A100637: Trisection of A000720.
; 2,3,4,5,6,7,8,9,9,10,11,11,12,13,14,15,15,16,16,17,18,18,19,20,21,21,22,23,23,24,24,24,25,26,27,28,29,30,30,30,30,30,31,32,32,33,34,34,34,35,36,36,37,37,38,39,39,40,40,41,42,42,42,43,44,45,46,46,46,46,47,47,47,47,48,49,50,51,51,52,53,53,53,54,54,55,55,56,56,57,58,58,59,60,61,61,61,62,62,62
mul $0,3
add $0,1
max $2,$0
mov $1,$2
seq $1,33270 ; Number of odd primes <= n.
trn $1,1
add $1,2
mov $0,$1
|
;------------------------------------------------------------------------------
;
; Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
; Module Name:
;
; MathLShiftS64.nasm
;
; Abstract:
;
; 64-bit Math Worker Function.
; Shifts a 64-bit signed value left by a certain number of bits.
;
;------------------------------------------------------------------------------
SECTION .text
global ASM_PFX(__ashldi3)
;------------------------------------------------------------------------------
;
; void __cdecl __ashldi3 (void)
;
;------------------------------------------------------------------------------
ASM_PFX(__ashldi3):
cmp cl,0x40
jnc ReturnZero
cmp cl,0x20
jnc More32
shld edx,eax,cl
shl eax,cl
ret
More32:
mov edx,eax
xor eax,eax
and cl,0x1f
shl edx,cl
ret
ReturnZero:
xor eax,eax
xor edx,edx
ret
|
#include <mapnik/version.hpp>
#include <mapnik/map.hpp>
#include <mapnik/layer.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/color.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/projection.hpp>
#include <mapnik/font_engine_freetype.hpp>
#if MAPNIK_VERSION >= 300000
#include <mapnik/image.hpp>
#define mapnik_image_type mapnik::image_rgba8
#else
#include <mapnik/graphics.hpp>
#define mapnik_image_type mapnik::image_32
#endif
#include "mapnik_c_api.h"
#include <stdlib.h>
#ifdef __cplusplus
extern "C"
{
#endif
int mapnik_register_font(const char *path, char **err)
{
try
{
mapnik::freetype_engine::register_font(path);
return 0;
}
catch (std::exception const &ex)
{
*err = strdup(ex.what());
return -1;
}
}
int mapnik_register_datasource(const char *path, char **err)
{
try
{
#if MAPNIK_VERSION >= 200200
mapnik::datasource_cache::instance().register_datasources(path);
#else
mapnik::datasource_cache::instance()->register_datasources(path);
#endif
}
catch (std::exception const &ex)
{
*err = strdup(ex.what());
return -1;
}
return 0;
}
struct _mapnik_map_t
{
mapnik::Map *m;
std::string *err;
};
mapnik_map_t *mapnik_map(unsigned width, unsigned height)
{
mapnik_map_t *map = new mapnik_map_t;
map->m = new mapnik::Map(width, height);
map->err = NULL;
return map;
}
void mapnik_map_free(mapnik_map_t *m)
{
if (m)
{
if (m->m)
delete m->m;
if (m->err)
delete m->err;
delete m;
}
}
inline void mapnik_map_reset_last_error(mapnik_map_t *m)
{
if (m && m->err)
{
delete m->err;
m->err = NULL;
}
}
void mapnik_map_set_max_connections(mapnik_map_t *m, int num_threads)
{
unsigned int i;
char *tmp = (char *)malloc(20);
for (i = 0; i < m->m->layer_count(); i++)
{
#if MAPNIK_VERSION >= 300000
mapnik::layer &l = m->m->get_layer(i);
#else
mapnik::layer &l = m->m->getLayer(i);
#endif
mapnik::parameters params = l.datasource()->params();
if (params.find("max_size") == params.end())
{
sprintf(tmp, "%i", num_threads + 2);
params["max_size"] = std::string(tmp);
}
#if MAPNIK_VERSION >= 200200
l.set_datasource(mapnik::datasource_cache::instance().create(params));
#else
l.set_datasource(mapnik::datasource_cache::instance()->create(params));
#endif
}
free(tmp);
}
const char *mapnik_map_get_srs(mapnik_map_t *m)
{
if (m && m->m)
return m->m->srs().c_str();
return NULL;
}
int mapnik_map_set_srs(mapnik_map_t *m, const char *srs)
{
if (m)
{
m->m->set_srs(srs);
return 0;
}
return -1;
}
int mapnik_map_load(mapnik_map_t *m, const char *stylesheet)
{
mapnik_map_reset_last_error(m);
if (m && m->m)
{
try
{
mapnik::load_map(*m->m, stylesheet);
}
catch (std::exception const &ex)
{
m->err = new std::string(ex.what());
return -1;
}
return 0;
}
return -1;
}
int mapnik_map_load_string(mapnik_map_t *m, const char *stylesheet_string)
{
mapnik_map_reset_last_error(m);
if (m && m->m)
{
try
{
mapnik::load_map_string(*m->m, stylesheet_string);
}
catch (std::exception const &ex)
{
m->err = new std::string(ex.what());
return -1;
}
return 0;
}
return -1;
}
int mapnik_map_zoom_all(mapnik_map_t *m)
{
mapnik_map_reset_last_error(m);
if (m && m->m)
{
try
{
m->m->zoom_all();
}
catch (std::exception const &ex)
{
m->err = new std::string(ex.what());
return -1;
}
return 0;
}
return -1;
}
int mapnik_map_render_to_file(mapnik_map_t *m, const char *filepath)
{
mapnik_map_reset_last_error(m);
if (m && m->m)
{
try
{
mapnik_image_type buf(m->m->width(), m->m->height());
mapnik::agg_renderer<mapnik_image_type> ren(*m->m, buf);
ren.apply();
mapnik::save_to_file(buf, filepath);
}
catch (std::exception const &ex)
{
m->err = new std::string(ex.what());
return -1;
}
return 0;
}
return -1;
}
void mapnik_map_resize(mapnik_map_t *m, unsigned int width, unsigned int height)
{
if (m && m->m)
{
m->m->resize(width, height);
}
}
MAPNIKCAPICALL void mapnik_map_set_buffer_size(mapnik_map_t *m, int buffer_size)
{
m->m->set_buffer_size(buffer_size);
}
const char *mapnik_map_last_error(mapnik_map_t *m)
{
if (m && m->err)
{
return m->err->c_str();
}
return NULL;
}
struct _mapnik_projection_t
{
mapnik::projection *p;
};
mapnik_projection_t *mapnik_map_projection(mapnik_map_t *m)
{
mapnik_projection_t *proj = new mapnik_projection_t;
if (m && m->m)
proj->p = new mapnik::projection(m->m->srs());
else
proj->p = NULL;
return proj;
}
void mapnik_projection_free(mapnik_projection_t *p)
{
if (p)
{
if (p->p)
delete p->p;
delete p;
}
}
mapnik_coord_t mapnik_projection_forward(mapnik_projection_t *p, mapnik_coord_t c)
{
if (p && p->p)
{
p->p->forward(c.x, c.y);
}
return c;
}
struct _mapnik_bbox_t
{
mapnik::box2d<double> b;
};
mapnik_bbox_t *mapnik_bbox(double minx, double miny, double maxx, double maxy)
{
mapnik_bbox_t *b = new mapnik_bbox_t;
b->b = mapnik::box2d<double>(minx, miny, maxx, maxy);
return b;
}
void mapnik_bbox_free(mapnik_bbox_t *b)
{
if (b)
delete b;
}
void mapnik_map_zoom_to_box(mapnik_map_t *m, mapnik_bbox_t *b)
{
if (m && m->m && b)
{
m->m->zoom_to_box(b->b);
}
}
struct _mapnik_image_t
{
mapnik_image_type *i;
std::string *err;
};
inline void mapnik_image_reset_last_error(mapnik_image_t *i)
{
if (i && i->err)
{
delete i->err;
i->err = NULL;
}
}
void mapnik_image_free(mapnik_image_t *i)
{
if (i)
{
if (i->i)
delete i->i;
delete i;
}
}
const char *mapnik_image_last_error(mapnik_image_t *i)
{
if (i && i->err)
{
return i->err->c_str();
}
return NULL;
}
mapnik_image_t *mapnik_map_render_to_image(mapnik_map_t *m, double scale, double scale_factor)
{
mapnik_map_reset_last_error(m);
mapnik_image_type *im = new mapnik_image_type(m->m->width(), m->m->height());
if (m && m->m)
{
try
{
mapnik::agg_renderer<mapnik_image_type> ren(*m->m, *im, scale_factor);
if (scale > 0.0)
{
ren.apply(scale);
}
else
{
ren.apply();
}
}
catch (std::exception const &ex)
{
delete im;
m->err = new std::string(ex.what());
return NULL;
}
}
mapnik_image_t *i = new mapnik_image_t;
i->i = im;
i->err = NULL;
return i;
}
void mapnik_image_blob_free(mapnik_image_blob_t *b)
{
if (b)
{
if (b->ptr)
delete[] b->ptr;
delete b;
}
}
mapnik_image_blob_t *mapnik_image_to_blob(mapnik_image_t *i, const char *format)
{
mapnik_image_reset_last_error(i);
mapnik_image_blob_t *blob = new mapnik_image_blob_t;
blob->ptr = NULL;
blob->len = 0;
if (i && i->i)
{
try
{
std::string s = save_to_string(*(i->i), format);
blob->len = s.length();
blob->ptr = new char[blob->len];
memcpy(blob->ptr, s.c_str(), blob->len);
}
catch (std::exception const &ex)
{
i->err = new std::string(ex.what());
delete blob;
return NULL;
}
}
return blob;
}
const uint8_t *mapnik_image_to_raw(mapnik_image_t *i, size_t *size)
{
if (i && i->i)
{
*size = i->i->width() * i->i->height() * 4;
return (uint8_t *)i->i->data();
}
return NULL;
}
mapnik_image_t *mapnik_image_from_raw(const uint8_t *raw, int width, int height)
{
mapnik_image_t *img = new mapnik_image_t;
img->i = new mapnik_image_type(width, height);
memcpy(img->i->data(), raw, width * height * 4);
img->err = NULL;
return img;
}
const char *mapnik_version_string()
{
#if MAPNIK_VERSION >= 200100
return MAPNIK_VERSION_STRING;
#else
#define MAPNIK_C_API_STRINGIFY(n) #n
return "ABI " MAPNIK_C_API_STRINGIFY(MAPNIK_VERSION);
#endif
}
void mapnik_logging_set_severity(int level)
{
mapnik::logger::severity_type severity;
switch (level)
{
case MAPNIK_DEBUG:
severity = mapnik::logger::debug;
break;
case MAPNIK_WARN:
severity = mapnik::logger::warn;
break;
case MAPNIK_ERROR:
severity = mapnik::logger::error;
break;
default:
severity = mapnik::logger::none;
break;
}
mapnik::logger::instance().set_severity(severity);
}
#ifdef __cplusplus
}
#endif
|
; int fzx_puts_callee(struct fzx_state *fs, char *s)
SECTION code_font_fzx
PUBLIC _fzx_puts_callee, l0_fzx_puts_callee
EXTERN l_neg_hl, asm_fzx_puts
_fzx_puts_callee:
pop af
pop ix
pop de
push af
l0_fzx_puts_callee:
call asm_fzx_puts
ret nc
jp l_neg_hl
|
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2008, 2009 Jose Aparicio
Copyright (C) 2008 Chris Kenyon
Copyright (C) 2008 Roland Lichters
Copyright (C) 2008 StatPro Italia srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#include <ql/termstructures/credit/defaultprobabilityhelpers.hpp>
#include <ql/instruments/creditdefaultswap.hpp>
#include <ql/pricingengines/credit/midpointcdsengine.hpp>
#include <ql/utilities/null_deleter.hpp>
namespace QuantLib {
CdsHelper::CdsHelper(const Handle<Quote>& quote,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
bool settlesAccrual,
bool paysAtDefaultTime)
: RelativeDateDefaultProbabilityHelper(quote),
tenor_(tenor), settlementDays_(settlementDays), calendar_(calendar),
frequency_(frequency), paymentConvention_(paymentConvention),
rule_(rule), dayCounter_(dayCounter), recoveryRate_(recoveryRate),
discountCurve_(discountCurve),
settlesAccrual_(settlesAccrual), paysAtDefaultTime_(paysAtDefaultTime) {
initializeDates();
registerWith(discountCurve);
}
CdsHelper::CdsHelper(Rate quote,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
bool settlesAccrual,
bool paysAtDefaultTime)
: RelativeDateDefaultProbabilityHelper(quote),
tenor_(tenor), settlementDays_(settlementDays), calendar_(calendar),
frequency_(frequency), paymentConvention_(paymentConvention),
rule_(rule), dayCounter_(dayCounter), recoveryRate_(recoveryRate),
discountCurve_(discountCurve),
settlesAccrual_(settlesAccrual), paysAtDefaultTime_(paysAtDefaultTime) {
initializeDates();
registerWith(discountCurve);
}
void CdsHelper::setTermStructure(DefaultProbabilityTermStructure* ts) {
RelativeDateDefaultProbabilityHelper::setTermStructure(ts);
probability_.linkTo(
boost::shared_ptr<DefaultProbabilityTermStructure>(ts, null_deleter()),
false);
resetEngine();
}
void CdsHelper::update() {
RelativeDateDefaultProbabilityHelper::update();
resetEngine();
}
void CdsHelper::initializeDates() {
protectionStart_ = evaluationDate_ + settlementDays_;
Date startDate = calendar_.adjust(protectionStart_,
paymentConvention_);
Date endDate = evaluationDate_ + tenor_;
schedule_ =
MakeSchedule().from(startDate)
.to(endDate)
.withFrequency(frequency_)
.withCalendar(calendar_)
.withConvention(paymentConvention_)
.withTerminationDateConvention(Unadjusted)
.withRule(rule_);
earliestDate_ = schedule_.dates().front();
latestDate_ = calendar_.adjust(schedule_.dates().back(),
paymentConvention_);
}
SpreadCdsHelper::SpreadCdsHelper(
const Handle<Quote>& runningSpread,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
bool settlesAccrual,
bool paysAtDefaultTime)
: CdsHelper(runningSpread, tenor, settlementDays, calendar,
frequency, paymentConvention, rule, dayCounter,
recoveryRate, discountCurve, settlesAccrual,
paysAtDefaultTime) {}
SpreadCdsHelper::SpreadCdsHelper(
Rate runningSpread,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
bool settlesAccrual,
bool paysAtDefaultTime)
: CdsHelper(runningSpread, tenor, settlementDays, calendar,
frequency, paymentConvention, rule, dayCounter,
recoveryRate, discountCurve, settlesAccrual,
paysAtDefaultTime) {}
Real SpreadCdsHelper::impliedQuote() const {
swap_->recalculate();
return swap_->fairSpread();
}
void SpreadCdsHelper::resetEngine() {
swap_ = boost::shared_ptr<CreditDefaultSwap>(
new CreditDefaultSwap(Protection::Buyer, 100.0, 0.01,
schedule_, paymentConvention_,
dayCounter_, settlesAccrual_,
paysAtDefaultTime_,
protectionStart_));
swap_->setPricingEngine(boost::shared_ptr<PricingEngine>(
new MidPointCdsEngine(probability_,
recoveryRate_,
discountCurve_)));
}
UpfrontCdsHelper::UpfrontCdsHelper(
const Handle<Quote>& upfront,
Rate runningSpread,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
Natural upfrontSettlementDays,
bool settlesAccrual,
bool paysAtDefaultTime)
: CdsHelper(upfront, tenor, settlementDays, calendar,
frequency, paymentConvention, rule, dayCounter,
recoveryRate, discountCurve, settlesAccrual,
paysAtDefaultTime),
upfrontSettlementDays_(upfrontSettlementDays),
runningSpread_(runningSpread) {
initializeDates();
}
UpfrontCdsHelper::UpfrontCdsHelper(
Rate upfrontSpread,
Rate runningSpread,
const Period& tenor,
Integer settlementDays,
const Calendar& calendar,
Frequency frequency,
BusinessDayConvention paymentConvention,
DateGeneration::Rule rule,
const DayCounter& dayCounter,
Real recoveryRate,
const Handle<YieldTermStructure>& discountCurve,
Natural upfrontSettlementDays,
bool settlesAccrual,
bool paysAtDefaultTime)
: CdsHelper(upfrontSpread, tenor, settlementDays, calendar,
frequency, paymentConvention, rule, dayCounter,
recoveryRate, discountCurve, settlesAccrual,
paysAtDefaultTime),
upfrontSettlementDays_(upfrontSettlementDays),
runningSpread_(runningSpread) {
initializeDates();
}
void UpfrontCdsHelper::initializeDates() {
CdsHelper::initializeDates();
upfrontDate_ = calendar_.advance(evaluationDate_,
upfrontSettlementDays_, Days,
paymentConvention_);
}
Real UpfrontCdsHelper::impliedQuote() const {
SavedSettings backup;
Settings::instance().includeTodaysCashFlows() = true;
swap_->recalculate();
return swap_->fairUpfront();
}
void UpfrontCdsHelper::resetEngine() {
swap_ = boost::shared_ptr<CreditDefaultSwap>(
new CreditDefaultSwap(Protection::Buyer, 100.0,
0.01, runningSpread_,
schedule_, paymentConvention_,
dayCounter_,
settlesAccrual_,
paysAtDefaultTime_,
protectionStart_,
upfrontDate_));
swap_->setPricingEngine(boost::shared_ptr<PricingEngine>(
new MidPointCdsEngine(probability_,
recoveryRate_,
discountCurve_,
true)));
}
}
|
; A041851: Denominators of continued fraction convergents to sqrt(447).
; Submitted by Jon Maiga
; 1,7,295,2072,87319,613305,25846129,181536208,7650366865,53734104263,2264482745911,15905113325640,670279242422791,4707859810285177,198400391274400225,1393510598731086752,58725845537980043809,412474429364591393415,17382651878850818567239,122091037581320321364088,5145206230294304315858935,36138534649641450532376633,1522963661515235226675677521,10696884165256288037262119280,450792098602279332791684687281,3166241574381211617579054930247,133432938222613167271111991757655
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,6
mul $2,21
add $3,$2
lpe
mov $0,$2
div $0,21
|
; A050605: Column/row 2 of A050602: a(n) = add3c(n,2).
; 0,0,1,1,0,0,2,2,0,0,1,1,0,0,3,3,0,0,1,1,0,0,2,2,0,0,1,1,0,0,4,4,0,0,1,1,0,0,2,2,0,0,1,1,0,0,3,3,0,0,1,1,0,0,2,2,0,0,1,1,0,0,5,5,0,0,1,1,0,0,2,2,0,0,1,1,0,0,3,3,0,0,1,1,0,0,2,2,0,0,1,1,0,0,4,4,0,0,1,1
div $0,2
add $0,1
lpb $0
dif $0,2
add $1,1
lpe
mov $0,$1
|
//=================================================================================================
/*!
// \file src/mathtest/smatdmatsub/DCbLDb.cpp
// \brief Source file for the DCbLDb sparse matrix/dense matrix subtraction math test
//
// Copyright (C) 2012-2019 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/CompressedMatrix.h>
#include <blaze/math/DiagonalMatrix.h>
#include <blaze/math/DynamicMatrix.h>
#include <blaze/math/LowerMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/smatdmatsub/OperationTest.h>
#include <blazetest/system/MathTest.h>
#ifdef BLAZE_USE_HPX_THREADS
# include <hpx/hpx_main.hpp>
#endif
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'DCbLDb'..." << std::endl;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
using DCb = blaze::DiagonalMatrix< blaze::CompressedMatrix<TypeB> >;
using LDb = blaze::LowerMatrix< blaze::DynamicMatrix<TypeB> >;
// Creator type definitions
using CDCb = blazetest::Creator<DCb>;
using CLDb = blazetest::Creator<LDb>;
// Running tests with small matrices
for( size_t i=0UL; i<=6UL; ++i ) {
for( size_t j=0UL; j<=i; ++j ) {
RUN_SMATDMATSUB_OPERATION_TEST( CDCb( i, j ), CLDb( i ) );
}
}
// Running tests with large matrices
RUN_SMATDMATSUB_OPERATION_TEST( CDCb( 67UL, 7UL ), CLDb( 67UL ) );
RUN_SMATDMATSUB_OPERATION_TEST( CDCb( 128UL, 16UL ), CLDb( 128UL ) );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during sparse matrix/dense matrix subtraction:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
|
/*
* Copyright (c) 2018 Intel Corporation
*
* 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.
*/
/**
* @brief a header file with declaration of BaseModel class
* @file base_model.cpp
*/
#include <algorithm>
#include <fstream>
#include <memory>
#include <string>
#include "dynamic_vino_lib/models/base_model.h"
#include "dynamic_vino_lib/slog.h"
// Validated Base Network
Models::BaseModel::BaseModel(const std::string& model_loc, int input_num,
int output_num, int max_batch_size)
: input_num_(input_num),
output_num_(output_num),
model_loc_(model_loc),
max_batch_size_(max_batch_size)
{
if (model_loc.empty())
{
throw std::logic_error("model file name is empty!");
}
net_reader_ = std::make_shared<InferenceEngine::CNNNetReader>();
}
void Models::BaseModel::modelInit()
{
slog::info << "Loading network files" << slog::endl;
// Read network model
net_reader_->ReadNetwork(model_loc_);
// Set batch size to given max_batch_size_
slog::info << "Batch size is set to " << max_batch_size_ << slog::endl;
net_reader_->getNetwork().setBatchSize(max_batch_size_);
// Extract model name and load it's weights
// remove extension
size_t last_index = model_loc_.find_last_of(".");
std::string raw_name = model_loc_.substr(0, last_index);
std::string bin_file_name = raw_name + ".bin";
net_reader_->ReadWeights(bin_file_name);
// Read labels (if any)
std::string label_file_name = raw_name + ".labels";
std::ifstream input_file(label_file_name);
std::copy(std::istream_iterator<std::string>(input_file),
std::istream_iterator<std::string>(), std::back_inserter(labels_));
checkNetworkSize(input_num_, output_num_, net_reader_);
checkLayerProperty(net_reader_);
setLayerProperty(net_reader_);
}
void Models::BaseModel::checkNetworkSize(
unsigned int input_size, unsigned int output_size,
InferenceEngine::CNNNetReader::Ptr net_reader)
{
// check input size
slog::info << "Checking input size" << slog::endl;
InferenceEngine::InputsDataMap input_info(
net_reader->getNetwork().getInputsInfo());
if (input_info.size() != input_size)
{
throw std::logic_error(getModelName() + " should have only one input");
}
// check output size
slog::info << "Checking output size" << slog::endl;
InferenceEngine::OutputsDataMap output_info(
net_reader->getNetwork().getOutputsInfo());
if (output_info.size() != output_size)
{
throw std::logic_error(getModelName() +
"network should have only one output");
}
// InferenceEngine::DataPtr& output_data_ptr = output_info.begin()->second;
}
|
#pragma once
#include <Register/Utility.hpp>
namespace Kvasir {
//General-purpose I/O ports
namespace GpioPfr0{ ///<Port function setting register 0
using Addr = Register::Address<0x40033000,0xffff7fe0,0x00000000,unsigned>;
///Bit15 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> pf{};
///Bit4 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> p4{};
///Bit3 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> p3{};
///Bit2 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit1 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of PFR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPfr1{ ///<Port function setting register 1
using Addr = Register::Address<0x40033004,0xffffffc0,0x00000000,unsigned>;
///Bit5 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> p5{};
///Bit4 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> p4{};
///Bit3 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> p3{};
///Bit2 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit1 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of PFR1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPfr2{ ///<Port function setting register 2
using Addr = Register::Address<0x40033008,0xfffffff1,0x00000000,unsigned>;
///Bit3 of PFR2
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> p3{};
///Bit2 of PFR2
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit1 of PFR2
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
}
namespace GpioPfr3{ ///<Port function setting register 3
using Addr = Register::Address<0x4003300c,0xffff01ff,0x00000000,unsigned>;
///Bit15 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> pf{};
///Bit14 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,unsigned> pe{};
///Bit13 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,unsigned> pd{};
///Bit12 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,unsigned> pc{};
///Bit11 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,unsigned> pb{};
///Bit10 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> pa{};
///Bit9 of PFR3
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> p9{};
}
namespace GpioPfr4{ ///<Port function setting register 4
using Addr = Register::Address<0x40033010,0xfffff93f,0x00000000,unsigned>;
///Bit10 of PFR4
constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,unsigned> pa{};
///Bit9 of PFR4
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> p9{};
///Bit7 of PFR4
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> p7{};
///Bit6 of PFR4
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> p6{};
}
namespace GpioPfr5{ ///<Port function setting register 5
using Addr = Register::Address<0x40033014,0xfffffff8,0x00000000,unsigned>;
///Bit2 of PFR5
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit1 of PFR5
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of PFR5
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPfr6{ ///<Port function setting register 6
using Addr = Register::Address<0x40033018,0xfffffffc,0x00000000,unsigned>;
///Bit1 of PFR6
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of PFR6
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPfr8{ ///<Port function setting register 8
using Addr = Register::Address<0x40033020,0xfffffffc,0x00000000,unsigned>;
///Bit1 of PFR8
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of PFR8
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPfre{ ///<Port function setting register E
using Addr = Register::Address<0x40033038,0xfffffff2,0x00000000,unsigned>;
///Bit2 of PFRE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> p3{};
///Bit1 of PFRE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit0 of PFRE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioPcr0{ ///<Pull-up Setting Register 0
using Addr = Register::Address<0x40033100,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr1{ ///<Pull-up Setting Register 1
using Addr = Register::Address<0x40033104,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr2{ ///<Pull-up Setting Register 2
using Addr = Register::Address<0x40033108,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr3{ ///<Pull-up Setting Register 3
using Addr = Register::Address<0x4003310c,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr4{ ///<Pull-up Setting Register 4
using Addr = Register::Address<0x40033110,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr5{ ///<Pull-up Setting Register 5
using Addr = Register::Address<0x40033114,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcr6{ ///<Pull-up Setting Register 6
using Addr = Register::Address<0x40033118,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPcre{ ///<Pull-up Setting Register E
using Addr = Register::Address<0x40033138,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr0{ ///<Port input/output direction setting register 0
using Addr = Register::Address<0x40033200,0xffff7fe0,0x00000000,unsigned>;
///Bit15 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,unsigned> pf{};
///Bit4 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> p4{};
///Bit3 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> p3{};
///Bit2 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> p2{};
///Bit1 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> p1{};
///Bit0 of DDR0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> p0{};
}
namespace GpioDdr1{ ///<Port input/output direction setting register 1
using Addr = Register::Address<0x40033204,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr2{ ///<Port input/output direction setting register 2
using Addr = Register::Address<0x40033208,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr3{ ///<Port input/output direction setting register 3
using Addr = Register::Address<0x4003320c,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr4{ ///<Port input/output direction setting register 4
using Addr = Register::Address<0x40033210,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr5{ ///<Port input/output direction setting register 5
using Addr = Register::Address<0x40033214,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr6{ ///<Port input/output direction setting register 6
using Addr = Register::Address<0x40033218,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdr8{ ///<Port input/output direction setting register 8
using Addr = Register::Address<0x40033220,0xffffffff,0x00000000,unsigned>;
}
namespace GpioDdre{ ///<Port input/output direction setting register E
using Addr = Register::Address<0x40033238,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir0{ ///<Port input data register 0
using Addr = Register::Address<0x40033300,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir1{ ///<Port input data register 1
using Addr = Register::Address<0x40033304,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir2{ ///<Port input data register 2
using Addr = Register::Address<0x40033308,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir3{ ///<Port input data register 3
using Addr = Register::Address<0x4003330c,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir4{ ///<Port input data register 4
using Addr = Register::Address<0x40033310,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir5{ ///<Port input data register 5
using Addr = Register::Address<0x40033314,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir6{ ///<Port input data register 6
using Addr = Register::Address<0x40033318,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdir8{ ///<Port input data register 8
using Addr = Register::Address<0x40033320,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdire{ ///<Port input data register E
using Addr = Register::Address<0x40033338,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor0{ ///<Port output data register 0
using Addr = Register::Address<0x40033400,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor1{ ///<Port output data register 1
using Addr = Register::Address<0x40033404,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor2{ ///<Port output data register 2
using Addr = Register::Address<0x40033408,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor3{ ///<Port output data register 3
using Addr = Register::Address<0x4003340c,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor4{ ///<Port output data register 4
using Addr = Register::Address<0x40033410,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor5{ ///<Port output data register 5
using Addr = Register::Address<0x40033414,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor6{ ///<Port output data register 6
using Addr = Register::Address<0x40033418,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdor8{ ///<Port output data register 8
using Addr = Register::Address<0x40033420,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPdore{ ///<Port output data register E
using Addr = Register::Address<0x40033438,0xffffffff,0x00000000,unsigned>;
}
namespace GpioAde{ ///<Analog input setting register
using Addr = Register::Address<0x40033500,0xffffff00,0x00000000,unsigned>;
///Bit7 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,unsigned> an7{};
///Bit6 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,unsigned> an6{};
///Bit5 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,unsigned> an5{};
///Bit4 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> an4{};
///Bit3 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,unsigned> an3{};
///Bit2 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> an2{};
///Bit1 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,unsigned> an1{};
///Bit0 of ADE
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> an0{};
}
namespace GpioSpsr{ ///<Special port setting register
using Addr = Register::Address<0x40033580,0xffffffea,0x00000000,unsigned>;
///USBch0 pin setting bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,unsigned> usb0c{};
///Main clock(oscillation) pin setting bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,unsigned> mainxc{};
///Sub clock(oscillation) pin setting bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> subxc{};
}
namespace GpioEpfr00{ ///<Extended pin function setting register 00
using Addr = Register::Address<0x40033600,0xfffcfd08,0x00000000,unsigned>;
///JTAG function select bit1
constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,unsigned> jtagen1s{};
///JTAG function select bit0
constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,unsigned> jtagen0b{};
///USBch0 function select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,unsigned> usbp0e{};
///Sub clock divide output function select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,unsigned> suboute{};
///RTC clock output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> rtccoe{};
///Internal high-speed CR oscillation output function select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,1),Register::ReadWriteAccess,unsigned> croute{};
///NMIX function select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,unsigned> nmis{};
}
namespace GpioEpfr01{ ///<Extended pin function setting register 01
using Addr = Register::Address<0x40033604,0x0000e000,0x00000000,unsigned>;
///IC03 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,29),Register::ReadWriteAccess,unsigned> ic03s{};
///IC02 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,26),Register::ReadWriteAccess,unsigned> ic02s{};
///IC01 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,23),Register::ReadWriteAccess,unsigned> ic01s{};
///IC00 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,20),Register::ReadWriteAccess,unsigned> ic00s{};
///FRCK0 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,18),Register::ReadWriteAccess,unsigned> frck0s{};
///DTTIX0 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,16),Register::ReadWriteAccess,unsigned> dtti0s{};
///DTTIX0 function select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,unsigned> dtti0c{};
///RTO05E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> rto05e{};
///RTO04E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,unsigned> rto04e{};
///RTO03E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,unsigned> rto03e{};
///RTO02E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> rto02e{};
///RTO01E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,2),Register::ReadWriteAccess,unsigned> rto01e{};
///RTO00E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,0),Register::ReadWriteAccess,unsigned> rto00e{};
}
namespace GpioEpfr04{ ///<Extended pin function setting register 04
using Addr = Register::Address<0x40033610,0xf0c3c083,0x00000000,unsigned>;
///TIOA3E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,26),Register::ReadWriteAccess,unsigned> tioa3e{};
///TIOA3 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,24),Register::ReadWriteAccess,unsigned> tioa3s{};
///TIOB2 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,20),Register::ReadWriteAccess,unsigned> tiob2s{};
///TIOA2 output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,18),Register::ReadWriteAccess,unsigned> tioa2e{};
///TIOB1 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> tiob1s{};
///TIOA1E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> tioa1e{};
///TIOA1 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,unsigned> tioa1s{};
///TIOB0 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,4),Register::ReadWriteAccess,unsigned> tiob0s{};
///TIOA0 output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,2),Register::ReadWriteAccess,unsigned> tioa0e{};
}
namespace GpioEpfr05{ ///<Extended pin function setting register 05
using Addr = Register::Address<0x40033614,0xc0fff0f3,0x00000000,unsigned>;
///TIOB7 input select Bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,28),Register::ReadWriteAccess,unsigned> tiob7s{};
///TIOA7E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,26),Register::ReadWriteAccess,unsigned> tioa7e{};
///TIOA7 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,24),Register::ReadWriteAccess,unsigned> tioa7s{};
///TIOA5E output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> tioa5e{};
///TIOA5 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,unsigned> tioa5s{};
///TIOA4 output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,2),Register::ReadWriteAccess,unsigned> tioa4e{};
}
namespace GpioEpfr06{ ///<Extended pin function setting register 06
using Addr = Register::Address<0x40033618,0x3fffcf00,0x00000000,unsigned>;
///External interrupt 15 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,30),Register::ReadWriteAccess,unsigned> eint15s{};
///External interrupt 6 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> eint06s{};
///External interrupt 3 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,unsigned> eint03s{};
///External interrupt 2 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> eint02s{};
///External interrupt 1 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,2),Register::ReadWriteAccess,unsigned> eint01s{};
///External interrupt 0 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,0),Register::ReadWriteAccess,unsigned> eint00s{};
}
namespace GpioEpfr07{ ///<Extended pin function setting register 07
using Addr = Register::Address<0x4003361c,0xf03f000f,0x00000000,unsigned>;
///SCK3 input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,26),Register::ReadWriteAccess,unsigned> sck3b{};
///SOT3B input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,24),Register::ReadWriteAccess,unsigned> sot3b{};
///SIN3S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,22),Register::ReadWriteAccess,unsigned> sin3s{};
///SCK1 input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,14),Register::ReadWriteAccess,unsigned> sck1b{};
///SCK1B input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> sot1b{};
///SIN1S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> sin1s{};
///SCK0 input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,8),Register::ReadWriteAccess,unsigned> sck0b{};
///SOT0B input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,6),Register::ReadWriteAccess,unsigned> sot0b{};
///SIN0S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> sin0s{};
}
namespace GpioEpfr08{ ///<Extended pin function setting register 08
using Addr = Register::Address<0x40033620,0xffff03ff,0x00000000,unsigned>;
///SCK5 input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,14),Register::ReadWriteAccess,unsigned> sck5b{};
///SOT5B input/output select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,12),Register::ReadWriteAccess,unsigned> sot5b{};
///SIN5S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,10),Register::ReadWriteAccess,unsigned> sin5s{};
}
namespace GpioEpfr09{ ///<Extended pin function setting register 09
using Addr = Register::Address<0x40033624,0xfff00fc0,0x00000000,unsigned>;
///ADTRG1 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,16),Register::ReadWriteAccess,unsigned> adtrg1s{};
///ADTRG0 input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,12),Register::ReadWriteAccess,unsigned> adtrg0s{};
///QZIN0S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,4),Register::ReadWriteAccess,unsigned> qzin0s{};
///QBIN0S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,2),Register::ReadWriteAccess,unsigned> qbin0s{};
///QAIN0S input select bit
constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,0),Register::ReadWriteAccess,unsigned> qain0s{};
}
namespace GpioPzr0{ ///<Port Pseudo Open Drain Setting Register 0
using Addr = Register::Address<0x40033700,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr1{ ///<Port Pseudo Open Drain Setting Register 1
using Addr = Register::Address<0x40033704,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr2{ ///<Port Pseudo Open Drain Setting Register 2
using Addr = Register::Address<0x40033708,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr3{ ///<Port Pseudo Open Drain Setting Register 3
using Addr = Register::Address<0x4003370c,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr4{ ///<Port Pseudo Open Drain Setting Register 4
using Addr = Register::Address<0x40033710,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr5{ ///<Port Pseudo Open Drain Setting Register 5
using Addr = Register::Address<0x40033714,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr6{ ///<Port Pseudo Open Drain Setting Register 6
using Addr = Register::Address<0x40033718,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzr8{ ///<Port Pseudo Open Drain Setting Register 8
using Addr = Register::Address<0x40033720,0xffffffff,0x00000000,unsigned>;
}
namespace GpioPzre{ ///<Port Pseudo Open Drain Setting Register E
using Addr = Register::Address<0x40033738,0xffffffff,0x00000000,unsigned>;
}
}
|
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-22, Lawrence Livermore National Security, LLC and Umpire
// project contributors. See the COPYRIGHT file for details.
//
// SPDX-License-Identifier: (MIT)
//////////////////////////////////////////////////////////////////////////////
#include "umpire/op/MemoryOperationRegistry.hpp"
#include "umpire/config.hpp"
#include "umpire/op/GenericReallocateOperation.hpp"
#include "umpire/op/HostCopyOperation.hpp"
#include "umpire/op/HostMemsetOperation.hpp"
#include "umpire/op/HostReallocateOperation.hpp"
#if defined(UMPIRE_ENABLE_NUMA)
#include "umpire/op/NumaMoveOperation.hpp"
#endif
#if defined(UMPIRE_ENABLE_CUDA)
#include "umpire/op/CudaAdviseOperation.hpp"
#include "umpire/op/CudaCopyOperation.hpp"
#include "umpire/op/CudaMemPrefetchOperation.hpp"
#include "umpire/op/CudaMemsetOperation.hpp"
#endif
#if defined(UMPIRE_ENABLE_HIP)
#include <hip/hip_runtime.h>
#include "umpire/op/HipAdviseOperation.hpp"
#include "umpire/op/HipCopyOperation.hpp"
#include "umpire/op/HipMemsetOperation.hpp"
#endif
#if defined(UMPIRE_ENABLE_SYCL)
#include "umpire/op/SyclCopyFromOperation.hpp"
#include "umpire/op/SyclCopyOperation.hpp"
#include "umpire/op/SyclCopyToOperation.hpp"
#include "umpire/op/SyclMemPrefetchOperation.hpp"
#include "umpire/op/SyclMemsetOperation.hpp"
#endif
#if defined(UMPIRE_ENABLE_OPENMP_TARGET)
#include <omp.h>
#include "umpire/op/OpenMPTargetCopyOperation.hpp"
#include "umpire/op/OpenMPTargetMemsetOperation.hpp"
#endif
#include "umpire/util/error.hpp"
namespace umpire {
namespace op {
MemoryOperationRegistry& MemoryOperationRegistry::getInstance() noexcept
{
static MemoryOperationRegistry memory_operation_registry;
return memory_operation_registry;
}
MemoryOperationRegistry::MemoryOperationRegistry() noexcept
{
registerOperation("COPY", std::make_pair(Platform::host, Platform::host), std::make_shared<HostCopyOperation>());
registerOperation("MEMSET", std::make_pair(Platform::host, Platform::host), std::make_shared<HostMemsetOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::host, Platform::host),
std::make_shared<HostReallocateOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::undefined, Platform::undefined),
std::make_shared<GenericReallocateOperation>());
#if defined(UMPIRE_ENABLE_NUMA)
registerOperation("MOVE", std::make_pair(Platform::host, Platform::host), std::make_shared<NumaMoveOperation>());
// NOTE: We don't use CUDA calls in the move operation so no guard is needed
registerOperation("MOVE", std::make_pair(Platform::host, Platform::cuda), std::make_shared<NumaMoveOperation>());
registerOperation("MOVE", std::make_pair(Platform::cuda, Platform::host), std::make_shared<NumaMoveOperation>());
#endif
#if defined(UMPIRE_ENABLE_CUDA)
const std::tuple<std::string, cudaMemoryAdvise, umpire::Platform> cuda_advice_operations[] = {
{"SET_READ_MOSTLY", cudaMemAdviseSetReadMostly, Platform::cuda},
{"UNSET_READ_MOSTLY", cudaMemAdviseUnsetReadMostly, Platform::cuda},
{"SET_PREFERRED_LOCATION", cudaMemAdviseSetPreferredLocation, Platform::cuda},
{"UNSET_PREFERRED_LOCATION", cudaMemAdviseUnsetPreferredLocation, Platform::cuda},
{"SET_ACCESSED_BY", cudaMemAdviseSetAccessedBy, Platform::cuda},
{"UNSET_ACCESSED_BY", cudaMemAdviseUnsetAccessedBy, Platform::cuda},
{"SET_PREFERRED_LOCATION", cudaMemAdviseSetPreferredLocation, Platform::host},
{"UNSET_PREFERRED_LOCATION", cudaMemAdviseUnsetPreferredLocation, Platform::host},
{"SET_ACCESSED_BY", cudaMemAdviseSetAccessedBy, Platform::host},
{"UNSET_ACCESSED_BY", cudaMemAdviseUnsetAccessedBy, Platform::host}};
const std::tuple<umpire::Platform, umpire::Platform, cudaMemcpyKind> cuda_copy_operations[] = {
{Platform::host, Platform::cuda, cudaMemcpyHostToDevice},
{Platform::cuda, Platform::host, cudaMemcpyDeviceToHost},
{Platform::cuda, Platform::cuda, cudaMemcpyDeviceToDevice}};
for (auto copy : cuda_copy_operations) {
auto src_plat = std::get<0>(copy);
auto dst_plat = std::get<1>(copy);
auto kind = std::get<2>(copy);
registerOperation("COPY", std::make_pair(src_plat, dst_plat), std::make_shared<CudaCopyOperation>(kind));
}
for (auto advice : cuda_advice_operations) {
auto name = std::get<0>(advice);
auto advice_enum = std::get<1>(advice);
auto platform = std::get<2>(advice);
registerOperation(name, std::make_pair(platform, platform), std::make_shared<CudaAdviseOperation>(advice_enum));
}
registerOperation("MEMSET", std::make_pair(Platform::cuda, Platform::cuda), std::make_shared<CudaMemsetOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::cuda, Platform::cuda),
std::make_shared<GenericReallocateOperation>());
registerOperation("PREFETCH", std::make_pair(Platform::cuda, Platform::cuda),
std::make_shared<CudaMemPrefetchOperation>());
#endif
#if defined(UMPIRE_ENABLE_HIP)
const std::tuple<std::string, hipMemoryAdvise> hip_advice_operations[] = {
{"SET_READ_MOSTLY", hipMemAdviseSetReadMostly},
{"UNSET_READ_MOSTLY", hipMemAdviseUnsetReadMostly},
{"SET_PREFERRED_LOCATION", hipMemAdviseSetPreferredLocation},
{"UNSET_PREFERRED_LOCATION", hipMemAdviseUnsetPreferredLocation},
{"SET_ACCESSED_BY", hipMemAdviseSetAccessedBy},
{"UNSET_ACCESSED_BY", hipMemAdviseUnsetAccessedBy}
#if HIP_VERSION_MAJOR >= 5
,
{"SET_COARSE_GRAIN", hipMemAdviseSetCoarseGrain},
{"UNSET_COARSE_GRAIN", hipMemAdviseUnsetCoarseGrain}
#endif
};
const std::tuple<umpire::Platform, umpire::Platform, hipMemcpyKind> hip_copy_operations[] = {
{Platform::host, Platform::hip, hipMemcpyHostToDevice},
{Platform::hip, Platform::host, hipMemcpyDeviceToHost},
{Platform::hip, Platform::hip, hipMemcpyDeviceToDevice}};
for (auto copy : hip_copy_operations) {
auto src_plat = std::get<0>(copy);
auto dst_plat = std::get<1>(copy);
auto kind = std::get<2>(copy);
registerOperation("COPY", std::make_pair(src_plat, dst_plat), std::make_shared<HipCopyOperation>(kind));
}
for (auto advice : hip_advice_operations) {
auto name = std::get<0>(advice);
auto advice_enum = std::get<1>(advice);
registerOperation(name, std::make_pair(Platform::hip, Platform::hip),
std::make_shared<HipAdviseOperation>(advice_enum));
}
registerOperation("MEMSET", std::make_pair(Platform::hip, Platform::hip), std::make_shared<HipMemsetOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::hip, Platform::hip),
std::make_shared<GenericReallocateOperation>());
#endif
#if defined(UMPIRE_ENABLE_OPENMP_TARGET)
registerOperation("COPY", std::make_pair(Platform::host, Platform::omp_target),
std::make_shared<OpenMPTargetCopyOperation>());
registerOperation("COPY", std::make_pair(Platform::omp_target, Platform::host),
std::make_shared<OpenMPTargetCopyOperation>());
registerOperation("COPY", std::make_pair(Platform::omp_target, Platform::omp_target),
std::make_shared<OpenMPTargetCopyOperation>());
registerOperation("MEMSET", std::make_pair(Platform::omp_target, Platform::omp_target),
std::make_shared<OpenMPTargetMemsetOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::omp_target, Platform::omp_target),
std::make_shared<GenericReallocateOperation>());
#endif
#if defined(UMPIRE_ENABLE_SYCL)
registerOperation("COPY", std::make_pair(Platform::host, Platform::sycl), std::make_shared<SyclCopyToOperation>());
registerOperation("COPY", std::make_pair(Platform::sycl, Platform::host), std::make_shared<SyclCopyFromOperation>());
registerOperation("COPY", std::make_pair(Platform::sycl, Platform::sycl), std::make_shared<SyclCopyOperation>());
registerOperation("MEMSET", std::make_pair(Platform::sycl, Platform::sycl), std::make_shared<SyclMemsetOperation>());
registerOperation("REALLOCATE", std::make_pair(Platform::sycl, Platform::sycl),
std::make_shared<GenericReallocateOperation>());
registerOperation("PREFETCH", std::make_pair(Platform::sycl, Platform::sycl),
std::make_shared<SyclMemPrefetchOperation>());
#endif
}
void MemoryOperationRegistry::registerOperation(const std::string& name, std::pair<Platform, Platform> platforms,
std::shared_ptr<MemoryOperation>&& operation) noexcept
{
auto operations = m_operators.find(name);
if (operations == m_operators.end()) {
operations =
m_operators
.insert(std::make_pair(
name, std::unordered_map<std::pair<Platform, Platform>, std::shared_ptr<MemoryOperation>, pair_hash>()))
.first;
}
operations->second.insert(std::make_pair(platforms, operation));
}
std::shared_ptr<umpire::op::MemoryOperation> MemoryOperationRegistry::find(const std::string& name,
strategy::AllocationStrategy* src_allocator,
strategy::AllocationStrategy* dst_allocator)
{
auto platforms = std::make_pair(src_allocator->getPlatform(), dst_allocator->getPlatform());
return find(name, platforms);
}
std::shared_ptr<umpire::op::MemoryOperation> MemoryOperationRegistry::find(const std::string& name,
std::pair<Platform, Platform> platforms)
{
auto operations = m_operators.find(name);
if (operations == m_operators.end()) {
UMPIRE_ERROR(runtime_error, umpire::fmt::format("Cannot find operator \"{}\"", name));
}
auto op = operations->second.find(platforms);
if (op == operations->second.end()) {
UMPIRE_ERROR(runtime_error,
umpire::fmt::format("Cannot find operator \"{}\" for platforms {}, {}", name,
static_cast<int>(platforms.first), static_cast<int>(platforms.second)));
}
return op->second;
}
} // end of namespace op
} // end of namespace umpire
|
# 2019CS10399 Sayam Sethi
# 2019CS50440 Mallika Prabhakar
# ----------------------ASSIGNMENT 2---------------------------
.text
.globl main
# setting and loading initial values along with handling base case
main:
jal readFile # reads file
move $s0, $v0 # file descriptor is stored in s0 register
lw $s1, MAX # load max size
li $s2, 0 # current size of stack
# loop the reading of file until EOF
loop:
jal readChar # reads the next char
beq $v0, 0, printRes # EOF reached, print the result
lw $a0, buffer # load buffer to register
blt $a0, 48, operate # not a digit, perform operation
addi $a0, $a0, -48 # subtract 48 to convert to int
bgt $a0, 9, fileError # invalid character
jal push # a digit, push to stack
j loop
# identify operator and perform operation
operate:
beq $a0, 42, product # operator is *
beq $a0, 43, sum # operator is +
beq $a0, 45, diff # operator is -
j fileError
product:
jal pop
move $s3, $v0 # store the value in s3
jal pop
mul $a0, $s3, $v0 # multiply the top two elements of stack and store in a0
jal push
j loop
sum:
jal pop
move $s3, $v0 # store the value in s3
jal pop
add $a0, $s3, $v0 # add the top two elements of stack and store in a0
jal push
j loop
diff:
jal pop
move $s3, $v0 # store the value in s3
jal pop
sub $a0, $v0, $s3 # subtract the top two elements of stack and store in a0
jal push
j loop
# reads the file
readFile:
li $v0, 13 # syscall for file_open
la $a0, input # load input file name (hardcoded)
li $a1, 0 # set read only flag
li $a2, 0 # file mode: UNIX style (irrelevant since only single line)
syscall
blt $v0, 0, fileError # file could not be read
jr $ra
# prints error message on file not being read and terminates
fileError:
la $a0, fileErrorMsg # load file error message
jal print
j exit
# reads the next char
readChar:
li $v0, 14 # syscall for file_read
move $a0, $s0 # load the file descriptor always (for safety)
la $a1, buffer # the buffer location
li $a2, 1 # 1 byte = 1 char to be read
syscall
beq $v0, -1, fileError # error in reading file
# two bytes are loaded instead? hence reset the last byte
la $a0, buffer
add $a0, $a0, $v0 # address of byte after file data
sb $zero, 0($a0)
jr $ra
# prints the result after checking if stack size is 1
printRes:
bne $s2, 4, fileError # stack contains more than/less than 1 element
lw $a0, stack($zero) # load the only element of stack
li $v0, 1
syscall
j exit
# exit the running of program
exit:
li $v0, 10 # syscall for terminate
syscall
# function to syscall print_string
print:
li $v0, 4 # syscall for print_string
syscall
jr $ra
# ####################
# stack push operation
push:
beq $s2, $s1, overflow # max size reached
sw $a0, stack($s2) # push the element
addi $s2, $s2, 4 # increment the current size
jr $ra
# stack pop operation
pop:
beq $s2, 0, fileError # pop error, hence expression is invalid
addi $s2, $s2, -4 # reduce the current size
lw $v0, stack($s2) # load the top element to v0
jr $ra
# overflow error
overflow:
la $a0, overflowMsg
jal print
j exit
# ####################
# data
.data
buffer:
.space 1
.align 2
stack:
.space 400000 # 4e5 space allcated for the stack
.align 2
MAX:
.word 400000 # storing the MAX permitted size
input:
.asciiz "in"
fileErrorMsg:
.asciiz "File not found or error while reading file or invalid postfix.\nTerminating..."
overflowMsg:
.asciiz "Stack size exceeded the maximum permissible limit.\nTerminating evaluation..." |
.byte $01 ; Unknown purpose
.byte OBJ_BUSTERBEATLE, $0C, $18
.byte OBJ_BUSTERBEATLE, $0F, $18
.byte OBJ_BUSTERBEATLE, $1E, $18
.byte OBJ_BUSTERBEATLE, $26, $18
.byte OBJ_BUSTERBEATLE, $37, $14
.byte OBJ_BUSTERBEATLE, $3B, $14
.byte OBJ_GREENTROOPA, $4A, $18
.byte OBJ_BUSTERBEATLE, $50, $18
.byte OBJ_NIPPER, $50, $08
.byte OBJ_NIPPER, $51, $08
.byte OBJ_VENUSFIRETRAP, $65, $18
.byte $FF ; Terminator
|
; A136761: a(n) = leading digit of n! in base 11.
; 1,1,2,6,2,10,5,3,2,2,2,2,2,2,3,4,6,10,1,2,4,9,1,3,7,1,3,9,2,5,1,3,1,3,9,2,9,2,9,3,1,3,1,5,1,7,2,1,4,1,9,3,1,7,3,1,8,3,1,9,4,2,1,7,3,2,1,6,3,2,1,8,4,2,1,1,7,4,3,2,1,10,6,4,3,2,1,1,9,6,5,3,2,2,1,1,1,9,7,6
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
lpb $0
mov $2,$0
div $0,11
lpe
mov $0,$2
|
_CeruleanCityText_19668::
text "<RIVAL>: Yo!"
line "<PLAYER>!"
para "You're still"
line "struggling along"
cont "back here?"
para "I'm doing great!"
line "I caught a bunch"
cont "of strong and"
cont "smart #MON!"
para "Here, let me see"
line "what you caught,"
cont "<PLAYER>!"
done
_CeruleanCityText_1966d::
text "Hey!"
line "Take it easy!"
cont "You won already!"
prompt
_CeruleanCityText_19672::
text "Heh!"
line "You're no match"
cont "for my genius!"
prompt
_CeruleanCityText_19677::
text "<RIVAL>: Hey,"
line "guess what?"
para "I went to BILL's"
line "and got him to"
cont "show me his rare"
cont "#MON!"
para "That added a lot"
line "of pages to my"
cont "#DEX!"
para "After all, BILL's"
line "world famous as a"
cont "#MANIAC!"
para "He invented the"
line "#MON Storage"
cont "System on PC!"
para "Since you're using"
line "his system, go"
cont "thank him!"
para "Well, I better"
line "get rolling!"
cont "Smell ya later!"
done
_CeruleanCityText_196d9::
text "Hey! Stay out!"
line "It's not your"
cont "yard! Huh? Me?"
para "I'm an innocent"
line "bystander! Don't"
cont "you believe me?"
done
_ReceivedTM28Text::
text "<PLAYER> recovered"
line "TM28!@@"
_ReceivedTM28Text2::
text ""
para "I better get"
line "moving! Bye!@@"
_TM28NoRoomText::
text "Make room for"
line "this!"
para "I can't run until"
line "I give it to you!"
done
_CeruleanCityText_196ee::
text "Stop!"
line "I give up! I'll"
cont "leave quietly!"
prompt
_CeruleanCityText_196f3::
text "OK! I'll return"
line "the TM I stole!"
prompt
_CeruleanCityText3::
text "You're a trainer"
line "too? Collecting,"
cont "fighting, it's a"
cont "tough life."
done
_CeruleanCityText4::
text "That bush in"
line "front of the shop"
cont "is in the way."
para "There might be a"
line "way around."
done
_CeruleanCityText5::
text "You're making an"
line "encyclopedia on"
cont "#MON? That"
cont "sounds amusing."
done
_CeruleanCityText6::
text "The people here"
line "were robbed."
para "It's obvious that"
line "TEAM ROCKET is"
cont "behind this most"
cont "heinous crime!"
para "Even our POLICE"
line "force has trouble"
cont "with the ROCKETs!"
done
_CeruleanCityText_19730::
text "OK! SLOWBRO!"
line "Use SONICBOOM!"
cont "Come on, SLOWBRO"
cont "pay attention!"
done
_CeruleanCityText_19735::
text "SLOWBRO punch!"
line "No! You blew it"
cont "again!"
done
_CeruleanCityText_1973a::
text "SLOWBRO, WITHDRAW!"
line "No! That's wrong!"
para "It's so hard to"
line "control #MON!"
para "Your #MON's"
line "obedience depends"
cont "on your abilities"
cont "as a trainer!"
done
_CeruleanCityText_1976f::
text "SLOWBRO took a"
line "snooze..."
done
_CeruleanCityText_19774::
text "SLOWBRO is"
line "loafing around..."
done
_CeruleanCityText_19779::
text "SLOWBRO turned"
line "away..."
done
_CeruleanCityText_1977e::
text "SLOWBRO"
line "ignored orders..."
done
_CeruleanCityText9::
text "I want a bright"
line "red BICYCLE!"
para "I'll keep it at"
line "home, so it won't"
cont "get dirty!"
done
_CeruleanCityText10::
text "This is CERULEAN"
line "CAVE! Horribly"
cont "strong #MON"
cont "live in there!"
para "The #MON LEAGUE"
line "champion is the"
cont "only person who"
cont "is allowed in!"
done
_CeruleanCityText12::
text "CERULEAN CITY"
line "A Mysterious,"
cont "Blue Aura"
cont "Surrounds It"
done
_CeruleanCityText13::
text "TRAINER TIPS"
para "Pressing B Button"
line "during evolution"
cont "cancels the whole"
cont "process."
done
_CeruleanCityText16::
text "Grass and caves"
line "handled easily!"
cont "BIKE SHOP"
done
_CeruleanCityText17::
text "CERULEAN CITY"
line "#MON GYM"
cont "LEADER: MISTY"
para "The Tomboyish"
line "Mermaid!"
done
|
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1994 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: UserInterface/Gen
FILE: genAppAttDet.asm
ROUTINES:
Name Description
---- -----------
GLB GenApplicationClass Class that implements an application
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 10/10/94 Broken out of genApplication.asm
DESCRIPTION:
This file contains routines to implement the GenApplication class.
$Id: genAppAttDet.asm,v 1.1 97/04/07 11:44:49 newdeal Exp $
------------------------------------------------------------------------------@
AppAttach segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppSetState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: General-purpose routine to change the AS_FOCUSABLE,
AS_MODELABLE, AS_NOT_USER_INTERACTABLE, or
AS_AVOID_TRANSPARENT_DETACH state bits.
CALLED BY: MSG_GEN_APPLICATION_SET_STATE
PASS: *ds:si = GenApplication object
ds:di = GenApplicationInstance
cx = bits to set
dx = bits to clear
RETURN: nothing
DESTROYED: ax, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/16/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppSetState method dynamic GenApplicationClass, MSG_GEN_APPLICATION_SET_STATE
push ds:[di].GAI_states ; save original value
; Change state flags
;
ornf ds:[di].GAI_states, cx
not dx
andnf ds:[di].GAI_states, dx
not dx
; Update specific UI
;
call GenCheckIfSpecGrown
jnc afterSpecUI
mov di, offset GenApplicationClass
mov ax, MSG_GEN_APPLICATION_SET_STATE
call ObjCallSuperNoLock
afterSpecUI:
pop ax ; get original value
mov di, ds:[si]
add di, ds:[di].Gen_offset
xor ax, ds:[di].GAI_states ; see what's changed
test ax, mask AS_NOT_USER_INTERACTABLE or \
mask AS_AVOID_TRANSPARENT_DETACH or \
mask AS_TRANSPARENT_DETACHING or \
mask AS_ATTACHING or \
mask AS_DETACHING or \
mask AS_QUIT_DETACHING
jz afterTransparentDetach
call GenAppUpdateTransparentDetachLists
afterTransparentDetach:
ret
GenAppSetState endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppSetAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Allow changing GA_TARGETABLE while usable.
CALLED BY: MSG_GEN_SET_ATTRS
PASS: *ds:si = GenApplication object
ds:di = GenApplicationInstance
cl = GenAttrs to set
ch = GenAttrs to clear
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS: if GA_TARGETABLE is cleared, the sys target will be released
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/16/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppSetAttrs method dynamic GenApplicationClass, MSG_GEN_SET_ATTRS
test cx, mask GA_TARGETABLE or (mask GA_TARGETABLE shl 8)
jnz specialCase
passToGen:
mov di, offset GenApplicationClass
passItUp:
GOTO ObjCallSuperNoLock
specialCase:
;
; Give the spui a crack at it, if we're grown (if not grown, just pass
; to Gen to handle, as it won't throw up).
;
call GenCheckIfSpecGrown
jnc passToGen ; => not grown
;
; Play with data
;
not ch
andnf ds:[di].GI_attrs, ch ; clear bits
ornf ds:[di].GI_attrs, cl ; set bits
not ch
;
; Now tell spui about it.
;
mov di, offset GenClass
jmp passItUp
GenAppSetAttrs endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppSet[Not]AttachedToStateFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sets/clears the bit in the application state that says that the
associated process has successfully attached to a state file.
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
Get serious! I just set a bit.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 9/28/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppSetAttachedToStateFile method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_SET_ATTACHED_TO_STATE_FILE
ornf ds:[di].GAI_states, mask AS_ATTACHED_TO_STATE_FILE
ret
GenAppSetAttachedToStateFile endm
GenAppSetNotAttachedToStateFile method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_SET_NOT_ATTACHED_TO_STATE_FILE
andnf ds:[di].GAI_states, not mask AS_ATTACHED_TO_STATE_FILE
ret
GenAppSetNotAttachedToStateFile endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppSetNotQuitting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mark app as not being quit by user.
CALLED BY: MSG_GEN_APPLICATION_SET_NOT_QUITTING
PASS: *ds:si = GenApplication object
ds:di = GenApplicationInstance
RETURN: ax, cx, dx, bp - unchanged
DESTROYED: nothing
SIDE EFFECTS: ...
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppSetNotQuitting method dynamic GenApplicationClass, MSG_GEN_APPLICATION_SET_NOT_QUITTING
.enter
LOG ALA_NOT_QUITTING
test ds:[di].GAI_states, mask AS_QUITTING
jz exit
; Clear quitting flag
;
andnf ds:[di].GAI_states, not mask AS_QUITTING
;
; Note that we're interactible still (no longer in flux).
;
mov cl, IACPSM_USER_INTERACTIBLE
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
;
; & allow input to flow again, to undo disruption that was
; started at the point AS_QUITTING was set.
;
mov ax, MSG_GEN_APPLICATION_ACCEPT_INPUT
call ObjCallInstanceNoLock
;
; Tell our parent field (if any) that we are no longer
; quitting. This is necessary if the field is waiting for
; us to exiting because it is in 'quitOnClose' mode.
;
push si
mov ax, MSG_GEN_FIELD_APP_NO_LONGER_EXITING
mov bx, segment GenFieldClass
mov si, offset GenFieldClass
mov di, mask MF_RECORD
call ObjMessage ; di = event handle
pop si
mov cx, di ; cx = event handle
mov ax, MSG_GEN_GUP_CALL_OBJECT_OF_CLASS
call ObjCallInstanceNoLock
exit:
.leave
ret
GenAppSetNotQuitting endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppAppStartup
DESCRIPTION: Begin bringing this whole thing to life, regardless of the
launch model of the application.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_APP_STARTUP
dx - AppLaunchBlock (MUST NOT BE DESTROYED HERE)
App filename & state file name should be copied into app
instance data.
RETURN: AppLaunchBlock intact.
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
attach application to UI system object;
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/89 Initial version
Doug 11/89 Modified to accept AppLaunchBlock data
ardeb 10/16/92 Changed to be invoked by MSG_META_APP_STARTUP
------------------------------------------------------------------------------@
GenAppAppStartup method dynamic GenApplicationClass, MSG_META_APP_STARTUP
;
; Set the AS_QUITTING flag now so if the app never changes to interact
; with the user, we'll know not to save anything to state. This also
; allows us to differentiate between a forced detach and a user-
; initiated quit in handling MSG_GEN_APPLICATION_NO_MORE_CONNECTIONS
;
ornf ds:[di].GAI_states, mask AS_QUITTING
;
; Set AS_SINGLE_INSTANCE if geode not multi-launchable. If it is
; multi-launchable, we leave the bit as it was set by the programmer.
;
call GeodeGetProcessHandle
mov ax, GGIT_ATTRIBUTES
call GeodeGetInfo
test ax, mask GA_MULTI_LAUNCHABLE
jnz copyAIR
ornf ds:[di].GAI_states, mask AS_SINGLE_INSTANCE
copyAIR:
;
; NOTE that we don't also have to IGNORE_INPUT, which is normally the
; case when AS_QUITTING is set, as the app is not yet attached,
; the other criteria for ignoring input while quitting.
;
; Copy the AppInstanceRef from the AppLaunchBlock into our instance
; data.
;
push si
mov bx, dx
call MemLock
push bx
push ds, es
segmov es, ds ; es:di = instance data
mov ds, ax ; ds = AppLaunchBlock
push di
; Copy app reference over to app instance
mov si, offset ALB_appRef
add di, offset GAI_appRef
mov cx, size AppInstanceReference
rep movsb
pop di
;
; Copy the launch flags.
;
mov al, ds:[ALB_launchFlags] ; fetch launch flags
mov es:[di].GAI_launchFlags,al ; store into instance data
;
; if in app-mode, set AS_ATTACHING so that if we get another
; IACPConnect before we get MSG_META_ATTACH, we'll not try to
; switch into app-mode again (via GenAppSwitchToAppMode)
; - brianc 3/22/93
;
cmp ds:[ALB_appMode], MSG_GEN_PROCESS_OPEN_ENGINE
je notAppMode
ornf es:[di].GAI_states, mask AS_ATTACHING
notAppMode:
; Add application object to generic parent
mov cx, ds:[ALB_genParent].handle
mov dx, ds:[ALB_genParent].chunk
pop ds, es
pop bx
call MemUnlock
pop si
; NOW, add app object to GenField
;
tst cx
jnz HaveParent
; Ask system object where the application should be placed
mov ax, MSG_SPEC_GUP_QUERY_VIS_PARENT
mov cx, SQT_VIS_PARENT_FOR_APPLICATION
call UserCallSystem
; Returns ^lcx:dx = vis parent to use
EC < ERROR_NC UI_GEN_APPLICATION_COULDNT_FIND_A_VIS_PARENT >
EC < tst cx >
EC < ERROR_Z UI_NO_CURRENT_FIELD_EXCLUSIVE >
HaveParent:
; Setup a one-way generic link to the field object
;
call GenSetUpwardLink
mov dx, bx ; dx <- ALB again
; Let the specific UI know about this. This has the side benefit
; of establishing the WinGeodeFlags for the app *before* we tell
; the field we're attached.
;
mov ax, MSG_META_APP_STARTUP
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
; Notify field that we're now on it.
; See if we actually are on a GenFieldClass object (The UI app
; sits under a GenScreenClass object)
;
mov cx, segment GenFieldClass
mov dx, offset GenFieldClass
mov ax, MSG_META_IS_OBJECT_IN_CLASS
call GenCallParent
jnc afterAddition ; if not, skip addition notification
mov cx, ds:[LMBH_handle] ; set GenApp object in ^lcx:dx
mov dx, si
mov bp, CCO_LAST ; add at end
mov ax, MSG_GEN_FIELD_ADD_GEN_APPLICATION
call GenCallParent
afterAddition:
;
; Send MSG_META_APP_STARTUP to the members of the MGCNLT_APP_STARTUP
; list.
;
mov dx, bx ; dx <- ALB handle
mov ax, MSG_META_APP_STARTUP
mov di, MGCNLT_APP_STARTUP
call SendToGenAppGCNList
;
; Register as IACP server in non-interactible mode.
;
mov cl, IACPSM_NOT_USER_INTERACTIBLE
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
;
; Add to removable disk list, so we'll be notified of the disk being
; removed.
;
call GenAppAddToRemovableDiskList
ret
GenAppAppStartup endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppSetAppModeMethod
DESCRIPTION: Stores the process method passed in GAI_appMode, for
later retrieval, usually upon the restoration of the application
after having been shut down.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_GEN_APPLICATION_SET_APP_MODE_MESSAGE
cx - method # to store in application object as app mode
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 11/89 Initial version
------------------------------------------------------------------------------@
GenAppSetAppModeMethod method dynamic GenApplicationClass, \
MSG_GEN_APPLICATION_SET_APP_MODE_MESSAGE
mov ds:[di].GAI_appMode, cx
ret
GenAppSetAppModeMethod endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppAttach
DESCRIPTION: Attach application, making it usable. This should ONLY be
called from the handler for MSG_GEN_PROCESS_OPEN_APPLICATION.
The handling of this method work unlike any other; the
application is actually always presumed "USABLE", & we
just update the bit here so that the object is consistent
with our beliefs. What really happens to bring the app
up on screen is that we send MSG_META_ATTACH on to our
superclass. Once WIN_GROUPS are GS_USABLE, SA_REALIZABLE,
& SA_ATTACHED, they'll come on screen.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_ATTACH
cx - AppAttachFlags
dx - AppLaunchBlock (MUST NOT BE DESTROYED HERE)
App filename & state file name should be copied into app
instance data.
bp - Extra state block from state file, if any
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
NOTE: We can arrive here with AS_ATTACHING already set, if the attach
comes from an IACP-initiated switch from engine to app mode -- ardeb
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/89 Initial version
------------------------------------------------------------------------------@
GenAppAttach method GenApplicationClass, MSG_META_ATTACH
; removed 10/19/92 so model exclusive grabbing by document control doesn't
; get lost when OLApplication data goes away -- ardeb.
;
; restored to allow GenAppLazarus to work for normal app mode situtations.
; Engine mode document support (which this breaks) will have to wait
; - brianc 3/8/93
; <sniff> -- ardeb 3/9/93 :)
;
; must also save and restore model exclusive as it is only grabbed by the
; document control on APP_STARTUP, before ATTACH - brianc 3/9/93
;
LOG ALA_ATTACH
;
; store AppAttachFlags early on as it may be checked early on
;
mov di, ds:[si]
add di, ds:[di].Gen_offset ; ds:di = GenInstance
mov ds:[di].GAI_attachFlags, cx ; store AppAttachFlags
push dx ; save AppLaunchBlock for end
push si, cx, dx, bp ; save ATTACH params
; If being launched in app-mode, mark the system busy, as
; the user shouldn't be trying to use an app that's about to be
; covered up by this new app coming up. -- Doug 3/26/93
;
; {
mov ax, MSG_GEN_SYSTEM_MARK_BUSY ; busy now
call UserCallSystem
; }
mov ax, MSG_META_GET_MODEL_EXCL
call ObjCallInstanceNoLock ; ^lcx:dx = model excl
movdw bxdi, cxdx ; ^lbx:di = model excl
push si, di
mov si, di ; ^lbx:si = model excl
mov ax, MSG_META_RELEASE_MODEL_EXCL
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage
pop si, di
call ZeroThreadUsage ; Keep 'er going
call GenSpecShrinkBranch ; Anything visually build out before now
; doesn't count...
mov si, di ; ^lbx:si = prev model excl
mov ax, MSG_META_GRAB_MODEL_EXCL
mov di, mask MF_CALL or mask MF_FIXUP_DS
call ObjMessage ; restore model excl
pop si, cx, dx, bp ; restore ATTACH params
; Change application object state
; to indicate "USABLE"
mov di, ds:[si]
add di, ds:[di].Gen_offset ; ds:di = GenInstance
ORNF ds:[di].GI_states, mask GS_USABLE
ornf ds:[di].GAI_states, mask AS_ATTACHING
andnf ds:[di].GAI_states, not (mask AS_QUITTING or \
mask AS_TRANSPARENT_DETACHING)
mov ds:[di].GAI_attachFlags, cx ; store AppAttachFlags
; If running in UILM_TRANSPARENT mode, remove Save Options trigger
;
segmov es, <segment uiLaunchModel>, ax
cmp es:[uiLaunchModel], UILM_TRANSPARENT
jne notTrans
; Set a flag so we know we're in TRANSPARENT mode.
;Set here always, cleared at reloc
ornf ds:[di].GAI_states, mask AS_TRANSPARENT
; If the app is not closable, nuke the "save options" trigger
call UserGetLaunchOptions
test ax, mask UILO_CLOSABLE_APPS
jnz notTrans
mov ax, ATTR_GEN_APPLICATION_SAVE_OPTIONS_TRIGGER
call ObjVarFindData
jnc notTrans
mov di, ds:[bx].chunk ; Fetch SaveOptions trigger
mov bx, ds:[bx].handle
call ObjSwapLock
.warn -private
mov di, ds:[di]
add di, ds:[di].Gen_offset ; ds:di = GenInstance
andnf ds:[di].GI_states, not mask GS_USABLE
.warn @private
call ObjSwapUnlock
notTrans:
; If we are on a system w/o a keyboard, add ourselves to the
; FOCUS_WINDOW_KBD_STATUS GCN list so we know when to bring up the
; floating keyboard
call CheckIfFloatingKbdAllowed
jnc afterKbd ;Branch if kbd not allowed
push cx,dx,bp
mov ax, MSG_META_GCN_LIST_ADD
sub sp, size GCNListParams
mov bp, sp
mov cx, ds:[LMBH_handle]
movdw ss:[bp].GCNLP_optr, cxsi
mov ss:[bp].GCNLP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS
mov ss:[bp].GCNLP_ID.GCNLT_type, GAGCNLT_FOCUS_WINDOW_KBD_STATUS
call ObjCallInstanceNoLock
add sp, size GCNListParams
pop cx,dx,bp
afterKbd:
;
; initialize options triggers to disabled unless restoring from
; state, in which case we keep previous state
;
test cx, mask AAF_RESTORING_FROM_STATE
jnz noOptions
mov ax, ATTR_GEN_APPLICATION_SAVE_OPTIONS_TRIGGER
call ObjVarFindData
jnc noOptions
;only disable Save
; mov di, bx
; mov ax, ATTR_GEN_APPLICATION_RESET_OPTIONS_TRIGGER
; call ObjVarFindData
; jnc noOptions
; push di ; save Save Options trigger
; call disableTrigger ; disable Reset Options trigger
; pop bx
call disableTrigger ; disable Save Options trigger
noOptions:
; Call the superclass to do stuff.
push cx, dx, bp ; save attach info
segmov es, <segment GenApplicationClass>, di
mov di, offset GenApplicationClass
mov ax, MSG_META_ATTACH
CallSuper MSG_META_ATTACH
pop cx, dx, bp ; restore attach info
; Send MSG_META_LOAD_OPTIONS to objects on options list, if
; needed. MSG_META_LOAD_OPTIONS *MUST* happen after
; MSG_META_ATTACH superclass call, because objects loading
; options may increment the busy count of the app object, which
; OLApplicationAttach nukes.
test cx, mask AAF_RESTORING_FROM_STATE
jnz afterOptions
push cx, dx, bp ; save AppAttachFlags
mov ax, MSG_META_LOAD_OPTIONS
call ObjCallInstanceNoLock
pop cx, dx, bp ; restore AppAttachFlags
afterOptions:
call ZeroThreadUsage ; Keep 'er going
; Send MSG_META_ATTACH to objects on active list.
push cx ; save AppAttachFlags
mov ax, MSG_META_ATTACH
mov di, MGCNLT_ACTIVE_LIST
call SendToGenAppGCNList
pop cx ; restore AppAttachFlags
; Mark app busy while we're comming up. This will appear when the
; first window is visible, & last until gadgetry is drawn.
; - Doug 3/26/93
;
; {
push cx, dx, bp
mov ax, MSG_GEN_APPLICATION_MARK_APP_COMPLETELY_BUSY
call ObjCallInstanceNoLock
pop cx, dx, bp
; }
call ZeroThreadUsage ; Keep 'er going
; let all active windows know that we are attaching
test cx, mask AAF_RESTORING_FROM_STATE
; UpdateWindowFlags:
; - attaching
; - top-level update
mov cx, mask UWF_ATTACHING or mask UWF_FROM_WINDOWS_LIST
jz notRestoringFromState
ornf cx, mask UWF_RESTORING_FROM_STATE
notRestoringFromState:
mov dl, VUM_NOW
mov ax, MSG_META_UPDATE_WINDOW
mov di, GAGCNLT_WINDOWS
call SendToGenAppGCNList
;
; Bring this application alive as the active app in the
; field (unless the ALF_DO_NOT_OPEN_ON_TOP is set)
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_launchFlags, mask ALF_DO_NOT_OPEN_ON_TOP
jnz ensureRegistered
; Bring this application to the top.
; Change to happen immediately now that window VisOpen's now happen
; immediately & aren't queued. Has the side benefit of giving
; this app the focus before the "Activating..." system dialog is brought
; down, meaning that we get the high thread prio instead of whoever
; had the focus before. - Doug 4/15/93
;
mov ax, MSG_GEN_BRING_TO_TOP
call ObjCallInstanceNoLock
ensureRegistered:
mov cl, IACPSM_USER_INTERACTIBLE
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
; & let ourselves know when app is up
mov ax, MSG_GEN_APPLICATION_OPEN_COMPLETE
mov bx, ds:LMBH_handle
mov di, mask MF_FORCE_QUEUE
call ObjMessage
; Change sys back to not busy again.
; {
mov ax, MSG_GEN_SYSTEM_MARK_NOT_BUSY ; not busy after flush
call UserCallSystem
; }
; Change app back to not be busy, after a queue flush
; {
mov ax, MSG_GEN_APPLICATION_MARK_APP_NOT_COMPLETELY_BUSY
mov bx, ds:[LMBH_handle] ; Send to self
mov di, mask MF_RECORD
call ObjMessage ; wrap up into event
mov cx, di ; event in cx
mov dx, bx ; pass a block owned by process
mov bp, OFIQNS_INPUT_OBJ_OF_OWNING_GEODE ; app obj is next stop
mov ax, MSG_META_OBJ_FLUSH_INPUT_QUEUE
; mov di, mask MF_RECORD ; Flush through a second time
; call ObjMessage ; wrap up into event
; mov cx, di ; event in cx
; dx is already block owned by process
; bp is next stop
; ax is message
call ObjCallInstanceNoLock ; Finally, send this after a flush
; }
pop dx ; retrieve AppLaunchBlock
; Tell field we're done with any "Activating" dialog that may be up
; on screen, as we're up (will cause no harm if there isn't).
; -- Doug 4/14/93
;
push si
mov bx, ds:[LMBH_handle]
call MemOwner
mov cx, bx ; Get owning geode
mov bx, segment GenFieldClass ; classed event
mov si, offset GenFieldClass
mov ax, MSG_GEN_FIELD_ACTIVATE_DISMISS
mov di, mask MF_RECORD
call ObjMessage ; di = event
pop si
mov cx, di ; cx = event
mov dx, TO_GEN_PARENT ; send to our gen parent (GenField)
mov ax, MSG_META_SEND_CLASSED_EVENT
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE
call ObjMessage ; throw onto our queue to delay
call ZeroThreadUsage ; Keep 'er going
ret
disableTrigger label near
push si
mov si, ds:[bx].chunk ; Fetch SaveOptions trigger
mov bx, ds:[bx].handle
call ObjSwapLock
.warn -private
mov di, ds:[si]
add di, ds:[di].Gen_offset ; ds:di = GenInstance
andnf ds:[di].GI_states, not mask GS_ENABLED
.warn @private
call ObjMarkDirty
call ObjSwapUnlock
pop si
retn
GenAppAttach endm
ZeroThreadUsage proc near uses ax, bx
.enter
clr bx
mov ah, mask TMF_ZERO_USAGE
call ThreadModify
.leave
ret
ZeroThreadUsage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FocusFirstWindow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: give focus to first window in GAGCNLT_WINDOWS list
CALLED BY: GenAppAttach
PASS: *ds:si = GenApplication
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/19/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @----------------------------------------------------------------------
METHOD: GenAppOpenComplete
DESCRIPTION: Let app know that it is up on screen. Sent from within
GenAppGenSetUsable
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_APP_GEN_OPEN_COMPLETE
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/90 Initial version
------------------------------------------------------------------------------@
GenAppOpenComplete method dynamic GenApplicationClass, \
MSG_GEN_APPLICATION_OPEN_COMPLETE
; Clear the flag, now that the application has
; been opened. (So that should app bring all
; windows down & then put any back up, they
; won't go up in back)
LOG ALA_OPEN_COMPLETE
andnf ds:[di].GAI_launchFlags, \
not (mask ALF_OPEN_IN_BACK or mask ALF_DO_NOT_OPEN_ON_TOP)
andnf ds:[di].GAI_states, not mask AS_ATTACHING
segmov es, <segment uiLaunchModel>, ax
cmp es:[uiLaunchModel], UILM_TRANSPARENT
jne afterTransparentDetachStuff
;
; Remove the geode from the list of geodes in the process of detaching,
; in case it's decided to come back to life. This will allow the
; kernel to transparently detach the thing if it is detachable, &
; space is needed. Now's a good time to do it, before we become a
; candidate for transparent detaching (we just finished AS_ATTACHING),
; & the lists haven't been updated yet)
;
mov bx, ds:[LMBH_handle]
call MemOwner
mov cx, bx
clr dx
mov bx, MANUFACTURER_ID_GEOWORKS
mov ax, GCNSLT_TRANSPARENT_DETACH_IN_PROGRESS
call GCNListRemove
afterTransparentDetachStuff:
; Update the transparent detach GCN lists, now that we're attached.
;
call GenAppUpdateTransparentDetachLists
call ZeroThreadUsage ; Keep 'er going
;
; Finish any pending IACP connections, now that we assume the app is
; prepared to field them.
;
mov ax, MSG_GEN_APPLICATION_IACP_COMPLETE_CONNECTIONS
; call ObjCallInstanceNoLock
;
; We need to FORCE_QUEUE this thing so that we may hold it up if there is
; a UserDoDialog in progress. (see comment in
; CheckIfObjectCanReceiveMessagesDuringUserDoDialog) - brianc 6/23/93
;
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE
call ObjMessage
;
; let specific UI know also
;
mov ax, MSG_GEN_APPLICATION_OPEN_COMPLETE
segmov es, <segment GenApplicationClass>, di
mov di, offset GenApplicationClass
GOTO ObjCallSuperNoLock
GenAppOpenComplete endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppBuild -- MSG_META_RESOLVE_VARIANT_SUPERCLASS for GenApplicationClass
DESCRIPTION: Return the correct specific class for an object
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_RESOLVE_VARIANT_SUPERCLASS
cx - master offset of variant class to build
RETURN: cx:dx - class for object (cx = 0 for no build)
ALLOWED TO DESTROY:
ax, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 2/89 Initial version
------------------------------------------------------------------------------@
GenAppBuild method dynamic GenApplicationClass, MSG_META_RESOLVE_VARIANT_SUPERCLASS
; get UI to use
mov ax, ds:[di].GAI_specificUI
tst ax
jnz GAB_40 ; if exists, use it.
; else determine UI to use
mov cx, GUQT_UI_FOR_APPLICATION
mov ax, MSG_SPEC_GUP_QUERY
call GenCallParent ; ask parent object what UI should be
jnc outaHere ; Bad news.. we appear to be a product
; of immaculate conception...
; Store it
EC < ERROR_NC UI_APP_OBJ_HAS_NO_GENERIC_PARENT >
mov di, ds:[si]
add di, ds:[di].Gen_offset ;ds:di = GenInstance
mov ds:[di].GAI_specificUI, ax
call ObjMarkDirty ; Change Gen instance data, mark dirty
GAB_40:
mov bx,ax ; bx = handle of specific UI to use
mov ax, SPIR_BUILD_APPLICATION
mov di,MSG_META_RESOLVE_VARIANT_SUPERCLASS
call ProcGetLibraryEntry
GOTO ProcCallFixedOrMovable
outaHere:
EC < ERROR UI_MESSAGE_ARRIVING_AFTER_SAVED_TO_STATE >
NEC < clr cx ; try to escape by just not building >
NEC < ret >
GenAppBuild endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppRelocOrUnReloc -- MSG_META_RELOCATE/MSG_META_UNRELOCATE for
GenApplicationClass
DESCRIPTION: Deal with loading and storing of an application object.
PASS: *ds:si - instance data
ax - MSG_META_RELOCATE/MSG_META_UNRELOCATE
cx - handle of block containing relocation
dx - VMRelocType:
VMRT_UNRELOCATE_BEFORE_WRITE
VMRT_RELOCATE_AFTER_READ
VMRT_RELOCATE_AFTER_WRITE
bp - data to pass to ObjRelocOrUnRelocSuper
RETURN:
carry - set if error
bp - unchanged
ALLOWED TO DESTROY:
ax, cx, dx
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
When unrelocating, we store a zero in the GAI_specificUI instance
variable so when the object is reloaded, we will query the system
for the UI to use.
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 11/89 Initial version
------------------------------------------------------------------------------@
GenAppRelocOrUnReloc method GenApplicationClass, reloc
cmp ax, MSG_META_RELOCATE
je reloc
mov di, ds:[si] ; Point to object
add di, ds:[di].Gen_offset ; Point to our part
; IF UNRELOCATING, CLEAR VARIOUS STATES
clr bx
mov ds:[di].GAI_specificUI, bx ; zero out spec ui handle
; zero out *certain* state flags
andnf ds:[di].GAI_states, not (mask AS_DETACHING or \
mask AS_QUITTING or \
mask AS_TRANSPARENT_DETACHING or \
mask AS_TRANSPARENT or \
mask AS_REAL_DETACHING or \
mask AS_ATTACHED_TO_STATE_FILE or \
mask AS_RECEIVED_APP_OBJECT_DETACH)
;
; unrelocate any GCN lists (will do all GCN lists stored in
; TEMP_META_GCN even non-GAGCNLT types. This is okay as other classes
; that do this will check if it is necessary before unrelocating.)
;
mov ax, TEMP_META_GCN
call ObjVarFindData ; get ptr to TempGenAppGCNList
jnc done
test ds:[bx].TMGCND_flags, mask TMGCNF_RELOCATED
jz done ; already unrelocated
; indicate unrelocated
andnf ds:[bx].TMGCND_flags, not mask TMGCNF_RELOCATED
mov di, ds:[bx].TMGCND_listOfLists ; get list of lists
mov dx, ds:[LMBH_handle]
call GCNListUnRelocateBlock ; unrelocate all the lists we've
; been using
jnc done ; lists saved to state, leave
; var data element
mov ax, TEMP_META_GCN
call ObjVarDeleteData ; else, remove var data element
jmp done
reloc:
;
; relocate any GCN lists (will do all GCN lists stored in TEMP_META_GCN
; even non-GAGCNLT types. This is okay as other classes that do this
; will check if it is necessary before relocating.)
;
mov ax, TEMP_META_GCN
call ObjVarFindData ; get ptr to TempGenAppGCNList
jnc done
test ds:[bx].TMGCND_flags, mask TMGCNF_RELOCATED
jnz done ; already relocated
; indicate relocated
ornf ds:[bx].TMGCND_flags, mask TMGCNF_RELOCATED
mov di, ds:[bx].TMGCND_listOfLists ; get list of lists
mov dx, ds:[LMBH_handle]
call GCNListRelocateBlock ; relocate all the lists we've
; been using
done:
clc
mov di, offset GenApplicationClass
call ObjRelocOrUnRelocSuper
ret
GenAppRelocOrUnReloc endm
COMMENT @----------------------------------------------------------------------
FUNCTION: GenApplicationFindMoniker
DESCRIPTION: Find the specified moniker (or most approriate moniker) in
this GenApplication's VisMonikerList, and optionally copy the
Moniker a remote ObjectBlock.
CALLED BY: EXTERNAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
bp - VisMonikerSearchFlags (see visClass.asm)
flags indicating what type of moniker to find
in the VisMonikerList, and what to do with
the Moniker when it is found.
cx - handle of destination block (if bp contains
VMSF_COPY_CHUNK command)
dh - DisplayType to use for search
RETURN: ds updated if ObjectBlock moved as a result of chunk overwrite
^lcx:dx - handle of VisMoniker (cx = NIL if none)
bp - unchanged
ALLOWED TO DESTROY:
ax
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric 11/89 Initial version
------------------------------------------------------------------------------@
GenApplicationFindMoniker method GenApplicationClass, \
MSG_GEN_APPLICATION_FIND_MONIKER
EC < call GenCheckGenAssumption ; Make sure gen data exists >
EC < test bp, mask VMSF_REPLACE_LIST >
EC < ERROR_NZ UI_CANNOT_REPLACE_APPLICATION_MONIKER_LIST >
mov bh, dh ;bh = DisplayType
;pass: *ds:di = VisMoniker or VisMonikerList
; bh = DisplayType
; bp = VisMonikerSearchFlags
; cx = handle of destination block
mov di, ds:[si]
add di, ds:[di].Gen_offset ;ds:di = GenInstance
mov di, ds:[di].GI_visMoniker ;*ds:di = VisMoniker
push si
call VisFindMoniker
pop si
ret
GenApplicationFindMoniker endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppAppModeComplete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Note that "application mode" for this application is complete,
and either shut down the app, or switch to engine mode,
depending on whether there are any IACP connections left.
CALLED BY: MSG_GEN_APPLICATION_APP_MODE_COMPLETE
PASS: *ds:si = GenApplication object
^ldx:bp = ack OD
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
This is used in two instances:
1) when an IACP connection goes away. We want to exit
if we're in engine mode and that was the last
connection
2) when GenProcess receives MSG_META_ACK from us, it
wants to either continue exiting, or switch us
into engine mode, based on whether there are any
IACP connections left. It also needs to unregister
us as an IACP server, with all that entails.
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppAppModeComplete method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_APP_MODE_COMPLETE
;
; See if we're in application mode, so we need to stay open regardless
; (this is for instance (1), above).
;
LOG ALA_APP_MODE_COMPLETE
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GI_states, mask GS_USABLE
jnz inAppMode
;
; If switching to app mode, pretend we're already there, for the
; purposes of deciding what to do. -- ardeb
;
test ds:[di].GAI_states, mask AS_ATTACHING
jnz inAppMode
;
; Tell IACP we're no longer interactible.
;
LOG ALA_AMC_NOT_IN_APP_MODE
push cx, dx, bp
mov cl, IACPSM_NOT_USER_INTERACTIBLE
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
pop cx, dx, bp
;
; See if we've got an app-mode thing pending.
;
mov ax, TEMP_GEN_APPLICATION_SAVED_ALB
call ObjVarFindData
jc iAmTheResurrectionAndTheLife
;
; App not interactible. If there are no more active client
; connections, unregister ourselves as a server, in preparation for
; exiting.
;
push cx
mov ax, MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_CONNECTIONS
call ObjCallInstanceNoLock
tst cx
pop cx
jz shutdown
LOG ALA_AMC_MORE_CONNECTIONS
;
; Check to see if we have an ack OD and if so save it so we can ack
; after all IACP connections have been closed.
;
tst dx
jz done
mov ax, TEMP_GEN_APPLICATION_APP_MODE_COMPLETE_ACK_OD
mov cx, size optr
call ObjVarAddData
movdw ds:[bx], dxbp
done:
; Update transparent detach list, in case we're now detachable
; again.
;
call GenAppUpdateTransparentDetachLists
ret
inAppMode:
; If open in app mode for user, stay open.
;
LOG ALA_AMC_IN_APP_MODE
test ds:[di].GAI_launchFlags, mask ALF_OPEN_FOR_IACP_ONLY
jz done
LOG ALA_AMC_FOR_IACP_ONLY
; If not, see if there's any remaining app mode connections
; to keep us open
;
push cx, dx, bp
mov ax, MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_APP_MODE_CONNECTIONS
call ObjCallInstanceNoLock
pop cx, dx, bp
tst ax
jnz done
LOG ALA_AMC_QUIT
; No reason to stay open in app mode -- quit (will end up
; hanging around in engine mode if there are still engine
; mode connections)
;
mov dx, QL_AFTER_UI
call GenAppQuitCommon
jmp done
iAmTheResurrectionAndTheLife:
LOG ALA_AMC_LAZARUS
mov bx, ds:[bx]
call ObjVarDeleteData
call GenAppLazarus
jmp done
shutdown:
;
; Unregister as a server for the application's token.
;
LOG ALA_AMC_SHUTDOWN
push cx, dx, bp
mov ax, MSG_GEN_APPLICATION_IACP_UNREGISTER
call ObjCallInstanceNoLock
pop cx, dx, bp
;
; Queue a message to ourselves to quit. If, when we receive that
; message, there are still no active connections (there might be a
; NEW_CONNECTION message queued for us...), we'll tell ourselves to
; quit.
;
mov ax, MSG_GEN_APPLICATION_IACP_NO_MORE_CONNECTIONS
mov bx, ds:[LMBH_handle]
mov di, mask MF_FORCE_QUEUE
call ObjMessage
jmp done
GenAppAppModeComplete endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GENAPPCLOSEKEYBOARD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Closes any open keyboard window. This routine is only
effective when an applicaiton is in the middle of attaching
(i.e. call this in your method for MSG_GEN_APPLICATION
_OPEN_APPLICATION)
CALLED BY: GLOBAL
PASS: Nothing
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 5/17/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GENAPPCLOSEKEYBOARD proc far
uses ax, ds
.enter
segmov ds, dgroup, ax
clr ds:[displayKeyboard]
.leave
ret
GENAPPCLOSEKEYBOARD endp
AppAttach ends
AppDetach segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppFinishQuit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send the passed abort flag off to the owning process.
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
cx - abort flag
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 3/13/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppFinishQuit method GenApplicationClass, MSG_META_FINISH_QUIT
push ax, cx
if LOG_DETACH_CRUFT
jcxz noAbort
LOG ALA_FINISH_QUIT_ABORT
jmp doIt
noAbort:
LOG ALA_FINISH_QUIT
doIt:
endif
mov ax, MSG_META_QUIT_ACK ;Send quit acknowledge with any abort
mov dx, QL_UI ; flag off to the process.
call GeodeGetProcessHandle
mov di, mask MF_FIXUP_DS
call ObjMessage
pop ax, cx
mov di, offset GenApplicationClass ; do superclass thing
GOTO ObjCallSuperNoLock
GenAppFinishQuit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppQuitOptionsQuery
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save options and quit
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
cx - IC_YES to save options and quit
cx - IC_NO to just quit
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 1/8/98 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppQuitOptionsQuery method GenApplicationClass, MSG_GEN_APPLICATION_QUIT_OPTIONS_QUERY
cmp cx, IC_NO
je justQuit
;
; save options first
;
mov ax, MSG_META_SAVE_OPTIONS
call ObjCallInstanceNoLock
justQuit:
mov dx, QL_BEFORE_UI ;Set appropriate quit level
GOTO GenAppQuitCommon
GenAppQuitOptionsQuery endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppQuit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This just sets the "I am quitting" flag in the state block, and
sends the method off to the process.
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 3/15/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
querySaveCat char "ui",0
querySaveKey char "askSaveOptions",0
GenAppQuit method GenApplicationClass, MSG_META_QUIT
LOG ALA_QUIT
;
; if changed options, query user to save them
;
push ds, si
mov cx, cs
mov dx, offset querySaveKey
mov si, offset querySaveCat
mov ds, cx
call InitFileReadBoolean
pop ds, si
jc askSave
tst ax
jz noOptionsShort
askSave:
mov ax, ATTR_GEN_APPLICATION_SAVE_OPTIONS_TRIGGER
call ObjVarFindData
jnc noOptionsShort
;only check save
; mov ax, ATTR_GEN_APPLICATION_RESET_OPTIONS_TRIGGER
; call ObjVarFindData
; jnc noOptionsShort
push si
mov si, ds:[bx].chunk
mov bx, ds:[bx].handle
mov ax, MSG_GEN_GET_ENABLED
mov di, mask MF_CALL or mask MF_FIXUP_DS ; C set if enabled
call ObjMessage
pop si
jc getAppName
noOptionsShort:
jmp noOptions
;
; get appname from app
;
getAppName:
mov dx, -1 ; get appname from app
mov bp, (VMS_TEXT shl offset VMSF_STYLE) or mask VMSF_COPY_CHUNK
mov cx, ds:[LMBH_handle] ; copy into spell control block
mov ax, MSG_GEN_FIND_MONIKER
call ObjCallInstanceNoLock ; ^lcx:dx = moniker
jcxz useNullString
mov di, dx
mov di, ds:[di]
test ds:[di].VM_type, mask VMT_GSTRING
jnz useNullString
add di, offset VM_data.VMT_text ; ds:di = appname
jmp short haveString
useNullString:
mov al, 0
mov cx, (size TCHAR) ; null-terminator only
call LMemAlloc
mov dx, ax
mov_tr di, ax
mov di, ds:[di] ; ds:di = null appname
mov {TCHAR}ds:[di], 0
;
; ask user
;
haveString:
push dx ; save appname chunk
mov ax, (CDT_QUESTION shl offset CDBF_DIALOG_TYPE or GIT_AFFIRMATION shl offset CDBF_INTERACTION_TYPE)
mov dx, size GenAppDoDialogParams
sub sp, dx
mov bp, sp
mov ss:[bp].GADDP_dialog.SDP_customFlags, ax
mov ss:[bp].GADDP_dialog.SDP_stringArg1.segment, ds
mov ss:[bp].GADDP_dialog.SDP_stringArg1.offset, di
mov ax, ds:[LMBH_handle]
mov ss:[bp].GADDP_finishOD.handle, ax
mov ss:[bp].GADDP_finishOD.offset, si
mov ss:[bp].GADDP_message, MSG_GEN_APPLICATION_QUIT_OPTIONS_QUERY
mov si, bx
mov bx, handle Strings
call MemLock
push ds
mov ds, ax
mov si, offset SaveOptionsQuery
mov si, ds:[si] ;DS:SI <- ptr to string to display
pop ds
mov ss:[bp].GADDP_dialog.SDP_customString.segment, ax
mov ss:[bp].GADDP_dialog.SDP_customString.offset, si
clr ss:[bp].GADDP_dialog.SDP_helpContext.segment
mov ax, MSG_GEN_APPLICATION_DO_STANDARD_DIALOG
call GenCallApplication
add sp, size GenAppDoDialogParams
pop ax ; *ds:ax = appname chunk
call LMemFree
mov bx, handle Strings
call MemUnlock
ret
noOptions:
mov dx, QL_BEFORE_UI ;Set appropriate quit level
FALL_THRU GenAppQuitCommon
GenAppQuit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppQuitCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Start quit sequence for attached app, if not yet in progress.
Sets AS_QUITTING flag, starts IGNORE_INPUT, sends off starting
MSG_META_QUIT to process at level indicated
CALLED BY: INTERNAL
PASS: *ds:si - app object
cx - QuitLevel
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/1/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppQuitCommon proc far uses si
class GenApplicationClass
.enter
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_states, mask AS_QUITTING ; If already quitting,
jnz exit ; just exit
test ds:[di].GAI_states, mask AS_DETACHING or mask AS_QUIT_DETACHING
;EC < ERROR_NZ UI_MSG_QUIT_RECEIVED_AFTER_MSG_META_DETACH >
;could happen in some new exit-to-dos while printing multiple-files from
;GeoManager scenario - brianc 8/16/94
EC < jne exit >
NEC < jne exit >
; Set flag to indicate quitting
;
ornf ds:[di].GAI_states, mask AS_QUITTING
push dx
mov cl, IACPSM_IN_FLUX
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
;
; Start ignoring input, other than dialog responses (Is undone if the
; abort is quit)
;
mov ax, MSG_GEN_APPLICATION_IGNORE_INPUT
call ObjCallInstanceNoLock
; Init flag to be false, i.e. missing
;
mov ax, TEMP_GEN_APPLICATION_ABORT_QUIT
call ObjVarDeleteData
pop dx
mov ax, MSG_META_QUIT
call GeodeGetProcessHandle
mov di, mask MF_FIXUP_DS
call ObjMessage
exit:
.leave
ret
GenAppQuitCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppInitiateQuit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends a MSG_META_QUIT off to the superclass.
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
PSEUDO CODE/STRATEGY:
This page intentionally left blank
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 3/19/90 Initial version
Joon 12/31/92 Send MSG_META_QUIT to window list
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppInitiateQuit method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_INITIATE_UI_QUIT
EC < test ds:[di].GAI_states, mask AS_QUITTING >
EC < ERROR_Z UI_APP_RECEIVED_INITIATE_QUIT_BEFORE_MSG_META_QUIT >
test ds:[di].GI_states, mask GS_USABLE ;If not usable, just
jne 10$ ; ack the quit
clr cx ;Clear abort flag
mov ax, MSG_META_QUIT_ACK ;Send ack off
mov dx, QL_UI
call GeodeGetProcessHandle
mov di, mask MF_FIXUP_DS
call ObjMessage
ret
10$:
; Do MSG_META_QUIT for window list
mov ax, MSG_META_QUIT
mov di, GAGCNLT_WINDOWS
call SendToGenAppGCNList
clr cx ; no abort
mov ax, MSG_META_QUIT_ACK
mov di, offset GenApplicationClass
GOTO ObjCallSuperNoLock
GenAppInitiateQuit endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppQuitAfterUI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Handle QL_AFTER_UI level of quit for the process QUIT
mechanism - set QUIT_DETACHING flag, detach application,
unless there remains a reason for it to be open in app mode,
in which case we abort the quit thereby defeating the detach
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - method
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 2/26/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppQuitAfterUI method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_QUIT_AFTER_UI
LOG ALA_QUIT_AFTER_UI
mov ax, TEMP_GEN_APPLICATION_ABORT_QUIT
call ObjVarFindData
jc abortQuit
mov ax, TEMP_GEN_APPLICATION_SAVED_ALB
call ObjVarFindData
jc healTheLeper
; If should be open for IACP, abort quit.
;
mov ax, MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_APP_MODE_CONNECTIONS
call ObjCallInstanceNoLock
tst ax
if LOG_DETACH_CRUFT
jz quit
LOG ALA_QAUI_MORE_CONNECTIONS
jmp abortQuit
quit:
else
jnz abortQuit ; if so, if we need app mode, then
; don't detach at all.
endif
LOG ALA_QAUI_QUITTING
mov di, ds:[si]
add di, ds:[di].Gen_offset
; Mark as NOT_OPEN_FOR_USER, as about to detach for a QUIT.
;
ornf ds:[di].GAI_launchFlags, mask ALF_OPEN_FOR_IACP_ONLY
ornf ds:[di].GAI_states, mask AS_QUIT_DETACHING
clr cx ; clear abort flag
jmp short ack
healTheLeper:
LOG ALA_QAUI_LEPER
mov ax, ds:[bx]
call ObjVarDeleteDataAt
clr bp
mov_tr bx, ax
call MemLock
mov es, ax
mov cx, TRUE ; open default if no document
call GenAppNotifyModelIfDoc
call MemFree
mov ax, MSG_GEN_APPLICATION_IACP_COMPLETE_CONNECTIONS
call ObjCallInstanceNoLock
abortQuit:
LOG ALA_QAUI_ABORT
; Let IACP know we're back.
mov cl, IACPSM_USER_INTERACTIBLE
mov ax, MSG_GEN_APPLICATION_IACP_REGISTER
call ObjCallInstanceNoLock
mov cx, -1 ; set abort flag
ack:
mov ax, MSG_META_QUIT_ACK
mov dx, QL_AFTER_UI
call GeodeGetProcessHandle
mov di, mask MF_FORCE_QUEUE
GOTO ObjMessage
GenAppQuitAfterUI endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppIACPGetNumberOfAppModeConnections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: <description here>
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_APP_MODE_CONNECTIONS
RETURN: ax - # of app mode IACP connections
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 2/24/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppIACPGetNumberOfAppModeConnections method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_APP_MODE_CONNECTIONS
clr ax ; default to zero
mov si, ds:[di].GAI_iacpConnects
tst si
jz exit
mov bx, cs
mov di, offset GAIGNOFMC_callback
call ChunkArrayEnum
exit:
ret
GenAppIACPGetNumberOfAppModeConnections endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GAIGNOFMC_callback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Count # of app mode connections
CALLED BY: GenAppIACPGetNumberOfAppModeConnections
PASS: *ds:si = array
ds:di = array element to examine
ax = # of app mode connections encountered so far
RETURN: ax = new # of app mode connections found
carry set to stop enumerating
carry clear to keep going
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 2/24/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GAIGNOFMC_callback proc far
.enter
cmp ds:[di].GAIACPC_appMode, \
MSG_GEN_PROCESS_OPEN_APPLICATION
jne next
inc ax
next:
clc
.leave
ret
GAIGNOFMC_callback endp
COMMENT @----------------------------------------------------------------------
METHOD: GenAppDetach -- MSG_META_DETACH for GenApplicationClass
DESCRIPTION: Perform actual object detach for the Application object
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_DETACH
cx - caller's ID
dx:bp - ackOD (The application process itself)
NOTE: the app process takes advantage of the passing parameters
by storing an optr in here, which it will get back later. The
"hidden" data here is:
dx - process handle
cx:bp - OD of original ackOD sent in MSG_META_DETACH to process
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/89 Initial version
Doug 12/89 Revised detach methodology
------------------------------------------------------------------------------@
GenAppDetach method GenApplicationClass, MSG_META_DETACH
EC < xchg bx, dx >
EC < xchg si, bp >
EC < call ECCheckOD >
EC < xchg bx, dx >
EC < xchg si, bp >
LOG ALA_DETACH
test ds:[di].GAI_states, mask AS_DETACHING
LONG jnz alreadyDetaching ;If already detaching, branch
; if not in app mode, this has no meaning (happens if we're exiting
; when field decides to shut everyone down...), so just ack the thing,
; as we're already detached -- ardeb 1/6/93
test ds:[di].GI_states, mask GS_USABLE
LONG jz alreadyDetaching
ornf ds:[di].GAI_states, mask AS_DETACHING
EC < andnf ds:[di].GAI_states, not mask AS_RECEIVED_APP_OBJECT_DETACH >
push ax
push cx
push dx
push bp
clr cx ; Remove from all transparent detach
; lists (won't be added back on again
; now that AS_DETACHING is set)
call GenAppRemoveFromTransparentDetachLists
;
; If we are on a system w/o a keyboard, remove ourselves from the
; FOCUS_WINDOW_KBD_STATUS GCN list.
;
call CheckIfFloatingKbdAllowed
jnc notOnGCNList
mov ax, MSG_META_GCN_LIST_REMOVE
sub sp, size GCNListParams
mov bp, sp
mov cx, ds:[LMBH_handle]
movdw ss:[bp].GCNLP_optr, cxsi
mov ss:[bp].GCNLP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS
mov ss:[bp].GCNLP_ID.GCNLT_type, GAGCNLT_FOCUS_WINDOW_KBD_STATUS
call ObjCallInstanceNoLock
add sp, size GCNListParams
notOnGCNList:
; Notify specific UI that application is
; being detached. Will force down any
; app-modal UserDoDialog's, so that app
; process will be able to get MSG_META_DETACH.
mov ax, MSG_GEN_APPLICATION_DETACH_PENDING
call ObjCallInstanceNoLock
pop bp
pop dx
pop cx
pop ax
EC < push cx, dx, bp >
EC < mov di, ds:[si] >
EC < add di, ds:[di].Gen_offset >
EC < ornf ds:[di].GAI_states, mask AS_RECEIVED_APP_OBJECT_DETACH >
EC < >
EC < xchg bx, dx >
EC < xchg si, bp >
EC < call ECCheckOD >
EC < xchg bx, dx >
EC < xchg si, bp >
EC < pop cx, dx, bp >
; start the standard detach mechanism
call ObjInitDetach
; IF the application is not marked as USABLE, then we may presume
; that the active list was never sent a MSG_META_ATTACH, as that happens
; in GenAppSetUsable itself. THEREFORE, if this thing isn't
; USABLE, then we want to skip sending MSG_META_DETACH to the active
; list. (The app object will stay USABLE until this detach is
; complete)
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GI_states, mask GS_USABLE
jz AfterActiveListDetached
; let all active windows know that we are detaching
push cx, dx, bp
mov cx, mask UWF_DETACHING ; UpdateWindowFlags
mov dl, VUM_NOW
mov ax, MSG_META_UPDATE_WINDOW
mov di, GAGCNLT_WINDOWS
call SendToGenAppGCNList
pop cx, dx, bp
; Do active list detach - pass same dx:bp ack OD, even
; though it is not used since ObjInitDetach has already been done.
;
; The detach will finish up when all DETACHES generated
; here AND in the active list are acknowledged.
mov ax, MGCNLT_ACTIVE_LIST
mov di, MSG_META_DETACH
call SendToGenAppGCNListUppingDetachCount
; let superclass do stuff, if it wishes
mov di, offset GenApplicationClass
mov ax, MSG_META_DETACH
CallSuper MSG_META_DETACH
AfterActiveListDetached:
; force a clearing of the event queue
call ObjIncDetach ; Inc for ACK we'll receive back from
; this...
mov bx,ds:[LMBH_handle]
mov ax, MSG_META_ACK
mov di, mask MF_FORCE_QUEUE
call ObjMessage
call ObjEnableDetach
done:
ret
alreadyDetaching:
LOG ALA_DETACH_NESTED
call GenAppNestedDetach
jmp short done
GenAppDetach endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SendToGenAppGCNListUppingDetachCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a message to all elements of a GCN list bound to the
application object, calling ObjIncDetach for each one
CALLED BY: (INTERNAL) GenAppDetach, GenAppAppShutdown
PASS: *ds:si = GenApplication object
ax = GeoWorks gcn list type
di = message to send to all members
RETURN: nothing
DESTROYED: ax
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SendToGenAppGCNListUppingDetachCount proc near
uses cx, dx, bp
.enter
;
; Locate the list of GCN lists.
;
push ax
mov bp, si ; *ds:bp = GenApp object
mov ax, TEMP_META_GCN
call ObjVarFindData ; ds:bx = TempMetaGCNData
pop ax
jnc done
;
; Locate the GCN list in question.
;
push di
mov di, ds:[bx].TMGCND_listOfLists
mov bx, MANUFACTURER_ID_GEOWORKS
call GCNListFindListInBlock ; *ds:si = MGCNLT_ACTIVE_LIST list
pop ax
jnc done
;
; Enumerate them all, sending the proper message to each.
;
mov bx, cs
mov di, offset STGAGLUDC_callback
call ChunkArrayEnum
mov si, bp ; *ds:si = GenApp object
done:
.leave
ret
SendToGenAppGCNListUppingDetachCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
STGAGLUDC_callback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Callback function to send a message to all members of a
GCN list, incrementing the app object's detach count for
each message sent.
CALLED BY: (INTERNAL) SendToGenAppGCNListUppingDetachCount via
ChunkArrayEnum
PASS: *ds:si = GCN list
ds:di = GCN list element
*ds:bp = GenApplication object
ax = message to send
RETURN: carry clear to continue enumeration
DESTROYED: cx, dx, si, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
STGAGLUDC_callback proc far
uses bp, ax
.enter
mov si, bp ; *ds:si = GenApp object
call ObjIncDetach ; INC for message we are about
; to send out
clr cx ; ACK ID
mov dx, ds:[LMBH_handle] ; active list objects ACK back here
; (dx:bp = GenApp object)
mov bx, ds:[di].GCNLE_item.handle ; ^lbx:si = object to detach
mov si, ds:[di].GCNLE_item.chunk
mov di, mask MF_FIXUP_DS
call ObjMessage
clc ; continue enumeration
.leave
ret
STGAGLUDC_callback endp
COMMENT @----------------------------------------------------------------------
FUNCTION: GenAppNestedDetach
DESCRIPTION: Handle case of nested detach
CALLED BY: INTERNAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
cx - caller's ID
dx:bp - ackOD (The application process itself)
NOTE: the app process takes advantage of the passing parameters
by storing an optr in here, which it will get back later. The
"hidden" data here is:
dx - process handle
cx:bp - OD of original ackOD sent in MSG_META_DETACH to process
RETURN: nothing
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 6/92 Initial version
------------------------------------------------------------------------------@
GenAppNestedDetach proc far ; (far for GOTO ObjMessage's sake)
push cx
push dx
push bp
; Check to see if DETACH_DATA can be found in the vardata space for
; this object, meaning that we've started a detach, but have not
; yet finished detaching the generic object tree.
;
mov ax, DETACH_DATA
call ObjVarFindData ;ds:bx = data entry if found
jnc justACK ;not found, just ACK the nested detach
; OK, we found one. Now, here's the tricky part -- if the app is
; being detach with a final ACK OD of NULL, as is the case when the
; app is quit by the user, convert it to have an ACK OD of the new
; DETACH requestor (such as a field), so that it won't exit until
; we've finished detaching.
tst ds:[bx].DDE_callerID
jnz justACK
pop ds:[bx].DDE_ackOD.chunk
pop ds:[bx].DDE_ackOD.handle
pop ds:[bx].DDE_callerID
ret
justACK:
pop bp
pop dx
pop cx
; ABORT this DETACH. Rather than sending ACK back to the process,
; which will continue with the shutdown antics, send the ACK back
; to the original caller, to let them know they should quit
; worrying about us.
;
mov ax, MSG_META_ACK
mov bx, cx
mov si, bp
clr cx ; error code (none)
clr bp ; DX:BP is source of ack, our
; process.
mov di, mask MF_FORCE_QUEUE
GOTO ObjMessage
GenAppNestedDetach endp
COMMENT @----------------------------------------------------------------------
METHOD: GenAppDetachComplete
DESCRIPTION: Handle notification that the applications's children
have finished detaching themselves.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_DETACH_COMPLETE
cx - caller's ID
dx:bp - OD for MSG_META_ACK (application process)
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 5/89 Initial version
Doug 12/89 Revised detach methodology
------------------------------------------------------------------------------@
GenAppDetachComplete method GenApplicationClass, MSG_META_DETACH_COMPLETE
LOG ALA_DETACH_COMPLETE
EC < xchg bx, dx >
EC < xchg si, bp >
EC < call ECCheckOD >
EC < xchg bx, dx >
EC < xchg si, bp >
; Call super to send MSG_META_ACK to process, which will then
; respond with MSG_GEN_APPLICATION_CLOSE_COMPLETE when done.
;
mov di, offset GenApplicationClass
GOTO ObjCallSuperNoLock
GenAppDetachComplete endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppCloseComplete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Called from process after UI has been detached &
the apropriate CLOSE message has been called on the process.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_GEN_APPLICATION_CLOSE_COMPLETE
^ldx:bp = ack OD
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 5/20/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppCloseComplete method dynamic GenApplicationClass,
MSG_GEN_APPLICATION_CLOSE_COMPLETE
LOG ALA_CLOSE_COMPLETE
push dx, bp ; save ack OD
; Change application object state to indicate "NOT USABLE". This
; happens ONLY after the application generic tree has been detached, &
; really is used as a flag for the rest of the detach mechanism.
;
andnf ds:[di].GI_states, not mask GS_USABLE
; NOTE! We can't clear the "AS_QUITTING" & AS_TRANSPARENT_DETACHING
; flags here, because they are actually used by the process's
; MSG_GEN_PROCESS_REAL_DETACH handler later, to know if the field
; needs to be updated about the detach, or whether we're exiting for
; a different reason that doesn't require the field to be updated.
; These two flags are updated seperately.
;
andnf ds:[di].GAI_states, not (mask AS_DETACHING or \
mask AS_QUIT_DETACHING or \
mask AS_RECEIVED_APP_OBJECT_DETACH)
;
; Sends off the IACP completion message that will let the client
; know that whatever file it wants to use has been closed. Has
; no effect unless TEMP_*_FILE_CLOSE_EVENNT exists.
;
mov ax, MSG_GEN_APPLICATION_CLOSE_FILE_ACK
call ObjCallInstanceNoLock
; Release mouse grab, if we've got it
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_FLOW_RELEASE_MOUSE_IF_GRABBED
mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT
call UserCallFlow
;
; let specific UI know also
;
mov ax, MSG_GEN_APPLICATION_CLOSE_COMPLETE
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
pop dx, bp ; restore ack OD
; Finally, figure out where we should go from here.
;
mov ax, MSG_GEN_APPLICATION_APP_MODE_COMPLETE
GOTO ObjCallInstanceNoLock
GenAppCloseComplete endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppLazarus
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Bring the application back to life with the passed ALB
CALLED BY: (INTERNAL) GenAppAppModeComplete
PASS: *ds:si = GenApplication object
^hbx = AppLaunchBlock to use in the resurrection
RETURN: nothing
DESTROYED: ax, bx, cx, dx
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 12/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppLazarus proc far
class GenApplicationClass
.enter
push bx
call GenAppSwitchToAppMode
pop bx
call MemFree
.leave
ret
GenAppLazarus endp
COMMENT @----------------------------------------------------------------------
METHOD: GenAppGenSetUsable
METHOD: GenAppGenSetNotUsable
DESCRIPTION: Intercept MSG_GEN_SET_USABLE & MSG_GEN_SET_NOT_USABLE to
warn developers that these methods may NOT be used on
GenApplicationClass objects.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_GEN_SET_USABLE/MSG_GEN_SET_NOT_USABLE
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 6/3/92 Initial version
------------------------------------------------------------------------------@
if ERROR_CHECK
GenAppFatalError method dynamic GenApplicationClass,
MSG_GEN_SET_USABLE,
MSG_GEN_SET_NOT_USABLE
ERROR UI_ILLEGAL_REQUEST_OF_GEN_APPLICATION_OBJECT
GenAppFatalError endm
endif
COMMENT @----------------------------------------------------------------------
METHOD: GenAppAppShutdown
DESCRIPTION: Complete detach stuff - unlink from generic tree,
clear out misc instance data.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
cx - data for MSG_META_SHUTDOWN_ACK
^ldx:bp - optr for MSG_META_SHUTDOWN_ACK
ax - MSG_META_APP_SHUTDOWN
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/89 Revised detach methodology
------------------------------------------------------------------------------@
GenAppAppShutdown method GenApplicationClass, \
MSG_META_APP_SHUTDOWN
LOG ALA_APP_SHUTDOWN
call ObjInitDetach
mov ax, MGCNLT_APP_STARTUP
mov di, MSG_META_APP_SHUTDOWN
call SendToGenAppGCNListUppingDetachCount
mov ax, MSG_META_APP_SHUTDOWN
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
call ObjEnableDetach
;
; Remove from removable disk list.
;
call GenAppRemoveFromRemovableDiskList
ret
GenAppAppShutdown endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppShutdownComplete
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Finish our processing of MSG_META_APP_SHUTDOWN
CALLED BY: MSG_META_SHUTDOWN_COMPLETE
PASS: *ds:si = GenApplication object
cx = word o' data passed with MSG_META_APP_SHUTDOWN
^ldx:bp = object to notify of our finishing
RETURN: nothing
DESTROYED: ax, cx, dx, bp
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppShutdownComplete method dynamic GenApplicationClass,
MSG_META_SHUTDOWN_COMPLETE
uses cx, dx, bp
.enter
LOG ALA_SHUTDOWN_COMPLETE
; One last time, just before linkage is severed -- make sure app
; doesn't have any exclusives (App SHOULD have already released
; this, but it is possible that an ill-behaved app could somehow
; re-grab an exclusive before being nuked)
;
mov cx, ds:[LMBH_handle]
mov dx, si
mov bp, mask MAEF_FOCUS or mask MAEF_TARGET or mask MAEF_MODEL
mov ax, MSG_META_MUP_ALTER_FTVMC_EXCL
call GenCallParent ; Call our GenField parent, to release
; any excl we may have
; Tell any Field object we may be on that we want off.
;
; See if we actually are on a GenFieldClass object (The UI app
; sits under a GenScreenClass object)
;
mov cx, segment GenFieldClass
mov dx, offset GenFieldClass
mov ax, MSG_META_IS_OBJECT_IN_CLASS
call GenCallParent
jnc afterRemoved ; if not, skip removal notification
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax, MSG_GEN_FIELD_REMOVE_GEN_APPLICATION
call GenCallParent
afterRemoved:
; Last thing before we nuke parent link -- have parent make sure
; there is a reasonable focus & target
; 12/10/92: do this only if the app was focusable, as otherwise nothing
; should have changed. This finesses a problem with the Lights Out
; Launched exiting before geomanager has finished attaching, making the
; field think it has nothing left with which the user can interact.
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_states, mask AS_FOCUSABLE
jz clearLink
mov ax, MSG_META_ENSURE_ACTIVE_FT
call GenCallParent
clearLink:
;
; clear upward-only link to GenField
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
mov ds:[di].GI_link.LP_next.handle, 0
mov ds:[di].GI_link.LP_next.chunk, 0
call ObjMarkDirty ; Change Gen instance data, mark dirty
.leave
;
; Let our superclass send the ack for us.
;
mov di, offset GenApplicationClass
mov ax, MSG_META_SHUTDOWN_COMPLETE
GOTO ObjCallSuperNoLock
GenAppShutdownComplete endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppFinalObjFree
DESCRIPTION: Free GenApplication GCN lists.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_META_FINAL_OBJ_FREE
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/92 Initial version
------------------------------------------------------------------------------@
GenAppFinalObjFree method GenApplicationClass, MSG_META_FINAL_OBJ_FREE
; Free GCN list of lists chunk, & list chunks, if in use here
;
mov ax, MSG_META_GCN_LIST_DESTROY
call ObjCallInstanceNoLock
mov ax, MSG_META_FINAL_OBJ_FREE
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
ret
GenAppFinalObjFree endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppGetAppRef
DESCRIPTION: Fetches data stored in GAI_appRef.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_GEN_APPLICATION_GET_APP_INSTANCE_REFERENCE
RETURN: dx - block handle of structure AppInstanceReference
ALLOWED TO DESTROY:
ax, cx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/89 Initial version
------------------------------------------------------------------------------@
GenAppGetAppRef method dynamic GenApplicationClass, MSG_GEN_APPLICATION_GET_APP_INSTANCE_REFERENCE
; figure the number of bytes required to save
; the disk handle
mov bx, ds:[di].GAI_appRef.AIR_diskHandle
push bx ; save handle for later DiskSave
clr cx
call DiskSave ; cx <- # bytes needed to save disk handle away
; Get ds:si = GAI_appRef
lea si, ds:[di].GAI_appRef
; Create block to return data in
mov ax, size AppInstanceReference
add ax, cx
push cx
mov cx, (mask HAF_ZERO_INIT shl 8) or mask HF_SHARABLE or ALLOC_DYNAMIC_NO_ERR
call MemAlloc
call MemLock
mov dx, bx ; return block handle in dx
mov es, ax ; es:di = ptr to appRef
clr di
mov cx, offset AIR_savedDiskData
rep movsb ; Copy data over into block
pop cx ; recover buffer size for DiskSave
pop bx ; and disk handle as well
call DiskSave
mov bx, dx ; bx <- memory block
call MemUnlock
ret
GenAppGetAppRef endm
COMMENT @----------------------------------------------------------------------
METHOD: GenAppSetAppRef
DESCRIPTION: Stores passed data in GAI_appRef.
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
ax - MSG_GEN_APPLICATION_SET_APP_INSTANCE_REFERENCE
dx - block handle of structure AppInstanceReference. any saved
disk handle should have already been restored.
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 12/89 Initial version
------------------------------------------------------------------------------@
GenAppSetAppRef method dynamic GenApplicationClass, MSG_GEN_APPLICATION_SET_APP_INSTANCE_REFERENCE
; Get ds:si = GAI_appRef
add di, offset GAI_appRef ;
segmov es, ds ;ES:DI <- ptr to dest for AppInstanceReference
mov bx, dx
call MemLock
mov ds, ax ; ds:di = ptr to appRef
clr si ;
mov cx, size AppInstanceReference
rep movsb ; Copy data over into block
GOTO MemFree ;Free up the block handle
GenAppSetAppRef endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppSendAppInstanceReferenceToField
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This routine sends the AppInstanceReference contained in the
instance data off to the parent field for use in restarting
the app.
CALLED BY: GLOBAL
PASS: *ds:si - instance data
ds:di - ptr to generic instance part
es - segment of GenApplicationClass
RETURN: nothing
ALLOWED TO DESTROY:
ax, cx, dx, bp
bx, si, di, ds, es
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
atw 10/ 1/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppSendAppInstanceReferenceToField method GenApplicationClass,
MSG_GEN_APPLICATION_SEND_APP_INSTANCE_REFERENCE_TO_FIELD
; See if we actually are on a GenFieldClass object (The UI app
; sits under a GenScreenClass object)
;
mov cx, segment GenFieldClass
mov dx, offset GenFieldClass
mov ax, MSG_META_IS_OBJECT_IN_CLASS
call GenCallParent
jnc done ;if not, don't create blcok
;that we'd have to get rid of
mov ax, MSG_GEN_APPLICATION_GET_APP_INSTANCE_REFERENCE
call ObjCallInstanceNoLock ;Get our AppInstanceReference
mov ax, MSG_GEN_FIELD_ADD_APP_INSTANCE_REFERENCE
mov bp, ds:[LMBH_handle] ;BP <- handle of our block
call GenCallParent ;Send ref to our parent
done:
ret
GenAppSendAppInstanceReferenceToField endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppTransparentDetach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Detach application because the system needs more heap space,
& we're running in transparent detach mode.
CALLED BY: MSG_META_TRANSPARENT_DETACH
PASS: *ds:si = GenApplication object
ds:di = GenApplication instance data
es = segment of GenApplicationClass
ax = MSG_META_TRANSPARENT_DETACH
RETURN: nothing
ALLOWED TO DESTROYED:
ax, cx, dx, bp
bx, si, di, ds, es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 11/20/92 Initial version
doug 3/3/93 Switched to meta message, sent by kernel
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppTransparentDetach method dynamic GenApplicationClass,
MSG_META_TRANSPARENT_DETACH
; If already detaching in any form, just ignore this request -- we'll
; be gone soon, satisfying the request.
;
test ds:[di].GAI_states, mask AS_TRANSPARENT_DETACHING or \
mask AS_DETACHING or \
mask AS_QUIT_DETACHING
jnz done
; If not usable, must already be on our way out, so bail.
;
test ds:[di].GI_states, mask GS_USABLE
jz done
; Note that we are starting a
; transparent detach
ornf ds:[di].GAI_states, mask AS_TRANSPARENT_DETACHING
; Let superclass do any cleanup it needs to do
;
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
;
; Send MSG_META_DETACH to process (matching logic in
; GenFieldShutdownApps)
;
call GeodeGetProcessHandle ; bx = process
clr cx, dx, bp ; no ACK needed
mov ax, MSG_META_DETACH
mov di, mask MF_FORCE_QUEUE ; in case of single-threaded app, let's
; make sure we finish up
GOTO ObjMessage
done:
ret
GenAppTransparentDetach endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppRemoveFromTransparentDetachLists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Removes app obj from transparent detach list, if it is on it
CALLED BY: INTERNAL
GenAppTransparentDetach
UI_Detach
PASS: cx - GeoWorks GCNList to keep on, if any
(i.e. don't remove from this one).
Pass 0 to remove from all lists.
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppRemoveFromTransparentDetachLists proc far
uses ax, bx, cx, dx
.enter
;
; Take ourselves off the transparent detach lists, if we're on there
;
mov ax, GCNSLT_TRANSPARENT_DETACH
call GCNListRemoveIfNoMatch
mov ax, GCNSLT_TRANSPARENT_DETACH_FULL_SCREEN_EXCL
call GCNListRemoveIfNoMatch
mov ax, GCNSLT_TRANSPARENT_DETACH_DA
call GCNListRemoveIfNoMatch
.leave
ret
GenAppRemoveFromTransparentDetachLists endp
GCNListRemoveIfNoMatch proc near
cmp ax, cx
je done
push cx
call GetTransparentDetachListParams
call GCNListRemove
pop cx
done:
ret
GCNListRemoveIfNoMatch endp
GetTransparentDetachListParams proc near
uses si
.enter
clr bx
call GeodeGetAppObject
mov cx, bx
mov dx, si
mov bx, MANUFACTURER_ID_GEOWORKS
.leave
ret
GetTransparentDetachListParams endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppRemoveFromRemovableDiskList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Removes app obj from removable disk list, if it is on it
CALLED BY: INTERNAL
GenAppTransparentDetach
UI_Detach
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Chris 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppRemoveFromRemovableDiskList proc far
uses ax, bx, cx, dx
.enter
;
; Take ourselves off GCNSLT_REMOVABLE_DISK list, if we're on it.
;
call GetRemovableDiskListParams
call GCNListRemove
.leave
ret
GenAppRemoveFromRemovableDiskList endp
GenAppAddToRemovableDiskList proc far
uses ax, bx, cx, dx
.enter
;
; Add ourselves to the GCNSLT_REMOVABLE_DISK list, if we're not
; on it.
;
call GetRemovableDiskListParams
call GCNListAdd
.leave
ret
GenAppAddToRemovableDiskList endp
GetRemovableDiskListParams proc near
uses si
.enter
clr bx
call GeodeGetAppObject
mov cx, bx
mov dx, si
mov bx, MANUFACTURER_ID_GEOWORKS
mov ax, GCNSLT_REMOVABLE_DISK
.leave
ret
GetRemovableDiskListParams endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppUpdateTransparentDetachLists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update whether we're on ia transparent detach list or not
NOTE: Will not move us between lists, will just remove from
all or add to specific, so if something's changed *which* list
we should go on, object should be removed from all lists first,
before calling here.
CALLED BY: INTERNAL
PASS: *ds:si - GenApplication object
RETURN: nothing
DESTROYED: ax, bx, cx, dx, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Doug 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppUpdateTransparentDetachLists proc far uses es
.enter
mov ax, segment uiLaunchModel
mov es, ax
; If still starting up UI, then don't know launch model yet.
;
test es:[uiFlags], mask UIF_INIT
jnz done ; if still starting up, bail
; See if doing transparent detach
;
cmp es:[uiLaunchModel], UILM_TRANSPARENT
jne done ; if not, bail
; If actually using these things, call self to figure out which list
; we should be on.
;
mov ax, MSG_GEN_APPLICATION_GET_TRANSPARENT_DETACH_LIST
call ObjCallInstanceNoLock
tst ax
jz remove
push cx ; Remove from all lists but this one
call GenAppRemoveFromTransparentDetachLists
; The add ourselves to it, if not
; already on.
call GetTransparentDetachListParams
pop ax
call GCNListAdd
done:
.leave
ret
remove:
clr cx ; Remove from all lists
call GenAppRemoveFromTransparentDetachLists
jmp short done
GenAppUpdateTransparentDetachLists endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppGetTransparentDetachList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Fetch GeoWorks Transparent Detach GCN list this app should
be on/is on, if any.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - MSG_GEN_APP_GET_TRANSPARENT_DETACH_LIST
nothing
RETURN: ax - GeoWorks transparent detach GCN list app should be
placed on/is on, if any
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 5/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppGetTransparentDetachList method GenApplicationClass,
MSG_GEN_APPLICATION_GET_TRANSPARENT_DETACH_LIST
.enter
mov ax, segment uiLaunchModel
mov es, ax
; If still starting up UI, then don't know launch model yet.
;
test es:[uiFlags], mask UIF_INIT
jnz none ; if still starting up, bail
; See if doing transparent detach
;
cmp es:[uiLaunchModel], UILM_TRANSPARENT
jne none ; if not, bail
mov di, ds:[si]
add di, ds:[di].Gen_offset
; Can't be transparently detachable if we aren't open in app mode.
;
test ds:[di].GI_states, mask GS_USABLE
jz none
; Can't be transparently detachable if we have any IACP connections open
;
mov ax, MSG_GEN_APPLICATION_IACP_GET_NUMBER_OF_CONNECTIONS
call ObjCallInstanceNoLock
tst cx
jnz none
; Can't be transparently detachable if not interactable, avoiding
; transparent detach, or attaching or detaching in any form.
;
mov di, ds:[si]
add di, ds:[di].Gen_offset
test ds:[di].GAI_states, mask AS_NOT_USER_INTERACTABLE or \
mask AS_AVOID_TRANSPARENT_DETACH or \
mask AS_TRANSPARENT_DETACHING or \
mask AS_ATTACHING or \
mask AS_DETACHING or \
mask AS_QUIT_DETACHING
jnz none
mov cx, GCNSLT_TRANSPARENT_DETACH ; default
; Different logic for desk accessory & full screen apps
;
test ds:[di].GAI_launchFlags, mask ALF_DESK_ACCESSORY
jnz deskAccessory
;fullScreenApp:
test ds:[di].GAI_states, mask AS_HAS_FULL_SCREEN_EXCL
jz thisOne
mov cx, GCNSLT_TRANSPARENT_DETACH_FULL_SCREEN_EXCL
jmp short thisOne
deskAccessory:
; If we are a desk accessory, check to see if now floating, or
; hidden in back as a "cached" app.
;
mov ax, ATTR_GEN_WINDOW_CUSTOM_LAYER_PRIORITY
call ObjVarFindData
jnc thisOne ; if not found, place on full screen
; if found, full-screen list if low
; prio
cmp {LayerPriority} ds:[bx], LAYER_PRIO_STD
jae thisOne
; Otherwise, we've passed all the tests.
; We're up there where the user can
; see us, so put ourselves on the
; DA list.
mov cx, GCNSLT_TRANSPARENT_DETACH_DA
thisOne:
mov ax, cx ; Return GCN List
.leave
ret
none:
clr cx
jmp short thisOne
GenAppGetTransparentDetachList endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppGainedFullScreenExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Handle gaining of full screen excl
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - message
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppGainedFullScreenExcl method dynamic GenApplicationClass,
MSG_META_GAINED_FULL_SCREEN_EXCL
;
; send notification to GAGCNLT_FULL_SCREEN_EXCL_CHANGE list
;
call UpdateFullScreenExclGCN
mov ax, MSG_META_GAINED_FULL_SCREEN_EXCL
mov di, ds:[si]
add di, ds:[di].Gen_offset
ornf ds:[di].GAI_states, mask AS_HAS_FULL_SCREEN_EXCL
call GenAppAdjustTDLists
;
; Let the Mailbox library know there's a new foreground app in town.
;
mov bx, ds:[LMBH_handle]
call IACPPrepareMailboxNotify ; bxcxdx <- app's token
; si <- SST_MAILBOX
mov di, MSN_NEW_FOCUS_APP
call SysSendNotification
ret
GenAppGainedFullScreenExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateFullScreenExclGCN
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: update GAGCNLT_FULL_SCREEN_EXCL_CHANGE GCN list
CALLED BY: GenAppGainedFullScreenExcl, GenAppLostFullScreenExcl
PASS: ax - gained/lost message
RETURN: nothing
DESTROYED: ax, cx, dx, bp, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 6/ 5/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
UpdateFullScreenExclGCN proc near
mov di, mask MF_RECORD
call ObjMessage ; di = event
sub sp, size GCNListMessageParams
mov bp, sp
mov ss:[bp].GCNLMP_ID.GCNLT_manuf, MANUFACTURER_ID_GEOWORKS
mov ss:[bp].GCNLMP_ID.GCNLT_type, GAGCNLT_FULL_SCREEN_EXCL_CHANGE
mov ss:[bp].GCNLMP_block, 0
mov ss:[bp].GCNLMP_event, di
mov ss:[bp].GCNLMP_flags, 0
mov ax, MSG_META_GCN_LIST_SEND
call ObjCallInstanceNoLock
add sp, size GCNListMessageParams
ret
UpdateFullScreenExclGCN endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppLostFullScreenExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Handle gaining of full screen excl
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - message
RETURN: nothing
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppLostFullScreenExcl method dynamic GenApplicationClass,
MSG_META_LOST_FULL_SCREEN_EXCL
;
; dismiss help so that switching to new app won't confusingly leave
; old app's help dialog up - brianc 6/9/93
; (responder does this on GEN_BRING_TO_TOP, below)
;
push si, ax
mov bx, handle SysHelpObject
mov si, offset SysHelpObject
mov ax, MSG_GEN_INTERACTION_ACTIVATE_COMMAND
mov cx, IC_DISMISS
mov di, mask MF_FIXUP_DS
call ObjMessage
pop si, ax
mov di, ds:[si]
add di, ds:[di].Gen_offset
andnf ds:[di].GAI_states, not mask AS_HAS_FULL_SCREEN_EXCL
mov ax, MSG_META_LOST_FULL_SCREEN_EXCL
call GenAppAdjustTDLists
;
; send notification to GAGCNLT_FULL_SCREEN_EXCL_CHANGE list
;
mov ax, MSG_META_LOST_FULL_SCREEN_EXCL
call UpdateFullScreenExclGCN
ret
GenAppLostFullScreenExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GenAppAdjustTDLists
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: Update which GCN app detach list we're on, or whether we're
on one at all.
PASS: *ds:si - instance data
ds:di - ptr to start of master instance data
es - segment of class
ax - message
RETURN: per message
ALLOWED TO DESTROY:
bx, si, di, ds, es
PSEUDO CODE/STRATEGY/KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
doug 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GenAppAdjustTDLists method static GenApplicationClass,
MSG_GEN_BRING_TO_TOP,
MSG_GEN_LOWER_TO_BOTTOM
;;; (statically called from above) MSG_META_LOST_FULL_SCREEN_EXCL
;;; MSG_META_GAINED_FULL_SCREEN_EXCL
mov di, offset GenApplicationClass
call ObjCallSuperNoLock
; Remove, add back app to transparent detach list if appropriate,
; to put it at the back of the LRU queue
;
pushf ; why do we do this?
push ax, cx, dx, bp
clr cx ; Remove from all lists, as this
; designates a "use" & we wish to
; be added back onto the end of whatever
; list we're already on.
call GenAppRemoveFromTransparentDetachLists
call GenAppUpdateTransparentDetachLists
pop ax, cx, dx, bp
popf
ret
GenAppAdjustTDLists endm
AppDetach ends
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.