text
stringlengths
1
1.05M
// Copyright 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/autofill/android/personal_data_manager_android.h" #include <stddef.h> #include <algorithm> #include <memory> #include <utility> #include "base/android/jni_array.h" #include "base/android/jni_string.h" #include "base/command_line.h" #include "base/format_macros.h" #include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "chrome/browser/android/resource_mapper.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/autofill/validation_rules_storage_factory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/pref_names.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/content/browser/content_autofill_driver_factory.h" #include "components/autofill/core/browser/address_i18n.h" #include "components/autofill/core/browser/autofill_country.h" #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/autofill_type.h" #include "components/autofill/core/browser/country_names.h" #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/payments/full_card_request.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/validation.h" #include "components/autofill/core/common/autofill_constants.h" #include "components/autofill/core/common/autofill_pref_names.h" #include "components/autofill/core/common/autofill_switches.h" #include "components/prefs/pref_service.h" #include "content/public/browser/web_contents.h" #include "jni/PersonalDataManager_jni.h" #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" #include "ui/base/l10n/l10n_util.h" namespace autofill { namespace { using ::base::android::ConvertJavaStringToUTF8; using ::base::android::ConvertUTF16ToJavaString; using ::base::android::ConvertUTF8ToJavaString; using ::base::android::JavaParamRef; using ::base::android::ScopedJavaGlobalRef; using ::base::android::ScopedJavaLocalRef; Profile* GetProfile() { return ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); } PrefService* GetPrefs() { return GetProfile()->GetPrefs(); } ScopedJavaLocalRef<jobject> CreateJavaProfileFromNative( JNIEnv* env, const AutofillProfile& profile) { return Java_AutofillProfile_create( env, ConvertUTF8ToJavaString(env, profile.guid()), ConvertUTF8ToJavaString(env, profile.origin()), profile.record_type() == AutofillProfile::LOCAL_PROFILE, ConvertUTF16ToJavaString( env, profile.GetInfo(AutofillType(NAME_FULL), g_browser_process->GetApplicationLocale())), ConvertUTF16ToJavaString(env, profile.GetRawInfo(COMPANY_NAME)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_STREET_ADDRESS)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_STATE)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_CITY)), ConvertUTF16ToJavaString( env, profile.GetRawInfo(ADDRESS_HOME_DEPENDENT_LOCALITY)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_ZIP)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_SORTING_CODE)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(ADDRESS_HOME_COUNTRY)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)), ConvertUTF16ToJavaString(env, profile.GetRawInfo(EMAIL_ADDRESS)), ConvertUTF8ToJavaString(env, profile.language_code())); } void MaybeSetRawInfo(AutofillProfile* profile, autofill::ServerFieldType type, const base::android::JavaRef<jstring>& jstr) { if (!jstr.is_null()) profile->SetRawInfo(type, ConvertJavaStringToUTF16(jstr)); } void PopulateNativeProfileFromJava(const JavaParamRef<jobject>& jprofile, JNIEnv* env, AutofillProfile* profile) { profile->set_origin( ConvertJavaStringToUTF8(Java_AutofillProfile_getOrigin(env, jprofile))); profile->SetInfo( AutofillType(NAME_FULL), ConvertJavaStringToUTF16(Java_AutofillProfile_getFullName(env, jprofile)), g_browser_process->GetApplicationLocale()); MaybeSetRawInfo(profile, autofill::COMPANY_NAME, Java_AutofillProfile_getCompanyName(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_STREET_ADDRESS, Java_AutofillProfile_getStreetAddress(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_STATE, Java_AutofillProfile_getRegion(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_CITY, Java_AutofillProfile_getLocality(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, Java_AutofillProfile_getDependentLocality(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_ZIP, Java_AutofillProfile_getPostalCode(env, jprofile)); MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_SORTING_CODE, Java_AutofillProfile_getSortingCode(env, jprofile)); ScopedJavaLocalRef<jstring> country_code = Java_AutofillProfile_getCountryCode(env, jprofile); if (!country_code.is_null()) { profile->SetInfo(AutofillType(ADDRESS_HOME_COUNTRY), ConvertJavaStringToUTF16(country_code), g_browser_process->GetApplicationLocale()); } MaybeSetRawInfo(profile, autofill::PHONE_HOME_WHOLE_NUMBER, Java_AutofillProfile_getPhoneNumber(env, jprofile)); MaybeSetRawInfo(profile, autofill::EMAIL_ADDRESS, Java_AutofillProfile_getEmailAddress(env, jprofile)); profile->set_language_code(ConvertJavaStringToUTF8( Java_AutofillProfile_getLanguageCode(env, jprofile))); } ScopedJavaLocalRef<jobject> CreateJavaCreditCardFromNative( JNIEnv* env, const CreditCard& card) { const data_util::PaymentRequestData& payment_request_data = data_util::GetPaymentRequestData(card.network()); return Java_CreditCard_create( env, ConvertUTF8ToJavaString(env, card.guid()), ConvertUTF8ToJavaString(env, card.origin()), card.record_type() == CreditCard::LOCAL_CARD, card.record_type() == CreditCard::FULL_SERVER_CARD, ConvertUTF16ToJavaString(env, card.GetRawInfo(CREDIT_CARD_NAME_FULL)), ConvertUTF16ToJavaString(env, card.GetRawInfo(CREDIT_CARD_NUMBER)), ConvertUTF16ToJavaString(env, card.NetworkAndLastFourDigits()), ConvertUTF16ToJavaString(env, card.GetRawInfo(CREDIT_CARD_EXP_MONTH)), ConvertUTF16ToJavaString(env, card.GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR)), ConvertUTF8ToJavaString(env, payment_request_data.basic_card_issuer_network), ResourceMapper::MapFromChromiumId(payment_request_data.icon_resource_id), card.card_type(), ConvertUTF8ToJavaString(env, card.billing_address_id()), ConvertUTF8ToJavaString(env, card.server_id())); } void PopulateNativeCreditCardFromJava(const jobject& jcard, JNIEnv* env, CreditCard* card) { card->set_origin( ConvertJavaStringToUTF8(Java_CreditCard_getOrigin(env, jcard))); card->SetRawInfo( CREDIT_CARD_NAME_FULL, ConvertJavaStringToUTF16(Java_CreditCard_getName(env, jcard))); card->SetRawInfo( CREDIT_CARD_NUMBER, ConvertJavaStringToUTF16(Java_CreditCard_getNumber(env, jcard))); card->SetRawInfo( CREDIT_CARD_EXP_MONTH, ConvertJavaStringToUTF16(Java_CreditCard_getMonth(env, jcard))); card->SetRawInfo( CREDIT_CARD_EXP_4_DIGIT_YEAR, ConvertJavaStringToUTF16(Java_CreditCard_getYear(env, jcard))); card->set_billing_address_id( ConvertJavaStringToUTF8(Java_CreditCard_getBillingAddressId(env, jcard))); card->set_server_id( ConvertJavaStringToUTF8(Java_CreditCard_getServerId(env, jcard))); jint card_type = Java_CreditCard_getCardType(env, jcard); DCHECK_GE(CreditCard::CARD_TYPE_PREPAID, card_type); DCHECK_LE(CreditCard::CARD_TYPE_UNKNOWN, card_type); card->set_card_type(static_cast<CreditCard::CardType>(card_type)); // Only set the guid if it is an existing card (java guid not empty). // Otherwise, keep the generated one. std::string guid = ConvertJavaStringToUTF8(Java_CreditCard_getGUID(env, jcard)); if (!guid.empty()) card->set_guid(guid); if (Java_CreditCard_getIsLocal(env, jcard)) { card->set_record_type(CreditCard::LOCAL_CARD); } else { if (Java_CreditCard_getIsCached(env, jcard)) { card->set_record_type(CreditCard::FULL_SERVER_CARD); } else { card->set_record_type(CreditCard::MASKED_SERVER_CARD); card->SetNetworkForMaskedCard( data_util::GetIssuerNetworkForBasicCardIssuerNetwork( ConvertJavaStringToUTF8( env, Java_CreditCard_getBasicCardIssuerNetwork(env, jcard)))); } } } // Self-deleting requester of full card details, including full PAN and the CVC // number. class FullCardRequester : public payments::FullCardRequest::ResultDelegate, public base::SupportsWeakPtr<FullCardRequester> { public: FullCardRequester() {} // Takes ownership of |card|. void GetFullCard(JNIEnv* env, const base::android::JavaParamRef<jobject>& jweb_contents, const base::android::JavaParamRef<jobject>& jdelegate, std::unique_ptr<CreditCard> card) { card_ = std::move(card); jdelegate_.Reset(env, jdelegate); if (!card_) { OnFullCardRequestFailed(); return; } content::WebContents* contents = content::WebContents::FromJavaWebContents(jweb_contents); if (!contents) { OnFullCardRequestFailed(); return; } ContentAutofillDriverFactory* factory = ContentAutofillDriverFactory::FromWebContents(contents); if (!factory) { OnFullCardRequestFailed(); return; } ContentAutofillDriver* driver = factory->DriverForFrame(contents->GetMainFrame()); if (!driver) { OnFullCardRequestFailed(); return; } driver->autofill_manager()->GetOrCreateFullCardRequest()->GetFullCard( *card_, AutofillClient::UNMASK_FOR_PAYMENT_REQUEST, AsWeakPtr(), driver->autofill_manager()->GetAsFullCardRequestUIDelegate()); } private: ~FullCardRequester() override {} // payments::FullCardRequest::ResultDelegate: void OnFullCardRequestSucceeded(const CreditCard& card, const base::string16& cvc) override { JNIEnv* env = base::android::AttachCurrentThread(); Java_FullCardRequestDelegate_onFullCardDetails( env, jdelegate_, CreateJavaCreditCardFromNative(env, card), base::android::ConvertUTF16ToJavaString(env, cvc)); delete this; } // payments::FullCardRequest::ResultDelegate: void OnFullCardRequestFailed() override { JNIEnv* env = base::android::AttachCurrentThread(); Java_FullCardRequestDelegate_onFullCardError(env, jdelegate_); delete this; } std::unique_ptr<CreditCard> card_; ScopedJavaGlobalRef<jobject> jdelegate_; DISALLOW_COPY_AND_ASSIGN(FullCardRequester); }; class AndroidAddressNormalizerDelegate : public ::payments::AddressNormalizer::Delegate, public base::SupportsWeakPtr<AndroidAddressNormalizerDelegate> { public: AndroidAddressNormalizerDelegate( JNIEnv* env, const base::android::JavaParamRef<jobject>& jdelegate) { jdelegate_.Reset(env, jdelegate); } void OnAddressNormalized(const AutofillProfile& normalized_profile) override { JNIEnv* env = base::android::AttachCurrentThread(); Java_NormalizedAddressRequestDelegate_onAddressNormalized( env, jdelegate_, CreateJavaProfileFromNative(env, normalized_profile)); delete this; } void OnCouldNotNormalize(const AutofillProfile& profile) override { JNIEnv* env = base::android::AttachCurrentThread(); Java_NormalizedAddressRequestDelegate_onCouldNotNormalize( env, jdelegate_, CreateJavaProfileFromNative(env, profile)); delete this; } private: ~AndroidAddressNormalizerDelegate() override {} ScopedJavaGlobalRef<jobject> jdelegate_; DISALLOW_COPY_AND_ASSIGN(AndroidAddressNormalizerDelegate); }; void OnSubKeysReceived(ScopedJavaGlobalRef<jobject> jdelegate, const std::vector<std::string>& subkeys_codes, const std::vector<std::string>& subkeys_names) { JNIEnv* env = base::android::AttachCurrentThread(); Java_GetSubKeysRequestDelegate_onSubKeysReceived( env, jdelegate, base::android::ToJavaArrayOfStrings(env, subkeys_codes), base::android::ToJavaArrayOfStrings(env, subkeys_names)); } } // namespace PersonalDataManagerAndroid::PersonalDataManagerAndroid(JNIEnv* env, jobject obj) : weak_java_obj_(env, obj), personal_data_manager_(PersonalDataManagerFactory::GetForProfile( ProfileManager::GetActiveUserProfile())), address_normalizer_( std::unique_ptr<::i18n::addressinput::Source>( new autofill::ChromeMetadataSource( I18N_ADDRESS_VALIDATION_DATA_URL, personal_data_manager_->GetURLRequestContextGetter())), ValidationRulesStorageFactory::CreateStorage()), subkey_requester_( base::MakeUnique<autofill::ChromeMetadataSource>( I18N_ADDRESS_VALIDATION_DATA_URL, personal_data_manager_->GetURLRequestContextGetter()), ValidationRulesStorageFactory::CreateStorage()) { personal_data_manager_->AddObserver(this); } PersonalDataManagerAndroid::~PersonalDataManagerAndroid() { personal_data_manager_->RemoveObserver(this); } jboolean PersonalDataManagerAndroid::IsDataLoaded( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) const { return personal_data_manager_->IsDataLoaded(); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileGUIDsForSettings( JNIEnv* env, const JavaParamRef<jobject>& unused_obj) { return GetProfileGUIDs(env, personal_data_manager_->GetProfiles()); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileGUIDsToSuggest( JNIEnv* env, const JavaParamRef<jobject>& unused_obj) { return GetProfileGUIDs(env, personal_data_manager_->GetProfilesToSuggest()); } ScopedJavaLocalRef<jobject> PersonalDataManagerAndroid::GetProfileByGUID( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid) { AutofillProfile* profile = personal_data_manager_->GetProfileByGUID( ConvertJavaStringToUTF8(env, jguid)); if (!profile) return ScopedJavaLocalRef<jobject>(); return CreateJavaProfileFromNative(env, *profile); } ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::SetProfile( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jprofile) { std::string guid = ConvertJavaStringToUTF8( env, Java_AutofillProfile_getGUID(env, jprofile).obj()); AutofillProfile profile; PopulateNativeProfileFromJava(jprofile, env, &profile); if (guid.empty()) { personal_data_manager_->AddProfile(profile); } else { profile.set_guid(guid); personal_data_manager_->UpdateProfile(profile); } return ConvertUTF8ToJavaString(env, profile.guid()); } ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::SetProfileToLocal( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jprofile) { AutofillProfile profile; PopulateNativeProfileFromJava(jprofile, env, &profile); AutofillProfile* target_profile = personal_data_manager_->GetProfileByGUID(ConvertJavaStringToUTF8( env, Java_AutofillProfile_getGUID(env, jprofile).obj())); if (target_profile != nullptr && target_profile->record_type() == AutofillProfile::LOCAL_PROFILE) { profile.set_guid(target_profile->guid()); personal_data_manager_->UpdateProfile(profile); } else { personal_data_manager_->AddProfile(profile); } return ConvertUTF8ToJavaString(env, profile.guid()); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabelsForSettings( JNIEnv* env, const JavaParamRef<jobject>& unused_obj) { return GetProfileLabels(env, false /* address_only */, false /* include_name_in_label */, true /* include_organization_in_label */, true /* include_country_in_label */, personal_data_manager_->GetProfiles()); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabelsToSuggest( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, jboolean include_name_in_label, jboolean include_organization_in_label, jboolean include_country_in_label) { return GetProfileLabels(env, true /* address_only */, include_name_in_label, include_organization_in_label, include_country_in_label, personal_data_manager_->GetProfilesToSuggest()); } base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::GetShippingAddressLabelWithCountryForPaymentRequest( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jobject>& jprofile) { return GetShippingAddressLabelForPaymentRequest( env, jprofile, true /* include_country_in_label */); } base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid:: GetShippingAddressLabelWithoutCountryForPaymentRequest( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jobject>& jprofile) { return GetShippingAddressLabelForPaymentRequest( env, jprofile, false /* include_country_in_label */); } base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::GetBillingAddressLabelForPaymentRequest( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jobject>& jprofile) { // The company name and country are not included in the billing address label. std::vector<ServerFieldType> label_fields; label_fields.push_back(NAME_FULL); label_fields.push_back(ADDRESS_HOME_LINE1); label_fields.push_back(ADDRESS_HOME_LINE2); label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); label_fields.push_back(ADDRESS_HOME_CITY); label_fields.push_back(ADDRESS_HOME_STATE); label_fields.push_back(ADDRESS_HOME_ZIP); label_fields.push_back(ADDRESS_HOME_SORTING_CODE); AutofillProfile profile; PopulateNativeProfileFromJava(jprofile, env, &profile); return ConvertUTF16ToJavaString( env, profile.ConstructInferredLabel( label_fields, label_fields.size(), g_browser_process->GetApplicationLocale())); } base::android::ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDsForSettings( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCards()); } base::android::ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDsToSuggest( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { return GetCreditCardGUIDs(env, personal_data_manager_->GetCreditCardsToSuggest()); } ScopedJavaLocalRef<jobject> PersonalDataManagerAndroid::GetCreditCardByGUID( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid) { CreditCard* card = personal_data_manager_->GetCreditCardByGUID( ConvertJavaStringToUTF8(env, jguid)); if (!card) return ScopedJavaLocalRef<jobject>(); return CreateJavaCreditCardFromNative(env, *card); } ScopedJavaLocalRef<jobject> PersonalDataManagerAndroid::GetCreditCardForNumber( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jcard_number) { // A local card with empty GUID. CreditCard card("", ""); card.SetNumber(ConvertJavaStringToUTF16(env, jcard_number)); return CreateJavaCreditCardFromNative(env, card); } ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::SetCreditCard( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jcard) { std::string guid = ConvertJavaStringToUTF8(env, Java_CreditCard_getGUID(env, jcard).obj()); CreditCard card; PopulateNativeCreditCardFromJava(jcard, env, &card); if (guid.empty()) { personal_data_manager_->AddCreditCard(card); } else { card.set_guid(guid); personal_data_manager_->UpdateCreditCard(card); } return ConvertUTF8ToJavaString(env, card.guid()); } void PersonalDataManagerAndroid::UpdateServerCardBillingAddress( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jcard) { CreditCard card; PopulateNativeCreditCardFromJava(jcard, env, &card); personal_data_manager_->UpdateServerCardMetadata(card); } ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::GetBasicCardIssuerNetwork( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jcard_number, const jboolean jempty_if_invalid) { base::string16 card_number = ConvertJavaStringToUTF16(env, jcard_number); if (static_cast<bool>(jempty_if_invalid) && !IsValidCreditCardNumber(card_number)) { return ConvertUTF8ToJavaString(env, ""); } return ConvertUTF8ToJavaString( env, data_util::GetPaymentRequestData(CreditCard::GetCardNetwork(card_number)) .basic_card_issuer_network); } void PersonalDataManagerAndroid::AddServerCreditCardForTest( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jobject>& jcard) { std::unique_ptr<CreditCard> card = base::MakeUnique<CreditCard>(); PopulateNativeCreditCardFromJava(jcard, env, card.get()); card->set_record_type(CreditCard::MASKED_SERVER_CARD); personal_data_manager_->AddServerCreditCardForTest(std::move(card)); personal_data_manager_->NotifyPersonalDataChangedForTest(); } void PersonalDataManagerAndroid::RemoveByGUID( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid) { personal_data_manager_->RemoveByGUID(ConvertJavaStringToUTF8(env, jguid)); } void PersonalDataManagerAndroid::ClearUnmaskedCache( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& guid) { personal_data_manager_->ResetFullServerCard( ConvertJavaStringToUTF8(env, guid)); } void PersonalDataManagerAndroid::GetFullCardForPaymentRequest( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jweb_contents, const JavaParamRef<jobject>& jcard, const JavaParamRef<jobject>& jdelegate) { std::unique_ptr<CreditCard> card = base::MakeUnique<CreditCard>(); PopulateNativeCreditCardFromJava(jcard, env, card.get()); // Self-deleting object. (new FullCardRequester()) ->GetFullCard(env, jweb_contents, jdelegate, std::move(card)); } void PersonalDataManagerAndroid::OnPersonalDataChanged() { JNIEnv* env = base::android::AttachCurrentThread(); auto java_obj = weak_java_obj_.get(env); if (java_obj.is_null()) return; Java_PersonalDataManager_personalDataChanged(env, java_obj); } void PersonalDataManagerAndroid::RecordAndLogProfileUse( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid) { AutofillProfile* profile = personal_data_manager_->GetProfileByGUID( ConvertJavaStringToUTF8(env, jguid)); if (profile) personal_data_manager_->RecordUseOf(*profile); } void PersonalDataManagerAndroid::SetProfileUseStatsForTesting( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid, jint count, jint date) { DCHECK(count >= 0 && date >= 0); AutofillProfile* profile = personal_data_manager_->GetProfileByGUID( ConvertJavaStringToUTF8(env, jguid)); profile->set_use_count(static_cast<size_t>(count)); profile->set_use_date(base::Time::FromTimeT(date)); personal_data_manager_->NotifyPersonalDataChangedForTest(); } jint PersonalDataManagerAndroid::GetProfileUseCountForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jguid) { AutofillProfile* profile = personal_data_manager_->GetProfileByGUID( ConvertJavaStringToUTF8(env, jguid)); return profile->use_count(); } jlong PersonalDataManagerAndroid::GetProfileUseDateForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jguid) { AutofillProfile* profile = personal_data_manager_->GetProfileByGUID( ConvertJavaStringToUTF8(env, jguid)); return profile->use_date().ToTimeT(); } void PersonalDataManagerAndroid::RecordAndLogCreditCardUse( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid) { CreditCard* card = personal_data_manager_->GetCreditCardByGUID( ConvertJavaStringToUTF8(env, jguid)); if (card) personal_data_manager_->RecordUseOf(*card); } void PersonalDataManagerAndroid::SetCreditCardUseStatsForTesting( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jguid, jint count, jint date) { DCHECK(count >= 0 && date >= 0); CreditCard* card = personal_data_manager_->GetCreditCardByGUID( ConvertJavaStringToUTF8(env, jguid)); card->set_use_count(static_cast<size_t>(count)); card->set_use_date(base::Time::FromTimeT(date)); personal_data_manager_->NotifyPersonalDataChangedForTest(); } jint PersonalDataManagerAndroid::GetCreditCardUseCountForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jguid) { CreditCard* card = personal_data_manager_->GetCreditCardByGUID( ConvertJavaStringToUTF8(env, jguid)); return card->use_count(); } jlong PersonalDataManagerAndroid::GetCreditCardUseDateForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jguid) { CreditCard* card = personal_data_manager_->GetCreditCardByGUID( ConvertJavaStringToUTF8(env, jguid)); return card->use_date().ToTimeT(); } // TODO(crbug.com/629507): Use a mock clock for testing. jlong PersonalDataManagerAndroid::GetCurrentDateForTesting( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { return base::Time::Now().ToTimeT(); } void PersonalDataManagerAndroid::LoadRulesForAddressNormalization( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jregion_code) { address_normalizer_.LoadRulesForRegion( ConvertJavaStringToUTF8(env, jregion_code)); } void PersonalDataManagerAndroid::LoadRulesForSubKeys( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj, const base::android::JavaParamRef<jstring>& jregion_code) { subkey_requester_.LoadRulesForRegion( ConvertJavaStringToUTF8(env, jregion_code)); } void PersonalDataManagerAndroid::StartAddressNormalization( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jobject>& jprofile, const JavaParamRef<jstring>& jregion_code, jint jtimeout_seconds, const JavaParamRef<jobject>& jdelegate) { const std::string region_code = ConvertJavaStringToUTF8(env, jregion_code); AutofillProfile profile; PopulateNativeProfileFromJava(jprofile, env, &profile); // Self-deleting object. AndroidAddressNormalizerDelegate* requester = new AndroidAddressNormalizerDelegate(env, jdelegate); // Start the normalization. address_normalizer_.StartAddressNormalization(profile, region_code, jtimeout_seconds, requester); } jboolean PersonalDataManagerAndroid::HasProfiles( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { return !personal_data_manager_->GetProfiles().empty(); } jboolean PersonalDataManagerAndroid::HasCreditCards( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { return !personal_data_manager_->GetCreditCards().empty(); } void PersonalDataManagerAndroid::StartRegionSubKeysRequest( JNIEnv* env, const JavaParamRef<jobject>& unused_obj, const JavaParamRef<jstring>& jregion_code, jint jtimeout_seconds, const JavaParamRef<jobject>& jdelegate) { const std::string region_code = ConvertJavaStringToUTF8(env, jregion_code); ScopedJavaGlobalRef<jobject> my_jdelegate; my_jdelegate.Reset(env, jdelegate); ::payments::SubKeyReceiverCallback cb = base::BindOnce( &OnSubKeysReceived, ScopedJavaGlobalRef<jobject>(my_jdelegate)); std::string language = l10n_util::GetLanguage(g_browser_process->GetApplicationLocale()); subkey_requester_.StartRegionSubKeysRequest(region_code, language, jtimeout_seconds, std::move(cb)); } void PersonalDataManagerAndroid::CancelPendingGetSubKeys( JNIEnv* env, const base::android::JavaParamRef<jobject>& unused_obj) { subkey_requester_.CancelPendingGetSubKeys(); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileGUIDs( JNIEnv* env, const std::vector<AutofillProfile*>& profiles) { std::vector<base::string16> guids; for (AutofillProfile* profile : profiles) guids.push_back(base::UTF8ToUTF16(profile->guid())); return base::android::ToJavaArrayOfStrings(env, guids); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetCreditCardGUIDs( JNIEnv* env, const std::vector<CreditCard*>& credit_cards) { std::vector<base::string16> guids; for (CreditCard* credit_card : credit_cards) guids.push_back(base::UTF8ToUTF16(credit_card->guid())); return base::android::ToJavaArrayOfStrings(env, guids); } ScopedJavaLocalRef<jobjectArray> PersonalDataManagerAndroid::GetProfileLabels( JNIEnv* env, bool address_only, bool include_name_in_label, bool include_organization_in_label, bool include_country_in_label, std::vector<AutofillProfile*> profiles) { std::unique_ptr<std::vector<ServerFieldType>> suggested_fields; size_t minimal_fields_shown = 2; if (address_only) { suggested_fields = base::MakeUnique<std::vector<ServerFieldType>>(); if (include_name_in_label) suggested_fields->push_back(NAME_FULL); if (include_organization_in_label) suggested_fields->push_back(COMPANY_NAME); suggested_fields->push_back(ADDRESS_HOME_LINE1); suggested_fields->push_back(ADDRESS_HOME_LINE2); suggested_fields->push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); suggested_fields->push_back(ADDRESS_HOME_CITY); suggested_fields->push_back(ADDRESS_HOME_STATE); suggested_fields->push_back(ADDRESS_HOME_ZIP); suggested_fields->push_back(ADDRESS_HOME_SORTING_CODE); if (include_country_in_label) suggested_fields->push_back(ADDRESS_HOME_COUNTRY); minimal_fields_shown = suggested_fields->size(); } ServerFieldType excluded_field = include_name_in_label ? UNKNOWN_TYPE : NAME_FULL; std::vector<base::string16> labels; AutofillProfile::CreateInferredLabels( profiles, suggested_fields.get(), excluded_field, minimal_fields_shown, g_browser_process->GetApplicationLocale(), &labels); return base::android::ToJavaArrayOfStrings(env, labels); } base::android::ScopedJavaLocalRef<jstring> PersonalDataManagerAndroid::GetShippingAddressLabelForPaymentRequest( JNIEnv* env, const base::android::JavaParamRef<jobject>& jprofile, bool include_country_in_label) { // The full name is not included in the label for shipping address. It is // added separately instead. std::vector<ServerFieldType> label_fields; label_fields.push_back(COMPANY_NAME); label_fields.push_back(ADDRESS_HOME_LINE1); label_fields.push_back(ADDRESS_HOME_LINE2); label_fields.push_back(ADDRESS_HOME_DEPENDENT_LOCALITY); label_fields.push_back(ADDRESS_HOME_CITY); label_fields.push_back(ADDRESS_HOME_STATE); label_fields.push_back(ADDRESS_HOME_ZIP); label_fields.push_back(ADDRESS_HOME_SORTING_CODE); if (include_country_in_label) label_fields.push_back(ADDRESS_HOME_COUNTRY); AutofillProfile profile; PopulateNativeProfileFromJava(jprofile, env, &profile); return ConvertUTF16ToJavaString( env, profile.ConstructInferredLabel( label_fields, label_fields.size(), g_browser_process->GetApplicationLocale())); } // Returns whether the Autofill feature is enabled. static jboolean IsAutofillEnabled(JNIEnv* env, const JavaParamRef<jclass>& clazz) { return GetPrefs()->GetBoolean(autofill::prefs::kAutofillEnabled); } // Enables or disables the Autofill feature. static void SetAutofillEnabled(JNIEnv* env, const JavaParamRef<jclass>& clazz, jboolean enable) { GetPrefs()->SetBoolean(autofill::prefs::kAutofillEnabled, enable); } // Returns whether the Autofill feature is managed. static jboolean IsAutofillManaged(JNIEnv* env, const JavaParamRef<jclass>& clazz) { return GetPrefs()->IsManagedPreference(autofill::prefs::kAutofillEnabled); } // Returns whether the Payments integration feature is enabled. static jboolean IsPaymentsIntegrationEnabled( JNIEnv* env, const JavaParamRef<jclass>& clazz) { return GetPrefs()->GetBoolean(autofill::prefs::kAutofillWalletImportEnabled); } // Enables or disables the Payments integration feature. static void SetPaymentsIntegrationEnabled(JNIEnv* env, const JavaParamRef<jclass>& clazz, jboolean enable) { GetPrefs()->SetBoolean(autofill::prefs::kAutofillWalletImportEnabled, enable); } // Returns an ISO 3166-1-alpha-2 country code for a |jcountry_name| using // the application locale, or an empty string. static ScopedJavaLocalRef<jstring> ToCountryCode( JNIEnv* env, const JavaParamRef<jclass>& clazz, const JavaParamRef<jstring>& jcountry_name) { return ConvertUTF8ToJavaString( env, CountryNames::GetInstance()->GetCountryCode( base::android::ConvertJavaStringToUTF16(env, jcountry_name))); } static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { PersonalDataManagerAndroid* personal_data_manager_android = new PersonalDataManagerAndroid(env, obj); return reinterpret_cast<intptr_t>(personal_data_manager_android); } } // namespace autofill
;================================================================= ; ; Copyright (c) 2014, Teriks ; ; All rights reserved. ; ; libasm_io is distributed under the following BSD 3-Clause License ; ; Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; ; 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from ; this software without specific prior written permission. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ; HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ; ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ; ;================================================================== ;the following is defined when the library examples are being built with the library %ifdef _LIBASM_IO_BUILDING_ ;if the library build system is building the examples, then an option to NASM specifies the directory ;to find this include, so we can include it by its name only %include "libasm_io.inc" %else ;otherwise if this code is compiled against the already installed library ;it's header needs to be included from its installed location %include "/usr/local/include/libasm_io.inc" %endif ;main gets called by the C runtime library, so it needs to be global to let the linker find it ;the cglobal macro from the library is used to add an underscore to the front of main if needed ;some platforms (Like Mac) use underscores in front of all their C library symbols ;the macro also defines main as _main if an underscore is needed, so we can reference it as 'main' ;consistently across platforms cglobal main section .data instructions: db "Type the name of a file to write to and hit enter.",10,0 instructions2: db 10,"Type what you want to write to the file and hit enter.",10,0 failure_message: db 10,"The file was not written successfully.",10 db "maybe you don't have permission to write to the specified location?",10,0 section .text main: ;set up a new stack frame, first save the old stack base pointer by pushing it push rbp ;then slide the base of the stack down to RSP by moving RSP into RBP mov rbp, rsp ;Windows requires a minimum of 32 bytes on the stack before calling any other functions ;so this is for compatibility, its perfectly valid on Linux and Mac also sub rsp, 32 ;move a pointer to our initial instructions string into RDI so we can print it with print_string ;this just tells the user to type the name of the file they want to write to mov rdi, QWORD instructions call print_string ;read a string from the console using read_string, this string will be the file name ;we will have to call free_mem on the pointer it returns later when we are done with it call read_string ;save the file name pointer on the stack at RSP so we can access it later mov [rsp], rax ;move our second instructions message into RDI so we can print it ;this message tells the user to type in some text to write to the file mov rdi, QWORD instructions2 call print_string ;call read_string so we can read some text from the console, to be written to the file call read_string ;save the result of read_string (the file content string) ;on the stack in a second location, so we can access it later mov [rsp+8], rax ;move the file name string pointer we stored on the stack into RDI, so it can be ;used as the first parameter of write_file mov rdi, [rsp] ;move the file content string pointer we stored on the stack into RSI, so it can be ;used as the second parameter to write_file mov rsi, [rsp+8] ;call write_file to write the file ;the first parameter of write_file is RDI (pointer to file name string) ;and the second parameter of write_file is RSI (pointer to file content string) call write_file ;move the success code into memory, so we can tell the user if the file was written successfully or not mov [rsp+16], rax ;write_file may have modified RDI and RSI so we need to move the file name string and file content string ;back into registers from the stack so we can call free_mem on them, as they both use dynamically allocated memory ;move the file name pointer into RDI and call free_mem on it mov rdi, [rsp] call free_mem ;move the file content pointer into RDI and call free_mem on it mov rdi, [rsp+8] call free_mem ;print a failure message if the file was not written successfully cmp QWORD [rsp+16],1 ; 1 = success je .success mov rdi, QWORD failure_message call print_string .success: ;restore the stack frame of the function that called this function ;first add back the amount that we subtracted from RSP ;including any additional subtractions we made to RSP after the initial one (just sum them) add rsp, 32 ;after we add what we subtracted back to RSP, the value of RBP we pushed is the only thing left ;so we pop it back into RBP to restore the stack base pointer pop rbp ret
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * ***** END GPL LICENSE BLOCK ***** */ /** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp * \ingroup freestyle */ #include "BPy_EqualToTimeStampUP1D.h" #ifdef __cplusplus extern "C" { #endif /////////////////////////////////////////////////////////////////////////////////////////// //------------------------INSTANCE METHODS ---------------------------------- static char EqualToTimeStampUP1D___doc__[] = "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`EqualToTimeStampUP1D`\n" "\n" ".. method:: __init__(ts)\n" "\n" " Builds a EqualToTimeStampUP1D object.\n" "\n" " :arg ts: A time stamp value.\n" " :type ts: int\n" "\n" ".. method:: __call__(inter)\n" "\n" " Returns true if the Interface1D's time stamp is equal to a certain\n" " user-defined value.\n" "\n" " :arg inter: An Interface1D object.\n" " :type inter: :class:`freestyle.types.Interface1D`\n" " :return: True if the time stamp is equal to a user-defined value.\n" " :rtype: bool\n"; static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, PyObject *args, PyObject *kwds) { static const char *kwlist[] = {"ts", NULL}; unsigned u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) return -1; self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); return 0; } /*-----------------------BPy_EqualToTimeStampUP1D type definition ------------------------------*/ PyTypeObject EqualToTimeStampUP1D_Type = { PyVarObject_HEAD_INIT(NULL, 0) "EqualToTimeStampUP1D", /* tp_name */ sizeof(BPy_EqualToTimeStampUP1D), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_reserved */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ EqualToTimeStampUP1D___doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &UnaryPredicate1D_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)EqualToTimeStampUP1D___init__, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif
#pragma once #include "Vertex.hpp" #include <span> namespace oeng { inline namespace rhi { class RHITexture; class RHIMesh; class RHIShader; class RHIWindow; class RHI_API DynamicRHI { public: virtual ~DynamicRHI() = default; [[nodiscard]] static DynamicRHI& Get() noexcept; [[nodiscard]] virtual RHITexture* CreateTexture(Vec2i size, int channels, const unsigned char* pixels) const = 0; [[nodiscard]] virtual RHIMesh* CreateMesh(std::span<const Vertex> vertices, std::span<const Vec3u16> indices) const = 0; [[nodiscard]] virtual RHIShader* CreateShader(const char* vertex_shader, const char* frag_shader) const = 0; [[nodiscard]] virtual RHIWindow* CreateWindow(const char8_t* title, int x, int y, int w, int h, unsigned flags) = 0; virtual void PreDraw3D() const noexcept = 0; virtual void PreDraw2D() const noexcept = 0; }; } // namespace rhi } // namespace oeng
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r14 push %r9 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x5489, %r14 nop nop nop cmp %rax, %rax mov $0x6162636465666768, %r9 movq %r9, (%r14) nop nop nop nop nop inc %rbx lea addresses_WC_ht+0x1a699, %r14 nop nop nop and $3389, %rbx mov (%r14), %r13 xor $28499, %rbx lea addresses_A_ht+0xe989, %r11 nop xor $6486, %rdx mov $0x6162636465666768, %rax movq %rax, (%r11) sub %rbx, %rbx lea addresses_UC_ht+0x605d, %rsi lea addresses_WC_ht+0x749c, %rdi nop nop nop nop sub %r11, %r11 mov $75, %rcx rep movsb nop nop dec %rbx lea addresses_normal_ht+0x16f69, %rdx nop cmp %r13, %r13 mov $0x6162636465666768, %rax movq %rax, (%rdx) xor $2837, %rcx lea addresses_A_ht+0x1ab29, %rsi lea addresses_A_ht+0x2ac1, %rdi clflush (%rdi) nop nop and %rbx, %rbx mov $72, %rcx rep movsl nop and $62981, %rsi lea addresses_D_ht+0x6869, %r13 clflush (%r13) nop nop nop add %rsi, %rsi movb $0x61, (%r13) nop nop xor %rdx, %rdx lea addresses_A_ht+0x5769, %r11 sub $51860, %rsi mov $0x6162636465666768, %rcx movq %rcx, (%r11) nop nop cmp $1198, %r14 lea addresses_WC_ht+0x3bc5, %rsi lea addresses_normal_ht+0x1ad1d, %rdi clflush (%rdi) nop nop nop nop xor %rdx, %rdx mov $43, %rcx rep movsb nop sub $15770, %r11 lea addresses_WT_ht+0xa839, %rsi lea addresses_normal_ht+0x18f69, %rdi nop sub %r14, %r14 mov $59, %rcx rep movsq nop cmp %rdx, %rdx lea addresses_WC_ht+0x1afe9, %rsi lea addresses_D_ht+0x1b519, %rdi nop nop nop nop nop and $40538, %rdx mov $52, %rcx rep movsq sub %rcx, %rcx lea addresses_normal_ht+0x9169, %r13 nop nop and $60977, %rcx movb $0x61, (%r13) nop nop nop nop nop cmp %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r14 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %rax push %rdi // Faulty Load lea addresses_US+0x1c769, %rax nop add %r15, %r15 mov (%rax), %r13d lea oracles, %rdi and $0xff, %r13 shlq $12, %r13 mov (%rdi,%r13,1), %r13 pop %rdi pop %rax pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'src': {'same': False, 'congruent': 0, 'NT': True, 'type': 'addresses_US', 'size': 8, 'AVXalign': True}, 'OP': 'LOAD'} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_US', 'size': 4, 'AVXalign': True}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True}} {'src': {'same': True, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 11, 'NT': False, 'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False}} {'00': 131} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
; A118948: n-th (starting from the right) decimal digit of 13^n. ; Submitted by Jon Maiga ; 3,6,1,8,7,8,2,1,6,7,9,2,2,3,1,5,5,4,1,0,0,1,5,8,6,3,5,2,3,9,9,7,1,9,8,2,0,1,7,8,5,8,1,0,8,8,5,6,4,2,9,3,5,6,3,2,0,6,1,1,3,4,6,6,9,5,7,4,4,4,9,6,7,8,5,2,7,4,9,0,5,6,9,5,7,5,8,1,3,9,6,3,8,1,2,9,3,7,9 mov $1,10 pow $1,$0 add $0,1 mov $2,13 pow $2,$0 div $2,$1 mov $0,$2 mod $0,10
#include "pch.h" #include "ColumnSet.h" #include "Column.h" #include "ParseUtil.h" #include "Image.h" #include "TextBlock.h" using namespace AdaptiveSharedNamespace; ColumnSet::ColumnSet() : BaseCardElement(CardElementType::ColumnSet), m_style(ContainerStyle::None) { PopulateKnownPropertiesSet(); } const std::vector<std::shared_ptr<Column>>& ColumnSet::GetColumns() const { return m_columns; } std::vector<std::shared_ptr<Column>>& ColumnSet::GetColumns() { return m_columns; } std::shared_ptr<BaseActionElement> ColumnSet::GetSelectAction() const { return m_selectAction; } void ColumnSet::SetSelectAction(const std::shared_ptr<BaseActionElement> action) { m_selectAction = action; } ContainerStyle ColumnSet::GetStyle() const { return m_style; } void ColumnSet::SetStyle(const ContainerStyle value) { m_style = value; } void ColumnSet::SetLanguage(const std::string& language) { for (auto& column : m_columns) { column->SetLanguage(language); } } Json::Value ColumnSet::SerializeToJsonValue() const { Json::Value root = BaseCardElement::SerializeToJsonValue(); std::string const& propertyName = AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::Columns); root[propertyName] = Json::Value(Json::arrayValue); for (const auto& column : m_columns) { root[propertyName].append(column->SerializeToJsonValue()); } if (m_selectAction != nullptr) { root[AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::SelectAction)] = BaseCardElement::SerializeSelectAction(m_selectAction); } if (m_style != ContainerStyle::None) { root[AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::Style)] = ContainerStyleToString(m_style); } return root; } std::shared_ptr<BaseCardElement> ColumnSetParser::Deserialize(ParseContext& context, const Json::Value& value) { ParseUtil::ExpectTypeString(value, CardElementType::ColumnSet); auto container = BaseCardElement::Deserialize<ColumnSet>(context, value); // Parse Columns auto cardElements = ParseUtil::GetElementCollectionOfSingleType<Column>(context, value, AdaptiveCardSchemaKey::Columns, Column::Deserialize, false); container->m_columns = std::move(cardElements); // Parse optional selectAction container->SetSelectAction(ParseUtil::GetAction(context, value, AdaptiveCardSchemaKey::SelectAction, false)); container->SetStyle(ParseUtil::GetEnumValue<ContainerStyle>(value, AdaptiveCardSchemaKey::Style, ContainerStyle::None, ContainerStyleFromString)); return container; } std::shared_ptr<BaseCardElement> ColumnSetParser::DeserializeFromString(ParseContext& context, const std::string& jsonString) { return ColumnSetParser::Deserialize(context, ParseUtil::GetJsonValueFromString(jsonString)); } void ColumnSet::PopulateKnownPropertiesSet() { m_knownProperties.insert({AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::Columns), AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::SelectAction), AdaptiveCardSchemaKeyToString(AdaptiveCardSchemaKey::Style)}); } void ColumnSet::GetResourceInformation(std::vector<RemoteResourceInformation>& resourceInfo) { auto columns = GetColumns(); for (const auto& column : columns) { column->GetResourceInformation(resourceInfo); } return; }
//the radar is 128 pixels wide and it should cover $a00 (2560) possible x positions. //We are working with fat pixels, which means that we reall have 64 possible x offsets in the radar. //Therefore each fat pixel corresponds to 40 pixels on the map. //We must divide by 40: that's like divided by 8 (three shifts) and then divide by 5, for which we already have a divtable radar: { init: lda #>radar_map sta p0radar + 1 ldx #0 lda #0 !: sta radar_map,x inx bne !- ldx #[radar_data_end - radar_data_start] - 1 !: sta radar_data_start,x dex bpl !- rts plot: lda clock and #1 beq plot_friends jmp plot_foes plot_friends: //plot the hero, unless it's gameover lda lives bne !skp+ jmp !plotvans+ !skp: lda hero_previous_addr sta p0radar ldx hero_previous_off ldy hero_previous_y lda (p0radar),y and andmask,x sta (p0radar),y iny lda (p0radar),y and andmask,x sta (p0radar),y lda xpos + 1 sta p0tmp lda xpos + 2 sta p0tmp + 1 :toradarx() tax sta hero_previous_off lda p0radar sta hero_previous_addr lda ypos sec sbc #MINY lsr lsr lsr sta hero_previous_y tay lda (p0radar),y ora friendormask,x sta (p0radar),y iny lda (p0radar),y ora friendormask,x sta (p0radar),y !plotvans: //first erase the old ones lda vans_previous_addr sta p0radar lda vans_previous_off sta p0tmp + 2 lda #0 sta p0tmp + 3 !: ldx p0tmp + 2 .for (var i = 0; i < 4; i++) { ldy #12 lda (p0radar),y and andmask,x sta (p0radar),y iny lda (p0radar),y and andmask,x sta (p0radar),y lda p0radar clc adc #64 sta p0radar } lda #3 sec isc p0tmp + 3 beq !done+ lda p0tmp + 2 clc adc #2 cmp #4 bcc !skp+ sbc #4 tax lda p0radar clc adc #16 sta p0radar txa !skp: sta p0tmp + 2 jmp !- !done: //now draw them lda vans.xpos_l sta p0tmp lda vans.xpos_h sta p0tmp + 1 :toradarx() tax sta vans_previous_off sta p0tmp + 2 lda p0radar sta vans_previous_addr lda #0 sta p0tmp + 3 //loops on vans within a group !: lda p0tmp + 3 sta p0tmp + 4 //loops on logical van number ldx p0tmp + 2 .for (var i = 0; i < 4; i++) { ldy p0tmp + 4 lda vans.status,y beq !skp+ ldy #12 lda (p0radar),y ora friendormask,x sta (p0radar),y iny lda (p0radar),y ora friendormask,x sta (p0radar),y !skp: lda p0tmp + 4 clc adc #3 sta p0tmp + 4 lda p0radar clc adc #64 sta p0radar } inc p0tmp + 3 lda p0tmp + 3 cmp #3 beq !done+ lda p0tmp + 2 clc adc #2 cmp #4 bcc !skp+ sbc #4 tax lda p0radar clc adc #16 sta p0radar txa !skp: sta p0tmp + 2 jmp !- !done: rts plot_foes: ldx #11 !: stx p0tmp + 2 //loops on enemies lda enemies.status,x and #enemies.STATUS_ALIVE bne !ok+ jmp !ne+ !ok: //erase previous position lda enemy_previous_addr,x sta p0radar lda enemy_previous_off,x ldy enemy_previous_y,x tax lda (p0radar),y and andmask,x sta (p0radar),y iny lda (p0radar),y and andmask,x sta (p0radar),y //draw new position ldx p0tmp + 2 lda enemies.xpos_l,x clc adc enemies.xdelta,x sta p0tmp lda enemies.xpos_h,x adc #0 cmp #$0a bcc !skp+ sbc #$0a !skp: sta p0tmp + 1 :toradarx() sta p0tmp + 3 sta enemy_previous_off,x lda p0radar sta enemy_previous_addr,x lda enemies.ypos,x clc adc enemies.ydelta,x sec sbc #MINY lsr lsr lsr sta enemy_previous_y,x tay ldx p0tmp + 3 lda (p0radar),y ora enemyormask,x sta (p0radar),y iny lda (p0radar),y ora enemyormask,x sta (p0radar),y ldx p0tmp + 2 !ne: dex bmi !done+ jmp !- !done: rts radar_data_start: hero_previous_addr: .byte 0 hero_previous_off: .byte 0 hero_previous_y: .byte 0 vans_previous_addr: .byte 0 vans_previous_off: .byte 0 enemy_previous_addr: .fill 12, 0 enemy_previous_off: .fill 12, 0 enemy_previous_y: .fill 12, 0 pixelviewport: .byte 0,0 radar_data_end: } //load p0tmp, p0tmp + 1 with object's word x-coordinate ($0-$a00). //Returns the pixel offset in the radar in the accumulator (0-63), adjusted in the viewport //sets p0tmp + 2, p0tmp + 3 with the char memory address at y = 0, which means we can just use (p0tmp + 2),y to plot .macro toradarx() { sec lda p0tmp sbc radar.pixelviewport sta p0tmp lda p0tmp + 1 sbc radar.pixelviewport + 1 bpl !+ clc adc #$0a !: lsr ror p0tmp lsr ror p0tmp lsr ror p0tmp sta p0tmp + 1 lda p0tmp clc adc #<div5 sta pixsrc + 1 lda p0tmp + 1 adc #>div5 sta pixsrc + 2 pixsrc: lda div5 sta p0tmp /* lsr lsr //char column asl asl asl asl */ //the following is equivalent and #%00111100 asl asl sta p0radar lda p0tmp and #3 } //the following are global, as we use them pretty much everywhere. friendormask: .byte %11000000 .byte %00110000 .byte %00001100 .byte %00000011 enemyormask: .byte %10000000 .byte %00100000 .byte %00001000 .byte %00000010 andmask: .byte %00111111 .byte %11001111 .byte %11110011 .byte %11111100
; A201920: a(n) = 2^n mod 125. ; 1,2,4,8,16,32,64,3,6,12,24,48,96,67,9,18,36,72,19,38,76,27,54,108,91,57,114,103,81,37,74,23,46,92,59,118,111,97,69,13,26,52,104,83,41,82,39,78,31,62,124,123,121,117,109,93,61,122,119,113,101,77,29,58,116,107,89,53,106,87,49,98,71,17,34,68,11,22,44,88,51,102,79,33,66,7,14,28,56,112,99,73,21,42,84,43,86,47,94,63 add $0,3 seq $0,126605 ; Final three digits of 2^n. div $0,8
// Copyright (c) 2019-2020 The TrumpCoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "qt/trumpcoin/patriotnodewizarddialog.h" #include "qt/trumpcoin/forms/ui_patriotnodewizarddialog.h" #include "activepatriotnode.h" #include "clientmodel.h" #include "key_io.h" #include "optionsmodel.h" #include "qt/trumpcoin/mnmodel.h" #include "qt/trumpcoin/guitransactionsutils.h" #include "qt/trumpcoin/qtutils.h" #include "qt/walletmodeltransaction.h" #include <QFile> #include <QIntValidator> #include <QHostAddress> #include <QRegularExpression> static inline QString formatParagraph(const QString& str) { return "<p align=\"justify\" style=\"text-align:center;\">" + str + "</p>"; } static inline QString formatHtmlContent(const QString& str) { return "<html><body>" + str + "</body></html>"; } PatriotNodeWizardDialog::PatriotNodeWizardDialog(WalletModel* model, ClientModel* _clientModel, QWidget *parent) : FocusedDialog(parent), ui(new Ui::PatriotNodeWizardDialog), icConfirm1(new QPushButton()), icConfirm3(new QPushButton()), icConfirm4(new QPushButton()), walletModel(model), clientModel(_clientModel) { ui->setupUi(this); this->setStyleSheet(parent->styleSheet()); setCssProperty(ui->frame, "container-dialog"); ui->frame->setContentsMargins(10,10,10,10); setCssProperty({ui->labelLine1, ui->labelLine3}, "line-purple"); setCssProperty({ui->groupBoxName, ui->groupContainer}, "container-border"); setCssProperty({ui->pushNumber1, ui->pushNumber3, ui->pushNumber4}, "btn-number-check"); setCssProperty({ui->pushName1, ui->pushName3, ui->pushName4}, "btn-name-check"); ui->pushNumber1->setEnabled(false); ui->pushNumber3->setEnabled(false); ui->pushNumber4->setEnabled(false); ui->pushName1->setEnabled(false); ui->pushName3->setEnabled(false); ui->pushName4->setEnabled(false); // Frame 1 setCssProperty(ui->labelTitle1, "text-title-dialog"); setCssProperty(ui->labelMessage1a, "text-main-grey"); setCssProperty(ui->labelMessage1b, "text-main-purple"); QString collateralAmountStr = GUIUtil::formatBalance(clientModel->getPNCollateralRequiredAmount()); ui->labelMessage1a->setText(formatHtmlContent( formatParagraph(tr("To create a TrumpCoin Patriotnode you must dedicate %1 (the unit of TrumpCoin) " "to the network (however, these coins are still yours and will never leave your possession).").arg(collateralAmountStr)) + formatParagraph(tr("You can deactivate the node and unlock the coins at any time.")))); // Frame 3 setCssProperty(ui->labelTitle3, "text-title-dialog"); setCssProperty(ui->labelMessage3, "text-main-grey"); ui->labelMessage3->setText(formatHtmlContent( formatParagraph(tr("A transaction of %1 will be made").arg(collateralAmountStr)) + formatParagraph(tr("to a new empty address in your wallet.")) + formatParagraph(tr("The Address is labeled under the patriot node's name.")))); initCssEditLine(ui->lineEditName); // PN alias must not contain spaces or "#" character QRegularExpression rx("^(?:(?![\\#\\s]).)*"); ui->lineEditName->setValidator(new QRegularExpressionValidator(rx, ui->lineEditName)); // Frame 4 setCssProperty(ui->labelTitle4, "text-title-dialog"); setCssProperty({ui->labelSubtitleIp, ui->labelSubtitlePort}, "text-title"); setCssSubtitleScreen(ui->labelSubtitleAddressIp); initCssEditLine(ui->lineEditIpAddress); initCssEditLine(ui->lineEditPort); ui->stackedWidget->setCurrentIndex(pos); ui->lineEditPort->setEnabled(false); // use default port number if (walletModel->isRegTestNetwork()) { ui->lineEditPort->setText("51476"); } else if (walletModel->isTestNetwork()) { ui->lineEditPort->setText("51474"); } else { ui->lineEditPort->setText("15110"); } // Confirm icons ui->stackedIcon1->addWidget(icConfirm1); ui->stackedIcon3->addWidget(icConfirm3); ui->stackedIcon4->addWidget(icConfirm4); initBtn({icConfirm1, icConfirm3, icConfirm4}); setCssProperty({icConfirm1, icConfirm3, icConfirm4}, "ic-step-confirm"); // Connect btns setCssBtnPrimary(ui->btnNext); setCssProperty(ui->btnBack , "btn-dialog-cancel"); ui->btnBack->setVisible(false); setCssProperty(ui->pushButtonSkip, "ic-close"); connect(ui->pushButtonSkip, &QPushButton::clicked, this, &PatriotNodeWizardDialog::close); connect(ui->btnNext, &QPushButton::clicked, this, &PatriotNodeWizardDialog::accept); connect(ui->btnBack, &QPushButton::clicked, this, &PatriotNodeWizardDialog::onBackClicked); } void PatriotNodeWizardDialog::showEvent(QShowEvent *event) { if (ui->btnNext) ui->btnNext->setFocus(); } void PatriotNodeWizardDialog::accept() { switch(pos) { case 0:{ ui->stackedWidget->setCurrentIndex(1); ui->pushName4->setChecked(false); ui->pushName3->setChecked(true); ui->pushName1->setChecked(true); icConfirm1->setVisible(true); ui->pushNumber3->setChecked(true); ui->btnBack->setVisible(true); ui->lineEditName->setFocus(); break; } case 1:{ // No empty names accepted. if (ui->lineEditName->text().isEmpty()) { setCssEditLine(ui->lineEditName, false, true); return; } setCssEditLine(ui->lineEditName, true, true); ui->stackedWidget->setCurrentIndex(2); ui->pushName4->setChecked(false); ui->pushName3->setChecked(true); ui->pushName1->setChecked(true); icConfirm3->setVisible(true); ui->pushNumber4->setChecked(true); ui->btnBack->setVisible(true); ui->lineEditIpAddress->setFocus(); break; } case 2:{ // No empty address accepted if (ui->lineEditIpAddress->text().isEmpty()) { return; } icConfirm4->setVisible(true); ui->btnBack->setVisible(true); ui->btnBack->setVisible(true); isOk = createPN(); QDialog::accept(); } } pos++; } bool PatriotNodeWizardDialog::createPN() { if (!walletModel) { returnStr = tr("walletModel not set"); return false; } /** * 1) generate the mn key. 2) create the mn address. 3) if there is a valid (unlocked) collateral utxo, use it 4) otherwise create a receiving address and send a tx with 10k to it. 5) get the collateral output. 6) use those values on the patriotnode.conf */ // validate IP address QString addressLabel = ui->lineEditName->text(); if (addressLabel.isEmpty()) { returnStr = tr("address label cannot be empty"); return false; } std::string alias = addressLabel.toStdString(); QString addressStr = ui->lineEditIpAddress->text(); QString portStr = ui->lineEditPort->text(); if (addressStr.isEmpty() || portStr.isEmpty()) { returnStr = tr("IP or port cannot be empty"); return false; } if (!PNModel::validatePNIP(addressStr)) { returnStr = tr("Invalid IP address"); return false; } // ip + port std::string ipAddress = addressStr.toStdString(); std::string port = portStr.toStdString(); // create the mn key CKey secret; secret.MakeNewKey(false); std::string mnKeyString = KeyIO::EncodeSecret(secret); // Look for a valid collateral utxo COutPoint collateralOut; // If not found create a new collateral tx if (!walletModel->getPNCollateralCandidate(collateralOut)) { // New receive address auto r = walletModel->getNewAddress(alias); if (!r) { // generate address fail inform(tr(r.getError().c_str())); return false; } // const QString& addr, const QString& label, const CAmount& amount, const QString& message SendCoinsRecipient sendCoinsRecipient( QString::fromStdString(r.getObjResult()->ToString()), QString::fromStdString(alias), clientModel->getPNCollateralRequiredAmount(), ""); // Send the 10 tx to one of your address QList<SendCoinsRecipient> recipients; recipients.append(sendCoinsRecipient); WalletModelTransaction currentTransaction(recipients); WalletModel::SendCoinsReturn prepareStatus; // no coincontrol, no P2CS delegations prepareStatus = walletModel->prepareTransaction(&currentTransaction, nullptr, false); QString returnMsg = tr("Unknown error"); // process prepareStatus and on error generate message shown to user CClientUIInterface::MessageBoxFlags informType; returnMsg = GuiTransactionsUtils::ProcessSendCoinsReturn( this, prepareStatus, walletModel, informType, // this flag is not needed BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), currentTransaction.getTransactionFee()), true ); if (prepareStatus.status != WalletModel::OK) { returnStr = tr("Prepare patriot node failed.\n\n%1\n").arg(returnMsg); return false; } WalletModel::SendCoinsReturn sendStatus = walletModel->sendCoins(currentTransaction); // process sendStatus and on error generate message shown to user returnMsg = GuiTransactionsUtils::ProcessSendCoinsReturn( this, sendStatus, walletModel, informType ); if (sendStatus.status != WalletModel::OK) { returnStr = tr("Cannot send collateral transaction.\n\n%1").arg(returnMsg); return false; } // look for the tx index of the collateral CTransactionRef walletTx = currentTransaction.getTransaction(); std::string txID = walletTx->GetHash().GetHex(); int indexOut = -1; for (int i=0; i < (int)walletTx->vout.size(); i++) { const CTxOut& out = walletTx->vout[i]; if (out.nValue == clientModel->getPNCollateralRequiredAmount()) { indexOut = i; break; } } if (indexOut == -1) { returnStr = tr("Invalid collateral output index"); return false; } // save the collateral outpoint collateralOut = COutPoint(walletTx->GetHash(), indexOut); } // Update the conf file std::string strConfFile = "patriotnode.conf"; std::string strDataDir = GetDataDir().string(); fs::path conf_file_path(strConfFile); if (strConfFile != conf_file_path.filename().string()) { throw std::runtime_error(strprintf(_("patriotnode.conf %s resides outside data directory %s"), strConfFile, strDataDir)); } fs::path pathBootstrap = GetDataDir() / strConfFile; if (!fs::exists(pathBootstrap)) { returnStr = tr("patriotnode.conf file doesn't exists"); return false; } fs::path pathPatriotnodeConfigFile = GetPatriotnodeConfigFile(); fsbridge::ifstream streamConfig(pathPatriotnodeConfigFile); if (!streamConfig.good()) { returnStr = tr("Invalid patriotnode.conf file"); return false; } int linenumber = 1; std::string lineCopy = ""; for (std::string line; std::getline(streamConfig, line); linenumber++) { if (line.empty()) continue; std::istringstream iss(line); std::string comment, alias, ip, privKey, txHash, outputIndex; if (iss >> comment) { if (comment.at(0) == '#') continue; iss.str(line); iss.clear(); } if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) { iss.str(line); iss.clear(); if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) { streamConfig.close(); returnStr = tr("Error parsing patriotnode.conf file"); return false; } } lineCopy += line + "\n"; } if (lineCopy.size() == 0) { lineCopy = "# Patriotnode config file\n" "# Format: alias IP:port patriotnodeprivkey collateral_output_txid collateral_output_index\n" "# Example: mn1 127.0.0.2:15110 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0" "#"; } lineCopy += "\n"; streamConfig.close(); std::string txID = collateralOut.hash.ToString(); std::string indexOutStr = std::to_string(collateralOut.n); // Check IP address type QHostAddress hostAddress(addressStr); QAbstractSocket::NetworkLayerProtocol layerProtocol = hostAddress.protocol(); if (layerProtocol == QAbstractSocket::IPv6Protocol) { ipAddress = "["+ipAddress+"]"; } fs::path pathConfigFile = AbsPathForConfigVal(fs::path("patriotnode_temp.conf")); FILE* configFile = fopen(pathConfigFile.string().c_str(), "w"); lineCopy += alias+" "+ipAddress+":"+port+" "+mnKeyString+" "+txID+" "+indexOutStr+"\n"; fwrite(lineCopy.c_str(), std::strlen(lineCopy.c_str()), 1, configFile); fclose(configFile); fs::path pathOldConfFile = AbsPathForConfigVal(fs::path("old_patriotnode.conf")); if (fs::exists(pathOldConfFile)) { fs::remove(pathOldConfFile); } rename(pathPatriotnodeConfigFile, pathOldConfFile); fs::path pathNewConfFile = AbsPathForConfigVal(fs::path("patriotnode.conf")); rename(pathConfigFile, pathNewConfFile); mnEntry = patriotnodeConfig.add(alias, ipAddress+":"+port, mnKeyString, txID, indexOutStr); // Lock collateral output walletModel->lockCoin(collateralOut); returnStr = tr("Patriot node created! Wait %1 confirmations before starting it.").arg(PatriotnodeCollateralMinConf()); return true; } void PatriotNodeWizardDialog::onBackClicked() { if (pos == 0) return; pos--; switch(pos) { case 0:{ ui->stackedWidget->setCurrentIndex(0); ui->btnNext->setFocus(); ui->pushNumber1->setChecked(true); ui->pushNumber4->setChecked(false); ui->pushNumber3->setChecked(false); ui->pushName4->setChecked(false); ui->pushName3->setChecked(false); ui->pushName1->setChecked(true); icConfirm1->setVisible(false); ui->btnBack->setVisible(false); break; } case 1:{ ui->stackedWidget->setCurrentIndex(1); ui->lineEditName->setFocus(); ui->pushNumber4->setChecked(false); ui->pushNumber3->setChecked(true); ui->pushName4->setChecked(false); ui->pushName3->setChecked(true); icConfirm3->setVisible(false); break; } } } void PatriotNodeWizardDialog::inform(QString text) { if (!snackBar) snackBar = new SnackBar(nullptr, this); snackBar->setText(text); snackBar->resize(this->width(), snackBar->height()); openDialog(snackBar, this); } QSize BUTTON_SIZE = QSize(22, 22); void PatriotNodeWizardDialog::initBtn(std::initializer_list<QPushButton*> args) { for (QPushButton* btn : args) { btn->setMinimumSize(BUTTON_SIZE); btn->setMaximumSize(BUTTON_SIZE); btn->move(0, 0); btn->show(); btn->raise(); btn->setVisible(false); } } PatriotNodeWizardDialog::~PatriotNodeWizardDialog() { if (snackBar) delete snackBar; delete ui; }
#include <iostream> #include <vector> std::vector<bool> binary(long x){ std::vector<bool> res; while(x > 0){res.push_back(x % 2); x /= 2;} return res; } int main(){ const long double m = 1.000000011; long n, t; std::cin >> n >> t; std::vector<bool> bin = binary(t); long double y(m), total(1.0); for(int p = 0; p < bin.size(); p++){ if(bin[p]){total *= y;} y = y * y; } total *= n; std::cout.precision(15); std::cout << std::fixed << total << std::endl; return 0; }
/****************************************************************************** * Copyright © 2014-2018 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * * holder information and the developer policies on copyright and licensing. * * * * Unless otherwise agreed in a custom licensing agreement, no part of the * * SuperNET software, including this file may be copied, modified, propagated * * or distributed except according to the terms contained in the LICENSE file * * * * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ #include "cc/eval.h" #include "cc/utils.h" #include "importcoin.h" #include "primitives/transaction.h" /* * CC Eval method for import coin. * * This method should control every parameter of the ImportCoin transaction, since it has no signature * to protect it from malleability. */ bool Eval::ImportCoin(const std::vector<uint8_t> params, const CTransaction &importTx, unsigned int nIn) { if (importTx.vout.size() < 2) return Invalid("too-few-vouts"); // params TxProof proof; CTransaction burnTx; std::vector<CTxOut> payouts; if (!UnmarshalImportTx(importTx, proof, burnTx, payouts)) return Invalid("invalid-params"); // Control all aspects of this transaction // It should not be at all malleable if (MakeImportCoinTransaction(proof, burnTx, payouts).GetHash() != importTx.GetHash()) return Invalid("non-canonical"); // burn params uint32_t targetCcid; std::string targetSymbol; uint256 payoutsHash; if (!UnmarshalBurnTx(burnTx, targetSymbol, &targetCcid, payoutsHash)) return Invalid("invalid-burn-tx"); if (targetCcid != GetAssetchainsCC() || targetSymbol != GetAssetchainsSymbol()) return Invalid("importcoin-wrong-chain"); if (targetCcid < KOMODO_FIRSTFUNGIBLEID) return Invalid("chain-not-fungible"); // check burn amount { uint64_t burnAmount = burnTx.vout.back().nValue; if (burnAmount == 0) return Invalid("invalid-burn-amount"); uint64_t totalOut = 0; for (int i=0; i<importTx.vout.size(); i++) totalOut += importTx.vout[i].nValue; if (totalOut > burnAmount) return Invalid("payout-too-high"); } // Check burntx shows correct outputs hash if (payoutsHash != SerializeHash(payouts)) return Invalid("wrong-payouts"); // Check proof confirms existance of burnTx { uint256 momom, target; if (!GetProofRoot(proof.first, momom)) return Invalid("coudnt-load-momom"); target = proof.second.Exec(burnTx.GetHash()); if (momom != proof.second.Exec(burnTx.GetHash())) return Invalid("momom-check-fail"); } return Valid(); }
// // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. // SPDX-License-Identifier: MIT // #pragma once #include "NeonBaseWorkload.hpp" #include <arm_compute/core/Error.h> #include <arm_compute/runtime/NEON/functions/NELogical.h> namespace armnn { arm_compute::Status NeonLogicalOrWorkloadValidate(const TensorInfo& input0, const TensorInfo& input1, const TensorInfo& output); class NeonLogicalOrWorkload : public NeonBaseWorkload<LogicalBinaryQueueDescriptor> { public: NeonLogicalOrWorkload(const LogicalBinaryQueueDescriptor& descriptor, const WorkloadInfo& info); virtual void Execute() const override; private: mutable arm_compute::NELogicalOr m_LogicalOrLayer; }; } //namespace armnn
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Berkeley Softworks 1993 -- All Rights Reserved PROJECT: PC GEOS MODULE: PostScript driver FILE: pscriptgenerf35Info.asm AUTHOR: Dave Durran 13 April 1993 REVISION HISTORY: Name Date Description ---- ---- ----------- dave 4/13/93 Initial revision parsed from pscriptlw2nt.asm DESCRIPTION: This file contains the device information for the PostScript printer: Apple LaserWriter2 NT Other Printers Supported by this resource: $Id: pscriptgenerf35Info.asm,v 1.1 97/04/18 11:56:21 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;---------------------------------------------------------------------------- ; Generic PostScript (LW compatible) ;---------------------------------------------------------------------------- generf35Info segment resource ; info blocks PrinterInfo < ; ---- PrinterType ------------- < PT_RASTER, BMF_MONO>, ; ---- PrinterConnections ------ < IC_NO_IEEE488, CC_NO_CUSTOM, SC_NO_SCSI, RC_RS232C, CC_CENTRONICS, FC_FILE, AC_APPLETALK >, ; ---- PrinterSmarts ----------- PS_PDL, ;-------Custom Entry Routine------- NULL, ;-------Custom Exit Routine------- NULL, ; ---- Mode Info Offsets ------- NULL, NULL, offset generf35Res, NULL, NULL, ; ---- Font Geometry ----------- NULL, ; ---- Symbol Set list ----------- NULL, ; ---- PaperMargins ------------ < PR_MARGIN_LEFT, ; Tractor Margins PR_MARGIN_TRACTOR, PR_MARGIN_RIGHT, PR_MARGIN_TRACTOR >, < PR_MARGIN_LEFT, ; ASF Margins PR_MARGIN_TOP, PR_MARGIN_RIGHT, PR_MARGIN_BOTTOM >, ; ---- PaperInputOptions ------- < MF_MANUAL1, TF_NO_TRACTOR, ASF_TRAY1 >, ; ---- PaperOutputOptions ------ < OC_COPIES, PS_NORMAL, OD_SIMPLEX, SO_NO_STAPLER, OS_NO_SORTER, OB_NO_OUTPUTBIN >, ; 612, ; paper width (points). NULL, ; Main UI NoSettingsDialogBox, ; Options UI offset PrintEvalDummyASF ; UI eval Routine > ;---------------------------------------------------------------------------- ; Graphics modes info ;---------------------------------------------------------------------------- generf35Res GraphicsProperties < 300, ; xres 300, ; yres 1, ; band height 1, ; buff height 1, ; interleaves BMF_MONO, ; color format NULL > ; color correction ;---------------------------------------------------------------------------- ; PostScript Info ;---------------------------------------------------------------------------- ; This structure holds PostScript-specific info about the printer. It ; *must* be placed directly after the hires GraphicProperties struct PSInfoStruct < PSFL_STANDARD_35N,; PSFontList 0x0001, ; PSLevel flags GENERIC_PROLOG_LEN, ; prolog length offset generf35Prolog ; ptr to prolog > ; (see pscriptConstant.def) ; this sets up a transfer function that is described in Computer ; Graphics and Applications, May 1991 issue, Jim Blinn's column. ; Basically, it corrects for the perceived darkening of greys when ; printing. The hardcoded values are empirical values arrived at ; through experimentation (see the article for details). generf35Prolog label byte char "GWDict begin", NL char "/SDC { 85 35 currentscreen 3 1 roll pop pop setscreen", NL char "{dup dup 0.3681 mul -1.145 add mul 1.7769 add mul}", NL char "currenttransfer CP settransfer} bdef", NL char "end", NL generf35EndProlog label byte GENERIC_PROLOG_LEN equ offset generf35EndProlog - offset generf35Prolog generf35Info ends
{ 'abc_class': 'AbcFile' , 'minor_version': 16 , 'major_version': 46 , 'int_pool': [ undefined ] , 'uint_pool': [ undefined ] , 'double_pool': [ undefined , '10.1' , '3.14' ] , 'utf8_pool': [ undefined , '' , 'Object' , 'Array' , 'RegExp' , 'print' , '10e2' , '314159e' , '05' , '0xABE' ] , 'namespace_pool': [ undefined , { 'kind': 'PackageNamespace' , 'utf8': 1 } , { 'kind': 'Namespace' , 'utf8': 1 } ] , 'nsset_pool': [ undefined , [ 2 ] ] , 'name_pool': [ undefined , { 'kind': 'QName' , 'ns': 1 , 'utf8': 2 } , { 'kind': 'QName' , 'ns': 1 , 'utf8': 3 } , { 'kind': 'QName' , 'ns': 1 , 'utf8': 4 } , { 'kind': 'Multiname' , 'utf8': 5 , 'nsset': 1 } ] , 'method_infos': [ { 'ret_type': 0 , 'param_types': [] , 'name': 0 , 'flags': 0 , 'optional_count': 0 , 'value_kind': [ ] , 'param_names': [ ] } , ] , 'metadata_infos': [ ] , 'instance_infos': [ ] , 'class_infos': [ ] , 'script_infos': [ { 'init': 0 , 'traits': [ ] } , ] , 'method_bodys': [ { 'method_info': 0 , 'max_stack': 3 , 'max_regs': 1 , 'scope_depth': 0 , 'max_scope': 1 , 'code': [ [ 'getlocal0' ] , [ 'pushscope' ] , [ 'findpropstrict', 4 ] , [ 'pushdouble', 1 ] , [ 'callproperty', 4, 1 ] , [ 'pop' ] , [ 'findpropstrict', 4 ] , [ 'pushdouble', 2 ] , [ 'callproperty', 4, 1 ] , [ 'pop' ] , [ 'findpropstrict', 4 ] , [ 'pushstring', 6 ] , [ 'convert_d' ] , [ 'callproperty', 4, 1 ] , [ 'pop' ] , [ 'findpropstrict', 4 ] , [ 'pushstring', 7 ] , [ 'convert_d' ] , [ 'pushstring', 8 ] , [ 'convert_d' ] , [ 'subtract' ] , [ 'callproperty', 4, 1 ] , [ 'pop' ] , [ 'findpropstrict', 4 ] , [ 'pushstring', 9 ] , [ 'convert_d' ] , [ 'callproperty', 4, 1 ] , [ 'pop' ] , [ 'returnvoid' ] , ] , 'exceptions': [ ] , 'fixtures': [ ] , 'traits': [ ] } , ] }
; A003269: a(n) = a(n-1) + a(n-4) with a(0) = 0, a(1) = a(2) = a(3) = 1. ; 0,1,1,1,1,2,3,4,5,7,10,14,19,26,36,50,69,95,131,181,250,345,476,657,907,1252,1728,2385,3292,4544,6272,8657,11949,16493,22765,31422,43371,59864,82629,114051,157422,217286,299915,413966,571388,788674,1088589,1502555,2073943,2862617,3951206,5453761,7527704,10390321,14341527,19795288,27322992,37713313,52054840,71850128,99173120,136886433,188941273,260791401,359964521,496850954,685792227,946583628,1306548149,1803399103,2489191330,3435774958,4742323107,6545722210,9034913540,12470688498,17213011605,23758733815,32793647355,45264335853,62477347458,86236081273,119029728628,164294064481,226771411939,313007493212,432037221840,596331286321,823102698260,1136110191472,1568147413312,2164478699633,2987581397893,4123691589365,5691839002677,7856317702310,10843899100203,14967590689568,20659429692245,28515747394555 mov $3,2 mov $5,$0 lpb $3 mov $0,$5 sub $3,1 add $0,$3 trn $0,1 seq $0,98578 ; a(n) = Sum_{k=0..floor(n/4)} C(n-3*k,k+1). mov $2,$3 mul $2,$0 add $1,$2 mov $4,$0 lpe min $5,1 mul $5,$4 sub $1,$5 mov $0,$1
.global s_prepare_buffers s_prepare_buffers: push %r8 push %r9 push %rax push %rbp push %rbx push %rdx push %rsi lea addresses_WT_ht+0x1cd2f, %rsi dec %r8 movl $0x61626364, (%rsi) nop nop nop nop nop cmp %rax, %rax lea addresses_WT_ht+0x1be97, %rbp nop nop add $51434, %r9 movw $0x6162, (%rbp) nop cmp $28232, %rdx pop %rsi pop %rdx pop %rbx pop %rbp pop %rax pop %r9 pop %r8 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %r8 push %rbp push %rdi push %rsi // Store mov $0x72f, %r14 nop nop xor $34862, %r11 mov $0x5152535455565758, %rbp movq %rbp, %xmm1 movups %xmm1, (%r14) nop nop nop nop nop xor %rsi, %rsi // Faulty Load lea addresses_normal+0x5b2f, %rbp nop cmp $41382, %r8 vmovups (%rbp), %ymm7 vextracti128 $0, %ymm7, %xmm7 vpextrq $0, %xmm7, %r14 lea oracles, %rdi and $0xff, %r14 shlq $12, %r14 mov (%rdi,%r14,1), %r14 pop %rsi pop %rdi pop %rbp pop %r8 pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 5}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_normal', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}} {'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 1}} {'34': 211} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
; A157447: a(n) = 512*n - 16. ; 496,1008,1520,2032,2544,3056,3568,4080,4592,5104,5616,6128,6640,7152,7664,8176,8688,9200,9712,10224,10736,11248,11760,12272,12784,13296,13808,14320,14832,15344,15856,16368,16880,17392,17904,18416,18928,19440,19952,20464,20976,21488,22000,22512,23024,23536,24048,24560,25072,25584,26096,26608,27120,27632,28144,28656,29168,29680,30192,30704,31216,31728,32240,32752,33264,33776,34288,34800,35312,35824,36336,36848,37360,37872,38384,38896,39408,39920,40432,40944,41456,41968,42480,42992,43504,44016,44528,45040,45552,46064,46576,47088,47600,48112,48624,49136,49648,50160,50672,51184,51696,52208,52720,53232,53744,54256,54768,55280,55792,56304,56816,57328,57840,58352,58864,59376,59888,60400,60912,61424,61936,62448,62960,63472,63984,64496,65008,65520,66032,66544,67056,67568,68080,68592,69104,69616,70128,70640,71152,71664,72176,72688,73200,73712,74224,74736,75248,75760,76272,76784,77296,77808,78320,78832,79344,79856,80368,80880,81392,81904,82416,82928,83440,83952,84464,84976,85488,86000,86512,87024,87536,88048,88560,89072,89584,90096,90608,91120,91632,92144,92656,93168,93680,94192,94704,95216,95728,96240,96752,97264,97776,98288,98800,99312,99824,100336,100848,101360,101872,102384,102896,103408,103920,104432,104944,105456,105968,106480,106992,107504,108016,108528,109040,109552,110064,110576,111088,111600,112112,112624,113136,113648,114160,114672,115184,115696,116208,116720,117232,117744,118256,118768,119280,119792,120304,120816,121328,121840,122352,122864,123376,123888,124400,124912,125424,125936,126448,126960,127472,127984 mov $1,$0 mul $1,512 add $1,496
COMMENT @----------------------------------------------------------------------- Copyright (c) Geoworks 1991 -- All Rights Reserved PROJECT: PC GEOS MODULE: FILE: sharedFile.asm AUTHOR: Cheng, 10/92 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 2/92 Initial revision DESCRIPTION: $Id: sharedFile.asm,v 1.1 97/04/07 11:42:13 newdeal Exp $ -------------------------------------------------------------------------------@ COMMENT @----------------------------------------------------------------------- FUNCTION: GetByte DESCRIPTION: CALLED BY: INTERNAL () PASS: RETURN: DESTROYED: REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Cheng 2/92 Initial version -------------------------------------------------------------------------------@ GetByte proc near ret GetByte endp
// Generated from /POI/java/org/apache/poi/hssf/usermodel/HSSFHyperlink.java #include <org/apache/poi/hssf/usermodel/HSSFHyperlink.hpp> #include <java/lang/ClassCastException.hpp> #include <java/lang/IllegalArgumentException.hpp> #include <java/lang/NullPointerException.hpp> #include <java/lang/Object.hpp> #include <java/lang/String.hpp> #include <java/lang/StringBuilder.hpp> #include <org/apache/poi/common/usermodel/HyperlinkType.hpp> #include <org/apache/poi/hssf/record/HyperlinkRecord.hpp> #include <org/apache/poi/ss/usermodel/Hyperlink.hpp> template<typename T, typename U> static T java_cast(U* u) { if(!u) return static_cast<T>(nullptr); auto t = dynamic_cast<T>(u); if(!t) throw new ::java::lang::ClassCastException(); return t; } template<typename T> static T* npc(T* t) { if(!t) throw new ::java::lang::NullPointerException(); return t; } poi::hssf::usermodel::HSSFHyperlink::HSSFHyperlink(const ::default_init_tag&) : super(*static_cast< ::default_init_tag* >(0)) { clinit(); } poi::hssf::usermodel::HSSFHyperlink::HSSFHyperlink(::poi::common::usermodel::HyperlinkType* type) : HSSFHyperlink(*static_cast< ::default_init_tag* >(0)) { ctor(type); } poi::hssf::usermodel::HSSFHyperlink::HSSFHyperlink(::poi::hssf::record::HyperlinkRecord* record) : HSSFHyperlink(*static_cast< ::default_init_tag* >(0)) { ctor(record); } poi::hssf::usermodel::HSSFHyperlink::HSSFHyperlink(::poi::ss::usermodel::Hyperlink* other) : HSSFHyperlink(*static_cast< ::default_init_tag* >(0)) { ctor(other); } void poi::hssf::usermodel::HSSFHyperlink::ctor(::poi::common::usermodel::HyperlinkType* type) { super::ctor(); this->link_type = type; record = new ::poi::hssf::record::HyperlinkRecord(); { auto v = type; if((v == ::poi::common::usermodel::HyperlinkType::URL) || (v == ::poi::common::usermodel::HyperlinkType::EMAIL)) { npc(record)->newUrlLink(); goto end_switch0;; } if((v == ::poi::common::usermodel::HyperlinkType::FILE)) { npc(record)->newFileLink(); goto end_switch0;; } if((v == ::poi::common::usermodel::HyperlinkType::DOCUMENT)) { npc(record)->newDocumentLink(); goto end_switch0;; } if((((v != ::poi::common::usermodel::HyperlinkType::URL) && (v != ::poi::common::usermodel::HyperlinkType::EMAIL) && (v != ::poi::common::usermodel::HyperlinkType::FILE) && (v != ::poi::common::usermodel::HyperlinkType::DOCUMENT)))) { throw new ::java::lang::IllegalArgumentException(::java::lang::StringBuilder().append(u"Invalid type: "_j)->append(static_cast< ::java::lang::Object* >(type))->toString()); } end_switch0:; } } void poi::hssf::usermodel::HSSFHyperlink::ctor(::poi::hssf::record::HyperlinkRecord* record) { super::ctor(); this->record = record; link_type = getType(record); } poi::common::usermodel::HyperlinkType* poi::hssf::usermodel::HSSFHyperlink::getType(::poi::hssf::record::HyperlinkRecord* record) { clinit(); ::poi::common::usermodel::HyperlinkType* link_type; if(npc(record)->isFileLink()) { link_type = ::poi::common::usermodel::HyperlinkType::FILE; } else if(npc(record)->isDocumentLink()) { link_type = ::poi::common::usermodel::HyperlinkType::DOCUMENT; } else { if(npc(record)->getAddress() != nullptr && npc(npc(record)->getAddress())->startsWith(u"mailto:"_j)) { link_type = ::poi::common::usermodel::HyperlinkType::EMAIL; } else { link_type = ::poi::common::usermodel::HyperlinkType::URL; } } return link_type; } void poi::hssf::usermodel::HSSFHyperlink::ctor(::poi::ss::usermodel::Hyperlink* other) { super::ctor(); if(dynamic_cast< HSSFHyperlink* >(other) != nullptr) { auto hlink = java_cast< HSSFHyperlink* >(other); record = npc(npc(hlink)->record)->clone(); link_type = getType(record); } else { link_type = npc(other)->getTypeEnum(); record = new ::poi::hssf::record::HyperlinkRecord(); setFirstRow(npc(other)->getFirstRow()); setFirstColumn(npc(other)->getFirstColumn()); setLastRow(npc(other)->getLastRow()); setLastColumn(npc(other)->getLastColumn()); } } int32_t poi::hssf::usermodel::HSSFHyperlink::getFirstRow() { return npc(record)->getFirstRow(); } void poi::hssf::usermodel::HSSFHyperlink::setFirstRow(int32_t row) { npc(record)->setFirstRow(row); } int32_t poi::hssf::usermodel::HSSFHyperlink::getLastRow() { return npc(record)->getLastRow(); } void poi::hssf::usermodel::HSSFHyperlink::setLastRow(int32_t row) { npc(record)->setLastRow(row); } int32_t poi::hssf::usermodel::HSSFHyperlink::getFirstColumn() { return npc(record)->getFirstColumn(); } void poi::hssf::usermodel::HSSFHyperlink::setFirstColumn(int32_t col) { npc(record)->setFirstColumn(static_cast< int16_t >(col)); } int32_t poi::hssf::usermodel::HSSFHyperlink::getLastColumn() { return npc(record)->getLastColumn(); } void poi::hssf::usermodel::HSSFHyperlink::setLastColumn(int32_t col) { npc(record)->setLastColumn(static_cast< int16_t >(col)); } java::lang::String* poi::hssf::usermodel::HSSFHyperlink::getAddress() { return npc(record)->getAddress(); } java::lang::String* poi::hssf::usermodel::HSSFHyperlink::getTextMark() { return npc(record)->getTextMark(); } void poi::hssf::usermodel::HSSFHyperlink::setTextMark(::java::lang::String* textMark) { npc(record)->setTextMark(textMark); } java::lang::String* poi::hssf::usermodel::HSSFHyperlink::getShortFilename() { return npc(record)->getShortFilename(); } void poi::hssf::usermodel::HSSFHyperlink::setShortFilename(::java::lang::String* shortFilename) { npc(record)->setShortFilename(shortFilename); } void poi::hssf::usermodel::HSSFHyperlink::setAddress(::java::lang::String* address) { npc(record)->setAddress(address); } java::lang::String* poi::hssf::usermodel::HSSFHyperlink::getLabel() { return npc(record)->getLabel(); } void poi::hssf::usermodel::HSSFHyperlink::setLabel(::java::lang::String* label) { npc(record)->setLabel(label); } int32_t poi::hssf::usermodel::HSSFHyperlink::getType() { return npc(link_type)->getCode(); } poi::common::usermodel::HyperlinkType* poi::hssf::usermodel::HSSFHyperlink::getTypeEnum() { return link_type; } bool poi::hssf::usermodel::HSSFHyperlink::equals(::java::lang::Object* other) { if(static_cast< ::java::lang::Object* >(this) == other) return true; if(!(dynamic_cast< HSSFHyperlink* >(other) != nullptr)) return false; auto otherLink = java_cast< HSSFHyperlink* >(other); return record == npc(otherLink)->record; } int32_t poi::hssf::usermodel::HSSFHyperlink::hashCode() { return npc(record)->hashCode(); } extern java::lang::Class *class_(const char16_t *c, int n); java::lang::Class* poi::hssf::usermodel::HSSFHyperlink::class_() { static ::java::lang::Class* c = ::class_(u"org.apache.poi.hssf.usermodel.HSSFHyperlink", 43); return c; } java::lang::Class* poi::hssf::usermodel::HSSFHyperlink::getClass0() { return class_(); }
// Copyright (c) 2017-2019 The Talkcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <chainparams.h> #include <index/txindex.h> #include <script/standard.h> #include <test/setup_common.h> #include <util/system.h> #include <util/time.h> #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_SUITE(txindex_tests) BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup) { TxIndex txindex(1 << 20, true); CTransactionRef tx_disk; uint256 block_hash; // Transaction should not be found in the index before it is started. for (const auto& txn : m_coinbase_txns) { BOOST_CHECK(!txindex.FindTx(txn->GetHash(), block_hash, tx_disk)); } // BlockUntilSyncedToCurrentChain should return false before txindex is started. BOOST_CHECK(!txindex.BlockUntilSyncedToCurrentChain()); txindex.Start(); // Allow tx index to catch up with the block index. constexpr int64_t timeout_ms = 10 * 1000; int64_t time_start = GetTimeMillis(); while (!txindex.BlockUntilSyncedToCurrentChain()) { BOOST_REQUIRE(time_start + timeout_ms > GetTimeMillis()); MilliSleep(100); } // Check that txindex excludes genesis block transactions. const CBlock& genesis_block = Params().GenesisBlock(); for (const auto& txn : genesis_block.vtx) { BOOST_CHECK(!txindex.FindTx(txn->GetHash(), block_hash, tx_disk)); } // Check that txindex has all txs that were in the chain before it started. for (const auto& txn : m_coinbase_txns) { if (!txindex.FindTx(txn->GetHash(), block_hash, tx_disk)) { BOOST_ERROR("FindTx failed"); } else if (tx_disk->GetHash() != txn->GetHash()) { BOOST_ERROR("Read incorrect tx"); } } // Check that new transactions in new blocks make it into the index. for (int i = 0; i < 10; i++) { CScript coinbase_script_pub_key = GetScriptForDestination(PKHash(coinbaseKey.GetPubKey())); std::vector<CMutableTransaction> no_txns; const CBlock& block = CreateAndProcessBlock(no_txns, coinbase_script_pub_key); const CTransaction& txn = *block.vtx[0]; BOOST_CHECK(txindex.BlockUntilSyncedToCurrentChain()); if (!txindex.FindTx(txn.GetHash(), block_hash, tx_disk)) { BOOST_ERROR("FindTx failed"); } else if (tx_disk->GetHash() != txn.GetHash()) { BOOST_ERROR("Read incorrect tx"); } } // shutdown sequence (c.f. Shutdown() in init.cpp) txindex.Stop(); threadGroup.interrupt_all(); threadGroup.join_all(); // Rest of shutdown sequence and destructors happen in ~TestingSetup() } BOOST_AUTO_TEST_SUITE_END()
%include "boot.inc" [bits 16] xor ax, ax ; eax = 0 ; 初始化段寄存器, 段地址全部设为0 mov ds, ax mov ss, ax mov es, ax mov fs, ax mov gs, ax ; 初始化栈指针 mov sp, 0x7c00 mov ax, LOADER_START_SECTOR mov cx, LOADER_SECTOR_COUNT mov bx, LOADER_START_ADDRESS load_bootloader: push ax push bx call asm_read_hard_disk ; 读取硬盘 add sp, 4 inc ax add bx, 512 loop load_bootloader jmp 0x0000:0x7e00 ; 跳转到bootloader jmp $ ; 死循环 ; asm_read_hard_disk(memory,block) ; 加载逻辑扇区号为block的扇区到内存地址memory asm_read_hard_disk: push bp mov bp, sp push ax push bx push cx push dx mov ax, [bp + 2 * 3] ; 逻辑扇区低16位 mov dx, 0x1f3 out dx, al ; LBA地址7~0 inc dx ; 0x1f4 mov al, ah out dx, al ; LBA地址15~8 xor ax, ax inc dx ; 0x1f5 out dx, al ; LBA地址23~16 = 0 inc dx ; 0x1f6 mov al, ah and al, 0x0f or al, 0xe0 ; LBA地址27~24 = 0 out dx, al mov dx, 0x1f2 mov al, 1 out dx, al ; 读取1个扇区 mov dx, 0x1f7 ; 0x1f7 mov al, 0x20 ;读命令 out dx,al ; 等待处理其他操作 .waits: in al, dx ; dx = 0x1f7 and al,0x88 cmp al,0x08 jnz .waits ; 读取512字节到地址ds:bx mov bx, [bp + 2 * 2] mov cx, 256 ; 每次读取一个字,2个字节,因此读取256次即可 mov dx, 0x1f0 .readw: in ax, dx mov [bx], ax add bx, 2 loop .readw pop dx pop cx pop bx pop ax pop bp ret times 510 - ($ - $$) db 0 db 0x55, 0xaa
SECTION code_fp_am9511 PUBLIC _cos_fastcall EXTERN asm_am9511_cos_fastcall defc _cos_fastcall = asm_am9511_cos_fastcall
//================================================================================================== /* EVE - Expressive Vector Engine Copyright : EVE Contributors & Maintainers SPDX-License-Identifier: MIT */ //================================================================================================== #pragma once #include <eve/function/derivative.hpp> #include <eve/function/negabsmax.hpp> #include <eve/function/sign.hpp> #include <eve/module/real/core/function/diff/detail/minmax_kernel.hpp> namespace eve::detail { template<int N, typename T0, typename T1, typename... Ts> auto negabsmax_(EVE_SUPPORTS(cpu_), diff_type<N> , T0 arg0, T1 arg1, Ts... args) noexcept { return -minmax_kernel<N>(eve::max, eve::sign, arg0, arg1, args...); } }
; A029744: Numbers of the form 2^n or 3*2^n. ; 1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768,49152,65536,98304,131072,196608,262144,393216,524288,786432,1048576,1572864,2097152,3145728,4194304,6291456,8388608,12582912,16777216,25165824,33554432,50331648,67108864,100663296,134217728,201326592,268435456,402653184,536870912,805306368,1073741824,1610612736,2147483648,3221225472,4294967296,6442450944,8589934592,12884901888,17179869184,25769803776,34359738368,51539607552,68719476736,103079215104,137438953472,206158430208,274877906944,412316860416,549755813888,824633720832,1099511627776,1649267441664,2199023255552,3298534883328,4398046511104,6597069766656,8796093022208,13194139533312,17592186044416,26388279066624,35184372088832,52776558133248,70368744177664,105553116266496,140737488355328,211106232532992,281474976710656,422212465065984,562949953421312,844424930131968,1125899906842624 lpb $0 sub $0,1 mov $1,$2 add $1,1 trn $2,$0 add $2,$1 lpe add $1,1 mov $0,$1
;-------------------------------------------------------- ; File Created by SDCC : free open source ANSI-C Compiler ; Version 3.6.0 #9615 (MINGW64) ;-------------------------------------------------------- .module lab1_1 .optsdcc -mmcs51 --model-small ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _main .globl _putchar .globl _printf .globl _getchar_nw .globl _Sys_Init .globl _UART0_Init .globl _SYSCLK_Init .globl _PB2 .globl _PB1 .globl _SS .globl _BUZZER .globl _BILED1 .globl _BILED0 .globl _LED0 .globl _SPIF .globl _WCOL .globl _MODF .globl _RXOVRN .globl _TXBSY .globl _SLVSEL .globl _MSTEN .globl _SPIEN .globl _AD0EN .globl _ADCEN .globl _AD0TM .globl _ADCTM .globl _AD0INT .globl _ADCINT .globl _AD0BUSY .globl _ADBUSY .globl _AD0CM1 .globl _ADSTM1 .globl _AD0CM0 .globl _ADSTM0 .globl _AD0WINT .globl _ADWINT .globl _AD0LJST .globl _ADLJST .globl _CF .globl _CR .globl _CCF4 .globl _CCF3 .globl _CCF2 .globl _CCF1 .globl _CCF0 .globl _CY .globl _AC .globl _F0 .globl _RS1 .globl _RS0 .globl _OV .globl _F1 .globl _P .globl _TF2 .globl _EXF2 .globl _RCLK .globl _TCLK .globl _EXEN2 .globl _TR2 .globl _CT2 .globl _CPRL2 .globl _BUSY .globl _ENSMB .globl _STA .globl _STO .globl _SI .globl _AA .globl _SMBFTE .globl _SMBTOE .globl _PT2 .globl _PS .globl _PS0 .globl _PT1 .globl _PX1 .globl _PT0 .globl _PX0 .globl _P3_7 .globl _P3_6 .globl _P3_5 .globl _P3_4 .globl _P3_3 .globl _P3_2 .globl _P3_1 .globl _P3_0 .globl _EA .globl _ET2 .globl _ES .globl _ES0 .globl _ET1 .globl _EX1 .globl _ET0 .globl _EX0 .globl _P2_7 .globl _P2_6 .globl _P2_5 .globl _P2_4 .globl _P2_3 .globl _P2_2 .globl _P2_1 .globl _P2_0 .globl _S0MODE .globl _SM00 .globl _SM0 .globl _SM10 .globl _SM1 .globl _MCE0 .globl _SM20 .globl _SM2 .globl _REN0 .globl _REN .globl _TB80 .globl _TB8 .globl _RB80 .globl _RB8 .globl _TI0 .globl _TI .globl _RI0 .globl _RI .globl _P1_7 .globl _P1_6 .globl _P1_5 .globl _P1_4 .globl _P1_3 .globl _P1_2 .globl _P1_1 .globl _P1_0 .globl _TF1 .globl _TR1 .globl _TF0 .globl _TR0 .globl _IE1 .globl _IT1 .globl _IE0 .globl _IT0 .globl _P0_7 .globl _P0_6 .globl _P0_5 .globl _P0_4 .globl _P0_3 .globl _P0_2 .globl _P0_1 .globl _P0_0 .globl _PCA0CP4 .globl _PCA0CP3 .globl _PCA0CP2 .globl _PCA0CP1 .globl _PCA0CP0 .globl _PCA0 .globl _DAC1 .globl _DAC0 .globl _ADC0LT .globl _ADC0GT .globl _ADC0 .globl _RCAP4 .globl _TMR4 .globl _TMR3RL .globl _TMR3 .globl _RCAP2 .globl _TMR2 .globl _TMR1 .globl _TMR0 .globl _WDTCN .globl _PCA0CPH4 .globl _PCA0CPH3 .globl _PCA0CPH2 .globl _PCA0CPH1 .globl _PCA0CPH0 .globl _PCA0H .globl _SPI0CN .globl _EIP2 .globl _EIP1 .globl _TH4 .globl _TL4 .globl _SADDR1 .globl _SBUF1 .globl _SCON1 .globl _B .globl _RSTSRC .globl _PCA0CPL4 .globl _PCA0CPL3 .globl _PCA0CPL2 .globl _PCA0CPL1 .globl _PCA0CPL0 .globl _PCA0L .globl _ADC0CN .globl _EIE2 .globl _EIE1 .globl _RCAP4H .globl _RCAP4L .globl _XBR2 .globl _XBR1 .globl _XBR0 .globl _ACC .globl _PCA0CPM4 .globl _PCA0CPM3 .globl _PCA0CPM2 .globl _PCA0CPM1 .globl _PCA0CPM0 .globl _PCA0MD .globl _PCA0CN .globl _DAC1CN .globl _DAC1H .globl _DAC1L .globl _DAC0CN .globl _DAC0H .globl _DAC0L .globl _REF0CN .globl _PSW .globl _SMB0CR .globl _TH2 .globl _TL2 .globl _RCAP2H .globl _RCAP2L .globl _T4CON .globl _T2CON .globl _ADC0LTH .globl _ADC0LTL .globl _ADC0GTH .globl _ADC0GTL .globl _SMB0ADR .globl _SMB0DAT .globl _SMB0STA .globl _SMB0CN .globl _ADC0H .globl _ADC0L .globl _P1MDIN .globl _ADC0CF .globl _AMX0SL .globl _AMX0CF .globl _SADEN0 .globl _IP .globl _FLACL .globl _FLSCL .globl _P74OUT .globl _OSCICN .globl _OSCXCN .globl _P3 .globl __XPAGE .globl _EMI0CN .globl _SADEN1 .globl _P3IF .globl _AMX1SL .globl _ADC1CF .globl _ADC1CN .globl _SADDR0 .globl _IE .globl _P3MDOUT .globl _PRT3CF .globl _P2MDOUT .globl _PRT2CF .globl _P1MDOUT .globl _PRT1CF .globl _P0MDOUT .globl _PRT0CF .globl _EMI0CF .globl _EMI0TC .globl _P2 .globl _CPT1CN .globl _CPT0CN .globl _SPI0CKR .globl _ADC1 .globl _SPI0DAT .globl _SPI0CFG .globl _SBUF0 .globl _SBUF .globl _SCON0 .globl _SCON .globl _P7 .globl _TMR3H .globl _TMR3L .globl _TMR3RLH .globl _TMR3RLL .globl _TMR3CN .globl _P1 .globl _PSCTL .globl _CKCON .globl _TH1 .globl _TH0 .globl _TL1 .globl _TL0 .globl _TMOD .globl _TCON .globl _PCON .globl _P6 .globl _P5 .globl _P4 .globl _DPH .globl _DPL .globl _SP .globl _P0 .globl _Port_Init .globl _Set_outputs .globl _sensor1 .globl _sensor2 ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- .area RSEG (ABS,DATA) .org 0x0000 G$P0$0$0 == 0x0080 _P0 = 0x0080 G$SP$0$0 == 0x0081 _SP = 0x0081 G$DPL$0$0 == 0x0082 _DPL = 0x0082 G$DPH$0$0 == 0x0083 _DPH = 0x0083 G$P4$0$0 == 0x0084 _P4 = 0x0084 G$P5$0$0 == 0x0085 _P5 = 0x0085 G$P6$0$0 == 0x0086 _P6 = 0x0086 G$PCON$0$0 == 0x0087 _PCON = 0x0087 G$TCON$0$0 == 0x0088 _TCON = 0x0088 G$TMOD$0$0 == 0x0089 _TMOD = 0x0089 G$TL0$0$0 == 0x008a _TL0 = 0x008a G$TL1$0$0 == 0x008b _TL1 = 0x008b G$TH0$0$0 == 0x008c _TH0 = 0x008c G$TH1$0$0 == 0x008d _TH1 = 0x008d G$CKCON$0$0 == 0x008e _CKCON = 0x008e G$PSCTL$0$0 == 0x008f _PSCTL = 0x008f G$P1$0$0 == 0x0090 _P1 = 0x0090 G$TMR3CN$0$0 == 0x0091 _TMR3CN = 0x0091 G$TMR3RLL$0$0 == 0x0092 _TMR3RLL = 0x0092 G$TMR3RLH$0$0 == 0x0093 _TMR3RLH = 0x0093 G$TMR3L$0$0 == 0x0094 _TMR3L = 0x0094 G$TMR3H$0$0 == 0x0095 _TMR3H = 0x0095 G$P7$0$0 == 0x0096 _P7 = 0x0096 G$SCON$0$0 == 0x0098 _SCON = 0x0098 G$SCON0$0$0 == 0x0098 _SCON0 = 0x0098 G$SBUF$0$0 == 0x0099 _SBUF = 0x0099 G$SBUF0$0$0 == 0x0099 _SBUF0 = 0x0099 G$SPI0CFG$0$0 == 0x009a _SPI0CFG = 0x009a G$SPI0DAT$0$0 == 0x009b _SPI0DAT = 0x009b G$ADC1$0$0 == 0x009c _ADC1 = 0x009c G$SPI0CKR$0$0 == 0x009d _SPI0CKR = 0x009d G$CPT0CN$0$0 == 0x009e _CPT0CN = 0x009e G$CPT1CN$0$0 == 0x009f _CPT1CN = 0x009f G$P2$0$0 == 0x00a0 _P2 = 0x00a0 G$EMI0TC$0$0 == 0x00a1 _EMI0TC = 0x00a1 G$EMI0CF$0$0 == 0x00a3 _EMI0CF = 0x00a3 G$PRT0CF$0$0 == 0x00a4 _PRT0CF = 0x00a4 G$P0MDOUT$0$0 == 0x00a4 _P0MDOUT = 0x00a4 G$PRT1CF$0$0 == 0x00a5 _PRT1CF = 0x00a5 G$P1MDOUT$0$0 == 0x00a5 _P1MDOUT = 0x00a5 G$PRT2CF$0$0 == 0x00a6 _PRT2CF = 0x00a6 G$P2MDOUT$0$0 == 0x00a6 _P2MDOUT = 0x00a6 G$PRT3CF$0$0 == 0x00a7 _PRT3CF = 0x00a7 G$P3MDOUT$0$0 == 0x00a7 _P3MDOUT = 0x00a7 G$IE$0$0 == 0x00a8 _IE = 0x00a8 G$SADDR0$0$0 == 0x00a9 _SADDR0 = 0x00a9 G$ADC1CN$0$0 == 0x00aa _ADC1CN = 0x00aa G$ADC1CF$0$0 == 0x00ab _ADC1CF = 0x00ab G$AMX1SL$0$0 == 0x00ac _AMX1SL = 0x00ac G$P3IF$0$0 == 0x00ad _P3IF = 0x00ad G$SADEN1$0$0 == 0x00ae _SADEN1 = 0x00ae G$EMI0CN$0$0 == 0x00af _EMI0CN = 0x00af G$_XPAGE$0$0 == 0x00af __XPAGE = 0x00af G$P3$0$0 == 0x00b0 _P3 = 0x00b0 G$OSCXCN$0$0 == 0x00b1 _OSCXCN = 0x00b1 G$OSCICN$0$0 == 0x00b2 _OSCICN = 0x00b2 G$P74OUT$0$0 == 0x00b5 _P74OUT = 0x00b5 G$FLSCL$0$0 == 0x00b6 _FLSCL = 0x00b6 G$FLACL$0$0 == 0x00b7 _FLACL = 0x00b7 G$IP$0$0 == 0x00b8 _IP = 0x00b8 G$SADEN0$0$0 == 0x00b9 _SADEN0 = 0x00b9 G$AMX0CF$0$0 == 0x00ba _AMX0CF = 0x00ba G$AMX0SL$0$0 == 0x00bb _AMX0SL = 0x00bb G$ADC0CF$0$0 == 0x00bc _ADC0CF = 0x00bc G$P1MDIN$0$0 == 0x00bd _P1MDIN = 0x00bd G$ADC0L$0$0 == 0x00be _ADC0L = 0x00be G$ADC0H$0$0 == 0x00bf _ADC0H = 0x00bf G$SMB0CN$0$0 == 0x00c0 _SMB0CN = 0x00c0 G$SMB0STA$0$0 == 0x00c1 _SMB0STA = 0x00c1 G$SMB0DAT$0$0 == 0x00c2 _SMB0DAT = 0x00c2 G$SMB0ADR$0$0 == 0x00c3 _SMB0ADR = 0x00c3 G$ADC0GTL$0$0 == 0x00c4 _ADC0GTL = 0x00c4 G$ADC0GTH$0$0 == 0x00c5 _ADC0GTH = 0x00c5 G$ADC0LTL$0$0 == 0x00c6 _ADC0LTL = 0x00c6 G$ADC0LTH$0$0 == 0x00c7 _ADC0LTH = 0x00c7 G$T2CON$0$0 == 0x00c8 _T2CON = 0x00c8 G$T4CON$0$0 == 0x00c9 _T4CON = 0x00c9 G$RCAP2L$0$0 == 0x00ca _RCAP2L = 0x00ca G$RCAP2H$0$0 == 0x00cb _RCAP2H = 0x00cb G$TL2$0$0 == 0x00cc _TL2 = 0x00cc G$TH2$0$0 == 0x00cd _TH2 = 0x00cd G$SMB0CR$0$0 == 0x00cf _SMB0CR = 0x00cf G$PSW$0$0 == 0x00d0 _PSW = 0x00d0 G$REF0CN$0$0 == 0x00d1 _REF0CN = 0x00d1 G$DAC0L$0$0 == 0x00d2 _DAC0L = 0x00d2 G$DAC0H$0$0 == 0x00d3 _DAC0H = 0x00d3 G$DAC0CN$0$0 == 0x00d4 _DAC0CN = 0x00d4 G$DAC1L$0$0 == 0x00d5 _DAC1L = 0x00d5 G$DAC1H$0$0 == 0x00d6 _DAC1H = 0x00d6 G$DAC1CN$0$0 == 0x00d7 _DAC1CN = 0x00d7 G$PCA0CN$0$0 == 0x00d8 _PCA0CN = 0x00d8 G$PCA0MD$0$0 == 0x00d9 _PCA0MD = 0x00d9 G$PCA0CPM0$0$0 == 0x00da _PCA0CPM0 = 0x00da G$PCA0CPM1$0$0 == 0x00db _PCA0CPM1 = 0x00db G$PCA0CPM2$0$0 == 0x00dc _PCA0CPM2 = 0x00dc G$PCA0CPM3$0$0 == 0x00dd _PCA0CPM3 = 0x00dd G$PCA0CPM4$0$0 == 0x00de _PCA0CPM4 = 0x00de G$ACC$0$0 == 0x00e0 _ACC = 0x00e0 G$XBR0$0$0 == 0x00e1 _XBR0 = 0x00e1 G$XBR1$0$0 == 0x00e2 _XBR1 = 0x00e2 G$XBR2$0$0 == 0x00e3 _XBR2 = 0x00e3 G$RCAP4L$0$0 == 0x00e4 _RCAP4L = 0x00e4 G$RCAP4H$0$0 == 0x00e5 _RCAP4H = 0x00e5 G$EIE1$0$0 == 0x00e6 _EIE1 = 0x00e6 G$EIE2$0$0 == 0x00e7 _EIE2 = 0x00e7 G$ADC0CN$0$0 == 0x00e8 _ADC0CN = 0x00e8 G$PCA0L$0$0 == 0x00e9 _PCA0L = 0x00e9 G$PCA0CPL0$0$0 == 0x00ea _PCA0CPL0 = 0x00ea G$PCA0CPL1$0$0 == 0x00eb _PCA0CPL1 = 0x00eb G$PCA0CPL2$0$0 == 0x00ec _PCA0CPL2 = 0x00ec G$PCA0CPL3$0$0 == 0x00ed _PCA0CPL3 = 0x00ed G$PCA0CPL4$0$0 == 0x00ee _PCA0CPL4 = 0x00ee G$RSTSRC$0$0 == 0x00ef _RSTSRC = 0x00ef G$B$0$0 == 0x00f0 _B = 0x00f0 G$SCON1$0$0 == 0x00f1 _SCON1 = 0x00f1 G$SBUF1$0$0 == 0x00f2 _SBUF1 = 0x00f2 G$SADDR1$0$0 == 0x00f3 _SADDR1 = 0x00f3 G$TL4$0$0 == 0x00f4 _TL4 = 0x00f4 G$TH4$0$0 == 0x00f5 _TH4 = 0x00f5 G$EIP1$0$0 == 0x00f6 _EIP1 = 0x00f6 G$EIP2$0$0 == 0x00f7 _EIP2 = 0x00f7 G$SPI0CN$0$0 == 0x00f8 _SPI0CN = 0x00f8 G$PCA0H$0$0 == 0x00f9 _PCA0H = 0x00f9 G$PCA0CPH0$0$0 == 0x00fa _PCA0CPH0 = 0x00fa G$PCA0CPH1$0$0 == 0x00fb _PCA0CPH1 = 0x00fb G$PCA0CPH2$0$0 == 0x00fc _PCA0CPH2 = 0x00fc G$PCA0CPH3$0$0 == 0x00fd _PCA0CPH3 = 0x00fd G$PCA0CPH4$0$0 == 0x00fe _PCA0CPH4 = 0x00fe G$WDTCN$0$0 == 0x00ff _WDTCN = 0x00ff G$TMR0$0$0 == 0x8c8a _TMR0 = 0x8c8a G$TMR1$0$0 == 0x8d8b _TMR1 = 0x8d8b G$TMR2$0$0 == 0xcdcc _TMR2 = 0xcdcc G$RCAP2$0$0 == 0xcbca _RCAP2 = 0xcbca G$TMR3$0$0 == 0x9594 _TMR3 = 0x9594 G$TMR3RL$0$0 == 0x9392 _TMR3RL = 0x9392 G$TMR4$0$0 == 0xf5f4 _TMR4 = 0xf5f4 G$RCAP4$0$0 == 0xe5e4 _RCAP4 = 0xe5e4 G$ADC0$0$0 == 0xbfbe _ADC0 = 0xbfbe G$ADC0GT$0$0 == 0xc5c4 _ADC0GT = 0xc5c4 G$ADC0LT$0$0 == 0xc7c6 _ADC0LT = 0xc7c6 G$DAC0$0$0 == 0xd3d2 _DAC0 = 0xd3d2 G$DAC1$0$0 == 0xd6d5 _DAC1 = 0xd6d5 G$PCA0$0$0 == 0xf9e9 _PCA0 = 0xf9e9 G$PCA0CP0$0$0 == 0xfaea _PCA0CP0 = 0xfaea G$PCA0CP1$0$0 == 0xfbeb _PCA0CP1 = 0xfbeb G$PCA0CP2$0$0 == 0xfcec _PCA0CP2 = 0xfcec G$PCA0CP3$0$0 == 0xfded _PCA0CP3 = 0xfded G$PCA0CP4$0$0 == 0xfeee _PCA0CP4 = 0xfeee ;-------------------------------------------------------- ; special function bits ;-------------------------------------------------------- .area RSEG (ABS,DATA) .org 0x0000 G$P0_0$0$0 == 0x0080 _P0_0 = 0x0080 G$P0_1$0$0 == 0x0081 _P0_1 = 0x0081 G$P0_2$0$0 == 0x0082 _P0_2 = 0x0082 G$P0_3$0$0 == 0x0083 _P0_3 = 0x0083 G$P0_4$0$0 == 0x0084 _P0_4 = 0x0084 G$P0_5$0$0 == 0x0085 _P0_5 = 0x0085 G$P0_6$0$0 == 0x0086 _P0_6 = 0x0086 G$P0_7$0$0 == 0x0087 _P0_7 = 0x0087 G$IT0$0$0 == 0x0088 _IT0 = 0x0088 G$IE0$0$0 == 0x0089 _IE0 = 0x0089 G$IT1$0$0 == 0x008a _IT1 = 0x008a G$IE1$0$0 == 0x008b _IE1 = 0x008b G$TR0$0$0 == 0x008c _TR0 = 0x008c G$TF0$0$0 == 0x008d _TF0 = 0x008d G$TR1$0$0 == 0x008e _TR1 = 0x008e G$TF1$0$0 == 0x008f _TF1 = 0x008f G$P1_0$0$0 == 0x0090 _P1_0 = 0x0090 G$P1_1$0$0 == 0x0091 _P1_1 = 0x0091 G$P1_2$0$0 == 0x0092 _P1_2 = 0x0092 G$P1_3$0$0 == 0x0093 _P1_3 = 0x0093 G$P1_4$0$0 == 0x0094 _P1_4 = 0x0094 G$P1_5$0$0 == 0x0095 _P1_5 = 0x0095 G$P1_6$0$0 == 0x0096 _P1_6 = 0x0096 G$P1_7$0$0 == 0x0097 _P1_7 = 0x0097 G$RI$0$0 == 0x0098 _RI = 0x0098 G$RI0$0$0 == 0x0098 _RI0 = 0x0098 G$TI$0$0 == 0x0099 _TI = 0x0099 G$TI0$0$0 == 0x0099 _TI0 = 0x0099 G$RB8$0$0 == 0x009a _RB8 = 0x009a G$RB80$0$0 == 0x009a _RB80 = 0x009a G$TB8$0$0 == 0x009b _TB8 = 0x009b G$TB80$0$0 == 0x009b _TB80 = 0x009b G$REN$0$0 == 0x009c _REN = 0x009c G$REN0$0$0 == 0x009c _REN0 = 0x009c G$SM2$0$0 == 0x009d _SM2 = 0x009d G$SM20$0$0 == 0x009d _SM20 = 0x009d G$MCE0$0$0 == 0x009d _MCE0 = 0x009d G$SM1$0$0 == 0x009e _SM1 = 0x009e G$SM10$0$0 == 0x009e _SM10 = 0x009e G$SM0$0$0 == 0x009f _SM0 = 0x009f G$SM00$0$0 == 0x009f _SM00 = 0x009f G$S0MODE$0$0 == 0x009f _S0MODE = 0x009f G$P2_0$0$0 == 0x00a0 _P2_0 = 0x00a0 G$P2_1$0$0 == 0x00a1 _P2_1 = 0x00a1 G$P2_2$0$0 == 0x00a2 _P2_2 = 0x00a2 G$P2_3$0$0 == 0x00a3 _P2_3 = 0x00a3 G$P2_4$0$0 == 0x00a4 _P2_4 = 0x00a4 G$P2_5$0$0 == 0x00a5 _P2_5 = 0x00a5 G$P2_6$0$0 == 0x00a6 _P2_6 = 0x00a6 G$P2_7$0$0 == 0x00a7 _P2_7 = 0x00a7 G$EX0$0$0 == 0x00a8 _EX0 = 0x00a8 G$ET0$0$0 == 0x00a9 _ET0 = 0x00a9 G$EX1$0$0 == 0x00aa _EX1 = 0x00aa G$ET1$0$0 == 0x00ab _ET1 = 0x00ab G$ES0$0$0 == 0x00ac _ES0 = 0x00ac G$ES$0$0 == 0x00ac _ES = 0x00ac G$ET2$0$0 == 0x00ad _ET2 = 0x00ad G$EA$0$0 == 0x00af _EA = 0x00af G$P3_0$0$0 == 0x00b0 _P3_0 = 0x00b0 G$P3_1$0$0 == 0x00b1 _P3_1 = 0x00b1 G$P3_2$0$0 == 0x00b2 _P3_2 = 0x00b2 G$P3_3$0$0 == 0x00b3 _P3_3 = 0x00b3 G$P3_4$0$0 == 0x00b4 _P3_4 = 0x00b4 G$P3_5$0$0 == 0x00b5 _P3_5 = 0x00b5 G$P3_6$0$0 == 0x00b6 _P3_6 = 0x00b6 G$P3_7$0$0 == 0x00b7 _P3_7 = 0x00b7 G$PX0$0$0 == 0x00b8 _PX0 = 0x00b8 G$PT0$0$0 == 0x00b9 _PT0 = 0x00b9 G$PX1$0$0 == 0x00ba _PX1 = 0x00ba G$PT1$0$0 == 0x00bb _PT1 = 0x00bb G$PS0$0$0 == 0x00bc _PS0 = 0x00bc G$PS$0$0 == 0x00bc _PS = 0x00bc G$PT2$0$0 == 0x00bd _PT2 = 0x00bd G$SMBTOE$0$0 == 0x00c0 _SMBTOE = 0x00c0 G$SMBFTE$0$0 == 0x00c1 _SMBFTE = 0x00c1 G$AA$0$0 == 0x00c2 _AA = 0x00c2 G$SI$0$0 == 0x00c3 _SI = 0x00c3 G$STO$0$0 == 0x00c4 _STO = 0x00c4 G$STA$0$0 == 0x00c5 _STA = 0x00c5 G$ENSMB$0$0 == 0x00c6 _ENSMB = 0x00c6 G$BUSY$0$0 == 0x00c7 _BUSY = 0x00c7 G$CPRL2$0$0 == 0x00c8 _CPRL2 = 0x00c8 G$CT2$0$0 == 0x00c9 _CT2 = 0x00c9 G$TR2$0$0 == 0x00ca _TR2 = 0x00ca G$EXEN2$0$0 == 0x00cb _EXEN2 = 0x00cb G$TCLK$0$0 == 0x00cc _TCLK = 0x00cc G$RCLK$0$0 == 0x00cd _RCLK = 0x00cd G$EXF2$0$0 == 0x00ce _EXF2 = 0x00ce G$TF2$0$0 == 0x00cf _TF2 = 0x00cf G$P$0$0 == 0x00d0 _P = 0x00d0 G$F1$0$0 == 0x00d1 _F1 = 0x00d1 G$OV$0$0 == 0x00d2 _OV = 0x00d2 G$RS0$0$0 == 0x00d3 _RS0 = 0x00d3 G$RS1$0$0 == 0x00d4 _RS1 = 0x00d4 G$F0$0$0 == 0x00d5 _F0 = 0x00d5 G$AC$0$0 == 0x00d6 _AC = 0x00d6 G$CY$0$0 == 0x00d7 _CY = 0x00d7 G$CCF0$0$0 == 0x00d8 _CCF0 = 0x00d8 G$CCF1$0$0 == 0x00d9 _CCF1 = 0x00d9 G$CCF2$0$0 == 0x00da _CCF2 = 0x00da G$CCF3$0$0 == 0x00db _CCF3 = 0x00db G$CCF4$0$0 == 0x00dc _CCF4 = 0x00dc G$CR$0$0 == 0x00de _CR = 0x00de G$CF$0$0 == 0x00df _CF = 0x00df G$ADLJST$0$0 == 0x00e8 _ADLJST = 0x00e8 G$AD0LJST$0$0 == 0x00e8 _AD0LJST = 0x00e8 G$ADWINT$0$0 == 0x00e9 _ADWINT = 0x00e9 G$AD0WINT$0$0 == 0x00e9 _AD0WINT = 0x00e9 G$ADSTM0$0$0 == 0x00ea _ADSTM0 = 0x00ea G$AD0CM0$0$0 == 0x00ea _AD0CM0 = 0x00ea G$ADSTM1$0$0 == 0x00eb _ADSTM1 = 0x00eb G$AD0CM1$0$0 == 0x00eb _AD0CM1 = 0x00eb G$ADBUSY$0$0 == 0x00ec _ADBUSY = 0x00ec G$AD0BUSY$0$0 == 0x00ec _AD0BUSY = 0x00ec G$ADCINT$0$0 == 0x00ed _ADCINT = 0x00ed G$AD0INT$0$0 == 0x00ed _AD0INT = 0x00ed G$ADCTM$0$0 == 0x00ee _ADCTM = 0x00ee G$AD0TM$0$0 == 0x00ee _AD0TM = 0x00ee G$ADCEN$0$0 == 0x00ef _ADCEN = 0x00ef G$AD0EN$0$0 == 0x00ef _AD0EN = 0x00ef G$SPIEN$0$0 == 0x00f8 _SPIEN = 0x00f8 G$MSTEN$0$0 == 0x00f9 _MSTEN = 0x00f9 G$SLVSEL$0$0 == 0x00fa _SLVSEL = 0x00fa G$TXBSY$0$0 == 0x00fb _TXBSY = 0x00fb G$RXOVRN$0$0 == 0x00fc _RXOVRN = 0x00fc G$MODF$0$0 == 0x00fd _MODF = 0x00fd G$WCOL$0$0 == 0x00fe _WCOL = 0x00fe G$SPIF$0$0 == 0x00ff _SPIF = 0x00ff G$LED0$0$0 == 0x00b6 _LED0 = 0x00b6 G$BILED0$0$0 == 0x00b3 _BILED0 = 0x00b3 G$BILED1$0$0 == 0x00b4 _BILED1 = 0x00b4 G$BUZZER$0$0 == 0x00b7 _BUZZER = 0x00b7 G$SS$0$0 == 0x00a0 _SS = 0x00a0 G$PB1$0$0 == 0x00b0 _PB1 = 0x00b0 G$PB2$0$0 == 0x00b1 _PB2 = 0x00b1 ;-------------------------------------------------------- ; overlayable register banks ;-------------------------------------------------------- .area REG_BANK_0 (REL,OVR,DATA) .ds 8 ;-------------------------------------------------------- ; internal ram data ;-------------------------------------------------------- .area DSEG (DATA) ;-------------------------------------------------------- ; overlayable items in internal ram ;-------------------------------------------------------- .area OSEG (OVR,DATA) .area OSEG (OVR,DATA) ;-------------------------------------------------------- ; Stack segment in internal ram ;-------------------------------------------------------- .area SSEG __start__stack: .ds 1 ;-------------------------------------------------------- ; indirectly addressable internal ram data ;-------------------------------------------------------- .area ISEG (DATA) ;-------------------------------------------------------- ; absolute internal ram data ;-------------------------------------------------------- .area IABS (ABS,DATA) .area IABS (ABS,DATA) ;-------------------------------------------------------- ; bit data ;-------------------------------------------------------- .area BSEG (BIT) ;-------------------------------------------------------- ; paged external ram data ;-------------------------------------------------------- .area PSEG (PAG,XDATA) ;-------------------------------------------------------- ; external ram data ;-------------------------------------------------------- .area XSEG (XDATA) ;-------------------------------------------------------- ; absolute external ram data ;-------------------------------------------------------- .area XABS (ABS,XDATA) ;-------------------------------------------------------- ; external initialized ram data ;-------------------------------------------------------- .area XISEG (XDATA) .area HOME (CODE) .area GSINIT0 (CODE) .area GSINIT1 (CODE) .area GSINIT2 (CODE) .area GSINIT3 (CODE) .area GSINIT4 (CODE) .area GSINIT5 (CODE) .area GSINIT (CODE) .area GSFINAL (CODE) .area CSEG (CODE) ;-------------------------------------------------------- ; interrupt vector ;-------------------------------------------------------- .area HOME (CODE) __interrupt_vect: ljmp __sdcc_gsinit_startup ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area HOME (CODE) .area GSINIT (CODE) .area GSFINAL (CODE) .area GSINIT (CODE) .globl __sdcc_gsinit_startup .globl __sdcc_program_startup .globl __start__stack .globl __mcs51_genXINIT .globl __mcs51_genXRAMCLEAR .globl __mcs51_genRAMCLEAR .area GSFINAL (CODE) ljmp __sdcc_program_startup ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area HOME (CODE) .area HOME (CODE) __sdcc_program_startup: ljmp _main ; return from main will return to caller ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area CSEG (CODE) ;------------------------------------------------------------ ;Allocation info for local variables in function 'SYSCLK_Init' ;------------------------------------------------------------ ;i Allocated to registers r6 r7 ;------------------------------------------------------------ G$SYSCLK_Init$0$0 ==. C$c8051_SDCC.h$42$0$0 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:42: void SYSCLK_Init(void) ; ----------------------------------------- ; function SYSCLK_Init ; ----------------------------------------- _SYSCLK_Init: ar7 = 0x07 ar6 = 0x06 ar5 = 0x05 ar4 = 0x04 ar3 = 0x03 ar2 = 0x02 ar1 = 0x01 ar0 = 0x00 C$c8051_SDCC.h$46$1$2 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:46: OSCXCN = 0x67; // start external oscillator with mov _OSCXCN,#0x67 C$c8051_SDCC.h$49$1$2 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:49: for (i=0; i < 256; i++); // wait for oscillator to start mov r6,#0x00 mov r7,#0x01 00107$: mov a,r6 add a,#0xff mov r4,a mov a,r7 addc a,#0xff mov r5,a mov ar6,r4 mov ar7,r5 mov a,r4 orl a,r5 jnz 00107$ C$c8051_SDCC.h$51$1$2 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:51: while (!(OSCXCN & 0x80)); // Wait for crystal osc. to settle 00102$: mov a,_OSCXCN jnb acc.7,00102$ C$c8051_SDCC.h$53$1$2 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:53: OSCICN = 0x88; // select external oscillator as SYSCLK mov _OSCICN,#0x88 C$c8051_SDCC.h$56$1$2 ==. XG$SYSCLK_Init$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'UART0_Init' ;------------------------------------------------------------ G$UART0_Init$0$0 ==. C$c8051_SDCC.h$64$1$2 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:64: void UART0_Init(void) ; ----------------------------------------- ; function UART0_Init ; ----------------------------------------- _UART0_Init: C$c8051_SDCC.h$66$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:66: SCON0 = 0x50; // SCON0: mode 1, 8-bit UART, enable RX mov _SCON0,#0x50 C$c8051_SDCC.h$67$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:67: TMOD = 0x20; // TMOD: timer 1, mode 2, 8-bit reload mov _TMOD,#0x20 C$c8051_SDCC.h$68$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:68: TH1 = 0xFF&-(SYSCLK/BAUDRATE/16); // set Timer1 reload value for baudrate mov _TH1,#0xdc C$c8051_SDCC.h$69$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:69: TR1 = 1; // start Timer1 setb _TR1 C$c8051_SDCC.h$70$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:70: CKCON |= 0x10; // Timer1 uses SYSCLK as time base orl _CKCON,#0x10 C$c8051_SDCC.h$71$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:71: PCON |= 0x80; // SMOD00 = 1 (disable baud rate orl _PCON,#0x80 C$c8051_SDCC.h$73$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:73: TI0 = 1; // Indicate TX0 ready setb _TI0 C$c8051_SDCC.h$74$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:74: P0MDOUT |= 0x01; // Set TX0 to push/pull orl _P0MDOUT,#0x01 C$c8051_SDCC.h$75$1$4 ==. XG$UART0_Init$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'Sys_Init' ;------------------------------------------------------------ G$Sys_Init$0$0 ==. C$c8051_SDCC.h$83$1$4 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:83: void Sys_Init(void) ; ----------------------------------------- ; function Sys_Init ; ----------------------------------------- _Sys_Init: C$c8051_SDCC.h$85$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:85: WDTCN = 0xde; // disable watchdog timer mov _WDTCN,#0xde C$c8051_SDCC.h$86$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:86: WDTCN = 0xad; mov _WDTCN,#0xad C$c8051_SDCC.h$88$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:88: SYSCLK_Init(); // initialize oscillator lcall _SYSCLK_Init C$c8051_SDCC.h$89$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:89: UART0_Init(); // initialize UART0 lcall _UART0_Init C$c8051_SDCC.h$91$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:91: XBR0 |= 0x04; orl _XBR0,#0x04 C$c8051_SDCC.h$92$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:92: XBR2 |= 0x40; // Enable crossbar and weak pull-ups orl _XBR2,#0x40 C$c8051_SDCC.h$93$1$6 ==. XG$Sys_Init$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'putchar' ;------------------------------------------------------------ ;c Allocated to registers r7 ;------------------------------------------------------------ G$putchar$0$0 ==. C$c8051_SDCC.h$98$1$6 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:98: void putchar(char c) ; ----------------------------------------- ; function putchar ; ----------------------------------------- _putchar: mov r7,dpl C$c8051_SDCC.h$100$1$8 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:100: while (!TI0); 00101$: C$c8051_SDCC.h$101$1$8 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:101: TI0 = 0; jbc _TI0,00112$ sjmp 00101$ 00112$: C$c8051_SDCC.h$102$1$8 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:102: SBUF0 = c; mov _SBUF0,r7 C$c8051_SDCC.h$103$1$8 ==. XG$putchar$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'getchar' ;------------------------------------------------------------ ;c Allocated to registers ;------------------------------------------------------------ G$getchar$0$0 ==. C$c8051_SDCC.h$108$1$8 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:108: char getchar(void) ; ----------------------------------------- ; function getchar ; ----------------------------------------- _getchar: C$c8051_SDCC.h$111$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:111: while (!RI0); 00101$: C$c8051_SDCC.h$112$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:112: RI0 = 0; jbc _RI0,00112$ sjmp 00101$ 00112$: C$c8051_SDCC.h$113$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:113: c = SBUF0; mov dpl,_SBUF0 C$c8051_SDCC.h$114$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:114: putchar(c); // echo to terminal lcall _putchar C$c8051_SDCC.h$115$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:115: return SBUF0; mov dpl,_SBUF0 C$c8051_SDCC.h$116$1$10 ==. XG$getchar$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'getchar_nw' ;------------------------------------------------------------ ;c Allocated to registers ;------------------------------------------------------------ G$getchar_nw$0$0 ==. C$c8051_SDCC.h$121$1$10 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:121: char getchar_nw(void) ; ----------------------------------------- ; function getchar_nw ; ----------------------------------------- _getchar_nw: C$c8051_SDCC.h$124$1$12 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:124: if (!RI0) return 0xFF; jb _RI0,00102$ mov dpl,#0xff sjmp 00104$ 00102$: C$c8051_SDCC.h$127$2$13 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:127: RI0 = 0; clr _RI0 C$c8051_SDCC.h$128$2$13 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:128: c = SBUF0; mov dpl,_SBUF0 C$c8051_SDCC.h$129$2$13 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:129: putchar(c); // echo to terminal lcall _putchar C$c8051_SDCC.h$130$2$13 ==. ; C:/Program Files/SDCC/bin/../include/mcs51/c8051_SDCC.h:130: return SBUF0; mov dpl,_SBUF0 00104$: C$c8051_SDCC.h$132$1$12 ==. XG$getchar_nw$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'main' ;------------------------------------------------------------ G$main$0$0 ==. C$lab1_1.c$36$1$12 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:36: void main(void) ; ----------------------------------------- ; function main ; ----------------------------------------- _main: C$lab1_1.c$38$1$32 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:38: Sys_Init(); // System Initialization lcall _Sys_Init C$lab1_1.c$39$1$32 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:39: putchar(' '); // the quote fonts may not copy correctly into SiLabs IDE mov dpl,#0x20 lcall _putchar C$lab1_1.c$40$1$32 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:40: Port_Init(); // Initialize ports 2 and 3 lcall _Port_Init C$lab1_1.c$42$1$32 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:42: while (1) // infinite loop 00115$: C$lab1_1.c$44$2$33 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:44: if(SS) { jnb _SS,00112$ C$lab1_1.c$45$3$34 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:45: LED0=1; setb _LED0 C$lab1_1.c$46$3$34 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:46: BILED0=1; setb _BILED0 C$lab1_1.c$47$3$34 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:47: BILED1=1; setb _BILED1 C$lab1_1.c$48$3$34 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:48: BUZZER=1; setb _BUZZER C$lab1_1.c$49$3$34 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:49: printf("\rSlide switch is off \n"); mov a,#___str_0 push acc mov a,#(___str_0 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp sjmp 00115$ 00112$: C$lab1_1.c$52$3$35 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:52: printf("\rSlide switch is on \n"); mov a,#___str_1 push acc mov a,#(___str_1 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp C$lab1_1.c$53$3$35 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:53: LED0=0; clr _LED0 C$lab1_1.c$54$3$35 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:54: if(!PB1 && !PB2) { jb _PB1,00108$ jb _PB2,00108$ C$lab1_1.c$55$4$36 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:55: printf("\rPush button 1 and Push button 2 are on \n"); mov a,#___str_2 push acc mov a,#(___str_2 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp C$lab1_1.c$56$4$36 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:56: BUZZER=0; clr _BUZZER C$lab1_1.c$57$4$36 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:57: BILED0=1; setb _BILED0 C$lab1_1.c$58$4$36 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:58: BILED1=1; setb _BILED1 sjmp 00115$ 00108$: C$lab1_1.c$60$3$35 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:60: else if(!PB1) { jb _PB1,00105$ C$lab1_1.c$61$4$37 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:61: printf("\rPush button 1 is on and push button 2 is off \n"); mov a,#___str_3 push acc mov a,#(___str_3 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp C$lab1_1.c$62$4$37 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:62: BILED0=1; setb _BILED0 C$lab1_1.c$63$4$37 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:63: BUZZER=1; setb _BUZZER C$lab1_1.c$64$4$37 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:64: BILED1=0; clr _BILED1 sjmp 00115$ 00105$: C$lab1_1.c$66$3$35 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:66: else if(!PB2) { jb _PB2,00102$ C$lab1_1.c$67$4$38 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:67: printf("\rPush button 2 is on and push button 1 is off \n"); mov a,#___str_4 push acc mov a,#(___str_4 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp C$lab1_1.c$68$4$38 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:68: BILED1=1; setb _BILED1 C$lab1_1.c$69$4$38 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:69: BUZZER=1; setb _BUZZER C$lab1_1.c$70$4$38 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:70: BILED0=0; clr _BILED0 ljmp 00115$ 00102$: C$lab1_1.c$73$4$39 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:73: BUZZER=1; setb _BUZZER C$lab1_1.c$74$4$39 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:74: BILED0=1; setb _BILED0 C$lab1_1.c$75$4$39 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:75: BILED1=1; setb _BILED1 ljmp 00115$ C$lab1_1.c$79$1$32 ==. XG$main$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'Port_Init' ;------------------------------------------------------------ G$Port_Init$0$0 ==. C$lab1_1.c$85$1$32 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:85: void Port_Init(void) ; ----------------------------------------- ; function Port_Init ; ----------------------------------------- _Port_Init: C$lab1_1.c$88$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:88: P3MDOUT |= 0xD8; // set Port 3 output pins to push-pull mode (fill in the blank) orl _P3MDOUT,#0xd8 C$lab1_1.c$89$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:89: P3MDOUT &= 0xFC; // set Port 3 input pins to open drain mode (fill in the blank) anl _P3MDOUT,#0xfc C$lab1_1.c$90$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:90: P3 |= ~0xFC; // set Port 3 input pins to high impedance state (fill in the blank) orl _P3,#0x03 C$lab1_1.c$93$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:93: P2MDOUT &= 0xFE; anl _P2MDOUT,#0xfe C$lab1_1.c$94$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:94: P2 |= ~0xFE; orl _P2,#0x01 C$lab1_1.c$97$1$41 ==. XG$Port_Init$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'Set_outputs' ;------------------------------------------------------------ G$Set_outputs$0$0 ==. C$lab1_1.c$104$1$41 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:104: void Set_outputs(void) ; ----------------------------------------- ; function Set_outputs ; ----------------------------------------- _Set_outputs: C$lab1_1.c$107$1$43 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:107: if (sensor2()) // if Slide Switch activated lcall _sensor2 mov a,dpl mov b,dph orl a,b jz 00102$ C$lab1_1.c$109$2$44 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:109: LED0 = 0; // Light LED clr _LED0 C$lab1_1.c$110$2$44 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:110: printf("\rSlide switch is off \n"); mov a,#___str_0 push acc mov a,#(___str_0 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp sjmp 00104$ 00102$: C$lab1_1.c$115$2$45 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:115: LED0 = 1; // turn off LED setb _LED0 C$lab1_1.c$116$2$45 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:116: printf("\rSlide switch is on \n"); mov a,#___str_1 push acc mov a,#(___str_1 >> 8) push acc mov a,#0x80 push acc lcall _printf dec sp dec sp dec sp 00104$: C$lab1_1.c$119$1$43 ==. XG$Set_outputs$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'sensor1' ;------------------------------------------------------------ G$sensor1$0$0 ==. C$lab1_1.c$126$1$43 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:126: int sensor1(void) ; ----------------------------------------- ; function sensor1 ; ----------------------------------------- _sensor1: C$lab1_1.c$129$1$47 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:129: if (!PB1) return 1; jb _PB1,00102$ mov dptr,#0x0001 sjmp 00104$ 00102$: C$lab1_1.c$130$1$47 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:130: else return 0; mov dptr,#0x0000 00104$: C$lab1_1.c$131$1$47 ==. XG$sensor1$0$0 ==. ret ;------------------------------------------------------------ ;Allocation info for local variables in function 'sensor2' ;------------------------------------------------------------ G$sensor2$0$0 ==. C$lab1_1.c$137$1$47 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:137: int sensor2(void) ; ----------------------------------------- ; function sensor2 ; ----------------------------------------- _sensor2: C$lab1_1.c$140$1$49 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:140: if (!SS) return 1; jb _SS,00102$ mov dptr,#0x0001 sjmp 00104$ 00102$: C$lab1_1.c$141$1$49 ==. ; C:\SiLabs\LITEC\Lab1-1\lab1-1.c:141: else return 0; mov dptr,#0x0000 00104$: C$lab1_1.c$142$1$49 ==. XG$sensor2$0$0 ==. ret .area CSEG (CODE) .area CONST (CODE) Flab1_1$__str_0$0$0 == . ___str_0: .db 0x0d .ascii "Slide switch is off " .db 0x0a .db 0x00 Flab1_1$__str_1$0$0 == . ___str_1: .db 0x0d .ascii "Slide switch is on " .db 0x0a .db 0x00 Flab1_1$__str_2$0$0 == . ___str_2: .db 0x0d .ascii "Push button 1 and Push button 2 are on " .db 0x0a .db 0x00 Flab1_1$__str_3$0$0 == . ___str_3: .db 0x0d .ascii "Push button 1 is on and push button 2 is off " .db 0x0a .db 0x00 Flab1_1$__str_4$0$0 == . ___str_4: .db 0x0d .ascii "Push button 2 is on and push button 1 is off " .db 0x0a .db 0x00 .area XINIT (CODE) .area CABS (ABS,CODE)
#ifndef BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP #define BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) # pragma once #endif // basic_config.hpp ---------------------------------------------// // (c) Copyright Robert Ramey 2004 // Use, modification, and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See library home page at http://www.boost.org/libs/serialization //----------------------------------------------------------------------------// // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html #include <boost/config.hpp> #ifdef BOOST_HAS_DECLSPEC // defined in config system // we need to import/export our code only if the user has specifically // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost // libraries to be dynamically linked, or BOOST_ARCHIVE_DYN_LINK // if they want just this one to be dynamically linked: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_ARCHIVE_DYN_LINK) // export if this is our own source, otherwise import: #ifdef BOOST_ARCHIVE_SOURCE # define BOOST_ARCHIVE_DECL __declspec(dllexport) #else # define BOOST_ARCHIVE_DECL __declspec(dllimport) #endif // BOOST_ARCHIVE_SOURCE #endif // DYN_LINK #endif // BOOST_HAS_DECLSPEC // // if BOOST_ARCHIVE_DECL isn't defined yet define it now: #ifndef BOOST_ARCHIVE_DECL #define BOOST_ARCHIVE_DECL #endif #endif // BOOST_ARCHIVE_DETAIL_BASIC_CONFIG_HPP
; A099076: a(n) = A000960(n) mod 3. ; 1,0,1,1,1,0,0,1,0,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1 seq $0,960 ; Flavius Josephus's sieve: Start with the natural numbers; at the k-th sieving step, remove every (k+1)-st term of the sequence remaining after the (k-1)-st sieving step; iterate. mod $0,3
INCLUDE "graphics/grafix.inc" XLIB w_xorpixel LIB l_cmp LIB w_pixeladdress XREF COORDS ; ; $Id: w_xorpixl.asm,v 1.1 2008/07/17 15:39:56 stefano Exp $ ; ; ****************************************************************** ; ; XOR pixel at (x,y) coordinate. ; ; Wide resolution (WORD based parameters) version by Stefano Bodrato ; ; Design & programming by Gunther Strube, Copyright (C) InterLogic 1995 ; ; The (0,0) origin is placed at the top left corner. ; ; in: hl,de = (x,y) coordinate of pixel ; ; registers changed after return: ; ......../ixiy same ; afbcdehl/.... different ; .w_xorpixel push hl ld hl,maxy call l_cmp pop hl ret nc ; Return if Y overflows push de ld de,maxx call l_cmp pop de ret c ; Return if X overflows ld (COORDS),hl ; store X ld (COORDS+2),de ; store Y: COORDS must be 2 bytes wider call w_pixeladdress ld b,a ld a,1 jr z, xor_pixel ; pixel is at bit 0... .plot_position rlca djnz plot_position .xor_pixel ex af,af ld d,18 ld bc,0d600h out (c),d loop1: in a,(c) rla jp nc,loop1 inc c out (c),h dec c inc d out (c),d loop2: in a,(c) rla jp nc,loop2 inc c out (c),l dec c ld a,31 out (c),a loop3: in a,(c) rla jp nc,loop3 inc c ex af,af in e,(c) xor e ; set pixel in current byte ex af,af dec c dec d out (c),d loop4: in a,(c) rla jp nc,loop4 inc c out (c),h dec c inc d out (c),d loop5: in a,(c) rla jp nc,loop5 inc c out (c),l dec c ld a,31 out (c),a loop6: in a,(c) rla jp nc,loop6 inc c ex af,af out (c),a ret
; A142993: Crystal ball sequence for the lattice C_4. ; 1,33,225,833,2241,4961,9633,17025,28033,43681,65121,93633,130625,177633,236321,308481,396033,501025,625633,772161,943041,1140833,1368225,1628033,1923201,2256801,2632033,3052225,3520833,4041441,4617761,5253633,5953025,6720033,7558881,8473921,9469633,10550625,11721633,12987521,14353281,15824033,17405025,19101633,20919361,22863841,24940833,27156225,29516033,32026401,34693601,37524033,40524225,43700833,47060641,50610561,54357633,58309025,62472033,66854081,71462721,76305633,81390625,86725633,92318721,98178081,104312033,110729025,117437633,124446561,131764641,139400833,147364225,155664033,164309601,173310401,182676033,192416225,202540833,213059841,223983361,235321633,247085025,259284033,271929281,285031521,298601633,312650625,327189633,342229921,357782881,373860033,390473025,407633633,425353761,443645441,462520833,481992225,502072033,522772801,544107201,566088033,588728225,612040833,636039041,660736161,686145633,712281025,739156033,766784481,795180321,824357633,854330625,885113633,916721121,949167681,982468033,1016637025,1051689633,1087640961,1124506241,1162300833,1201040225,1240740033,1281416001,1323084001,1365760033,1409460225,1454200833,1499998241,1546868961,1594829633,1643897025,1694088033,1745419681,1797909121,1851573633,1906430625,1962497633,2019792321,2078332481,2138136033,2199221025,2261605633,2325308161,2390347041,2456740833,2524508225,2593668033,2664239201,2736240801,2809692033,2884612225,2961020833,3038937441,3118381761,3199373633,3281933025,3366080033,3451834881,3539217921,3628249633,3718950625,3811341633,3905443521,4001277281,4098864033,4198225025,4299381633,4402355361,4507167841,4613840833,4722396225,4832856033,4945242401,5059577601,5175884033,5294184225,5414500833,5536856641,5661274561,5787777633,5916389025,6047132033,6180030081,6315106721,6452385633,6591890625,6733645633,6877674721,7024002081,7172652033,7323649025,7477017633,7632782561,7790968641,7951600833,8114704225,8280304033,8448425601,8619094401,8792336033,8968176225,9146640833,9327755841,9511547361,9698041633,9887265025,10079244033,10274005281,10471575521,10671981633,10875250625,11081409633,11290485921,11502506881,11717500033,11935493025,12156513633,12380589761,12607749441,12838020833,13071432225,13308012033,13547788801,13790791201,14037048033,14286588225,14539440833,14795635041,15055200161,15318165633,15584561025,15854416033,16127760481,16404624321,16685037633,16969030625,17256633633,17547877121,17842791681,18141408033,18443757025,18749869633,19059776961,19373510241,19691100833,20012580225,20337980033,20667332001 mov $1,1 add $1,$0 pow $1,2 sub $1,$0 bin $1,2 div $1,3 mul $1,32 add $1,1
;------------------------------------------------------------------------------ ; ; Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR> ; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: ; ; SmiEntry.nasm ; ; Abstract: ; ; Code template of the SMI handler for a particular processor ; ;------------------------------------------------------------------------------- %include "StuffRsbNasm.inc" ; ; Variables referenced by C code ; %define MSR_IA32_MISC_ENABLE 0x1A0 %define MSR_EFER 0xc0000080 %define MSR_EFER_XD 0x800 ; ; Constants relating to TXT_PROCESSOR_SMM_DESCRIPTOR ; %define DSC_OFFSET 0xfb00 %define DSC_GDTPTR 0x48 %define DSC_GDTSIZ 0x50 %define DSC_CS 0x14 %define DSC_DS 0x16 %define DSC_SS 0x18 %define DSC_OTHERSEG 0x1a ; ; Constants relating to CPU State Save Area ; %define SSM_DR6 0xffd0 %define SSM_DR7 0xffc8 %define PROTECT_MODE_CS 0x8 %define PROTECT_MODE_DS 0x20 %define LONG_MODE_CS 0x38 %define TSS_SEGMENT 0x40 %define GDT_SIZE 0x50 extern ASM_PFX(SmiRendezvous) extern ASM_PFX(gStmSmiHandlerIdtr) extern ASM_PFX(CpuSmmDebugEntry) extern ASM_PFX(CpuSmmDebugExit) global ASM_PFX(gStmSmbase) global ASM_PFX(gStmXdSupported) global ASM_PFX(gStmSmiStack) global ASM_PFX(gStmSmiCr3) global ASM_PFX(gcStmSmiHandlerTemplate) global ASM_PFX(gcStmSmiHandlerSize) global ASM_PFX(gcStmSmiHandlerOffset) ASM_PFX(gStmSmbase) EQU StmSmbasePatch - 4 ASM_PFX(gStmSmiStack) EQU StmSmiStackPatch - 4 ASM_PFX(gStmSmiCr3) EQU StmSmiCr3Patch - 4 ASM_PFX(gStmXdSupported) EQU StmXdSupportedPatch - 1 DEFAULT REL SECTION .text BITS 16 ASM_PFX(gcStmSmiHandlerTemplate): _StmSmiEntryPoint: mov bx, _StmGdtDesc - _StmSmiEntryPoint + 0x8000 mov ax,[cs:DSC_OFFSET + DSC_GDTSIZ] dec ax mov [cs:bx], ax mov eax, [cs:DSC_OFFSET + DSC_GDTPTR] mov [cs:bx + 2], eax o32 lgdt [cs:bx] ; lgdt fword ptr cs:[bx] mov ax, PROTECT_MODE_CS mov [cs:bx-0x2],ax o32 mov edi, strict dword 0 StmSmbasePatch: lea eax, [edi + (@ProtectedMode - _StmSmiEntryPoint) + 0x8000] mov [cs:bx-0x6],eax mov ebx, cr0 and ebx, 0x9ffafff3 or ebx, 0x23 mov cr0, ebx jmp dword 0x0:0x0 _StmGdtDesc: DW 0 DD 0 BITS 32 @ProtectedMode: mov ax, PROTECT_MODE_DS o16 mov ds, ax o16 mov es, ax o16 mov fs, ax o16 mov gs, ax o16 mov ss, ax mov esp, strict dword 0 StmSmiStackPatch: jmp ProtFlatMode BITS 64 ProtFlatMode: mov eax, strict dword 0 StmSmiCr3Patch: mov cr3, rax mov eax, 0x668 ; as cr4.PGE is not set here, refresh cr3 mov cr4, rax ; in PreModifyMtrrs() to flush TLB. ; Load TSS sub esp, 8 ; reserve room in stack sgdt [rsp] mov eax, [rsp + 2] ; eax = GDT base add esp, 8 mov dl, 0x89 mov [rax + TSS_SEGMENT + 5], dl ; clear busy flag mov eax, TSS_SEGMENT ltr ax ; enable NXE if supported mov al, strict byte 1 StmXdSupportedPatch: cmp al, 0 jz @SkipXd ; ; Check XD disable bit ; mov ecx, MSR_IA32_MISC_ENABLE rdmsr sub esp, 4 push rdx ; save MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 ; MSR_IA32_MISC_ENABLE[34] jz .0 and dx, 0xFFFB ; clear XD Disable bit if it is set wrmsr .0: mov ecx, MSR_EFER rdmsr or ax, MSR_EFER_XD ; enable NXE wrmsr jmp @XdDone @SkipXd: sub esp, 8 @XdDone: ; Switch into @LongMode push LONG_MODE_CS ; push cs hardcore here call Base ; push return address for retf later Base: add dword [rsp], @LongMode - Base; offset for far retf, seg is the 1st arg mov ecx, MSR_EFER rdmsr or ah, 1 ; enable LME wrmsr mov rbx, cr0 or ebx, 0x80010023 ; enable paging + WP + NE + MP + PE mov cr0, rbx retf @LongMode: ; long mode (64-bit code) starts here mov rax, strict qword 0 ; mov rax, ASM_PFX(gStmSmiHandlerIdtr) StmSmiEntrySmiHandlerIdtrAbsAddr: lidt [rax] lea ebx, [rdi + DSC_OFFSET] mov ax, [rbx + DSC_DS] mov ds, eax mov ax, [rbx + DSC_OTHERSEG] mov es, eax mov fs, eax mov gs, eax mov ax, [rbx + DSC_SS] mov ss, eax mov rax, strict qword 0 ; mov rax, CommonHandler StmSmiEntryCommonHandlerAbsAddr: jmp rax CommonHandler: mov rbx, [rsp + 0x08] ; rbx <- CpuIndex ; ; Save FP registers ; sub rsp, 0x200 fxsave64 [rsp] add rsp, -0x20 mov rcx, rbx call ASM_PFX(CpuSmmDebugEntry) mov rcx, rbx call ASM_PFX(SmiRendezvous) mov rcx, rbx call ASM_PFX(CpuSmmDebugExit) add rsp, 0x20 ; ; Restore FP registers ; fxrstor64 [rsp] add rsp, 0x200 lea rax, [ASM_PFX(gStmXdSupported)] mov al, [rax] cmp al, 0 jz .1 pop rdx ; get saved MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 jz .1 mov ecx, MSR_IA32_MISC_ENABLE rdmsr or dx, BIT2 ; set XD Disable bit if it was set before entering into SMM wrmsr .1: StuffRsb64 rsm _StmSmiHandler: ; ; Check XD disable bit ; xor r8, r8 lea rax, [ASM_PFX(gStmXdSupported)] mov al, [rax] cmp al, 0 jz @StmXdDone mov ecx, MSR_IA32_MISC_ENABLE rdmsr mov r8, rdx ; save MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 ; MSR_IA32_MISC_ENABLE[34] jz .0 and dx, 0xFFFB ; clear XD Disable bit if it is set wrmsr .0: mov ecx, MSR_EFER rdmsr or ax, MSR_EFER_XD ; enable NXE wrmsr @StmXdDone: push r8 ; below step is needed, because STM does not run above code. ; we have to run below code to set IDT/CR0/CR4 mov rax, strict qword 0 ; mov rax, ASM_PFX(gStmSmiHandlerIdtr) StmSmiHandlerIdtrAbsAddr: lidt [rax] mov rax, cr0 or eax, 0x80010023 ; enable paging + WP + NE + MP + PE mov cr0, rax mov rax, cr4 mov eax, 0x668 ; as cr4.PGE is not set here, refresh cr3 mov cr4, rax ; in PreModifyMtrrs() to flush TLB. ; STM init finish jmp CommonHandler ASM_PFX(gcStmSmiHandlerSize) : DW $ - _StmSmiEntryPoint ASM_PFX(gcStmSmiHandlerOffset) : DW _StmSmiHandler - _StmSmiEntryPoint global ASM_PFX(SmmCpuFeaturesLibStmSmiEntryFixupAddress) ASM_PFX(SmmCpuFeaturesLibStmSmiEntryFixupAddress): lea rax, [ASM_PFX(gStmSmiHandlerIdtr)] lea rcx, [StmSmiEntrySmiHandlerIdtrAbsAddr] mov qword [rcx - 8], rax lea rcx, [StmSmiHandlerIdtrAbsAddr] mov qword [rcx - 8], rax lea rax, [CommonHandler] lea rcx, [StmSmiEntryCommonHandlerAbsAddr] mov qword [rcx - 8], rax ret
dnl AMD K6 mpn_lshift -- mpn left shift. dnl dnl K6: 3.0 cycles/limb dnl Copyright (C) 1999, 2000 Free Software Foundation, Inc. dnl dnl This file is part of the GNU MP Library. dnl dnl The GNU MP Library is free software; you can redistribute it and/or dnl modify it under the terms of the GNU Lesser General Public License as dnl published by the Free Software Foundation; either version 2.1 of the dnl License, or (at your option) any later version. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl Lesser General Public License for more details. dnl dnl You should have received a copy of the GNU Lesser General Public dnl License along with the GNU MP Library; see the file COPYING.LIB. If dnl not, write to the Free Software Foundation, Inc., 59 Temple Place - dnl Suite 330, Boston, MA 02111-1307, USA. include(`../config.m4') C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size, C unsigned shift); C C The loop runs at 3 cycles/limb, limited by decoding and by having 3 mmx C instructions. This is despite every second fetch being unaligned. defframe(PARAM_SHIFT,16) defframe(PARAM_SIZE, 12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) .text ALIGN(32) PROLOGUE(mpn_lshift) deflit(`FRAME',0) C The 1 limb case can be done without the push %ebx, but it's then C still the same speed. The push is left as a free helping hand for C the two_or_more code. movl PARAM_SIZE, %eax pushl %ebx FRAME_pushl() movl PARAM_SRC, %ebx decl %eax movl PARAM_SHIFT, %ecx jnz L(two_or_more) movl (%ebx), %edx C src limb movl PARAM_DST, %ebx shldl( %cl, %edx, %eax) C return value shll %cl, %edx movl %edx, (%ebx) C dst limb popl %ebx ret ALIGN(16) C avoid offset 0x1f nop C avoid bad cache line crossing L(two_or_more): C eax size-1 C ebx src C ecx shift C edx movl (%ebx,%eax,4), %edx C src high limb negl %ecx movd PARAM_SHIFT, %mm6 addl $32, %ecx C 32-shift shrl %cl, %edx movd %ecx, %mm7 movl PARAM_DST, %ecx L(top): C eax counter, size-1 to 1 C ebx src C ecx dst C edx retval C C mm0 scratch C mm6 shift C mm7 32-shift movq -4(%ebx,%eax,4), %mm0 decl %eax psrlq %mm7, %mm0 movd %mm0, 4(%ecx,%eax,4) jnz L(top) movd (%ebx), %mm0 popl %ebx psllq %mm6, %mm0 movl %edx, %eax movd %mm0, (%ecx) emms ret EPILOGUE()
; A171781: Numbers for which the second bit of the binary expansion is equal to the last bit. ; 2,3,4,7,8,10,13,15,16,18,20,22,25,27,29,31,32,34,36,38,40,42,44,46,49,51,53,55,57,59,61,63,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,193,195,197,199 mov $1,2 mov $3,$0 mul $0,2 lpb $0 sub $0,1 mov $1,$0 div $0,2 lpe mov $2,$3 mul $2,2 add $1,$2 mov $0,$1
;***************************************************************************** ;* dct-a.asm: h264 encoder library ;***************************************************************************** ;* Copyright (C) 2003-2008 x264 project ;* ;* Authors: Holger Lubitz <holger@lubitz.org> ;* Loren Merritt <lorenm@u.washington.edu> ;* Laurent Aimar <fenrir@via.ecp.fr> ;* Min Chen <chenm001.163.com> ;* ;* This program is free software; you can redistribute it and/or modify ;* it under the terms of the GNU General Public License as published by ;* the Free Software Foundation; either version 2 of the License, or ;* (at your option) any later version. ;* ;* This program is distributed in the hope that it will be useful, ;* but WITHOUT ANY WARRANTY; without even the implied warranty of ;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;* GNU General Public License for more details. ;* ;* You should have received a copy of the GNU General Public License ;* along with this program; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. ;***************************************************************************** %include "x86inc.asm" %include "x86util.asm" %macro SHUFFLE_16BIT 8 %rep 8 db %1*2 db %1*2+1 %rotate 1 %endrep %endmacro SECTION_RODATA pb_sub4frame: db 0,1,4,8,5,2,3,6,9,12,13,10,7,11,14,15 pb_sub4field: db 0,4,1,8,12,5,9,13,2,6,10,14,3,7,11,15 pb_subacmask: dw 0,-1,-1,-1,-1,-1,-1,-1 pb_scan4framea: SHUFFLE_16BIT 6,3,7,0,4,1,2,5 pb_scan4frameb: SHUFFLE_16BIT 0,4,1,2,5,6,3,7 pb_idctdc_unpack: db 0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3 pb_idctdc_unpack2: db 4,4,4,4,5,5,5,5,6,6,6,6,7,7,7,7 SECTION .text cextern pw_32_0 cextern pw_32 cextern pw_8000 cextern hsub_mul cextern pb_1 cextern pw_1 %macro WALSH4_1D 5 SUMSUB_BADC m%4, m%3, m%2, m%1, m%5 SUMSUB_BADC m%4, m%2, m%3, m%1, m%5 SWAP %1, %4, %3 %endmacro %macro SUMSUB_17BIT 4 ; a, b, tmp, 0x8000 movq m%3, m%4 pxor m%1, m%4 psubw m%3, m%2 pxor m%2, m%4 pavgw m%3, m%1 pavgw m%2, m%1 pxor m%3, m%4 pxor m%2, m%4 SWAP %1, %2, %3 %endmacro INIT_MMX ;----------------------------------------------------------------------------- ; void dct4x4dc( int16_t d[4][4] ) ;----------------------------------------------------------------------------- cglobal dct4x4dc_mmx, 1,1 movq m3, [r0+24] movq m2, [r0+16] movq m1, [r0+ 8] movq m0, [r0+ 0] movq m7, [pw_8000] ; convert to unsigned and back, so that pavgw works WALSH4_1D 0,1,2,3,4 TRANSPOSE4x4W 0,1,2,3,4 SUMSUB_BADC m1, m0, m3, m2, m4 SWAP 0, 1 SWAP 2, 3 SUMSUB_17BIT 0,2,4,7 SUMSUB_17BIT 1,3,5,7 movq [r0+0], m0 movq [r0+8], m2 movq [r0+16], m3 movq [r0+24], m1 RET ;----------------------------------------------------------------------------- ; void idct4x4dc( int16_t d[4][4] ) ;----------------------------------------------------------------------------- cglobal idct4x4dc_mmx, 1,1 movq m3, [r0+24] movq m2, [r0+16] movq m1, [r0+ 8] movq m0, [r0+ 0] WALSH4_1D 0,1,2,3,4 TRANSPOSE4x4W 0,1,2,3,4 WALSH4_1D 0,1,2,3,4 movq [r0+ 0], m0 movq [r0+ 8], m1 movq [r0+16], m2 movq [r0+24], m3 RET %macro SUB_DCT4 1 ;----------------------------------------------------------------------------- ; void sub4x4_dct( int16_t dct[4][4], uint8_t *pix1, uint8_t *pix2 ) ;----------------------------------------------------------------------------- cglobal sub4x4_dct_%1, 3,3 %ifidn %1, mmx .skip_prologue: LOAD_DIFF m0, m4, m5, [r1+0*FENC_STRIDE], [r2+0*FDEC_STRIDE] LOAD_DIFF m3, m4, m5, [r1+3*FENC_STRIDE], [r2+3*FDEC_STRIDE] LOAD_DIFF m1, m4, m5, [r1+1*FENC_STRIDE], [r2+1*FDEC_STRIDE] LOAD_DIFF m2, m4, m5, [r1+2*FENC_STRIDE], [r2+2*FDEC_STRIDE] %else mova m5, [hsub_mul] LOAD_DIFF8x4_SSSE3 0, 3, 1, 2, 4, 5, r1, r2 %endif DCT4_1D 0,1,2,3,4 TRANSPOSE4x4W 0,1,2,3,4 DCT4_1D 0,1,2,3,4 movq [r0+ 0], m0 movq [r0+ 8], m1 movq [r0+16], m2 movq [r0+24], m3 RET %endmacro SUB_DCT4 mmx SUB_DCT4 ssse3 ;----------------------------------------------------------------------------- ; void add4x4_idct( uint8_t *p_dst, int16_t dct[4][4] ) ;----------------------------------------------------------------------------- cglobal add4x4_idct_mmx, 2,2 pxor m7, m7 .skip_prologue: movq m1, [r1+ 8] movq m3, [r1+24] movq m2, [r1+16] movq m0, [r1+ 0] IDCT4_1D 0,1,2,3,4,5 TRANSPOSE4x4W 0,1,2,3,4 paddw m0, [pw_32] IDCT4_1D 0,1,2,3,4,5 STORE_DIFF m0, m4, m7, [r0+0*FDEC_STRIDE] STORE_DIFF m1, m4, m7, [r0+1*FDEC_STRIDE] STORE_DIFF m2, m4, m7, [r0+2*FDEC_STRIDE] STORE_DIFF m3, m4, m7, [r0+3*FDEC_STRIDE] RET INIT_XMM cglobal add4x4_idct_sse4, 2,2,6 mova m0, [r1+0x00] ; row1/row0 mova m2, [r1+0x10] ; row3/row2 mova m1, m0 ; row1/row0 psraw m0, 1 ; row1>>1/... mova m3, m2 ; row3/row2 psraw m2, 1 ; row3>>1/... movsd m0, m1 ; row1>>1/row0 movsd m2, m3 ; row3>>1/row2 psubw m0, m3 ; row1>>1-row3/row0-2 paddw m2, m1 ; row3>>1+row1/row0+2 SBUTTERFLY2 wd, 0, 2, 1 SUMSUB_BA m2, m0, m1 pshuflw m1, m2, 10110001b pshufhw m2, m2, 10110001b punpckldq m1, m0 punpckhdq m2, m0 SWAP 0, 1 mova m1, [pw_32_0] paddw m1, m0 ; row1/row0 corrected psraw m0, 1 ; row1>>1/... mova m3, m2 ; row3/row2 psraw m2, 1 ; row3>>1/... movsd m0, m1 ; row1>>1/row0 movsd m2, m3 ; row3>>1/row2 psubw m0, m3 ; row1>>1-row3/row0-2 paddw m2, m1 ; row3>>1+row1/row0+2 SBUTTERFLY2 qdq, 0, 2, 1 SUMSUB_BA m2, m0, m1 movd m4, [r0+FDEC_STRIDE*0] movd m1, [r0+FDEC_STRIDE*1] movd m3, [r0+FDEC_STRIDE*2] movd m5, [r0+FDEC_STRIDE*3] punpckldq m1, m4 ; row0/row1 pxor m4, m4 punpckldq m3, m5 ; row3/row2 punpcklbw m1, m4 psraw m2, 6 punpcklbw m3, m4 psraw m0, 6 paddsw m2, m1 paddsw m0, m3 packuswb m0, m2 ; row0/row1/row3/row2 pextrd [r0+FDEC_STRIDE*0], m0, 3 pextrd [r0+FDEC_STRIDE*1], m0, 2 movd [r0+FDEC_STRIDE*2], m0 pextrd [r0+FDEC_STRIDE*3], m0, 1 RET INIT_MMX ;----------------------------------------------------------------------------- ; void sub8x8_dct( int16_t dct[4][4][4], uint8_t *pix1, uint8_t *pix2 ) ;----------------------------------------------------------------------------- %macro SUB_NxN_DCT 6 cglobal %1, 3,3,11 %if mmsize == 8 pxor m7, m7 %else add r2, 4*FDEC_STRIDE mova m7, [hsub_mul] %endif .skip_prologue: %ifdef WIN64 sub rsp, 8 %endif call %2 add r0, %3 add r1, %4-%5-%6*FENC_STRIDE add r2, %4-%5-%6*FDEC_STRIDE call %2 add r0, %3 add r1, (%4-%6)*FENC_STRIDE-%5-%4 add r2, (%4-%6)*FDEC_STRIDE-%5-%4 call %2 add r0, %3 add r1, %4-%5-%6*FENC_STRIDE add r2, %4-%5-%6*FDEC_STRIDE %ifdef WIN64 add rsp, 8 call %2 RET %else jmp %2 %endif %endmacro ;----------------------------------------------------------------------------- ; void add8x8_idct( uint8_t *pix, int16_t dct[4][4][4] ) ;----------------------------------------------------------------------------- %macro ADD_NxN_IDCT 6-7 cglobal %1, 2,2,11 pxor m7, m7 %if mmsize==16 add r0, 4*FDEC_STRIDE %endif .skip_prologue: %ifdef WIN64 sub rsp, 8 %endif call %2 add r0, %4-%5-%6*FDEC_STRIDE add r1, %3 call %2 add r0, (%4-%6)*FDEC_STRIDE-%5-%4 add r1, %3 call %2 add r0, %4-%5-%6*FDEC_STRIDE add r1, %3 %ifdef WIN64 add rsp, 8 call %2 RET %else jmp %2 %endif %endmacro %ifndef ARCH_X86_64 SUB_NxN_DCT sub8x8_dct_mmx, sub4x4_dct_mmx.skip_prologue, 32, 4, 0, 0 ADD_NxN_IDCT add8x8_idct_mmx, add4x4_idct_mmx.skip_prologue, 32, 4, 0, 0 SUB_NxN_DCT sub16x16_dct_mmx, sub8x8_dct_mmx.skip_prologue, 32, 8, 4, 4 ADD_NxN_IDCT add16x16_idct_mmx, add8x8_idct_mmx.skip_prologue, 32, 8, 4, 4 cextern sub8x8_dct8_mmx.skip_prologue cextern add8x8_idct8_mmx.skip_prologue SUB_NxN_DCT sub16x16_dct8_mmx, sub8x8_dct8_mmx.skip_prologue, 128, 8, 0, 0 ADD_NxN_IDCT add16x16_idct8_mmx, add8x8_idct8_mmx.skip_prologue, 128, 8, 0, 0 %endif INIT_XMM cextern sub8x8_dct_sse2.skip_prologue cextern sub8x8_dct_ssse3.skip_prologue SUB_NxN_DCT sub16x16_dct_sse2, sub8x8_dct_sse2.skip_prologue, 128, 8, 0, 0 SUB_NxN_DCT sub16x16_dct_ssse3, sub8x8_dct_ssse3.skip_prologue, 128, 8, 0, 0 cextern add8x8_idct_sse2.skip_prologue ADD_NxN_IDCT add16x16_idct_sse2, add8x8_idct_sse2.skip_prologue, 2*64, 8, 0, 0 cextern sub8x8_dct8_sse2.skip_prologue cextern add8x8_idct8_sse2.skip_prologue SUB_NxN_DCT sub16x16_dct8_sse2, sub8x8_dct8_sse2.skip_prologue, 128, 8, 0, 0 ADD_NxN_IDCT add16x16_idct8_sse2, add8x8_idct8_sse2.skip_prologue, 128, 8, 0, 0 cextern sub8x8_dct8_ssse3.skip_prologue SUB_NxN_DCT sub16x16_dct8_ssse3, sub8x8_dct8_ssse3.skip_prologue, 128, 8, 0, 0 ;----------------------------------------------------------------------------- ; void add8x8_idct_dc( uint8_t *p_dst, int16_t *dct2x2 ) ;----------------------------------------------------------------------------- %macro ADD_DC 3 movq mm4, [%3+FDEC_STRIDE*0] movq mm5, [%3+FDEC_STRIDE*1] movq mm6, [%3+FDEC_STRIDE*2] paddusb mm4, %1 paddusb mm5, %1 paddusb mm6, %1 paddusb %1, [%3+FDEC_STRIDE*3] psubusb mm4, %2 psubusb mm5, %2 psubusb mm6, %2 psubusb %1, %2 movq [%3+FDEC_STRIDE*0], mm4 movq [%3+FDEC_STRIDE*1], mm5 movq [%3+FDEC_STRIDE*2], mm6 movq [%3+FDEC_STRIDE*3], %1 %endmacro cglobal add8x8_idct_dc_mmx, 2,2 movq mm0, [r1] pxor mm1, mm1 add r0, FDEC_STRIDE*4 paddw mm0, [pw_32] psraw mm0, 6 psubw mm1, mm0 packuswb mm0, mm0 packuswb mm1, mm1 punpcklbw mm0, mm0 punpcklbw mm1, mm1 pshufw mm2, mm0, 0xFA pshufw mm3, mm1, 0xFA punpcklbw mm0, mm0 punpcklbw mm1, mm1 ADD_DC mm0, mm1, r0-FDEC_STRIDE*4 ADD_DC mm2, mm3, r0 RET cglobal add8x8_idct_dc_ssse3, 2,2 movq xmm0, [r1] pxor xmm1, xmm1 add r0, FDEC_STRIDE*4 paddw xmm0, [pw_32] psraw xmm0, 6 psubw xmm1, xmm0 movdqa xmm5, [pb_idctdc_unpack] packuswb xmm0, xmm0 packuswb xmm1, xmm1 pshufb xmm0, xmm5 pshufb xmm1, xmm5 movq xmm2, [r0+FDEC_STRIDE*-4] movq xmm3, [r0+FDEC_STRIDE*-3] movq xmm4, [r0+FDEC_STRIDE*-2] movq xmm5, [r0+FDEC_STRIDE*-1] movhps xmm2, [r0+FDEC_STRIDE* 0] movhps xmm3, [r0+FDEC_STRIDE* 1] movhps xmm4, [r0+FDEC_STRIDE* 2] movhps xmm5, [r0+FDEC_STRIDE* 3] paddusb xmm2, xmm0 paddusb xmm3, xmm0 paddusb xmm4, xmm0 paddusb xmm5, xmm0 psubusb xmm2, xmm1 psubusb xmm3, xmm1 psubusb xmm4, xmm1 psubusb xmm5, xmm1 movq [r0+FDEC_STRIDE*-4], xmm2 movq [r0+FDEC_STRIDE*-3], xmm3 movq [r0+FDEC_STRIDE*-2], xmm4 movq [r0+FDEC_STRIDE*-1], xmm5 movhps [r0+FDEC_STRIDE* 0], xmm2 movhps [r0+FDEC_STRIDE* 1], xmm3 movhps [r0+FDEC_STRIDE* 2], xmm4 movhps [r0+FDEC_STRIDE* 3], xmm5 RET cglobal add16x16_idct_dc_mmx, 2,3 mov r2, 4 .loop: movq mm0, [r1] pxor mm1, mm1 paddw mm0, [pw_32] psraw mm0, 6 psubw mm1, mm0 packuswb mm0, mm0 packuswb mm1, mm1 punpcklbw mm0, mm0 punpcklbw mm1, mm1 pshufw mm2, mm0, 0xFA pshufw mm3, mm1, 0xFA punpcklbw mm0, mm0 punpcklbw mm1, mm1 ADD_DC mm0, mm1, r0 ADD_DC mm2, mm3, r0+8 add r1, 8 add r0, FDEC_STRIDE*4 dec r2 jg .loop REP_RET %macro IDCT_DC_STORE 3 movdqa xmm4, [r0+%1+FDEC_STRIDE*0] movdqa xmm5, [r0+%1+FDEC_STRIDE*1] movdqa xmm6, [r0+%1+FDEC_STRIDE*2] movdqa xmm7, [r0+%1+FDEC_STRIDE*3] paddusb xmm4, %2 paddusb xmm5, %2 paddusb xmm6, %2 paddusb xmm7, %2 psubusb xmm4, %3 psubusb xmm5, %3 psubusb xmm6, %3 psubusb xmm7, %3 movdqa [r0+%1+FDEC_STRIDE*0], xmm4 movdqa [r0+%1+FDEC_STRIDE*1], xmm5 movdqa [r0+%1+FDEC_STRIDE*2], xmm6 movdqa [r0+%1+FDEC_STRIDE*3], xmm7 %endmacro cglobal add16x16_idct_dc_sse2, 2,2,8 call .loop add r0, FDEC_STRIDE*4 %ifdef WIN64 call .loop RET %endif .loop: add r0, FDEC_STRIDE*4 movq xmm0, [r1+0] movq xmm2, [r1+8] add r1, 16 punpcklwd xmm0, xmm0 punpcklwd xmm2, xmm2 pxor xmm1, xmm1 pxor xmm3, xmm3 paddw xmm0, [pw_32] paddw xmm2, [pw_32] psraw xmm0, 6 psraw xmm2, 6 psubw xmm1, xmm0 psubw xmm3, xmm2 packuswb xmm0, xmm1 packuswb xmm2, xmm3 movdqa xmm1, xmm0 movdqa xmm3, xmm2 punpcklbw xmm0, xmm0 punpcklbw xmm2, xmm2 punpckhbw xmm1, xmm1 punpckhbw xmm3, xmm3 IDCT_DC_STORE FDEC_STRIDE*-4, xmm0, xmm1 IDCT_DC_STORE 0, xmm2, xmm3 ret cglobal add16x16_idct_dc_ssse3, 2,2,8 call .loop add r0, FDEC_STRIDE*4 %ifdef WIN64 call .loop RET %endif .loop: add r0, FDEC_STRIDE*4 movdqa xmm0, [r1] add r1, 16 pxor xmm1, xmm1 paddw xmm0, [pw_32] psraw xmm0, 6 psubw xmm1, xmm0 movdqa xmm5, [ pb_idctdc_unpack] movdqa xmm6, [pb_idctdc_unpack2] packuswb xmm0, xmm0 packuswb xmm1, xmm1 movdqa xmm2, xmm0 movdqa xmm3, xmm1 pshufb xmm0, xmm5 pshufb xmm2, xmm6 pshufb xmm1, xmm5 pshufb xmm3, xmm6 IDCT_DC_STORE FDEC_STRIDE*-4, xmm0, xmm1 IDCT_DC_STORE 0, xmm2, xmm3 ret ;----------------------------------------------------------------------------- ; void sub8x8_dct_dc( int16_t dct[2][2], uint8_t *pix1, uint8_t *pix2 ) ;----------------------------------------------------------------------------- %macro DCTDC_2ROW_MMX 3 movq %1, [r1+FENC_STRIDE*(0+%3)] movq m1, [r1+FENC_STRIDE*(1+%3)] movq m2, [r2+FDEC_STRIDE*(0+%3)] movq m3, [r2+FDEC_STRIDE*(1+%3)] movq %2, %1 punpckldq %1, m1 punpckhdq %2, m1 movq m1, m2 punpckldq m2, m3 punpckhdq m1, m3 pxor m3, m3 psadbw %1, m3 psadbw %2, m3 psadbw m2, m3 psadbw m1, m3 psubw %1, m2 psubw %2, m1 %endmacro %macro DCT2x2 2 ; reg s1/s0 (!=m1), reg s3/s2 pshufw mm1, %1, 10100000b ; s1 s1 s0 s0 pshufw mm0, %2, 10110001b ; s3 __ s2 __ paddw mm1, %2 ; s1 s13 s0 s02 psubw mm1, mm0 ; d13 s13 d02 s02 pshufw mm0, mm1, 01000100b ; d02 s02 d02 s02 psrlq mm1, 32 ; __ __ d13 s13 paddw mm0, mm1 ; d02 s02 d02+d13 s02+s13 psllq mm1, 32 ; d13 s13 psubw mm0, mm1 ; d02-d13 s02-s13 d02+d13 s02+s13 %endmacro INIT_MMX cglobal sub8x8_dct_dc_mmxext, 3,3 DCTDC_2ROW_MMX m0, m4, 0 DCTDC_2ROW_MMX m5, m6, 2 paddw m0, m5 paddw m4, m6 punpckldq m0, m4 add r1, FENC_STRIDE*4 add r2, FDEC_STRIDE*4 DCTDC_2ROW_MMX m7, m4, 0 DCTDC_2ROW_MMX m5, m6, 2 paddw m7, m5 paddw m4, m6 punpckldq m7, m4 DCT2x2 m0, m7 movq [r0], m0 ret INIT_XMM %macro DCTDC_2ROW_SSE2 3 movq m0, [r1+FENC_STRIDE*(0+%1)] movq m1, [r1+FENC_STRIDE*(1+%1)] movq m2, [r2+FDEC_STRIDE*(0+%1)] movq m3, [r2+FDEC_STRIDE*(1+%1)] punpckldq m0, m1 punpckldq m2, m3 psadbw m0, m7 psadbw m2, m7 %if %2 paddw %3, m0 paddw m6, m2 %else SWAP %3, m0 SWAP m6, m2 %endif %endmacro cglobal sub8x8_dct_dc_sse2, 3,3,8 pxor m7, m7 DCTDC_2ROW_SSE2 0, 0, m4 DCTDC_2ROW_SSE2 2, 1, m4 add r1, FENC_STRIDE*4 add r2, FDEC_STRIDE*4 psubd m4, m6 DCTDC_2ROW_SSE2 0, 0, m5 DCTDC_2ROW_SSE2 2, 1, m5 psubd m5, m6 packssdw m4, m5 movhlps m5, m4 movdq2q mm0, m4 movdq2q mm7, m5 DCT2x2 mm0, mm7 movq [r0], mm0 RET ;----------------------------------------------------------------------------- ; void zigzag_scan_8x8_frame( int16_t level[64], int16_t dct[8][8] ) ;----------------------------------------------------------------------------- %macro SCAN_8x8 1 cglobal zigzag_scan_8x8_frame_%1, 2,2,8 movdqa xmm0, [r1] movdqa xmm1, [r1+16] movdq2q mm0, xmm0 PALIGNR xmm1, xmm1, 14, xmm2 movdq2q mm1, xmm1 movdqa xmm2, [r1+32] movdqa xmm3, [r1+48] PALIGNR xmm2, xmm2, 12, xmm4 movdq2q mm2, xmm2 PALIGNR xmm3, xmm3, 10, xmm4 movdq2q mm3, xmm3 punpckhwd xmm0, xmm1 punpckhwd xmm2, xmm3 movq mm4, mm1 movq mm5, mm1 movq mm6, mm2 movq mm7, mm3 punpckhwd mm1, mm0 psllq mm0, 16 psrlq mm3, 16 punpckhdq mm1, mm1 punpckhdq mm2, mm0 punpcklwd mm0, mm4 punpckhwd mm4, mm3 punpcklwd mm4, mm2 punpckhdq mm0, mm2 punpcklwd mm6, mm3 punpcklwd mm5, mm7 punpcklwd mm5, mm6 movdqa xmm4, [r1+64] movdqa xmm5, [r1+80] movdqa xmm6, [r1+96] movdqa xmm7, [r1+112] movq [r0+2*00], mm0 movq [r0+2*04], mm4 movd [r0+2*08], mm1 movq [r0+2*36], mm5 movq [r0+2*46], mm6 PALIGNR xmm4, xmm4, 14, xmm3 movdq2q mm4, xmm4 PALIGNR xmm5, xmm5, 12, xmm3 movdq2q mm5, xmm5 PALIGNR xmm6, xmm6, 10, xmm3 movdq2q mm6, xmm6 %ifidn %1, ssse3 PALIGNR xmm7, xmm7, 8, xmm3 movdq2q mm7, xmm7 %else movhlps xmm3, xmm7 punpcklqdq xmm7, xmm7 movdq2q mm7, xmm3 %endif punpckhwd xmm4, xmm5 punpckhwd xmm6, xmm7 movq mm0, mm4 movq mm1, mm5 movq mm3, mm7 punpcklwd mm7, mm6 psrlq mm6, 16 punpcklwd mm4, mm6 punpcklwd mm5, mm4 punpckhdq mm4, mm3 punpcklwd mm3, mm6 punpckhwd mm3, mm4 punpckhwd mm0, mm1 punpckldq mm4, mm0 punpckhdq mm0, mm6 pshufw mm4, mm4, 0x6c movq [r0+2*14], mm4 movq [r0+2*25], mm0 movd [r0+2*54], mm7 movq [r0+2*56], mm5 movq [r0+2*60], mm3 movdqa xmm3, xmm0 movdqa xmm7, xmm4 punpckldq xmm0, xmm2 punpckldq xmm4, xmm6 punpckhdq xmm3, xmm2 punpckhdq xmm7, xmm6 pshufhw xmm0, xmm0, 0x1b pshuflw xmm4, xmm4, 0x1b pshufhw xmm3, xmm3, 0x1b pshuflw xmm7, xmm7, 0x1b movlps [r0+2*10], xmm0 movhps [r0+2*17], xmm0 movlps [r0+2*21], xmm3 movlps [r0+2*28], xmm4 movhps [r0+2*32], xmm3 movhps [r0+2*39], xmm4 movlps [r0+2*43], xmm7 movhps [r0+2*50], xmm7 RET %endmacro INIT_XMM %define PALIGNR PALIGNR_MMX SCAN_8x8 sse2 %define PALIGNR PALIGNR_SSSE3 SCAN_8x8 ssse3 ;----------------------------------------------------------------------------- ; void zigzag_scan_8x8_frame( int16_t level[64], int16_t dct[8][8] ) ;----------------------------------------------------------------------------- cglobal zigzag_scan_8x8_frame_mmxext, 2,2 movq mm0, [r1] movq mm1, [r1+2*8] movq mm2, [r1+2*14] movq mm3, [r1+2*21] movq mm4, [r1+2*28] movq mm5, mm0 movq mm6, mm1 psrlq mm0, 16 punpckldq mm1, mm1 punpcklwd mm5, mm6 punpckhwd mm1, mm3 punpckhwd mm6, mm0 punpckldq mm5, mm0 movq mm7, [r1+2*52] movq mm0, [r1+2*60] punpckhwd mm1, mm2 punpcklwd mm2, mm4 punpckhwd mm4, mm3 punpckldq mm3, mm3 punpckhwd mm3, mm2 movq [r0], mm5 movq [r0+2*4], mm1 movq [r0+2*8], mm6 punpcklwd mm6, mm0 punpcklwd mm6, mm7 movq mm1, [r1+2*32] movq mm5, [r1+2*39] movq mm2, [r1+2*46] movq [r0+2*35], mm3 movq [r0+2*47], mm4 punpckhwd mm7, mm0 psllq mm0, 16 movq mm3, mm5 punpcklwd mm5, mm1 punpckhwd mm1, mm2 punpckhdq mm3, mm3 movq [r0+2*52], mm6 movq [r0+2*13], mm5 movq mm4, [r1+2*11] movq mm6, [r1+2*25] punpcklwd mm5, mm7 punpcklwd mm1, mm3 punpckhdq mm0, mm7 movq mm3, [r1+2*4] movq mm7, [r1+2*18] punpcklwd mm2, mm5 movq [r0+2*25], mm1 movq mm1, mm4 movq mm5, mm6 punpcklwd mm4, mm3 punpcklwd mm6, mm7 punpckhwd mm1, mm3 punpckhwd mm5, mm7 movq mm3, mm6 movq mm7, mm5 punpckldq mm6, mm4 punpckldq mm5, mm1 punpckhdq mm3, mm4 punpckhdq mm7, mm1 movq mm4, [r1+2*35] movq mm1, [r1+2*49] pshufw mm6, mm6, 0x1b pshufw mm5, mm5, 0x1b movq [r0+2*60], mm0 movq [r0+2*56], mm2 movq mm0, [r1+2*42] movq mm2, [r1+2*56] movq [r0+2*17], mm3 movq [r0+2*32], mm7 movq [r0+2*10], mm6 movq [r0+2*21], mm5 movq mm3, mm0 movq mm7, mm2 punpcklwd mm0, mm4 punpcklwd mm2, mm1 punpckhwd mm3, mm4 punpckhwd mm7, mm1 movq mm4, mm2 movq mm1, mm7 punpckhdq mm2, mm0 punpckhdq mm7, mm3 punpckldq mm4, mm0 punpckldq mm1, mm3 pshufw mm2, mm2, 0x1b pshufw mm7, mm7, 0x1b movq [r0+2*28], mm4 movq [r0+2*43], mm1 movq [r0+2*39], mm2 movq [r0+2*50], mm7 RET ;----------------------------------------------------------------------------- ; void zigzag_scan_4x4_frame( int16_t level[16], int16_t dct[4][4] ) ;----------------------------------------------------------------------------- cglobal zigzag_scan_4x4_frame_mmx, 2,2 movq mm0, [r1] movq mm1, [r1+8] movq mm2, [r1+16] movq mm3, [r1+24] movq mm4, mm0 movq mm5, mm1 movq mm6, mm2 movq mm7, mm3 psllq mm3, 16 psrlq mm0, 16 punpckldq mm2, mm2 punpckhdq mm1, mm1 punpcklwd mm4, mm5 punpcklwd mm5, mm3 punpckldq mm4, mm0 punpckhwd mm5, mm2 punpckhwd mm0, mm6 punpckhwd mm6, mm7 punpcklwd mm1, mm0 punpckhdq mm3, mm6 movq [r0], mm4 movq [r0+8], mm5 movq [r0+16], mm1 movq [r0+24], mm3 RET ;----------------------------------------------------------------------------- ; void zigzag_scan_4x4_frame( int16_t level[16], int16_t dct[4][4] ) ;----------------------------------------------------------------------------- cglobal zigzag_scan_4x4_frame_ssse3, 2,2 movdqa xmm1, [r1+16] movdqa xmm0, [r1] pshufb xmm1, [pb_scan4frameb] pshufb xmm0, [pb_scan4framea] movdqa xmm2, xmm1 psrldq xmm1, 6 palignr xmm2, xmm0, 6 pslldq xmm0, 10 palignr xmm1, xmm0, 10 movdqa [r0], xmm2 movdqa [r0+16], xmm1 RET ;----------------------------------------------------------------------------- ; void zigzag_scan_4x4_field( int16_t level[16], int16_t dct[4][4] ) ;----------------------------------------------------------------------------- ; sse2 is only 1 cycle faster, and ssse3/pshufb is slower on core2 cglobal zigzag_scan_4x4_field_mmxext, 2,3 pshufw mm0, [r1+4], 0xd2 movq mm1, [r1+16] movq mm2, [r1+24] movq [r0+4], mm0 movq [r0+16], mm1 movq [r0+24], mm2 mov r2d, [r1] mov [r0], r2d mov r2d, [r1+12] mov [r0+12], r2d RET ;----------------------------------------------------------------------------- ; void zigzag_scan_8x8_field( int16_t level[64], int16_t dct[8][8] ) ;----------------------------------------------------------------------------- ; Output order: ; 0 1 2 8 9 3 4 10 ; 16 11 5 6 7 12 17 24 ; 18 13 14 15 19 25 32 26 ; 20 21 22 23 27 33 40 34 ; 28 29 30 31 35 41 48 42 ; 36 37 38 39 43 49 50 44 ; 45 46 47 51 56 57 52 53 ; 54 55 58 59 60 61 62 63 cglobal zigzag_scan_8x8_field_mmxext, 2,3 movq mm0, [r1+2*0] ; 03 02 01 00 movq mm1, [r1+2*4] ; 07 06 05 04 movq mm2, [r1+2*8] ; 11 10 09 08 pshufw mm3, mm0, 011111111b ; 03 03 03 03 movd r2, mm2 ; 09 08 pshufw mm2, mm2, 000111001b ; 08 11 10 09 punpcklwd mm3, mm1 ; 05 03 04 03 pinsrw mm0, r2, 3 ; 08 02 01 00 movq mm4, mm2 punpcklwd mm2, mm3 ; 04 10 03 09 pshufw mm2, mm2, 010110100b ; 10 04 03 09 movq [r0+2*0], mm0 ; 08 02 01 00 movq [r0+2*4], mm2 ; 10 04 03 09 movq mm3, [r1+2*12] ; 15 14 13 12 movq mm5, [r1+2*16] ; 19 18 17 16 punpckldq mm6, mm5 ; 17 16 XX XX psrlq mm1, 16 ; XX 07 06 05 punpckhwd mm6, mm4 ; 08 17 11 16 punpckldq mm6, mm1 ; 06 05 11 16 movq [r0+2*8], mm6 ; 06 05 11 16 psrlq mm1, 16 ; XX XX 07 06 punpcklwd mm1, mm5 ; 17 07 16 06 movq mm0, [r1+2*20] ; 23 22 21 20 movq mm2, [r1+2*24] ; 27 26 25 24 movq mm6, mm3 punpckhdq mm1, mm1 ; 17 07 17 07 punpcklwd mm6, mm2 ; 25 13 24 12 pextrw r2, mm5, 2 movq [r0+2*24], mm0 ; 23 22 21 20 punpcklwd mm1, mm6 ; 24 17 12 07 movq [r0+2*12], mm1 pinsrw mm3, r2, 0 ; 15 14 13 18 movq [r0+2*16], mm3 ; 15 14 13 18 movq mm7, [r1+2*28] movq mm0, [r1+2*32] ; 35 34 33 32 psrlq mm5, 48 ; XX XX XX 19 pshufw mm1, mm2, 011111001b ; 27 27 26 25 punpcklwd mm5, mm0 ; 33 XX 32 19 psrlq mm2, 48 ; XX XX XX 27 punpcklwd mm5, mm1 ; 26 32 25 19 movq [r0+2*32], mm7 movq [r0+2*20], mm5 ; 26 32 25 19 movq mm7, [r1+2*36] movq mm1, [r1+2*40] ; 43 42 41 40 pshufw mm3, mm0, 011111001b ; 35 35 34 33 punpcklwd mm2, mm1 ; 41 XX 40 27 movq [r0+2*40], mm7 punpcklwd mm2, mm3 ; 34 40 33 27 movq [r0+2*28], mm2 movq mm7, [r1+2*44] ; 47 46 45 44 movq mm2, [r1+2*48] ; 51 50 49 48 psrlq mm0, 48 ; XX XX XX 35 punpcklwd mm0, mm2 ; 49 XX 48 35 pshufw mm3, mm1, 011111001b ; 43 43 42 41 punpcklwd mm0, mm3 ; 42 48 41 35 movq [r0+2*36], mm0 pextrw r2, mm2, 3 ; 51 psrlq mm1, 48 ; XX XX XX 43 punpcklwd mm1, mm7 ; 45 XX 44 43 psrlq mm2, 16 ; XX 51 50 49 punpcklwd mm1, mm2 ; 50 44 49 43 pshufw mm1, mm1, 010110100b ; 44 50 49 43 movq [r0+2*44], mm1 psrlq mm7, 16 ; XX 47 46 45 pinsrw mm7, r2, 3 ; 51 47 46 45 movq [r0+2*48], mm7 movq mm0, [r1+2*56] ; 59 58 57 56 movq mm1, [r1+2*52] ; 55 54 53 52 movq mm2, mm0 movq mm7, [r1+2*60] punpckldq mm2, mm1 ; 53 52 57 56 punpckhdq mm1, mm0 ; 59 58 55 54 movq [r0+2*52], mm2 movq [r0+2*56], mm1 movq [r0+2*60], mm7 RET ;----------------------------------------------------------------------------- ; void zigzag_sub_4x4_frame( int16_t level[16], const uint8_t *src, uint8_t *dst ) ;----------------------------------------------------------------------------- %macro ZIGZAG_SUB_4x4 2 %ifidn %1, ac cglobal zigzag_sub_4x4%1_%2_ssse3, 4,4,8 %else cglobal zigzag_sub_4x4%1_%2_ssse3, 3,3,8 %endif movd xmm0, [r1+0*FENC_STRIDE] movd xmm1, [r1+1*FENC_STRIDE] movd xmm2, [r1+2*FENC_STRIDE] movd xmm3, [r1+3*FENC_STRIDE] movd xmm4, [r2+0*FDEC_STRIDE] movd xmm5, [r2+1*FDEC_STRIDE] movd xmm6, [r2+2*FDEC_STRIDE] movd xmm7, [r2+3*FDEC_STRIDE] movd [r2+0*FDEC_STRIDE], xmm0 movd [r2+1*FDEC_STRIDE], xmm1 movd [r2+2*FDEC_STRIDE], xmm2 movd [r2+3*FDEC_STRIDE], xmm3 punpckldq xmm0, xmm1 punpckldq xmm2, xmm3 punpckldq xmm4, xmm5 punpckldq xmm6, xmm7 punpcklqdq xmm0, xmm2 punpcklqdq xmm4, xmm6 %ifidn %2, frame movdqa xmm7, [pb_sub4frame] %else movdqa xmm7, [pb_sub4field] %endif pshufb xmm0, xmm7 pshufb xmm4, xmm7 pxor xmm6, xmm6 movdqa xmm1, xmm0 movdqa xmm5, xmm4 punpcklbw xmm0, xmm6 punpckhbw xmm1, xmm6 punpcklbw xmm4, xmm6 punpckhbw xmm5, xmm6 psubw xmm0, xmm4 psubw xmm1, xmm5 %ifidn %1, ac movd r2d, xmm0 pand xmm0, [pb_subacmask] %endif movdqa [r0], xmm0 pxor xmm2, xmm2 movdqa [r0+16], xmm1 por xmm0, xmm1 pcmpeqb xmm0, xmm2 pmovmskb eax, xmm0 %ifidn %1, ac mov [r3], r2w %endif sub eax, 0xffff shr eax, 31 RET %endmacro ZIGZAG_SUB_4x4 , frame ZIGZAG_SUB_4x4 ac, frame ZIGZAG_SUB_4x4 , field ZIGZAG_SUB_4x4 ac, field ;----------------------------------------------------------------------------- ; void zigzag_interleave_8x8_cavlc( int16_t *dst, int16_t *src, uint8_t *nnz ) ;----------------------------------------------------------------------------- %macro INTERLEAVE 1 movq m0, [r1+%1*4+ 0] movq m1, [r1+%1*4+ 8] movq m2, [r1+%1*4+16] movq m3, [r1+%1*4+24] TRANSPOSE4x4W 0,1,2,3,4 movq [r0+%1+ 0], m0 movq [r0+%1+32], m1 movq [r0+%1+64], m2 movq [r0+%1+96], m3 %if %1 packsswb m0, m1 por m6, m2 por m7, m3 por m5, m0 %else packsswb m0, m1 SWAP m5, m0 SWAP m6, m2 SWAP m7, m3 %endif %endmacro INIT_MMX cglobal zigzag_interleave_8x8_cavlc_mmx, 3,3 INTERLEAVE 0 INTERLEAVE 8 INTERLEAVE 16 INTERLEAVE 24 packsswb m6, m7 packsswb m5, m6 packsswb m5, m5 pxor m0, m0 pcmpeqb m5, m0 paddb m5, [pb_1] movd r0d, m5 mov [r2+0], r0w shr r0d, 16 mov [r2+8], r0w RET %macro INTERLEAVE_XMM 1 mova m0, [r1+%1*4+ 0] mova m1, [r1+%1*4+16] mova m4, [r1+%1*4+32] mova m5, [r1+%1*4+48] SBUTTERFLY wd, 0, 1, 6 SBUTTERFLY wd, 4, 5, 7 SBUTTERFLY wd, 0, 1, 6 SBUTTERFLY wd, 4, 5, 7 movq [r0+%1+ 0], m0 movhps [r0+%1+ 32], m0 movq [r0+%1+ 64], m1 movhps [r0+%1+ 96], m1 movq [r0+%1+ 8], m4 movhps [r0+%1+ 40], m4 movq [r0+%1+ 72], m5 movhps [r0+%1+104], m5 %if %1 por m2, m0 por m3, m1 por m2, m4 por m3, m5 %else SWAP 0,2 SWAP 3,1 por m2, m4 por m3, m5 %endif %endmacro INIT_XMM cglobal zigzag_interleave_8x8_cavlc_sse2, 3,3,8 INTERLEAVE_XMM 0 INTERLEAVE_XMM 16 packsswb m2, m3 pxor m5, m5 packsswb m2, m2 packsswb m2, m2 pcmpeqb m5, m2 paddb m5, [pb_1] movd r0d, m5 mov [r2+0], r0w shr r0d, 16 mov [r2+8], r0w RET
#include <iostream> #include <string> using namespace std; int main(){ string alunni[10], alunno; int eta[10], etalu; int contarray = 0; for (int i = 0; i<10; i++){ cout<< "Inserire il cognome e l'eta' dell'alunno numero " <<i+1 <<endl; cin>>alunno; cin>>etalu; if (etalu >= 18){ alunni[contarray] = alunno; eta[contarray] = etalu; contarray++; } } cout<< "Gli alunni maggiorenni sono: " <<endl; for (int i = 0; i < contarray; i++){ cout<<alunni[i] <<" " <<eta[i] <<endl; } return 0; }
; A142672: Primes congruent to 11 mod 57. ; Submitted by Jon Maiga ; 11,239,353,467,809,1151,1493,1607,1721,1949,2063,2633,2861,3089,3203,3659,4001,4229,4457,4799,5483,5711,5939,6053,6737,7079,7193,7307,7649,7877,8219,8447,9473,9587,9929,10271,10499,10613,11069,11411,11867,11981,12323,12437,12893,13007,13121,13463,13577,13691,14033,14489,14717,14831,15173,15287,15401,15629,15971,16427,16883,17681,17909,18251,18593,19163,19391,19961,20759,20873,21101,21557,22013,22469,22697,22811,23039,23609,24179,24407,24749,24977,25889,26003,26459,26573,26687,26801,27143,27827 mov $1,5 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,2 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,57 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,113
INCLUDE "hardware.inc" INCLUDE "header.inc" ;-------------------------------------------------------------------------- ;- RESTART VECTORS - ;-------------------------------------------------------------------------- SECTION "RST_00",HOME[$0000] ret SECTION "RST_08",HOME[$0008] ret SECTION "RST_10",HOME[$0010] ret SECTION "RST_18",HOME[$0018] ret SECTION "RST_20",HOME[$0020] ret SECTION "RST_28",HOME[$0028] ret SECTION "RST_30",HOME[$0030] ret SECTION "RST_38",HOME[$0038] jp Reset ;-------------------------------------------------------------------------- ;- INTERRUPT VECTORS - ;-------------------------------------------------------------------------- SECTION "Interrupt Vectors",HOME[$0040] ; SECTION "VBL Interrupt Vector",HOME[$0040] push hl ld hl,_is_vbl_flag ld [hl],1 jr irq_VBlank ; SECTION "LCD Interrupt Vector",HOME[$0048] push hl ld hl,LCD_handler jr irq_Common nop nop ; SECTION "TIM Interrupt Vector",HOME[$0050] ld [hl+],a ld [hl],b inc hl ret ; don't enable interrupts again! nop nop nop nop ; SECTION "SIO Interrupt Vector",HOME[$0058] ld a,IEF_TIMER ld [rIE],a ld [rIF],a xor a,a reti ; SECTION "JOY Interrupt Vector",HOME[$0060] push hl ld hl,JOY_handler jr irq_Common ; nop ; nop ;-------------------------------------------------------------------------- ;- IRQS HANDLER - ;-------------------------------------------------------------------------- irq_VBlank: ld hl,VBL_handler irq_Common: push af ld a,[hl+] ld h,[hl] ld l,a ; or a,h ; jr z,.no_irq push bc push de call .goto_irq_handler pop de pop bc ;.no_irq: pop af pop hl reti .goto_irq_handler: jp hl ;-------------------------------------------------------------------------- ;- wait_vbl() - ;-------------------------------------------------------------------------- wait_vbl: ld hl,_is_vbl_flag ld [hl],0 ._not_yet: halt bit 0,[hl] jr z,._not_yet ret ;-------------------------------------------------------------------------- ;- CARTRIDGE HEADER - ;-------------------------------------------------------------------------- SECTION "Cartridge Header",HOME[$0100] nop jp StartPoint DB $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C,$00,$0D DB $00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6,$DD,$DD,$D9,$99 DB $BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC,$99,$9F,$BB,$B9,$33,$3E ; 0123456789ABC DB "TESTING......" DW $0000 DB $C0 ;GBC flag DB 0,0,0 ;SuperGameboy DB $1B ;CARTTYPE (MBC5+RAM+BATTERY) DB 0 ;ROMSIZE DB 2 ;RAMSIZE (8KB) DB $01 ;Destination (0 = Japan, 1 = Non Japan) DB $00 ;Manufacturer DB 0 ;Version DB 0 ;Complement check DW 0 ;Checksum ;-------------------------------------------------------------------------- ;- INITIALIZE THE GAMEBOY - ;-------------------------------------------------------------------------- SECTION "Program Start",HOME[$0150] StartPoint: di ld sp,$FFFE ; Use this as stack for a while push af ; Save CPU type push bc xor a,a ld [rNR52],a ; Switch off sound ld hl,_RAM ; Clear RAM ld bc,$2000 ld d,$00 call memset pop bc ; Get CPU type pop af ld [Init_Reg_A],a ; Save CPU type into RAM ld a,b ld [Init_Reg_B],a ld sp,StackTop ; Real stack call screen_off ld hl,_VRAM ; Clear VRAM ld bc,$2000 ld d,$00 call memset ld hl,_HRAM ; Clear high RAM (and rIE) ld bc,$0080 ld d,$00 call memset call init_OAM ; Copy OAM refresh function to high ram call refresh_OAM ; We filled RAM with $00, so this will clear OAM call rom_handler_init ; Real program starts here call Main ;Should never reach this point jp Reset ;-------------------------------------------------------------------------- ;- Reset() - ;-------------------------------------------------------------------------- Reset:: ld a,[Init_Reg_B] ld b,a ld a,[Init_Reg_A] jp $0100 ;-------------------------------------------------------------------------- ;- irq_set_VBL() bc = function pointer - ;- irq_set_LCD() bc = function pointer - ;- irq_set_TIM() bc = function pointer - ;- irq_set_SIO() bc = function pointer - ;- irq_set_JOY() bc = function pointer - ;-------------------------------------------------------------------------- irq_set_VBL:: ld hl,VBL_handler jr irq_set_handler irq_set_LCD:: ld hl,LCD_handler jr irq_set_handler irq_set_TIM:: ld hl,TIM_handler jr irq_set_handler irq_set_SIO:: ld hl,SIO_handler jr irq_set_handler irq_set_JOY:: ld hl,JOY_handler ; jr irq_set_handler irq_set_handler: ; hl = dest handler bc = function pointer ld [hl],c inc hl ld [hl],b ret ;-------------------------------------------------------------------------- ;- CPU_fast() - ;- CPU_slow() - ;-------------------------------------------------------------------------- CPU_fast:: ld a,[rKEY1] bit 7,a jr z,__CPU_switch ret CPU_slow:: ld a,[rKEY1] bit 7,a jr nz,__CPU_switch ret __CPU_switch: ld a,[rIE] ld b,a ; save IE xor a,a ld [rIE],a ld a,$30 ld [rP1],a ld a,$01 ld [rKEY1],a stop ld a,b ld [rIE],a ; restore IE ret ;-------------------------------------------------------------------------- ;- Variables - ;-------------------------------------------------------------------------- SECTION "StartupVars",BSS Init_Reg_A:: DS 1 Init_Reg_B:: DS 1 _is_vbl_flag: DS 1 VBL_handler: DS 2 LCD_handler: DS 2 TIM_handler: DS 2 SIO_handler: DS 2 JOY_handler: DS 2 SECTION "Stack",BSS[$CE00] Stack: DS $200 StackTop: ; $D000
; A050452: a(n) = Sum_{d|n, d=3 mod 4} d. ; 0,0,3,0,0,3,7,0,3,0,11,3,0,7,18,0,0,3,19,0,10,11,23,3,0,0,30,7,0,18,31,0,14,0,42,3,0,19,42,0,0,10,43,11,18,23,47,3,7,0,54,0,0,30,66,7,22,0,59,18,0,31,73,0,0,14,67,0,26,42,71,3,0,0,93,19,18,42,79,0,30,0,83,10,0,43,90,11,0,18,98,23,34,47,114,3,0,7,113,0 add $0,1 mov $2,$0 lpb $0 mov $3,$2 dif $3,$0 cmp $3,$2 cmp $3,0 mul $3,$0 sub $0,1 mov $4,1 lpb $4 add $1,$3 add $4,$3 mod $4,4 lpe lpe mov $0,$1
/*============================================================================= Copyright (c) 2001-2006 Joel de Guzman Copyright (c) 2005-2006 Dan Marsden Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ==============================================================================*/ #if !defined(BOOST_FUSION_STD_PAIR_24122005_1744) #define BOOST_FUSION_STD_PAIR_24122005_1744 #include <boost/fusion/support/tag_of_fwd.hpp> #include <boost/fusion/adapted/struct.hpp> #include <boost/mpl/int.hpp> #include <boost/config/no_tr1/utility.hpp> namespace boost { namespace fusion { struct struct_tag; namespace traits { template <typename T1, typename T2> #if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) struct tag_of<std::pair<T1, T2>, void > #else struct tag_of<std::pair<T1, T2> > #endif { typedef struct_tag type; }; } namespace extension { template <typename Struct, int N> struct struct_member; template <typename Struct> struct struct_size; template <typename T1, typename T2> struct struct_member<std::pair<T1, T2>, 0> { typedef T1 type; static type& call(std::pair<T1, T2>& pair) { return pair.first; } }; template <typename T1, typename T2> struct struct_member<std::pair<T1, T2>, 1> { typedef T2 type; static type& call(std::pair<T1, T2>& pair) { return pair.second; } }; template <typename T1, typename T2> struct struct_size<std::pair<T1, T2> > : mpl::int_<2> { }; } }} #endif
; A082543: Take a string of n x's and insert n-1 ^'s and n-1 pairs of parentheses in all possible ways. Sequence gives number of distinct integer values when x=sqrt(2). ; 0,0,1,1,2,2,3,4,5,7 pow $0,2 sub $0,93 mov $2,$0 div $2,13 mov $0,$2 add $0,7 mod $0,10
; void funlockfile(FILE *file) SECTION code_clib SECTION code_stdio PUBLIC _funlockfile EXTERN asm_funlockfile _funlockfile: pop af pop ix push hl push af jp asm_funlockfile
.global s_prepare_buffers s_prepare_buffers: push %r15 push %r9 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x100a0, %rsi lea addresses_WC_ht+0x84b0, %rdi nop nop nop nop xor %r15, %r15 mov $97, %rcx rep movsq dec %rbp lea addresses_normal_ht+0x11a82, %rsi lea addresses_WC_ht+0xf5d0, %rdi nop nop and %r9, %r9 mov $28, %rcx rep movsq nop nop nop xor %rcx, %rcx lea addresses_D_ht+0xa1ce, %rdi nop nop nop cmp $61293, %rdx movb (%rdi), %r15b nop nop xor %rdi, %rdi lea addresses_UC_ht+0xeb74, %rsi lea addresses_UC_ht+0x191d0, %rdi nop nop nop nop nop add $33580, %rax mov $117, %rcx rep movsl nop nop nop sub $40090, %r15 lea addresses_UC_ht+0xafb0, %rsi lea addresses_WT_ht+0x2cb0, %rdi clflush (%rsi) nop nop nop nop nop inc %r15 mov $2, %rcx rep movsb nop and %rbp, %rbp lea addresses_WT_ht+0x90b0, %rsi lea addresses_D_ht+0x184b0, %rdi nop inc %r15 mov $110, %rcx rep movsw nop inc %r15 lea addresses_normal_ht+0xf8b0, %rsi lea addresses_WT_ht+0x1e822, %rdi clflush (%rsi) nop nop nop nop inc %r9 mov $0, %rcx rep movsl and %rbp, %rbp lea addresses_D_ht+0x579b, %rsi lea addresses_WC_ht+0x15b1c, %rdi nop nop sub $52303, %rdx mov $38, %rcx rep movsw lfence lea addresses_WT_ht+0x3f20, %rax clflush (%rax) nop nop nop nop inc %rdi mov (%rax), %r9d nop nop nop nop cmp %rsi, %rsi lea addresses_A_ht+0xcc60, %rsi lea addresses_D_ht+0x10a60, %rdi nop nop sub $8537, %rax mov $101, %rcx rep movsw nop nop xor $32816, %r9 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r15 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r9 push %rax push %rdx push %rsi // Load mov $0x7cf7390000000db0, %rdx clflush (%rdx) nop nop nop nop and %r9, %r9 movups (%rdx), %xmm3 vpextrq $0, %xmm3, %r14 nop nop nop nop nop xor %r11, %r11 // Store lea addresses_A+0x155b0, %rdx cmp %rsi, %rsi movb $0x51, (%rdx) nop nop sub $8220, %rsi // Store lea addresses_UC+0x56b0, %r15 nop nop nop sub %r14, %r14 movl $0x51525354, (%r15) nop nop nop nop nop add $10027, %r14 // Store lea addresses_PSE+0x116f0, %r14 nop nop nop nop nop dec %r9 movl $0x51525354, (%r14) nop nop nop nop and %r14, %r14 // Faulty Load lea addresses_A+0x1f4b0, %r9 nop nop inc %rax mov (%r9), %r15 lea oracles, %rax and $0xff, %r15 shlq $12, %r15 mov (%rax,%r15,1), %r15 pop %rsi pop %rdx pop %rax pop %r9 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 8, 'size': 16, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': True, 'congruent': 8, 'size': 4, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, '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 */
// // Oric.cpp // Clock Signal // // Created by Thomas Harte on 06/11/2016. // Copyright 2016 Thomas Harte. All rights reserved. // #include "Oric.hpp" using namespace Storage::Tape::Oric; int Parser::get_next_byte(const std::shared_ptr<Storage::Tape::Tape> &tape, bool use_fast_encoding) { detection_mode_ = use_fast_encoding ? FastZero : SlowZero; cycle_length_ = 0.0f; int result = 0; int bit_count = 0; while(bit_count < 11 && !tape->is_at_end()) { SymbolType symbol = get_next_symbol(tape); if(!bit_count && symbol != SymbolType::Zero) continue; detection_mode_ = use_fast_encoding ? FastData : SlowData; result |= ((symbol == SymbolType::One) ? 1 : 0) << bit_count; bit_count++; } // TODO: check parity? return tape->is_at_end() ? -1 : ((result >> 1)&0xff); } bool Parser::sync_and_get_encoding_speed(const std::shared_ptr<Storage::Tape::Tape> &tape) { detection_mode_ = Sync; while(!tape->is_at_end()) { const SymbolType symbol = get_next_symbol(tape); switch(symbol) { case SymbolType::FoundSlow: return false; case SymbolType::FoundFast: return true; default: break; } } return false; } void Parser::process_pulse(const Storage::Tape::Tape::Pulse &pulse) { constexpr float maximum_short_length = 0.000512f; constexpr float maximum_medium_length = 0.000728f; constexpr float maximum_long_length = 0.001456f; bool wave_is_high = pulse.type == Storage::Tape::Tape::Pulse::High; if(!wave_was_high_ && wave_is_high != wave_was_high_) { if(cycle_length_ < maximum_short_length) push_wave(WaveType::Short); else if(cycle_length_ < maximum_medium_length) push_wave(WaveType::Medium); else if(cycle_length_ < maximum_long_length) push_wave(WaveType::Long); else push_wave(WaveType::Unrecognised); cycle_length_ = 0.0f; } wave_was_high_ = wave_is_high; cycle_length_ += pulse.length.get<float>(); } void Parser::inspect_waves(const std::vector<WaveType> &waves) { switch(detection_mode_) { case FastZero: if(waves.empty()) return; if(waves[0] == WaveType::Medium) { push_symbol(SymbolType::Zero, 1); return; } break; case FastData: if(waves.empty()) return; if(waves[0] == WaveType::Medium) { push_symbol(SymbolType::Zero, 1); return; } if(waves[0] == WaveType::Short) { push_symbol(SymbolType::One, 1); return; } break; case SlowZero: if(waves.size() < 4) return; if(waves[0] == WaveType::Long && waves[1] == WaveType::Long && waves[2] == WaveType::Long && waves[3] == WaveType::Long) { push_symbol(SymbolType::Zero, 4); return; } break; case SlowData: #define CHECK_RUN(length, type, symbol) \ if(waves.size() >= length) {\ std::size_t c;\ for(c = 0; c < length; c++) if(waves[c] != type) break;\ if(c == length) {\ push_symbol(symbol, length);\ return;\ }\ } CHECK_RUN(4, WaveType::Long, SymbolType::Zero); CHECK_RUN(8, WaveType::Short, SymbolType::One); #undef CHECK_RUN if(waves.size() < 16) return; // TODO, maybe: if there are any inconsistencies in the first 8, don't return break; case Sync: { // Sync is 0x16, either encoded fast or slow; i.e. 0 0110 1000 1 const Pattern slow_sync[] = { {WaveType::Long, 8}, {WaveType::Short, 16}, {WaveType::Long, 4}, {WaveType::Short, 8}, {WaveType::Long, 12}, {WaveType::Short, 8}, {WaveType::Unrecognised} }; const Pattern fast_sync[] = { {WaveType::Medium, 2}, {WaveType::Short, 2}, {WaveType::Medium, 1}, {WaveType::Short, 1}, {WaveType::Medium, 3}, {WaveType::Short, 1}, {WaveType::Unrecognised} }; std::size_t slow_sync_matching_depth = pattern_matching_depth(waves, slow_sync); std::size_t fast_sync_matching_depth = pattern_matching_depth(waves, fast_sync); if(slow_sync_matching_depth == 52) { push_symbol(SymbolType::FoundSlow, 52); return; } if(fast_sync_matching_depth == 10) { push_symbol(SymbolType::FoundFast, 10); return; } if(slow_sync_matching_depth < waves.size() && fast_sync_matching_depth < waves.size()) { int least_depth = int(std::min(slow_sync_matching_depth, fast_sync_matching_depth)); remove_waves(least_depth ? least_depth : 1); } return; } break; } remove_waves(1); } std::size_t Parser::pattern_matching_depth(const std::vector<WaveType> &waves, const Pattern *pattern) { std::size_t depth = 0; int pattern_depth = 0; while(depth < waves.size() && pattern->type != WaveType::Unrecognised) { if(waves[depth] != pattern->type) break; depth++; pattern_depth++; if(pattern_depth == pattern->count) { pattern_depth = 0; pattern++; } } return depth; }
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r9 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0xa0dd, %rax nop nop nop nop nop dec %rsi movb (%rax), %r12b nop nop nop nop and %rbp, %rbp lea addresses_WT_ht+0x15453, %rsi lea addresses_normal_ht+0xe30b, %rdi nop nop nop nop nop xor $58711, %rbx mov $68, %rcx rep movsq nop add %rcx, %rcx lea addresses_D_ht+0x8101, %rsi lea addresses_UC_ht+0x1a1, %rdi nop nop nop nop nop xor %r9, %r9 mov $84, %rcx rep movsq nop nop nop nop nop dec %rbp lea addresses_normal_ht+0x5d81, %r9 nop nop nop sub %rsi, %rsi mov (%r9), %rbp nop nop inc %rbp lea addresses_normal_ht+0xdb64, %rax nop xor $42526, %rbx movb $0x61, (%rax) nop sub %r9, %r9 lea addresses_WC_ht+0xca1, %rsi lea addresses_A_ht+0x1abc1, %rdi dec %rbx mov $82, %rcx rep movsw nop nop nop nop nop inc %rdi lea addresses_UC_ht+0x9b81, %rsi lea addresses_A_ht+0x13e01, %rdi clflush (%rdi) nop nop nop add %r12, %r12 mov $3, %rcx rep movsw nop sub $6396, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r9 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r15 push %rbx push %rcx push %rdi push %rsi // Store lea addresses_normal+0xfb81, %rdi nop cmp $17857, %rbx mov $0x5152535455565758, %r13 movq %r13, (%rdi) nop nop nop add $8179, %r13 // REPMOV lea addresses_normal+0x6781, %rsi lea addresses_PSE+0x14381, %rdi clflush (%rsi) nop nop sub $63007, %r13 mov $56, %rcx rep movsq add $55219, %r11 // REPMOV lea addresses_A+0x8297, %rsi lea addresses_A+0x1c891, %rdi nop nop nop and $44363, %r10 mov $44, %rcx rep movsq nop nop nop sub $31370, %r11 // Store lea addresses_A+0x2b81, %rsi nop nop nop nop nop dec %rdi movb $0x51, (%rsi) nop nop nop nop nop inc %rsi // Store lea addresses_D+0x6121, %r15 nop nop inc %r11 movw $0x5152, (%r15) nop nop nop xor %rcx, %rcx // Store lea addresses_UC+0xfb81, %r11 nop nop nop nop nop and $54572, %r10 mov $0x5152535455565758, %rcx movq %rcx, %xmm3 movups %xmm3, (%r11) nop nop nop nop add %rsi, %rsi // Load lea addresses_PSE+0x17321, %r15 add %r10, %r10 movb (%r15), %r11b nop xor $64170, %rsi // Store lea addresses_A+0x162ad, %r13 clflush (%r13) nop dec %rsi mov $0x5152535455565758, %r15 movq %r15, %xmm3 movups %xmm3, (%r13) nop nop nop nop nop add %rcx, %rcx // Faulty Load lea addresses_UC+0xfb81, %r10 nop nop nop cmp %r11, %r11 mov (%r10), %r13d lea oracles, %r11 and $0xff, %r13 shlq $12, %r13 mov (%r11,%r13,1), %r13 pop %rsi pop %rdi pop %rcx pop %rbx pop %r15 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 11, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_normal'}} {'dst': {'same': False, 'congruent': 2, 'type': 'addresses_A'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_A'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D', 'congruent': 5}, 'OP': 'STOR'} {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_UC', 'congruent': 0}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_PSE', 'congruent': 5}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_A', 'congruent': 1}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 2}} {'dst': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 1, 'type': 'addresses_WT_ht'}} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 9}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}} {'dst': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_UC_ht'}} {'58': 21829} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
; A135448: Period 5: repeat [1, 5, 3, 4, -2]. ; Submitted by Christian Krause ; 1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1,5,3,4,-2,1 mov $1,5 pow $1,$0 add $1,14 mod $1,11 sub $1,3 mov $0,$1
; This program Sums content of a 16 bit array ;Author: MBadry org 100h include 'emu8086.inc' .data array DW 0001h,0002h,0003h arrayCount = ($-array)/2 .code main PROC lea si,array mov cx, arrayCount call ArraySum call PRINT_NUM_UNS JMP Exit main ENDP ;----------------------------------------------------- ;ArraySum PROC ;Calculates the sum of an array of 16-bit integers. ;Receives: SI the array offset ; CX = number of elements in the array ;Returns: AX = sum of the array elements ;----------------------------------------------------- ArraySum PROC push si push cx mov ax,0 L1: add ax,[si] add si,2 loop L1 pop si pop cx ret ArraySum ENDP Exit: ret DEFINE_PRINT_NUM_UNS END main
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/directconnect/model/AllocatePrivateVirtualInterfaceResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::DirectConnect::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; AllocatePrivateVirtualInterfaceResult::AllocatePrivateVirtualInterfaceResult() : m_vlan(0), m_asn(0), m_addressFamily(AddressFamily::NOT_SET), m_virtualInterfaceState(VirtualInterfaceState::NOT_SET) { } AllocatePrivateVirtualInterfaceResult::AllocatePrivateVirtualInterfaceResult(const AmazonWebServiceResult<JsonValue>& result) : m_vlan(0), m_asn(0), m_addressFamily(AddressFamily::NOT_SET), m_virtualInterfaceState(VirtualInterfaceState::NOT_SET) { *this = result; } AllocatePrivateVirtualInterfaceResult& AllocatePrivateVirtualInterfaceResult::operator =(const AmazonWebServiceResult<JsonValue>& result) { const JsonValue& jsonValue = result.GetPayload(); if(jsonValue.ValueExists("ownerAccount")) { m_ownerAccount = jsonValue.GetString("ownerAccount"); } if(jsonValue.ValueExists("virtualInterfaceId")) { m_virtualInterfaceId = jsonValue.GetString("virtualInterfaceId"); } if(jsonValue.ValueExists("location")) { m_location = jsonValue.GetString("location"); } if(jsonValue.ValueExists("connectionId")) { m_connectionId = jsonValue.GetString("connectionId"); } if(jsonValue.ValueExists("virtualInterfaceType")) { m_virtualInterfaceType = jsonValue.GetString("virtualInterfaceType"); } if(jsonValue.ValueExists("virtualInterfaceName")) { m_virtualInterfaceName = jsonValue.GetString("virtualInterfaceName"); } if(jsonValue.ValueExists("vlan")) { m_vlan = jsonValue.GetInteger("vlan"); } if(jsonValue.ValueExists("asn")) { m_asn = jsonValue.GetInteger("asn"); } if(jsonValue.ValueExists("authKey")) { m_authKey = jsonValue.GetString("authKey"); } if(jsonValue.ValueExists("amazonAddress")) { m_amazonAddress = jsonValue.GetString("amazonAddress"); } if(jsonValue.ValueExists("customerAddress")) { m_customerAddress = jsonValue.GetString("customerAddress"); } if(jsonValue.ValueExists("addressFamily")) { m_addressFamily = AddressFamilyMapper::GetAddressFamilyForName(jsonValue.GetString("addressFamily")); } if(jsonValue.ValueExists("virtualInterfaceState")) { m_virtualInterfaceState = VirtualInterfaceStateMapper::GetVirtualInterfaceStateForName(jsonValue.GetString("virtualInterfaceState")); } if(jsonValue.ValueExists("customerRouterConfig")) { m_customerRouterConfig = jsonValue.GetString("customerRouterConfig"); } if(jsonValue.ValueExists("virtualGatewayId")) { m_virtualGatewayId = jsonValue.GetString("virtualGatewayId"); } if(jsonValue.ValueExists("routeFilterPrefixes")) { Array<JsonValue> routeFilterPrefixesJsonList = jsonValue.GetArray("routeFilterPrefixes"); for(unsigned routeFilterPrefixesIndex = 0; routeFilterPrefixesIndex < routeFilterPrefixesJsonList.GetLength(); ++routeFilterPrefixesIndex) { m_routeFilterPrefixes.push_back(routeFilterPrefixesJsonList[routeFilterPrefixesIndex].AsObject()); } } if(jsonValue.ValueExists("bgpPeers")) { Array<JsonValue> bgpPeersJsonList = jsonValue.GetArray("bgpPeers"); for(unsigned bgpPeersIndex = 0; bgpPeersIndex < bgpPeersJsonList.GetLength(); ++bgpPeersIndex) { m_bgpPeers.push_back(bgpPeersJsonList[bgpPeersIndex].AsObject()); } } return *this; }
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <cstring> #include <iomanip> #include <climits> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <functional> #include <iterator> using namespace std; #define SIZE 200010 pair<long long int, long long int> arr[SIZE]; long long int dsc[SIZE << 1], ans[SIZE]; long long int prefixSum[SIZE << 1]; int main() { ios::sync_with_stdio(false); int num; cin >> num; for (int i = 0; i < num; i++) { cin >> arr[i].first >> arr[i].second; dsc[i << 1] = arr[i].first; dsc[i << 1 ^ 1] = arr[i].second + 1; } sort(dsc + 0, dsc + (num << 1)); int dscLen = unique(dsc + 0, dsc + (num << 1)) - dsc; for (int i = 0; i < num; i++) { int leftPt = lower_bound(dsc + 0, dsc + dscLen, arr[i].first) - dsc; int rightPt = lower_bound(dsc + 0, dsc + dscLen, arr[i].second + 1) - dsc; prefixSum[leftPt]++; prefixSum[rightPt]--; } for (int i = 1; i < (num << 1); i++) { prefixSum[i] += prefixSum[i - 1]; } memset(ans, 0, sizeof(ans)); for (int i = 0; i < (num << 1); i++) { ans[prefixSum[i]] += dsc[i + 1] - dsc[i]; } for (int i = 1; i <= num; i++) { cout << ans[i]; if (i < num) cout << " "; else cout << endl; } return 0; }
SeafoamIslandsB1F_Script: call EnableAutoTextBoxDrawing ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] jr z, .asm_46362 ld hl, Seafoam2HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 jr nz, .asm_46340 SetEventReuseHL EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_1 ld [wObjectToShow], a jr .asm_4634c .asm_46340 SetEventAfterBranchReuseHL EVENT_SEAFOAM2_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM2_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B1F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B2F_BOULDER_2 ld [wObjectToShow], a .asm_4634c ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef_jump ShowObject .asm_46362 ld a, SEAFOAM_ISLANDS_B2F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam2HolesCoords jp IsPlayerOnDungeonWarp Seafoam2HolesCoords: dbmapcoord 18, 6 dbmapcoord 23, 6 db -1 ; end SeafoamIslandsB1F_TextPointers: dw BoulderText dw BoulderText
include mpcp.inc ;; declaracoes de dados (variaveis globais) .data seq SWORD 1, 2, 3 msg BYTE "%d", 13, 10, 0 ;; seccao de codigo principal .code poly2 PROTO coefs:PTR SWORD, x:SWORD main PROC C invoke poly2, OFFSET seq, 2 invoke printf, OFFSET msg, eax invoke _getch invoke ExitProcess, 0 main ENDP ;; ----------------------------- ;; codigo de outras rotinas poly2 PROC USES ebx esi coefs:PTR SWORD, x:SWORD xor eax, eax xor edx, edx xor ebx, ebx mov esi, coefs mov ax, x imul x mov bx,[esi] imul bx push eax mov ax, x mov bx,[esi+2] imul bx pop edx add ax, dx add ax, [esi+4] ret poly2 ENDP end
; A267541: Expansion of (2 + 4*x + x^2 + x^3 + 2*x^4 + x^5)/(1 - x - x^5 + x^6). ; 2,6,7,8,10,13,17,18,19,21,24,28,29,30,32,35,39,40,41,43,46,50,51,52,54,57,61,62,63,65,68,72,73,74,76,79,83,84,85,87,90,94,95,96,98,101,105,106,107,109,112,116,117,118,120,123,127,128,129,131,134,138,139,140,142,145,149,150,151,153,156,160,161,162,164,167,171,172,173,175,178,182,183,184,186,189,193,194,195,197,200,204,205,206,208,211,215,216,217,219,222,226,227,228,230,233,237,238,239,241,244,248,249,250,252,255,259,260,261,263,266,270,271,272,274,277,281,282,283,285,288,292,293,294,296,299,303,304,305,307,310,314,315,316,318,321,325,326,327,329,332,336,337,338,340,343,347,348,349,351,354,358,359,360,362,365,369,370,371,373,376,380,381,382,384,387,391,392,393,395,398,402,403,404,406,409,413,414,415,417,420,424,425,426,428,431,435,436,437,439,442,446,447,448,450,453,457,458,459,461,464,468,469,470,472,475,479,480,481,483,486,490,491,492,494,497,501,502,503,505,508,512,513,514,516,519,523,524,525,527,530,534,535,536,538,541,545,546,547,549 mov $3,$0 add $0,5 mul $0,2 mov $1,7 lpb $0,1 sub $0,3 mov $2,$0 trn $0,$1 add $4,6 lpe sub $1,1 sub $2,1 trn $2,3 add $4,$1 add $1,4 add $4,$2 add $4,5 add $1,$4 lpb $3,1 add $1,1 sub $3,1 lpe sub $1,28
map_header Museum2F, MUSEUM_2F, MUSEUM, 0 end_map_header
; ; Copyright (c) 2014-2018, Linaro Limited. All rights reserved. ; ; SPDX-License-Identifier: BSD-2-Clause-Patent ; AREA IoLibMmio, CODE, READONLY EXPORT MmioRead8Internal EXPORT MmioWrite8Internal EXPORT MmioRead16Internal EXPORT MmioWrite16Internal EXPORT MmioRead32Internal EXPORT MmioWrite32Internal EXPORT MmioRead64Internal EXPORT MmioWrite64Internal ; ; Reads an 8-bit MMIO register. ; ; Reads the 8-bit MMIO register specified by Address. The 8-bit read value is ; returned. This function must guarantee that all MMIO read and write ; operations are serialized. ; ; @param Address The MMIO register to read. ; ; @return The value read. ; MmioRead8Internal ldrb w0, [x0] dmb ld ret ; ; Writes an 8-bit MMIO register. ; ; Writes the 8-bit MMIO register specified by Address with the value specified ; by Value and returns Value. This function must guarantee that all MMIO read ; and write operations are serialized. ; ; @param Address The MMIO register to write. ; @param Value The value to write to the MMIO register. ; MmioWrite8Internal dmb st strb w1, [x0] ret ; ; Reads a 16-bit MMIO register. ; ; Reads the 16-bit MMIO register specified by Address. The 16-bit read value is ; returned. This function must guarantee that all MMIO read and write ; operations are serialized. ; ; @param Address The MMIO register to read. ; ; @return The value read. ; MmioRead16Internal ldrh w0, [x0] dmb ld ret ; ; Writes a 16-bit MMIO register. ; ; Writes the 16-bit MMIO register specified by Address with the value specified ; by Value and returns Value. This function must guarantee that all MMIO read ; and write operations are serialized. ; ; @param Address The MMIO register to write. ; @param Value The value to write to the MMIO register. ; MmioWrite16Internal dmb st strh w1, [x0] ret ; ; Reads a 32-bit MMIO register. ; ; Reads the 32-bit MMIO register specified by Address. The 32-bit read value is ; returned. This function must guarantee that all MMIO read and write ; operations are serialized. ; ; @param Address The MMIO register to read. ; ; @return The value read. ; MmioRead32Internal ldr w0, [x0] dmb ld ret ; ; Writes a 32-bit MMIO register. ; ; Writes the 32-bit MMIO register specified by Address with the value specified ; by Value and returns Value. This function must guarantee that all MMIO read ; and write operations are serialized. ; ; @param Address The MMIO register to write. ; @param Value The value to write to the MMIO register. ; MmioWrite32Internal dmb st str w1, [x0] ret ; ; Reads a 64-bit MMIO register. ; ; Reads the 64-bit MMIO register specified by Address. The 64-bit read value is ; returned. This function must guarantee that all MMIO read and write ; operations are serialized. ; ; @param Address The MMIO register to read. ; ; @return The value read. ; MmioRead64Internal ldr x0, [x0] dmb ld ret ; ; Writes a 64-bit MMIO register. ; ; Writes the 64-bit MMIO register specified by Address with the value specified ; by Value and returns Value. This function must guarantee that all MMIO read ; and write operations are serialized. ; ; @param Address The MMIO register to write. ; @param Value The value to write to the MMIO register. ; MmioWrite64Internal dmb st str x1, [x0] ret END
; A188511: Floor(7n/10). ; 0,0,1,2,2,3,4,4,5,6,7,7,8,9,9,10,11,11,12,13,14,14,15,16,16,17,18,18,19,20,21,21,22,23,23,24,25,25,26,27,28,28,29,30,30,31,32,32,33,34,35,35,36,37,37,38,39,39,40,41,42,42,43,44,44,45,46,46,47,48,49,49,50,51,51,52,53,53,54,55,56,56,57,58,58,59,60,60,61,62,63 mul $0,7 div $0,10
<% from pwnlib.shellcraft.aarch64.linux import syscall %> <%page args="clock_id, res"/> <%docstring> Invokes the syscall clock_getres. See 'man 2 clock_getres' for more information. Arguments: clock_id(clockid_t): clock_id res(timespec): res </%docstring> ${syscall('SYS_clock_getres', clock_id, res)}
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #include "frc/TimedRobot.h" #include <stdint.h> #include <utility> #include <hal/HAL.h> #include "frc/Timer.h" #include "frc/Utility.h" #include "frc/WPIErrors.h" using namespace frc; void TimedRobot::StartCompetition() { RobotInit(); // Tell the DS that the robot is ready to be enabled HAL_ObserveUserProgramStarting(); m_expirationTime = units::second_t{Timer::GetFPGATimestamp()} + m_period; UpdateAlarm(); // Loop forever, calling the appropriate mode-dependent function while (true) { int32_t status = 0; uint64_t curTime = HAL_WaitForNotifierAlarm(m_notifier, &status); if (curTime == 0 || status != 0) break; m_expirationTime += m_period; UpdateAlarm(); // Call callback LoopFunc(); } } units::second_t TimedRobot::GetPeriod() const { return units::second_t(m_period); } TimedRobot::TimedRobot(double period) : TimedRobot(units::second_t(period)) {} TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) { int32_t status = 0; m_notifier = HAL_InitializeNotifier(&status); wpi_setErrorWithContext(status, HAL_GetErrorMessage(status)); HAL_Report(HALUsageReporting::kResourceType_Framework, HALUsageReporting::kFramework_Timed); } TimedRobot::~TimedRobot() { int32_t status = 0; HAL_StopNotifier(m_notifier, &status); wpi_setErrorWithContext(status, HAL_GetErrorMessage(status)); HAL_CleanNotifier(m_notifier, &status); } void TimedRobot::UpdateAlarm() { int32_t status = 0; HAL_UpdateNotifierAlarm( m_notifier, static_cast<uint64_t>(m_expirationTime * 1e6), &status); wpi_setErrorWithContext(status, HAL_GetErrorMessage(status)); }
;/*! ; @file ; ; @brief BvsScrollRt DOS wrapper ; ; (c) osFree Project 2008-2022, <http://www.osFree.org> ; for licence see licence.txt in root directory, or project website ; ; This is Family API implementation for DOS, used with BIND tools ; to link required API ; ; @author Yuri Prokushev (yuri.prokushev@gmail.com) ; ;----------------------------------------------------------------------------------- ;----------------------------------------------------------------------------------- ; ;*/ .8086 ; Helpers INCLUDE HELPERS.INC INCLUDE BSEERR.INC _TEXT SEGMENT BYTE PUBLIC 'CODE' USE16 @BVSPROLOG BVSSCROLLRT VIOHANDLE DW ? CELL DD ? LINES DW ? RIGHTCOL DW ? BOTROW DW ? LEFTCOL DW ? TOPROW DW ? @BVSSTART BVSSCROLLRT EXTERN VIOCHECKHANDLE: PROC MOV BX,[DS:BP].ARGS.VIOHANDLE ; GET HANDLE CALL VIOCHECKHANDLE JNZ EXIT MOV AX,[DS:BP].ARGS.TOPROW ; GET TOP ROW MOV CH,AL ; PUT IN PLACE MOV AX,[DS:BP].ARGS.LEFTCOL ; GET LEFT COLUMN MOV CL,AL ; PUT IN PLACE MOV AX,[DS:BP].ARGS.BOTROW ; GET BOTTOM ROW MOV DH,AL ; PUT IN PLACE MOV AX,[DS:BP].ARGS.RIGHTCOL ; GET RIGHT COLUMN MOV DL,AL ; PUT IN PLACE LDS SI,[DS:BP].ARGS.CELL ; GET POINTER TO CELL LODSW ; GET THE CELL TO USE MOV BH,AH ; PUT ATTRIBUTE IN PLACE MOV AX,[DS:BP].ARGS.LINES ; GET LINES TO SCROLL OR AX,AX ; IS IT 0? JNE F10_20 ; NO, SO GO ON XOR AX,AX ; NOTHING TO DO, SO RETURN GOOD JMP EXIT ; GO AWAY F10_20: CMP AX,-1 ; IF IT IS -1, MAKE IT 0 JNE F10_21 ; ITS NOT, SO GO ON XOR AX,AX ; MAKE IT 0 F10_21: ; MOV AH,? ; SCROLL RIGHT ; INT 10H ; XOR AX,AX EXIT: @BVSEPILOG BVSSCROLLRT _TEXT ENDS END
; A161946: Odd part of sum of unitary divisors of n. ; Submitted by Jon Maiga ; 1,3,1,5,3,3,1,9,5,9,3,5,7,3,3,17,9,15,5,15,1,9,3,9,13,21,7,5,15,9,1,33,3,27,3,25,19,15,7,27,21,3,11,15,15,9,3,17,25,39,9,35,27,21,9,9,5,45,15,15,31,3,5,65,21,9,17,45,3,9,9,45,37,57,13,25,3,21,5,51,41,63,21,5,27,33,15,27,45,45,7,15,1,9,15,33,49,75,15,65 add $0,1 mov $1,1 lpb $0 mov $3,$0 lpb $3 mov $4,$0 mov $6,$2 cmp $6,0 add $2,$6 mod $4,$2 cmp $4,0 cmp $4,0 mov $5,$2 add $2,1 cmp $5,1 max $4,$5 sub $3,$4 lpe mov $5,1 lpb $0 dif $0,$2 mul $5,$2 lpe add $5,1 mul $1,$5 lpe lpb $1 dif $1,2 lpe mov $0,$1
#include <DRV_CANINterface.h> #include <joint_control_global_def.h> #include <FreeRTOS.h> CANInterface::CANInterface() { CAN.setPins(CAN_RX, CAN_TX); if (!CAN.begin(1000E3)) { Serial.println("Starting CAN failed!"); running = true; } else { Serial.println("Starting CAN successful!"); } drvSys_parameters drive_param = drvSys_get_parameters(); max_motor_torque = drive_param.max_torque_Nm; motor_torque_factor = double(drive_param.max_torque_Nm) / double(255.0); motor_torque_factor_pack = double(255) / double(drive_param.max_torque_Nm); }; CANInterface::CANInterface(uint8_t joint_id) { this->joint_id = joint_id; }; void CANInterface::init() { if (!running) { CAN.setPins(CAN_RX, CAN_TX); if (!CAN.begin(1000E3)) { Serial.println("Starting CAN failed!"); running = true; } else { Serial.println("Starting CAN successful!"); } } // Set up CAN TASK xTaskCreatePinnedToCore( this->handle_CAN_task, "CAN_Task", 2000, this, 7, &can_task_th, 1 ); } void CANInterface::send_drive_motion_data() { drvSys_driveState data = drvSys_get_drive_state(); drvComm_MotionState motion_data; int16_t pos = data.joint_pos * MAX_POS_FACTOR_PACK; int16_t vel = data.joint_vel * MAX_VEL_FACTOR_PACK; int16_t acc = data.joint_acc * MAX_ACC_FACTOR_PACK; int16_t m_torque = data.joint_torque * motor_torque_factor_pack; drvComm_CAN_motionMsg msg; msg.motionMsg = motion_data; motion_data.acc = acc; motion_data.pos = pos; motion_data.vel = vel; motion_data.m_torque = m_torque; drvComm_CANID msg_id; msg_id.sys_id = 0; msg_id.joint_id = joint_id; msg_id.msg_type = drive_motion_state; //xSemaphoreTake(mutex) CAN.beginPacket(msg_id.msg_id); CAN.write(msg.bytes, 8); CAN.endPacket(); } void CANInterface::send_drive_torque_data() { drvSys_driveState data = drvSys_get_drive_state(); drvComm_CAN_torqueMsg msg; msg.torque.torque_val = data.joint_torque * MAX_JTORQUE_FACTOR_PACK; drvComm_CANID msg_id; msg_id.sys_id = 0; msg_id.joint_id = joint_id; msg_id.msg_type = drive_torque; CAN.beginPacket(msg_id.msg_id); CAN.write(msg.bytes, 3); CAN.endPacket(); } void CANInterface::send_drive_controllersys_state() { drvSys_controllerState ctrl_state_drive = drvSys_get_controllerState(); drvComm_ControllerState ctrl_state_data; ctrl_state_data.mode = ctrl_state_drive.control_mode; ctrl_state_data.calibrated = ctrl_state_drive.calibrated; ctrl_state_data.stateFlag = ctrl_state_drive.state_flag; ctrl_state_data.overtemperature = ctrl_state_drive.overtemperature; ctrl_state_data.temperature = ctrl_state_drive.temperature; //add conversion factor if (ctrl_state_drive.state_flag == control_active) { ctrl_state_data.active = true; } else { ctrl_state_data.active = false; } if (ctrl_state_data.stateFlag == error) { ctrl_state_data.error = true; } else { ctrl_state_data.active = false; } //obtain max torque drvSys_parameters drive_params = drvSys_get_parameters(); ctrl_state_data.max_motor_torque = drive_params.max_torque_Nm * MOTOR_TORQUE_FACTOR_PACK; drvComm_CANID msg_id; msg_id.joint_id = joint_id; msg_id.msg_type = drive_state; msg_id.sys_id = 0; union { uint8_t bytes[7]; drvComm_ControllerState state_data; }state_can_msg; state_can_msg.state_data = ctrl_state_data; CAN.beginPacket(msg_id.msg_id); CAN.write(state_can_msg.bytes, 7); CAN.endPacket(); } void CANInterface::process_motion_command(drvComm_MotionCmd motion_cmd) { if (motion_cmd.type == traj_command) { if (drvSys_mode == cascade_position_control && drvSys_mode == admittance_control) { float target_pos = float(motion_cmd.traj_target.pos) * MAX_POS_FACTOR; float vel_ff = float(motion_cmd.traj_target.vel_ff) * MAX_VEL_FACTOR; float torque_ff = float(motion_cmd.traj_target.torque_ff) * motor_torque_factor; drvSys_set_feed_forward_torque(torque_ff); drvSys_set_feed_forward_velocity(vel_ff); drvSys_set_target_pos(target_pos); } } if (motion_cmd.type = direct_command) { if (drvSys_mode == direct_torque) { float target_torque = float(motion_cmd.direct_target.m_torque_target) * motor_torque_factor; drvSys_set_target_torque(target_torque); } } if (motion_cmd.type == goto_command) { // TO DO } } void CANInterface::process_update_PID_command(drvComm_PID_update pid_update) { // Collect old PID Values drvSys_parameters params = drvSys_get_parameters(); if (pid_update.PID_t == 0) { // Position Controller float P = params.pos_pid_gains.K_p; float I = params.pos_pid_gains.K_i; float D = params.pos_pid_gains.K_d; if (pid_update.PID_K == 0) { P = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 1) { I = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 2) { D = pid_update.gain * PID_GAIN_VAL_FACTOR; } bool save = pid_update.save; drvSys_set_pos_PID_gains(P, I, D, save); return; } if (pid_update.PID_t == 1) { // Velocity Controller float P = params.vel_pid_gains.K_p; float I = params.vel_pid_gains.K_i; float D = params.vel_pid_gains.K_d; if (pid_update.PID_K == 0) { P = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 1) { I = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 2) { D = pid_update.gain * PID_GAIN_VAL_FACTOR; } bool save = pid_update.save; drvSys_set_vel_PID_gains(P, I, D, save); return; } if (pid_update.PID_t == 2) { // Admittance Controller float spring = params.admittance_gains.virtual_spring; float damper = params.admittance_gains.virtual_damping; float inertia = params.admittance_gains.virtual_inertia; if (pid_update.PID_K == 0) { spring = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 1) { damper = pid_update.gain * PID_GAIN_VAL_FACTOR; } if (pid_update.PID_K == 2) { inertia = pid_update.gain * PID_GAIN_VAL_FACTOR; } bool save = pid_update.save; drvSys_set_admittance_params(spring, damper, inertia, save); return; } } void CANInterface::onReceive(int packetSize) { drvComm_CANID can_id; can_id.msg_id = CAN.packetId(); union { uint8_t array[8]; uint64_t _int; }paket; paket._int = CAN.read(); if (can_id.msg_id == drive_motion_command) { union { uint64_t _int; drvComm_MotionCmd mot_cmd; }motion_input; motion_input._int = paket._int; this->process_motion_command(motion_input.mot_cmd); return; } if (can_id.msg_id == drive_sys_controller_command) { union { uint64_t _int; drvComm_controllerCmd cmd; }input; this->process_drive_sys_controller_command(input.cmd); return; } if (can_id.msg_id == drive_sys_param_command) { union { uint64_t _int; drvComm_paramsCmd cmd; }input; this->process_drive_sys_parameter_command(input.cmd); return; } if (can_id.msg_id == drive_sys_pid_command) { union { uint64_t _int; drvComm_PID_update cmd; }input; this->process_update_PID_command(input.cmd); return; } if (can_id.msg_id == drive_sys_light_command) { // return; } } void process_drive_sys_controller_command(drvComm_controllerCmd controller_cmd) { if (controller_cmd.stop == true) { drvSys_stop_controllers(); return; } if (controller_cmd.start == true) { drvSys_controlMode mode = controller_cmd.mode; drvSys_start_motion_control(mode); return; } } void process_drive_sys_parameter_command(drvComm_paramsCmd params_cmd) { if (params_cmd.type == torque_limit) { drvSys_parameter_config.max_torque_Nm = params_cmd.parameter; return; } if (params_cmd.type == pos_limit_high) { drvSys_parameter_config.limit_high_deg = params_cmd.parameter; return; } if (params_cmd.type == pos_limit_low) { drvSys_parameter_config.limit_low_deg = params_cmd.parameter; return; } if (params_cmd.type == max_vel) { drvSys_parameter_config.max_vel = params_cmd.parameter; return; } if (params_cmd.type == max_current_mA) { drvSys_parameter_config.max_current_mA = params_cmd.parameter; return; } } //void
#include <iostream> #include <string> using namespace std; string trim(const string &str) { size_t first = str.find_first_not_of(' '); if (string::npos == first) { return str; } size_t last = str.find_last_not_of(' '); return str.substr(first, (last - first + 1)); } int main() { int lineCount = 0; while (cin) { lineCount++; string input_line; getline(cin, input_line); auto l = trim(input_line); if ((l.compare("true") != 0) && (l.compare("") != 0)) { cout << "ERROR at print : " << lineCount << endl; cout << "Test Failed!" << endl << endl; return 0; } }; cout << "Test Passed!" << endl << endl; return 0; }
// C:\diabpsx\PSXSRC\TONY.CPP #include "types.h" // address: 0x80090F5C // line start: 93 // line end: 94 void stub__FPcPv_addr_80090F5C(char *e, void *argptr) { } // address: 0x80090F64 // line start: 97 // line end: 99 void new_eprint__FPcT0i(char *Text, char *File, int Line) { } // address: 0x80090F98 // line start: 103 // line end: 111 void TonysGameTask__FP4TASK(struct TASK *T) { } // address: 0x80091020 // line start: 116 // line end: 136 void SetAmbientLight__Fv() { } // address: 0x800910A4 // line start: 153 // line end: 195 void print_demo_task__FP4TASK(struct TASK *T) { { { // register: 3 register int x; } } } // address: 0x800912A8 // line start: 199 // line end: 201 void TonysDummyPoll__Fv() { } // address: 0x800912CC // line start: 205 // line end: 212 void load_demo_pad_data__FUl(unsigned long demo_num) { // register: 4 // size: 0x14 register struct FileIO *Fs; } // address: 0x8009132C // line start: 216 // line end: 223 void save_demo_pad_data__FUl(unsigned long demo_num) { // register: 4 // size: 0x14 register struct FileIO *Fs; } // address: 0x8009138C // line start: 235 // line end: 246 void set_pad_record_play__Fi(int level) { } // address: 0x80091400 // line start: 251 // line end: 259 void start_demo__Fv() { } // address: 0x8009149C // line start: 263 // line end: 265 void tony__Fv() { }
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ // Helmet Software Framework // // Copyright (C) 2018 Hat Boy Software, Inc. // // @author Matthew Alan Gray - <mgray@hatboysoftware.com> // @author Tony Richards - <trichards@indiezen.com> //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ #pragma once #ifdef _MSC_VER # pragma inline_depth(255) # pragma inline_recursion(off) # pragma warning(disable:4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' # pragma warning(disable:4275) // non � DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' #endif // _MSC_VER #ifdef _MSC_VER # ifndef HOST_WIN32 // this probably should be done elsewhere ... # ifdef _WIN32 # define HOST_WIN32 # endif # endif # ifndef HOST_WIN64 # ifdef _WIN64 # define HOST_WIN64 # endif # endif #endif // _MSC_VER // Microsoft C++ compiler #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) # ifdef TOPPER_WORKBENCH_EXPORTS # define TOPPER_WORKBENCH_DLL_LINK __declspec(dllexport) # else # define TOPPER_WORKBENCH_DLL_LINK __declspec(dllimport) # endif #endif // _MSC_VER // GNU C++ compiler #if defined(__GNUG__) && !defined(__INTEL_COMPILER) # if (__GNUC__ >= 4) && !defined(HOST_CYGWIN) && !defined(HOST_SOLARIS) # ifdef TOPPER_WORKBENCH_EXPORTS # define TOPPER_WORKBENCH_DLL_LINK __attribute__ ((visibility ("default"))) # else # define TOPPER_WORKBENCH_DLL_LINK __attribute__ ((visibility ("hidden"))) # endif # else # ifdef TOPPER_WORKBENCH_EXPORTS # define TOPPER_WORKBENCH_DLL_LINK // __declspec(dllexport) # else # define TOPPER_WORKBENCH_DLL_LINK // __declspec(dllimport) # endif # endif #endif // __GNUG__ // Sun C++ compiler #if defined(__SUNPRO_CC) # ifdef TOPPER_WORKBENCH_EXPORTS # define TOPPER_WORKBENCH_DLL_LINK // ? # else # define TOPPER_WORKBENCH_DLL_LINK // ? # endif #endif // __SUNPRO_CC // Intel C++ compiler #if defined(__INTEL_COMPILER) # ifdef TOPPER_WORKBENCH_EXPORTS # define TOPPER_WORKBENCH_DLL_LINK __declspec(dllexport) # else # define TOPPER_WORKBENCH_DLL_LINK __declspec(dllimport) # endif #endif // __INTEL_COMPILER #ifndef TOPPER_WORKBENCH_DLL_LINK # define TOPPER_WORKBENCH_DLL_LINK #endif // ! TOPPER_WORKBENCH_EXPORTS
; A079208: Number of isomorphism classes of associative non-commutative non-anti-associative anti-commutative closed binary operations on a set of order n, listed by class size. ; 0,2,0,2,0,0,0,2,0,0,0,1,0,0,0 mov $2,5 lpb $0 add $0,1 div $2,$0 dif $0,2 add $1,$2 mov $2,$0 sub $0,1 lpe mov $0,$1
/* Copyright 2015 The TensorFlow 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. ==============================================================================*/ // See docs in ../ops/nn_ops.cc. #define EIGEN_USE_THREADS #include "tensorflow/core/kernels/topk_op.h" #include <algorithm> #include <numeric> #include <vector> #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" #include "tensorflow/core/framework/op_kernel.h" #include "tensorflow/core/framework/register_types.h" #include "tensorflow/core/framework/tensor.h" #include "tensorflow/core/framework/tensor_shape.h" #include "tensorflow/core/framework/types.h" #include "tensorflow/core/lib/gtl/top_n.h" #include "tensorflow/core/util/work_sharder.h" namespace tensorflow { typedef Eigen::ThreadPoolDevice CPUDevice; typedef Eigen::GpuDevice GPUDevice; template <typename Device, typename T> class TopK : public OpKernel { public: explicit TopK(OpKernelConstruction* context) : OpKernel(context) { OP_REQUIRES_OK(context, context->GetAttr("sorted", &sorted_)); if (num_inputs() < 2) { // k is an attr (TopK). OP_REQUIRES_OK(context, context->GetAttr("k", &k_)); } else { // k is an input (TopKV2), so we won't know it until Compute. k_ = -1; } } void Compute(OpKernelContext* context) override { int k = k_; if (num_inputs() >= 2) { const auto& k_in = context->input(1); OP_REQUIRES(context, TensorShapeUtils::IsScalar(k_in.shape()), errors::InvalidArgument("k must be scalar, got shape ", k_in.shape().DebugString())); k = k_in.scalar<int32>()(); } OP_REQUIRES(context, k >= 0, errors::InvalidArgument("Need k >= 0, got ", k)); const auto& input_in = context->input(0); OP_REQUIRES(context, input_in.dims() >= 1, errors::InvalidArgument("input must be >= 1-D, got shape ", input_in.shape().DebugString())); OP_REQUIRES(context, input_in.dim_size(input_in.dims() - 1) >= k, errors::InvalidArgument( "input must have at least k columns. Had ", input_in.dim_size(input_in.dims() - 1), ", needed ", k)); const auto& input = input_in.flat_inner_dims<T>(); const int64 num_rows = input.dimension(0); // generally batch_size const int64 num_cols = input.dimension(1); OP_REQUIRES( context, num_rows <= std::numeric_limits<int32>::max(), errors::InvalidArgument( "First dimension of flattened input must be <= INT_MAX, got ", num_rows)); OP_REQUIRES( context, num_cols <= std::numeric_limits<int32>::max(), errors::InvalidArgument( "Second dimension of flattened input must be <= INT_MAX, got ", num_cols)); TensorShape output_shape = input_in.shape(); output_shape.set_dim(input_in.dims() - 1, k); Tensor* values_out = nullptr; OP_REQUIRES_OK(context, context->allocate_output(0, output_shape, &values_out)); Tensor* indices_out = nullptr; OP_REQUIRES_OK(context, context->allocate_output(1, output_shape, &indices_out)); // Nothing to do for top-nothing or over nothing. if (k == 0 || num_rows == 0) return; auto values = values_out->flat_inner_dims<T>(); auto indices = indices_out->flat_inner_dims<int32>(); Status s = functor::TopKFunctor<Device, T>::Compute( context, sorted_, k, input, num_rows, num_cols, values, indices); OP_REQUIRES_OK(context, s); } private: int k_; bool sorted_; }; namespace functor { template <typename T> struct TopKFunctor<CPUDevice, T> { static EIGEN_ALWAYS_INLINE Status Compute(OpKernelContext* context, bool sorted, int k, const typename TTypes<T, 2>::ConstTensor& input, const int64 num_rows, const int64 num_cols, typename TTypes<T, 2>::Tensor values, typename TTypes<int, 2>::Tensor indices) { const CPUDevice& d = context->eigen_device<CPUDevice>(); // Special case for k == 1. if (k == 1) { #ifdef EIGEN_HAS_INDEX_LIST typename Eigen::IndexList<Eigen::type2index<1>> reduce_on_cols; typename Eigen::IndexList<int, Eigen::type2index<1>> rows_by_one; rows_by_one.set(0, num_rows); #else Eigen::array<int, 1> reduce_on_cols = {1}; Eigen::array<int, 2> rows_by_one = {static_cast<int>(num_rows), 1}; #endif values.device(d) = input.maximum(/*dims=*/reduce_on_cols).eval().reshape(rows_by_one); // Get the indices of the maximum values. for (int r = 0; r < num_rows; ++r) { indices(r, 0) = 0; for (int c = 0; c < num_cols; ++c) { if (values(r, 0) == input(r, c)) { indices(r, 0) = c; break; } } values(r, 0) = input(r, indices(r, 0)); } return Status::OK(); } auto SortIndices = [&](int64 start_batch, int64 limit_batch) { for (int32 b = start_batch; b < limit_batch; ++b) { const T* input_data = &input(b, 0); const auto stable_comp = [input_data](const int32 a, const int32 b) { if (input_data[b] < input_data[a]) { return true; } else if (input_data[b] > input_data[a]) { return false; } else { return a < b; } }; const auto comp = [input_data](const int32 a, const int32 b) { return input_data[b] < input_data[a]; }; // TODO(ebrevdo): For large k < num_cols, instead of using // TopN, it may be faster to create a temporary vector of // values 0..num_cols - 1 and then use std::partial_sort_copy // of this into indices. Choosing the appropriate minimum k or // ratio of k/num_cols will require some experimentation. if (k == num_cols) { auto* begin = &indices(b, 0); auto* end = &indices(b, k); // Set the initial array of indices 0 ... k - 1. std::iota(begin, end, 0); // We want an in-place sort, but we can cheat because we're sorting // indices that started out sorted. First, do a std::sort, which // is notably faster than std::stable_sort. std::sort(begin, end, comp); // Then, for runs of adjacent elements that were equal, sort the // indices in those runs in increasing order. for (auto* run_begin = begin; run_begin != end;) { auto* run_end = run_begin + 1; if (run_end == end) break; if (input_data[*run_begin] == input_data[*run_end]) { while (++run_end != end) { if (input_data[*run_begin] != input_data[*run_end]) break; } std::sort(run_begin, run_end); } run_begin = run_end; } } else { // Use the TopN heap object to sort. gtl::TopN<int32, decltype(stable_comp)> filter(k, stable_comp); filter.reserve(num_cols); for (int32 c = 0; c < num_cols; ++c) { filter.push(c); } int32 i = 0; if (sorted) { std::unique_ptr<std::vector<int32>> top_k(filter.Extract()); for (auto top_k_it = top_k->begin(); top_k_it != top_k->end(); ++top_k_it, ++i) { indices(b, i) = *top_k_it; } } else { for (auto top_k_it = filter.unsorted_begin(); top_k_it != filter.unsorted_end(); ++top_k_it, ++i) { indices(b, i) = *top_k_it; } } } // Now that the indices are sorted, copy the values over in // sorted order. std::transform(&indices(b, 0), &indices(b, k), &values(b, 0), [b, &input](const int32 loc) { return input(b, loc); }); } // for (int32 b = ... }; // Guesstimate of cost; 4*N*log(K) where N == num_cols. // If K == N, assume the cost is N*log(K + 1). const double cmp_cost = 3 * Eigen::TensorOpCost::AddCost<int32>() + Eigen::TensorOpCost::AddCost<T>(); const double base_cost = cmp_cost * static_cast<double>(num_cols * Eigen::numext::log2(static_cast<float>(k + 1))); const double sort_cost = (k == num_cols) ? base_cost : 4 * base_cost; const double copy_cost = 2 * k * Eigen::TensorOpCost::AddCost<T>(); const double total_cost = sort_cost + copy_cost; const int64 final_cost = (total_cost >= static_cast<double>(kint64max)) ? kint64max : static_cast<int64>(total_cost); auto worker_threads = *(context->device()->tensorflow_cpu_worker_threads()); Shard(worker_threads.num_threads, worker_threads.workers, num_rows, final_cost, SortIndices); return Status::OK(); } }; } // namespace functor #define REGISTER_KERNELS_NAME(name, type) \ REGISTER_KERNEL_BUILDER( \ Name(#name).Device(DEVICE_CPU).TypeConstraint<type>("T"), \ TopK<CPUDevice, type>) #define REGISTER_KERNELS(type) \ REGISTER_KERNELS_NAME(TopK, type); \ REGISTER_KERNELS_NAME(TopKV2, type) TF_CALL_REAL_NUMBER_TYPES(REGISTER_KERNELS); #undef REGISTER_KERNELS_NAME #undef REGISTER_KERNELS #if GOOGLE_CUDA || TENSORFLOW_USE_ROCM namespace functor { #define DECLARE_GPU_SPEC(T) \ template <> \ Status TopKFunctor<GPUDevice, T>::Compute( \ OpKernelContext* context, bool sorted, int k, \ const typename TTypes<T, 2>::ConstTensor& input, const int64 num_rows, \ const int64 num_cols, typename TTypes<T, 2>::Tensor values, \ typename TTypes<int, 2>::Tensor indices); \ extern template struct functor::TopKFunctor<GPUDevice, T>; TF_CALL_GPU_NUMBER_TYPES(DECLARE_GPU_SPEC); TF_CALL_INTEGRAL_TYPES(DECLARE_GPU_SPEC); #undef DECLARE_GPU_SPEC } // namespace functor #define REGISTER_KERNELS(type) \ REGISTER_KERNEL_BUILDER( \ Name("TopK").Device(DEVICE_GPU).TypeConstraint<type>("T"), \ TopK<GPUDevice, type>) \ REGISTER_KERNEL_BUILDER(Name("TopKV2") \ .Device(DEVICE_GPU) \ .TypeConstraint<type>("T") \ .HostMemory("k"), \ TopK<GPUDevice, type>) TF_CALL_GPU_NUMBER_TYPES(REGISTER_KERNELS); TF_CALL_INTEGRAL_TYPES(REGISTER_KERNELS); #undef REGISTER_KERNELS #endif // end GOOGLE_CUDA || TENSORFLOW_USE_ROCM } // end namespace tensorflow
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %rax push %rbx push %rcx lea addresses_WC_ht+0x122c9, %rax nop add $47020, %r14 vmovups (%rax), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $0, %xmm0, %r11 nop nop add %r10, %r10 lea addresses_D_ht+0x9619, %rcx nop nop sub $17508, %rbx mov (%rcx), %r10 dec %r11 pop %rcx pop %rbx pop %rax pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r14 push %r15 push %r9 push %rbp push %rdx // Store mov $0x2bd870000000839, %r14 add %rdx, %rdx movw $0x5152, (%r14) nop nop nop nop nop xor $57217, %rdx // Store lea addresses_RW+0xbb7d, %r11 nop nop nop nop inc %r15 movb $0x51, (%r11) nop add $20997, %r11 // Faulty Load lea addresses_normal+0x11319, %r15 nop nop nop nop cmp $17221, %rbp movb (%r15), %r14b lea oracles, %r11 and $0xff, %r14 shlq $12, %r14 mov (%r11,%r14,1), %r14 pop %rdx pop %rbp pop %r9 pop %r15 pop %r14 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_NC'}} {'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_RW'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 8, 'AVXalign': True, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'34': 21829} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
class Solution { public: int calPoints(vector<string>& ops) { int value1; int value2; int ans = 0; stack<int>stk; for(string i:ops) { if(i == "C") { stk.pop(); } else if(i == "D") { stk.push(stk.top()*2); } else if(i == "+") { value1 = stk.top(); stk.pop(); value2 = stk.top(); stk.push(value1); stk.push(value1 + value2); } else { stk.push(stoi(i)); } } while(stk.size() != 0) { ans += stk.top(); stk.pop(); } return ans; } };
; NASM code style ; Prototype when used in C: int asm_strcasecmp(const char *s1, const char *s2) bits 64 section .text ; Code section global asm_strcasecmp ; Exporting the function name asm_strcasecmp: push rbp ; prologue mov rbp, rsp push rdx ; save rdx value in stack push r11 ; save r11 value in stack push r12 ; save r12 value in stack mov rdx, 0 ; start the iterator in 0 mov r11, 0 ; start the registeer compator 0 mov r12, 0 ; start the registeer compator 0 count_c: ; for statement inc rdx ; increment the iterator mov r12b, byte [rsi + rdx - 1] ; check if the char in arg1 mov r11b, byte [rdi + rdx - 1] ; check if the char in arg2 cmp r12b, 65 ; convert from uppercase to lowercase jl next_count1 ; if the byte is in uppercase cmp r12b, 91 jl conv_lower_arg1 next_count1: cmp r11b, 65 ; convert from uppercase to lowercase jl next_count2 ; if the byte is in uppercase cmp r11b, 91 jl conv_lower_arg2 next_count2: cmp r12b, 0x00 ; is not a null char je end ; if it is go out of for loop cmp r11b, 0x00 ; is not a null char je end ; if it is go out of for loop cmp r11b, r12b ; check if char in arg1 is eql to char in arg2 je count_c ; if it is, continue in the for loop end: ; end lopp mov rax, 0 ; set the return value in 0 mov rax, r11 ; compare the previous variables sub rax, r12 pop r12 pop r11 ; set back the previous value of r8 pop rdx ; set back the previous value of rdx mov rsp, rbp ; epilogue pop rbp ; set back the previous value of rbp ret ; return the len value conv_lower_arg1: ; symbol: function that converts from uppercase to lowercase add r12b, 32 jmp next_count1 conv_lower_arg2: ; symbol: function that converts from uppercase to lowercase add r11b, 32 jmp next_count2
_BasementKey: ret
Snd_PresSega_Header: smpsHeaderStartSong 3 smpsHeaderVoice Snd_PresSega_Voices smpsHeaderChan $06, $03 smpsHeaderTempo $01, $08 smpsHeaderDAC Snd_PresSega_DAC smpsHeaderFM Snd_PresSega_FM1, $01, $12 smpsHeaderFM Snd_PresSega_FM2, $0D, $04 smpsHeaderFM Snd_PresSega_FM3, $01, $1C smpsHeaderFM Snd_PresSega_FM4, $0D, $12 smpsHeaderFM Snd_PresSega_FM5, $0D, $12 smpsHeaderPSG Snd_PresSega_PSG1, $01, $09, $00, $00 smpsHeaderPSG Snd_PresSega_PSG2, $01, $09, $00, $00 smpsHeaderPSG Snd_PresSega_PSG3, $E9, $01, $00, $00 ; FM1 Data Snd_PresSega_FM1: smpsSetvoice $05 smpsAlterNote $FE smpsModSet $14, $01, $06, $06 dc.b nA4, $06, nCs5, nB4, nD5 smpsFMAlterVol $FF dc.b nCs5, nE5, nD5, nFs5 smpsFMAlterVol $FF dc.b nE5, nAb5, nFs5, nA5 smpsFMAlterVol $FF dc.b nAb5, nB5, nA5, nCs6 smpsSetvoice $00 dc.b nA4, $18, nFs4, $0C, nE4, nA4, nFs4, nD4, nE4, smpsNoAttack, nE4, $24 dc.b nD5, $18 smpsNoteFill $06 dc.b $0C, $0C, $0C smpsNoteFill $00 smpsFMAlterVol $FD dc.b nD5, nCs5, $18, nA4, nB4, nRst, $0C, nE5, nD5, $18, nA4, nB4 smpsFMAlterVol $FE dc.b nCs5, $0C smpsStop ; FM2 Data Snd_PresSega_FM2: smpsSetvoice $01 dc.b nE1, $06, nE1, nRst, nE1, nRst, nE1, nE1, smpsNoAttack, nE1, nRst, nRst dc.b nE1, smpsNoAttack, nE1, nE1, nE1, nE1, nE1, nA1, $06, nA1, nRst, nA1 dc.b nRst, nA1, nA1, smpsNoAttack, nA1, nFs1, $0C, nFs1, smpsNoAttack, nFs1, nE1, nE1 dc.b $06, nE1, nRst, nE1, nRst, nE1, nD1, smpsNoAttack, nD1, nRst, nD1, nRst dc.b nD2, smpsNoAttack, nD2, nD1, nD1, nD1, nA1, nA1, nRst, nA1, nRst, nA1 dc.b nA1, smpsNoAttack, nA1, nFs1, $0C, nFs1, smpsNoAttack, nFs1, nG1, nG1, $06, nG1 dc.b nRst, nG1, nRst, nG1, nE1, smpsNoAttack, nE1, nRst, nE1, nRst, nE2, smpsNoAttack dc.b nE2, nE1 smpsFMAlterVol $FD dc.b nA1, $60 smpsStop ; FM3 Data Snd_PresSega_FM3: smpsSetvoice $05 smpsAlterNote $02 smpsModSet $15, $01, $06, $06 dc.b nRst, $03, nB4, $06, nE5, nCs5, nFs5 smpsFMAlterVol $FF dc.b nD5, nAb5, nE5, nA5 smpsFMAlterVol $FF dc.b nFs5, nB5, nAb5, nCs6 smpsFMAlterVol $FF dc.b nA5, nD6, nB5, nE6, $03 smpsSetvoice $00 dc.b nRst, $07, nA4, $18, nFs4, $0C, nE4, nA4, nFs4, nD4, nE4, smpsNoAttack dc.b nE4, $24, nD5, $18 smpsNoteFill $06 dc.b $0C, $0C, $0C smpsNoteFill $00 smpsFMAlterVol $FD dc.b nD5, nCs5, $18, nA4, nB4, nRst, $0C, nE5, nD5, $18, nA4, nB4 dc.b $05, nRst, $05 smpsFMAlterVol $FE dc.b nA4, $0C smpsStop ; FM4 Data Snd_PresSega_FM4: smpsSetvoice $04 smpsPan panRight, $00 smpsModSet $01, $01, $0C, $00 dc.b nG2, $60 smpsSetvoice $03 smpsModSet $00, $00, $00, $00 dc.b nA3, nB3, $24, nA3, $30, smpsNoAttack, $0C smpsSetvoice $02 dc.b nA4, $24, nA4, $30, nRst, $0C smpsFMAlterVol $FF dc.b nB4, $24, nB4, $30 smpsFMAlterVol $FF dc.b nCs5, $0C smpsStop ; FM5 Data Snd_PresSega_FM5: smpsSetvoice $04 smpsPan panLeft, $00 smpsModSet $01, $01, $0C, $00 dc.b nG2, $60 smpsSetvoice $03 smpsModSet $00, $00, $00, $00 dc.b nE3, nE3, $24, nD3, $30, smpsNoAttack, $0C smpsSetvoice $02 dc.b nE4, $24, nD4, $30, nRst, $0C smpsFMAlterVol $FF dc.b nG4, $24, nE4, $30 smpsFMAlterVol $FF dc.b nE4, $0C smpsStop ; PSG1 Data Snd_PresSega_PSG1: smpsPSGvoice sTone_0C dc.b nA2, $06, nCs3, nB2, nD3 smpsPSGAlterVol $FF dc.b nCs3, nE3, nD3, nFs3 smpsPSGAlterVol $FF dc.b nE3, nAb3, nFs3, nA3 smpsPSGAlterVol $FF dc.b nAb3, nB3, nA3, nCs4 smpsPSGAlterVol $FD smpsPSGvoice sTone_0A dc.b nE4, $0C, nB3, nE4, nB3, nE4, nB3, nE4, nB3, nD4, nB3, nD4 dc.b nB3, nD4, nB3, nD4, nB3, nE4, $0C, nB3, nE4, nB3, nD4, nB3 dc.b nD4, nB3, nD4, nA3, nD4, nA3, nE4, nB3, nE4 smpsPSGAlterVol $01 Snd_PresSega_Loop01: dc.b nA4 smpsPSGAlterVol $01 dc.b nG5 smpsPSGAlterVol $01 smpsLoop $00, $05, Snd_PresSega_Loop01 smpsStop ; PSG2 Data Snd_PresSega_PSG2: smpsPSGvoice sTone_0C dc.b nRst, $03, nB2, $06, nE3, nCs3, nFs3 smpsPSGAlterVol $FF dc.b nD3, nAb3, nE3, nA3 smpsPSGAlterVol $FF dc.b nFs3, nB3, nAb3, nCs4 smpsPSGAlterVol $FF dc.b nA3, nD4, nB3, nE4, $03 smpsPSGAlterVol $FD smpsPSGvoice sTone_0A dc.b nRst, $06, nCs4, $0C, nA3, nCs4, nA3, nCs4, nA3, nCs4, nA3, nCs4 dc.b nA3, nCs4, nA3, nCs4, nA3, nCs4, nA3, nCs4, $0C, nA3, nCs4, nA3 dc.b nCs4, nA3, nCs4, nA3, nB3, nG3, nB3, nG3, nCs4, nA3, nCs4 smpsPSGAlterVol $01 Snd_PresSega_Loop00: dc.b nE5 smpsPSGAlterVol $01 dc.b nA5 smpsPSGAlterVol $01 smpsLoop $00, $05, Snd_PresSega_Loop00 smpsStop ; PSG3 Data Snd_PresSega_PSG3: smpsPSGvoice sTone_0A smpsModSet $14, $01, $03, $06 dc.b nRst, $60, nA4, $18, nFs4, $0C, nE4, nA4, nFs4, nD4, nE4, smpsNoAttack dc.b nE4, $24, nD5, $18 smpsNoteFill $06 dc.b $0C, $0C, $0C smpsNoteFill $00 smpsModSet $00, $00, $00, $00 dc.b nA4, $24, nD4, $30, nRst, $0C, nG4, $24, nE4, $30, nCs4, $0C smpsStop ; DAC Data Snd_PresSega_DAC: smpsFade $25 dc.b dCrashCymbal, $30, nRst, $0C, dSnareS3, dSnareS3, dSnareS3, $06, $06, dCrashCymbal, $18, dSnareS3 dc.b $0C, dKickS3, dKickS3, $06, dKickS3, dKickS3, $0C, dSnareS3, $18, dKickS3, $18, dSnareS3 dc.b $0C, dKickS3, dKickS3, $06, dKickS3, dKickS3, $0C, dSnareS3, $06, $06, nRst, nRst dc.b dKickS3, $18, dSnareS3, dKickS3, $06, dKickS3, dKickS3, $0C, dSnareS3, $18, dKickS3, dSnareS3 dc.b $12, dKickS3, $06, dKickS3, dKickS3, dKickS3, $0C, dSnareS3, dCrashCymbal, $60 smpsStop Snd_PresSega_Voices: ; Voice $00 ; $3D ; $01, $01, $11, $12, $18, $1F, $1F, $1F, $10, $06, $06, $06 ; $01, $00, $00, $00, $3F, $1F, $1F, $1F, $10, $83, $83, $83 smpsVcAlgorithm $05 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $01, $01, $00, $00 smpsVcCoarseFreq $02, $01, $01, $01 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $18 smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $06, $06, $06, $10 smpsVcDecayRate2 $00, $00, $00, $01 smpsVcDecayLevel $01, $01, $01, $03 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $03, $03, $03, $10 ; Voice $01 ; $00 ; $23, $30, $30, $21, $9F, $5F, $1F, $1F, $00, $0F, $01, $00 ; $07, $00, $00, $0C, $0F, $4F, $FF, $0F, $26, $30, $1D, $80 smpsVcAlgorithm $00 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $02, $03, $03, $02 smpsVcCoarseFreq $01, $00, $00, $03 smpsVcRateScale $00, $00, $01, $02 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $01, $0F, $00 smpsVcDecayRate2 $0C, $00, $00, $07 smpsVcDecayLevel $00, $0F, $04, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $1D, $30, $26 ; Voice $02 ; $3C ; $71, $31, $12, $11, $17, $1F, $19, $2F, $04, $01, $07, $01 ; $00, $00, $00, $00, $F7, $F8, $F7, $F8, $1D, $80, $19, $80 smpsVcAlgorithm $04 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $01, $01, $03, $07 smpsVcCoarseFreq $01, $02, $01, $01 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $2F, $19, $1F, $17 smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $01, $07, $01, $04 smpsVcDecayRate2 $00, $00, $00, $00 smpsVcDecayLevel $0F, $0F, $0F, $0F smpsVcReleaseRate $08, $07, $08, $07 smpsVcTotalLevel $00, $19, $00, $1D ; Voice $03 ; $2C ; $71, $62, $31, $32, $5F, $54, $5F, $5F, $00, $09, $00, $09 ; $00, $03, $00, $03, $0F, $8F, $0F, $AF, $16, $80, $11, $80 smpsVcAlgorithm $04 smpsVcFeedback $05 smpsVcUnusedBits $00 smpsVcDetune $03, $03, $06, $07 smpsVcCoarseFreq $02, $01, $02, $01 smpsVcRateScale $01, $01, $01, $01 smpsVcAttackRate $1F, $1F, $14, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $09, $00, $09, $00 smpsVcDecayRate2 $03, $00, $03, $00 smpsVcDecayLevel $0A, $00, $08, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $00, $11, $00, $16 ; Voice $04 ; $3D ; $51, $21, $30, $10, $1F, $1F, $1F, $1F, $0F, $00, $00, $00 ; $00, $00, $00, $00, $1F, $4F, $4F, $4F, $10, $8E, $8E, $8E smpsVcAlgorithm $05 smpsVcFeedback $07 smpsVcUnusedBits $00 smpsVcDetune $01, $03, $02, $05 smpsVcCoarseFreq $00, $00, $01, $01 smpsVcRateScale $00, $00, $00, $00 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $00, $0F smpsVcDecayRate2 $00, $00, $00, $00 smpsVcDecayLevel $04, $04, $04, $01 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $0E, $0E, $0E, $10 ; Voice $05 ; $04 ; $12, $0A, $06, $7C, $5F, $5F, $5F, $5F, $00, $08, $00, $00 ; $00, $00, $00, $0A, $0F, $FF, $0F, $0F, $11, $8C, $13, $8C smpsVcAlgorithm $04 smpsVcFeedback $00 smpsVcUnusedBits $00 smpsVcDetune $07, $00, $00, $01 smpsVcCoarseFreq $0C, $06, $0A, $02 smpsVcRateScale $01, $01, $01, $01 smpsVcAttackRate $1F, $1F, $1F, $1F smpsVcAmpMod $00, $00, $00, $00 smpsVcDecayRate1 $00, $00, $08, $00 smpsVcDecayRate2 $0A, $00, $00, $00 smpsVcDecayLevel $00, $00, $0F, $00 smpsVcReleaseRate $0F, $0F, $0F, $0F smpsVcTotalLevel $0C, $13, $0C, $11
;****************************************************************************** ; ; source.asm ; IKForth ; ; Unlicense since 1999 by Illya Kysil ; ;****************************************************************************** ; ;****************************************************************************** ; 6.1.2216 SOURCE ; c-addr is the address of, and u is the number of characters in ; the input buffer. ; D: -- c-addr u $NONAME $_SOURCE CW $FILE_LINE CFETCH $HASH_FILE_LINE $END_COLON $DEFER 'SOURCE',$SOURCE,$_SOURCE ; (REPORT-SOURCE) ; D: c-addr u line-u -- $COLON '(REPORT-SOURCE)',$PREPORT_SOURCE $WRITE 'LINE# H# ' CW $HOUT8 $WRITE ' ' CW $TYPE $END_COLON ; REPORT-REFILL $COLON 'REPORT-REFILL',$REPORT_REFILL CW $REFILL_SOURCE, $TWO_FETCH CFETCH $INCLUDE_LINE_NUM CW $PREPORT_SOURCE $END_COLON ; REPORT-SOURCE $COLON 'REPORT-SOURCE',$REPORT_SOURCE CW $INTERPRET_TEXT CFETCH $HASH_INTERPRET_TEXT CFETCH $ERROR_LINE_NUM CW $PREPORT_SOURCE $END_COLON ; REPORT-SOURCE! $COLON 'REPORT-SOURCE!',$REPORT_SOURCE_STORE CW $SOURCE, $REFILL_SOURCE, $TWO_STORE CFETCH $INCLUDE_LINE_NUM CSTORE $ERROR_LINE_NUM $END_COLON ; 11.6.1.2090 READ-LINE ; (S c-addr u1 fileid -- u2 flag ior ) $DEFER 'READ-LINE',$READ_LINE,$_READ_LINE ; 6.2.2125 REFILL ; D: -- flag $DEFER 'REFILL',$REFILL,$REFILL_FILE $DEFER '(SAVE-INPUT)',$PSAVE_INPUT,$SAVE_INPUT_FILE ; SAVE-INPUT $COLON 'SAVE-INPUT',$SAVE_INPUT CW $PSAVE_INPUT MATCH =TRUE, DEBUG { $TRACE_STACK 'SAVE-INPUT',12 } $END_COLON ; RESTORE-INPUT $COLON 'RESTORE-INPUT',$RESTORE_INPUT MATCH =TRUE, DEBUG { $TRACE_STACK 'RESTORE-INPUT-A',12 } CW $ONE_MINUS, $SWAP, $CATCH MATCH =TRUE, DEBUG { $TRACE_STACK 'RESTORE-INPUT-B',1 } $END_COLON $DEFER '(RESET-INPUT)',$PRESET_INPUT,$RESET_INPUT_FILE ; RESET-INPUT $COLON 'RESET-INPUT',$RESET_INPUT CW $PRESET_INPUT $END_COLON ; INPUT>R $COLON 'INPUT>R',$INPUT_TO_R,VEF_COMPILE_ONLY CW $R_FROM, $SAVE_INPUT MATCH =TRUE, DEBUG { $TRACE_STACK 'INPUT>R',12 } CW $N_TO_R, $TO_R $END_COLON ; R>INPUT $COLON 'R>INPUT',$R_TO_INPUT,VEF_COMPILE_ONLY CW $R_FROM, $N_R_FROM MATCH =TRUE, DEBUG { $TRACE_STACK 'R>INPUT',12 } CW $RESTORE_INPUT, $THROW, $TO_R $END_COLON
/* * Copyright 2009-2017 Alibaba Cloud 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 <alibabacloud/tdsr/model/GetSceneDataResult.h> #include <json/json.h> using namespace AlibabaCloud::Tdsr; using namespace AlibabaCloud::Tdsr::Model; GetSceneDataResult::GetSceneDataResult() : ServiceResult() {} GetSceneDataResult::GetSceneDataResult(const std::string &payload) : ServiceResult() { parse(payload); } GetSceneDataResult::~GetSceneDataResult() {} void GetSceneDataResult::parse(const std::string &payload) { Json::Reader reader; Json::Value value; reader.parse(payload, value); setRequestId(value["RequestId"].asString()); if(!value["Success"].isNull()) success_ = value["Success"].asString() == "true"; if(!value["ErrMessage"].isNull()) errMessage_ = value["ErrMessage"].asString(); if(!value["Data"].isNull()) data_ = value["Data"].asString(); if(!value["ObjectString"].isNull()) objectString_ = value["ObjectString"].asString(); } std::string GetSceneDataResult::getObjectString()const { return objectString_; } std::string GetSceneDataResult::getData()const { return data_; } std::string GetSceneDataResult::getErrMessage()const { return errMessage_; } bool GetSceneDataResult::getSuccess()const { return success_; }
; CRT0 for the Mattel Aquarius ; ; Stefano Bodrato Dec. 2000 ; ; If an error occurs eg break we just drop back to BASIC ; ; $Id: aquarius_crt0.asm,v 1.21 2016/07/15 21:03:25 dom Exp $ ; MODULE aquarius_crt0 ;-------- ; Include zcc_opt.def to find out some info ;-------- defc crt0 = 1 INCLUDE "zcc_opt.def" ;-------- ; Some scope definitions ;-------- EXTERN _main ;main() is always external to crt0 code PUBLIC cleanup ;jp'd to by exit() PUBLIC l_dcal ;jp(hl) IF !DEFINED_CRT_ORG_CODE defc CRT_ORG_CODE = 14712 ENDIF org CRT_ORG_CODE start: ld (start1+1),sp ;Save entry stack ld hl,-64 add hl,sp ld sp,hl call crt0_init_bss ld (exitsp),sp ; Optional definition for auto MALLOC init ; it assumes we have free space between the end of ; the compiled program and the stack pointer IF DEFINED_USING_amalloc INCLUDE "amalloc.def" ENDIF call _main ;Call user program cleanup: ; ; Deallocate memory which has been allocated here! ; IF !DEFINED_nostreams EXTERN closeall call closeall ENDIF start1: ld sp,0 ;Restore stack to entry value ret l_dcal: jp (hl) ;Used for function pointer calls defm "Small C+ Aquarius" ;Unnecessary file signature defb 0 INCLUDE "crt0_runtime_selection.asm" INCLUDE "crt0_section.asm" SECTION code_crt_init ld hl,$3028 ld (base_graphics),hl
CinnabarLabTradeRoom_Script: jp EnableAutoTextBoxDrawing CinnabarLabTradeRoom_TextPointers: dw Lab2Text1 dw Lab2Text2 dw Lab2Text3 Lab2Text1: text_far _Lab2Text1 text_end Lab2Text2: text_asm ld a, TRADE_FOR_DORIS ld [wWhichTrade], a jr Lab2DoTrade Lab2Text3: text_asm ld a, TRADE_FOR_CRINKLES ld [wWhichTrade], a Lab2DoTrade: predef DoInGameTradeDialogue jp TextScriptEnd
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 .byte 0xe4 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 90 10 00 mov $0x109000,%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 c0 b5 10 80 mov $0x8010b5c0,%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 60 2e 10 80 mov $0x80102e60,%eax jmp *%eax 80100032: ff e0 jmp *%eax 80100034: 66 90 xchg %ax,%ax 80100036: 66 90 xchg %ax,%ax 80100038: 66 90 xchg %ax,%ax 8010003a: 66 90 xchg %ax,%ax 8010003c: 66 90 xchg %ax,%ax 8010003e: 66 90 xchg %ax,%ax 80100040 <binit>: struct buf head; } bcache; void binit(void) { 80100040: 55 push %ebp 80100041: 89 e5 mov %esp,%ebp 80100043: 53 push %ebx //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++){ 80100044: bb f4 b5 10 80 mov $0x8010b5f4,%ebx struct buf head; } bcache; void binit(void) { 80100049: 83 ec 0c sub $0xc,%esp struct buf *b; initlock(&bcache.lock, "bcache"); 8010004c: 68 20 6f 10 80 push $0x80106f20 80100051: 68 c0 b5 10 80 push $0x8010b5c0 80100056: e8 95 41 00 00 call 801041f0 <initlock> //PAGEBREAK! // Create linked list of buffers bcache.head.prev = &bcache.head; 8010005b: c7 05 0c fd 10 80 bc movl $0x8010fcbc,0x8010fd0c 80100062: fc 10 80 bcache.head.next = &bcache.head; 80100065: c7 05 10 fd 10 80 bc movl $0x8010fcbc,0x8010fd10 8010006c: fc 10 80 8010006f: 83 c4 10 add $0x10,%esp 80100072: ba bc fc 10 80 mov $0x8010fcbc,%edx 80100077: eb 09 jmp 80100082 <binit+0x42> 80100079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80100080: 89 c3 mov %eax,%ebx for(b = bcache.buf; b < bcache.buf+NBUF; b++){ b->next = bcache.head.next; b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); 80100082: 8d 43 0c lea 0xc(%ebx),%eax 80100085: 83 ec 08 sub $0x8,%esp //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++){ b->next = bcache.head.next; 80100088: 89 53 54 mov %edx,0x54(%ebx) b->prev = &bcache.head; 8010008b: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) initsleeplock(&b->lock, "buffer"); 80100092: 68 27 6f 10 80 push $0x80106f27 80100097: 50 push %eax 80100098: e8 23 40 00 00 call 801040c0 <initsleeplock> bcache.head.next->prev = b; 8010009d: a1 10 fd 10 80 mov 0x8010fd10,%eax //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++){ 801000a2: 83 c4 10 add $0x10,%esp 801000a5: 89 da mov %ebx,%edx b->next = bcache.head.next; b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); bcache.head.next->prev = b; 801000a7: 89 58 50 mov %ebx,0x50(%eax) //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++){ 801000aa: 8d 83 5c 02 00 00 lea 0x25c(%ebx),%eax b->next = bcache.head.next; b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); bcache.head.next->prev = b; bcache.head.next = b; 801000b0: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 //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++){ 801000b6: 3d bc fc 10 80 cmp $0x8010fcbc,%eax 801000bb: 75 c3 jne 80100080 <binit+0x40> b->prev = &bcache.head; initsleeplock(&b->lock, "buffer"); bcache.head.next->prev = b; bcache.head.next = b; } } 801000bd: 8b 5d fc mov -0x4(%ebp),%ebx 801000c0: c9 leave 801000c1: c3 ret 801000c2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801000c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801000d0 <bread>: } // Return a locked buf with the contents of the indicated block. struct buf* bread(uint dev, uint blockno) { 801000d0: 55 push %ebp 801000d1: 89 e5 mov %esp,%ebp 801000d3: 57 push %edi 801000d4: 56 push %esi 801000d5: 53 push %ebx 801000d6: 83 ec 18 sub $0x18,%esp 801000d9: 8b 75 08 mov 0x8(%ebp),%esi 801000dc: 8b 7d 0c mov 0xc(%ebp),%edi static struct buf* bget(uint dev, uint blockno) { struct buf *b; acquire(&bcache.lock); 801000df: 68 c0 b5 10 80 push $0x8010b5c0 801000e4: e8 67 42 00 00 call 80104350 <acquire> // Is the block already cached? for(b = bcache.head.next; b != &bcache.head; b = b->next){ 801000e9: 8b 1d 10 fd 10 80 mov 0x8010fd10,%ebx 801000ef: 83 c4 10 add $0x10,%esp 801000f2: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 801000f8: 75 11 jne 8010010b <bread+0x3b> 801000fa: eb 24 jmp 80100120 <bread+0x50> 801000fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100100: 8b 5b 54 mov 0x54(%ebx),%ebx 80100103: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 80100109: 74 15 je 80100120 <bread+0x50> if(b->dev == dev && b->blockno == blockno){ 8010010b: 3b 73 04 cmp 0x4(%ebx),%esi 8010010e: 75 f0 jne 80100100 <bread+0x30> 80100110: 3b 7b 08 cmp 0x8(%ebx),%edi 80100113: 75 eb jne 80100100 <bread+0x30> b->refcnt++; 80100115: 83 43 4c 01 addl $0x1,0x4c(%ebx) 80100119: eb 3f jmp 8010015a <bread+0x8a> 8010011b: 90 nop 8010011c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } // Not cached; recycle an unused buffer. // Even if refcnt==0, B_DIRTY indicates a buffer is in use // because log.c has modified it but not yet committed it. for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ 80100120: 8b 1d 0c fd 10 80 mov 0x8010fd0c,%ebx 80100126: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 8010012c: 75 0d jne 8010013b <bread+0x6b> 8010012e: eb 60 jmp 80100190 <bread+0xc0> 80100130: 8b 5b 50 mov 0x50(%ebx),%ebx 80100133: 81 fb bc fc 10 80 cmp $0x8010fcbc,%ebx 80100139: 74 55 je 80100190 <bread+0xc0> if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { 8010013b: 8b 43 4c mov 0x4c(%ebx),%eax 8010013e: 85 c0 test %eax,%eax 80100140: 75 ee jne 80100130 <bread+0x60> 80100142: f6 03 04 testb $0x4,(%ebx) 80100145: 75 e9 jne 80100130 <bread+0x60> b->dev = dev; 80100147: 89 73 04 mov %esi,0x4(%ebx) b->blockno = blockno; 8010014a: 89 7b 08 mov %edi,0x8(%ebx) b->flags = 0; 8010014d: c7 03 00 00 00 00 movl $0x0,(%ebx) b->refcnt = 1; 80100153: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) release(&bcache.lock); 8010015a: 83 ec 0c sub $0xc,%esp 8010015d: 68 c0 b5 10 80 push $0x8010b5c0 80100162: e8 99 42 00 00 call 80104400 <release> acquiresleep(&b->lock); 80100167: 8d 43 0c lea 0xc(%ebx),%eax 8010016a: 89 04 24 mov %eax,(%esp) 8010016d: e8 8e 3f 00 00 call 80104100 <acquiresleep> 80100172: 83 c4 10 add $0x10,%esp bread(uint dev, uint blockno) { struct buf *b; b = bget(dev, blockno); if((b->flags & B_VALID) == 0) { 80100175: f6 03 02 testb $0x2,(%ebx) 80100178: 75 0c jne 80100186 <bread+0xb6> iderw(b); 8010017a: 83 ec 0c sub $0xc,%esp 8010017d: 53 push %ebx 8010017e: e8 6d 1f 00 00 call 801020f0 <iderw> 80100183: 83 c4 10 add $0x10,%esp } return b; } 80100186: 8d 65 f4 lea -0xc(%ebp),%esp 80100189: 89 d8 mov %ebx,%eax 8010018b: 5b pop %ebx 8010018c: 5e pop %esi 8010018d: 5f pop %edi 8010018e: 5d pop %ebp 8010018f: c3 ret release(&bcache.lock); acquiresleep(&b->lock); return b; } } panic("bget: no buffers"); 80100190: 83 ec 0c sub $0xc,%esp 80100193: 68 2e 6f 10 80 push $0x80106f2e 80100198: e8 d3 01 00 00 call 80100370 <panic> 8010019d: 8d 76 00 lea 0x0(%esi),%esi 801001a0 <bwrite>: } // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { 801001a0: 55 push %ebp 801001a1: 89 e5 mov %esp,%ebp 801001a3: 53 push %ebx 801001a4: 83 ec 10 sub $0x10,%esp 801001a7: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001aa: 8d 43 0c lea 0xc(%ebx),%eax 801001ad: 50 push %eax 801001ae: e8 ed 3f 00 00 call 801041a0 <holdingsleep> 801001b3: 83 c4 10 add $0x10,%esp 801001b6: 85 c0 test %eax,%eax 801001b8: 74 0f je 801001c9 <bwrite+0x29> panic("bwrite"); b->flags |= B_DIRTY; 801001ba: 83 0b 04 orl $0x4,(%ebx) iderw(b); 801001bd: 89 5d 08 mov %ebx,0x8(%ebp) } 801001c0: 8b 5d fc mov -0x4(%ebp),%ebx 801001c3: c9 leave bwrite(struct buf *b) { if(!holdingsleep(&b->lock)) panic("bwrite"); b->flags |= B_DIRTY; iderw(b); 801001c4: e9 27 1f 00 00 jmp 801020f0 <iderw> // Write b's contents to disk. Must be locked. void bwrite(struct buf *b) { if(!holdingsleep(&b->lock)) panic("bwrite"); 801001c9: 83 ec 0c sub $0xc,%esp 801001cc: 68 3f 6f 10 80 push $0x80106f3f 801001d1: e8 9a 01 00 00 call 80100370 <panic> 801001d6: 8d 76 00 lea 0x0(%esi),%esi 801001d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801001e0 <brelse>: // Release a locked buffer. // Move to the head of the MRU list. void brelse(struct buf *b) { 801001e0: 55 push %ebp 801001e1: 89 e5 mov %esp,%ebp 801001e3: 56 push %esi 801001e4: 53 push %ebx 801001e5: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holdingsleep(&b->lock)) 801001e8: 83 ec 0c sub $0xc,%esp 801001eb: 8d 73 0c lea 0xc(%ebx),%esi 801001ee: 56 push %esi 801001ef: e8 ac 3f 00 00 call 801041a0 <holdingsleep> 801001f4: 83 c4 10 add $0x10,%esp 801001f7: 85 c0 test %eax,%eax 801001f9: 74 66 je 80100261 <brelse+0x81> panic("brelse"); releasesleep(&b->lock); 801001fb: 83 ec 0c sub $0xc,%esp 801001fe: 56 push %esi 801001ff: e8 5c 3f 00 00 call 80104160 <releasesleep> acquire(&bcache.lock); 80100204: c7 04 24 c0 b5 10 80 movl $0x8010b5c0,(%esp) 8010020b: e8 40 41 00 00 call 80104350 <acquire> b->refcnt--; 80100210: 8b 43 4c mov 0x4c(%ebx),%eax if (b->refcnt == 0) { 80100213: 83 c4 10 add $0x10,%esp panic("brelse"); releasesleep(&b->lock); acquire(&bcache.lock); b->refcnt--; 80100216: 83 e8 01 sub $0x1,%eax if (b->refcnt == 0) { 80100219: 85 c0 test %eax,%eax panic("brelse"); releasesleep(&b->lock); acquire(&bcache.lock); b->refcnt--; 8010021b: 89 43 4c mov %eax,0x4c(%ebx) if (b->refcnt == 0) { 8010021e: 75 2f jne 8010024f <brelse+0x6f> // no one is waiting for it. b->next->prev = b->prev; 80100220: 8b 43 54 mov 0x54(%ebx),%eax 80100223: 8b 53 50 mov 0x50(%ebx),%edx 80100226: 89 50 50 mov %edx,0x50(%eax) b->prev->next = b->next; 80100229: 8b 43 50 mov 0x50(%ebx),%eax 8010022c: 8b 53 54 mov 0x54(%ebx),%edx 8010022f: 89 50 54 mov %edx,0x54(%eax) b->next = bcache.head.next; 80100232: a1 10 fd 10 80 mov 0x8010fd10,%eax b->prev = &bcache.head; 80100237: c7 43 50 bc fc 10 80 movl $0x8010fcbc,0x50(%ebx) b->refcnt--; if (b->refcnt == 0) { // no one is waiting for it. b->next->prev = b->prev; b->prev->next = b->next; b->next = bcache.head.next; 8010023e: 89 43 54 mov %eax,0x54(%ebx) b->prev = &bcache.head; bcache.head.next->prev = b; 80100241: a1 10 fd 10 80 mov 0x8010fd10,%eax 80100246: 89 58 50 mov %ebx,0x50(%eax) bcache.head.next = b; 80100249: 89 1d 10 fd 10 80 mov %ebx,0x8010fd10 } release(&bcache.lock); 8010024f: c7 45 08 c0 b5 10 80 movl $0x8010b5c0,0x8(%ebp) } 80100256: 8d 65 f8 lea -0x8(%ebp),%esp 80100259: 5b pop %ebx 8010025a: 5e pop %esi 8010025b: 5d pop %ebp b->prev = &bcache.head; bcache.head.next->prev = b; bcache.head.next = b; } release(&bcache.lock); 8010025c: e9 9f 41 00 00 jmp 80104400 <release> // Move to the head of the MRU list. void brelse(struct buf *b) { if(!holdingsleep(&b->lock)) panic("brelse"); 80100261: 83 ec 0c sub $0xc,%esp 80100264: 68 46 6f 10 80 push $0x80106f46 80100269: e8 02 01 00 00 call 80100370 <panic> 8010026e: 66 90 xchg %ax,%ax 80100270 <consoleread>: } } int consoleread(struct inode *ip, char *dst, int n) { 80100270: 55 push %ebp 80100271: 89 e5 mov %esp,%ebp 80100273: 57 push %edi 80100274: 56 push %esi 80100275: 53 push %ebx 80100276: 83 ec 28 sub $0x28,%esp 80100279: 8b 7d 08 mov 0x8(%ebp),%edi 8010027c: 8b 75 0c mov 0xc(%ebp),%esi uint target; int c; iunlock(ip); 8010027f: 57 push %edi 80100280: e8 cb 14 00 00 call 80101750 <iunlock> target = n; acquire(&cons.lock); 80100285: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 8010028c: e8 bf 40 00 00 call 80104350 <acquire> while(n > 0){ 80100291: 8b 5d 10 mov 0x10(%ebp),%ebx 80100294: 83 c4 10 add $0x10,%esp 80100297: 31 c0 xor %eax,%eax 80100299: 85 db test %ebx,%ebx 8010029b: 0f 8e 9a 00 00 00 jle 8010033b <consoleread+0xcb> while(input.r == input.w){ 801002a1: a1 a0 ff 10 80 mov 0x8010ffa0,%eax 801002a6: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 801002ac: 74 24 je 801002d2 <consoleread+0x62> 801002ae: eb 58 jmp 80100308 <consoleread+0x98> if(myproc()->killed){ release(&cons.lock); ilock(ip); return -1; } sleep(&input.r, &cons.lock); 801002b0: 83 ec 08 sub $0x8,%esp 801002b3: 68 20 a5 10 80 push $0x8010a520 801002b8: 68 a0 ff 10 80 push $0x8010ffa0 801002bd: e8 6e 3a 00 00 call 80103d30 <sleep> iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ while(input.r == input.w){ 801002c2: a1 a0 ff 10 80 mov 0x8010ffa0,%eax 801002c7: 83 c4 10 add $0x10,%esp 801002ca: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 801002d0: 75 36 jne 80100308 <consoleread+0x98> if(myproc()->killed){ 801002d2: e8 a9 34 00 00 call 80103780 <myproc> 801002d7: 8b 40 24 mov 0x24(%eax),%eax 801002da: 85 c0 test %eax,%eax 801002dc: 74 d2 je 801002b0 <consoleread+0x40> release(&cons.lock); 801002de: 83 ec 0c sub $0xc,%esp 801002e1: 68 20 a5 10 80 push $0x8010a520 801002e6: e8 15 41 00 00 call 80104400 <release> ilock(ip); 801002eb: 89 3c 24 mov %edi,(%esp) 801002ee: e8 7d 13 00 00 call 80101670 <ilock> return -1; 801002f3: 83 c4 10 add $0x10,%esp 801002f6: b8 ff ff ff ff mov $0xffffffff,%eax } release(&cons.lock); ilock(ip); return target - n; } 801002fb: 8d 65 f4 lea -0xc(%ebp),%esp 801002fe: 5b pop %ebx 801002ff: 5e pop %esi 80100300: 5f pop %edi 80100301: 5d pop %ebp 80100302: c3 ret 80100303: 90 nop 80100304: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi ilock(ip); return -1; } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; 80100308: 8d 50 01 lea 0x1(%eax),%edx 8010030b: 89 15 a0 ff 10 80 mov %edx,0x8010ffa0 80100311: 89 c2 mov %eax,%edx 80100313: 83 e2 7f and $0x7f,%edx 80100316: 0f be 92 20 ff 10 80 movsbl -0x7fef00e0(%edx),%edx if(c == C('D')){ // EOF 8010031d: 83 fa 04 cmp $0x4,%edx 80100320: 74 39 je 8010035b <consoleread+0xeb> // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; 80100322: 83 c6 01 add $0x1,%esi --n; 80100325: 83 eb 01 sub $0x1,%ebx if(c == '\n') 80100328: 83 fa 0a cmp $0xa,%edx // caller gets a 0-byte result. input.r--; } break; } *dst++ = c; 8010032b: 88 56 ff mov %dl,-0x1(%esi) --n; if(c == '\n') 8010032e: 74 35 je 80100365 <consoleread+0xf5> int c; iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ 80100330: 85 db test %ebx,%ebx 80100332: 0f 85 69 ff ff ff jne 801002a1 <consoleread+0x31> 80100338: 8b 45 10 mov 0x10(%ebp),%eax *dst++ = c; --n; if(c == '\n') break; } release(&cons.lock); 8010033b: 83 ec 0c sub $0xc,%esp 8010033e: 89 45 e4 mov %eax,-0x1c(%ebp) 80100341: 68 20 a5 10 80 push $0x8010a520 80100346: e8 b5 40 00 00 call 80104400 <release> ilock(ip); 8010034b: 89 3c 24 mov %edi,(%esp) 8010034e: e8 1d 13 00 00 call 80101670 <ilock> return target - n; 80100353: 83 c4 10 add $0x10,%esp 80100356: 8b 45 e4 mov -0x1c(%ebp),%eax 80100359: eb a0 jmp 801002fb <consoleread+0x8b> } sleep(&input.r, &cons.lock); } c = input.buf[input.r++ % INPUT_BUF]; if(c == C('D')){ // EOF if(n < target){ 8010035b: 39 5d 10 cmp %ebx,0x10(%ebp) 8010035e: 76 05 jbe 80100365 <consoleread+0xf5> // Save ^D for next time, to make sure // caller gets a 0-byte result. input.r--; 80100360: a3 a0 ff 10 80 mov %eax,0x8010ffa0 80100365: 8b 45 10 mov 0x10(%ebp),%eax 80100368: 29 d8 sub %ebx,%eax 8010036a: eb cf jmp 8010033b <consoleread+0xcb> 8010036c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100370 <panic>: release(&cons.lock); } void panic(char *s) { 80100370: 55 push %ebp 80100371: 89 e5 mov %esp,%ebp 80100373: 56 push %esi 80100374: 53 push %ebx 80100375: 83 ec 30 sub $0x30,%esp } static inline void cli(void) { asm volatile("cli"); 80100378: fa cli int i; uint pcs[10]; cli(); cons.locking = 0; 80100379: c7 05 54 a5 10 80 00 movl $0x0,0x8010a554 80100380: 00 00 00 // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); 80100383: 8d 5d d0 lea -0x30(%ebp),%ebx 80100386: 8d 75 f8 lea -0x8(%ebp),%esi uint pcs[10]; cli(); cons.locking = 0; // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); 80100389: e8 62 23 00 00 call 801026f0 <lapicid> 8010038e: 83 ec 08 sub $0x8,%esp 80100391: 50 push %eax 80100392: 68 4d 6f 10 80 push $0x80106f4d 80100397: e8 c4 02 00 00 call 80100660 <cprintf> cprintf(s); 8010039c: 58 pop %eax 8010039d: ff 75 08 pushl 0x8(%ebp) 801003a0: e8 bb 02 00 00 call 80100660 <cprintf> cprintf("\n"); 801003a5: c7 04 24 db 78 10 80 movl $0x801078db,(%esp) 801003ac: e8 af 02 00 00 call 80100660 <cprintf> getcallerpcs(&s, pcs); 801003b1: 5a pop %edx 801003b2: 8d 45 08 lea 0x8(%ebp),%eax 801003b5: 59 pop %ecx 801003b6: 53 push %ebx 801003b7: 50 push %eax 801003b8: e8 53 3e 00 00 call 80104210 <getcallerpcs> 801003bd: 83 c4 10 add $0x10,%esp for(i=0; i<10; i++) cprintf(" %p", pcs[i]); 801003c0: 83 ec 08 sub $0x8,%esp 801003c3: ff 33 pushl (%ebx) 801003c5: 83 c3 04 add $0x4,%ebx 801003c8: 68 61 6f 10 80 push $0x80106f61 801003cd: e8 8e 02 00 00 call 80100660 <cprintf> // use lapiccpunum so that we can call panic from mycpu() cprintf("lapicid %d: panic: ", lapicid()); cprintf(s); cprintf("\n"); getcallerpcs(&s, pcs); for(i=0; i<10; i++) 801003d2: 83 c4 10 add $0x10,%esp 801003d5: 39 f3 cmp %esi,%ebx 801003d7: 75 e7 jne 801003c0 <panic+0x50> cprintf(" %p", pcs[i]); panicked = 1; // freeze other CPU 801003d9: c7 05 58 a5 10 80 01 movl $0x1,0x8010a558 801003e0: 00 00 00 801003e3: eb fe jmp 801003e3 <panic+0x73> 801003e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801003e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801003f0 <consputc>: } void consputc(int c) { if(panicked){ 801003f0: 8b 15 58 a5 10 80 mov 0x8010a558,%edx 801003f6: 85 d2 test %edx,%edx 801003f8: 74 06 je 80100400 <consputc+0x10> 801003fa: fa cli 801003fb: eb fe jmp 801003fb <consputc+0xb> 801003fd: 8d 76 00 lea 0x0(%esi),%esi crt[pos] = ' ' | 0x0700; } void consputc(int c) { 80100400: 55 push %ebp 80100401: 89 e5 mov %esp,%ebp 80100403: 57 push %edi 80100404: 56 push %esi 80100405: 53 push %ebx 80100406: 89 c3 mov %eax,%ebx 80100408: 83 ec 0c sub $0xc,%esp cli(); for(;;) ; } if(c == BACKSPACE){ 8010040b: 3d 00 01 00 00 cmp $0x100,%eax 80100410: 0f 84 b8 00 00 00 je 801004ce <consputc+0xde> uartputc('\b'); uartputc(' '); uartputc('\b'); } else uartputc(c); 80100416: 83 ec 0c sub $0xc,%esp 80100419: 50 push %eax 8010041a: e8 c1 56 00 00 call 80105ae0 <uartputc> 8010041f: 83 c4 10 add $0x10,%esp } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100422: bf d4 03 00 00 mov $0x3d4,%edi 80100427: b8 0e 00 00 00 mov $0xe,%eax 8010042c: 89 fa mov %edi,%edx 8010042e: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010042f: be d5 03 00 00 mov $0x3d5,%esi 80100434: 89 f2 mov %esi,%edx 80100436: ec in (%dx),%al { int pos; // Cursor position: col + 80*row. outb(CRTPORT, 14); pos = inb(CRTPORT+1) << 8; 80100437: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 8010043a: 89 fa mov %edi,%edx 8010043c: c1 e0 08 shl $0x8,%eax 8010043f: 89 c1 mov %eax,%ecx 80100441: b8 0f 00 00 00 mov $0xf,%eax 80100446: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80100447: 89 f2 mov %esi,%edx 80100449: ec in (%dx),%al outb(CRTPORT, 15); pos |= inb(CRTPORT+1); 8010044a: 0f b6 c0 movzbl %al,%eax 8010044d: 09 c8 or %ecx,%eax if(c == '\n') 8010044f: 83 fb 0a cmp $0xa,%ebx 80100452: 0f 84 0b 01 00 00 je 80100563 <consputc+0x173> pos += 80 - pos%80; else if(c == BACKSPACE){ 80100458: 81 fb 00 01 00 00 cmp $0x100,%ebx 8010045e: 0f 84 e6 00 00 00 je 8010054a <consputc+0x15a> if(pos > 0) --pos; } else crt[pos++] = (c&0xff) | 0x0700; // black on white 80100464: 0f b6 d3 movzbl %bl,%edx 80100467: 8d 78 01 lea 0x1(%eax),%edi 8010046a: 80 ce 07 or $0x7,%dh 8010046d: 66 89 94 00 00 80 0b mov %dx,-0x7ff48000(%eax,%eax,1) 80100474: 80 if(pos < 0 || pos > 25*80) 80100475: 81 ff d0 07 00 00 cmp $0x7d0,%edi 8010047b: 0f 8f bc 00 00 00 jg 8010053d <consputc+0x14d> panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. 80100481: 81 ff 7f 07 00 00 cmp $0x77f,%edi 80100487: 7f 6f jg 801004f8 <consputc+0x108> 80100489: 89 f8 mov %edi,%eax 8010048b: 8d 8c 3f 00 80 0b 80 lea -0x7ff48000(%edi,%edi,1),%ecx 80100492: 89 fb mov %edi,%ebx 80100494: c1 e8 08 shr $0x8,%eax 80100497: 89 c6 mov %eax,%esi } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80100499: bf d4 03 00 00 mov $0x3d4,%edi 8010049e: b8 0e 00 00 00 mov $0xe,%eax 801004a3: 89 fa mov %edi,%edx 801004a5: ee out %al,(%dx) 801004a6: ba d5 03 00 00 mov $0x3d5,%edx 801004ab: 89 f0 mov %esi,%eax 801004ad: ee out %al,(%dx) 801004ae: b8 0f 00 00 00 mov $0xf,%eax 801004b3: 89 fa mov %edi,%edx 801004b5: ee out %al,(%dx) 801004b6: ba d5 03 00 00 mov $0x3d5,%edx 801004bb: 89 d8 mov %ebx,%eax 801004bd: ee out %al,(%dx) outb(CRTPORT, 14); outb(CRTPORT+1, pos>>8); outb(CRTPORT, 15); outb(CRTPORT+1, pos); crt[pos] = ' ' | 0x0700; 801004be: b8 20 07 00 00 mov $0x720,%eax 801004c3: 66 89 01 mov %ax,(%ecx) if(c == BACKSPACE){ uartputc('\b'); uartputc(' '); uartputc('\b'); } else uartputc(c); cgaputc(c); } 801004c6: 8d 65 f4 lea -0xc(%ebp),%esp 801004c9: 5b pop %ebx 801004ca: 5e pop %esi 801004cb: 5f pop %edi 801004cc: 5d pop %ebp 801004cd: c3 ret for(;;) ; } if(c == BACKSPACE){ uartputc('\b'); uartputc(' '); uartputc('\b'); 801004ce: 83 ec 0c sub $0xc,%esp 801004d1: 6a 08 push $0x8 801004d3: e8 08 56 00 00 call 80105ae0 <uartputc> 801004d8: c7 04 24 20 00 00 00 movl $0x20,(%esp) 801004df: e8 fc 55 00 00 call 80105ae0 <uartputc> 801004e4: c7 04 24 08 00 00 00 movl $0x8,(%esp) 801004eb: e8 f0 55 00 00 call 80105ae0 <uartputc> 801004f0: 83 c4 10 add $0x10,%esp 801004f3: e9 2a ff ff ff jmp 80100422 <consputc+0x32> if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 801004f8: 83 ec 04 sub $0x4,%esp pos -= 80; 801004fb: 8d 5f b0 lea -0x50(%edi),%ebx if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 801004fe: 68 60 0e 00 00 push $0xe60 80100503: 68 a0 80 0b 80 push $0x800b80a0 80100508: 68 00 80 0b 80 push $0x800b8000 pos -= 80; memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 8010050d: 8d b4 1b 00 80 0b 80 lea -0x7ff48000(%ebx,%ebx,1),%esi if(pos < 0 || pos > 25*80) panic("pos under/overflow"); if((pos/80) >= 24){ // Scroll up. memmove(crt, crt+80, sizeof(crt[0])*23*80); 80100514: e8 e7 3f 00 00 call 80104500 <memmove> pos -= 80; memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos)); 80100519: b8 80 07 00 00 mov $0x780,%eax 8010051e: 83 c4 0c add $0xc,%esp 80100521: 29 d8 sub %ebx,%eax 80100523: 01 c0 add %eax,%eax 80100525: 50 push %eax 80100526: 6a 00 push $0x0 80100528: 56 push %esi 80100529: e8 22 3f 00 00 call 80104450 <memset> 8010052e: 89 f1 mov %esi,%ecx 80100530: 83 c4 10 add $0x10,%esp 80100533: be 07 00 00 00 mov $0x7,%esi 80100538: e9 5c ff ff ff jmp 80100499 <consputc+0xa9> if(pos > 0) --pos; } else crt[pos++] = (c&0xff) | 0x0700; // black on white if(pos < 0 || pos > 25*80) panic("pos under/overflow"); 8010053d: 83 ec 0c sub $0xc,%esp 80100540: 68 65 6f 10 80 push $0x80106f65 80100545: e8 26 fe ff ff call 80100370 <panic> pos |= inb(CRTPORT+1); if(c == '\n') pos += 80 - pos%80; else if(c == BACKSPACE){ if(pos > 0) --pos; 8010054a: 85 c0 test %eax,%eax 8010054c: 8d 78 ff lea -0x1(%eax),%edi 8010054f: 0f 85 20 ff ff ff jne 80100475 <consputc+0x85> 80100555: b9 00 80 0b 80 mov $0x800b8000,%ecx 8010055a: 31 db xor %ebx,%ebx 8010055c: 31 f6 xor %esi,%esi 8010055e: e9 36 ff ff ff jmp 80100499 <consputc+0xa9> pos = inb(CRTPORT+1) << 8; outb(CRTPORT, 15); pos |= inb(CRTPORT+1); if(c == '\n') pos += 80 - pos%80; 80100563: ba 67 66 66 66 mov $0x66666667,%edx 80100568: f7 ea imul %edx 8010056a: 89 d0 mov %edx,%eax 8010056c: c1 e8 05 shr $0x5,%eax 8010056f: 8d 04 80 lea (%eax,%eax,4),%eax 80100572: c1 e0 04 shl $0x4,%eax 80100575: 8d 78 50 lea 0x50(%eax),%edi 80100578: e9 f8 fe ff ff jmp 80100475 <consputc+0x85> 8010057d: 8d 76 00 lea 0x0(%esi),%esi 80100580 <printint>: int locking; } cons; static void printint(int xx, int base, int sign) { 80100580: 55 push %ebp 80100581: 89 e5 mov %esp,%ebp 80100583: 57 push %edi 80100584: 56 push %esi 80100585: 53 push %ebx 80100586: 89 d6 mov %edx,%esi 80100588: 83 ec 2c sub $0x2c,%esp static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 8010058b: 85 c9 test %ecx,%ecx int locking; } cons; static void printint(int xx, int base, int sign) { 8010058d: 89 4d d4 mov %ecx,-0x2c(%ebp) static char digits[] = "0123456789abcdef"; char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) 80100590: 74 0c je 8010059e <printint+0x1e> 80100592: 89 c7 mov %eax,%edi 80100594: c1 ef 1f shr $0x1f,%edi 80100597: 85 c0 test %eax,%eax 80100599: 89 7d d4 mov %edi,-0x2c(%ebp) 8010059c: 78 51 js 801005ef <printint+0x6f> x = -xx; else x = xx; i = 0; 8010059e: 31 ff xor %edi,%edi 801005a0: 8d 5d d7 lea -0x29(%ebp),%ebx 801005a3: eb 05 jmp 801005aa <printint+0x2a> 801005a5: 8d 76 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; 801005a8: 89 cf mov %ecx,%edi 801005aa: 31 d2 xor %edx,%edx 801005ac: 8d 4f 01 lea 0x1(%edi),%ecx 801005af: f7 f6 div %esi 801005b1: 0f b6 92 90 6f 10 80 movzbl -0x7fef9070(%edx),%edx }while((x /= base) != 0); 801005b8: 85 c0 test %eax,%eax else x = xx; i = 0; do{ buf[i++] = digits[x % base]; 801005ba: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 801005bd: 75 e9 jne 801005a8 <printint+0x28> if(sign) 801005bf: 8b 45 d4 mov -0x2c(%ebp),%eax 801005c2: 85 c0 test %eax,%eax 801005c4: 74 08 je 801005ce <printint+0x4e> buf[i++] = '-'; 801005c6: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1) 801005cb: 8d 4f 02 lea 0x2(%edi),%ecx 801005ce: 8d 74 0d d7 lea -0x29(%ebp,%ecx,1),%esi 801005d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi while(--i >= 0) consputc(buf[i]); 801005d8: 0f be 06 movsbl (%esi),%eax 801005db: 83 ee 01 sub $0x1,%esi 801005de: e8 0d fe ff ff call 801003f0 <consputc> }while((x /= base) != 0); if(sign) buf[i++] = '-'; while(--i >= 0) 801005e3: 39 de cmp %ebx,%esi 801005e5: 75 f1 jne 801005d8 <printint+0x58> consputc(buf[i]); } 801005e7: 83 c4 2c add $0x2c,%esp 801005ea: 5b pop %ebx 801005eb: 5e pop %esi 801005ec: 5f pop %edi 801005ed: 5d pop %ebp 801005ee: c3 ret char buf[16]; int i; uint x; if(sign && (sign = xx < 0)) x = -xx; 801005ef: f7 d8 neg %eax 801005f1: eb ab jmp 8010059e <printint+0x1e> 801005f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801005f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100600 <consolewrite>: return target - n; } int consolewrite(struct inode *ip, char *buf, int n) { 80100600: 55 push %ebp 80100601: 89 e5 mov %esp,%ebp 80100603: 57 push %edi 80100604: 56 push %esi 80100605: 53 push %ebx 80100606: 83 ec 18 sub $0x18,%esp int i; iunlock(ip); 80100609: ff 75 08 pushl 0x8(%ebp) return target - n; } int consolewrite(struct inode *ip, char *buf, int n) { 8010060c: 8b 75 10 mov 0x10(%ebp),%esi int i; iunlock(ip); 8010060f: e8 3c 11 00 00 call 80101750 <iunlock> acquire(&cons.lock); 80100614: c7 04 24 20 a5 10 80 movl $0x8010a520,(%esp) 8010061b: e8 30 3d 00 00 call 80104350 <acquire> 80100620: 8b 7d 0c mov 0xc(%ebp),%edi for(i = 0; i < n; i++) 80100623: 83 c4 10 add $0x10,%esp 80100626: 85 f6 test %esi,%esi 80100628: 8d 1c 37 lea (%edi,%esi,1),%ebx 8010062b: 7e 12 jle 8010063f <consolewrite+0x3f> 8010062d: 8d 76 00 lea 0x0(%esi),%esi consputc(buf[i] & 0xff); 80100630: 0f b6 07 movzbl (%edi),%eax 80100633: 83 c7 01 add $0x1,%edi 80100636: e8 b5 fd ff ff call 801003f0 <consputc> { int i; iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++) 8010063b: 39 df cmp %ebx,%edi 8010063d: 75 f1 jne 80100630 <consolewrite+0x30> consputc(buf[i] & 0xff); release(&cons.lock); 8010063f: 83 ec 0c sub $0xc,%esp 80100642: 68 20 a5 10 80 push $0x8010a520 80100647: e8 b4 3d 00 00 call 80104400 <release> ilock(ip); 8010064c: 58 pop %eax 8010064d: ff 75 08 pushl 0x8(%ebp) 80100650: e8 1b 10 00 00 call 80101670 <ilock> return n; } 80100655: 8d 65 f4 lea -0xc(%ebp),%esp 80100658: 89 f0 mov %esi,%eax 8010065a: 5b pop %ebx 8010065b: 5e pop %esi 8010065c: 5f pop %edi 8010065d: 5d pop %ebp 8010065e: c3 ret 8010065f: 90 nop 80100660 <cprintf>: //PAGEBREAK: 50 // Print to the console. only understands %d, %x, %p, %s. void cprintf(char *fmt, ...) { 80100660: 55 push %ebp 80100661: 89 e5 mov %esp,%ebp 80100663: 57 push %edi 80100664: 56 push %esi 80100665: 53 push %ebx 80100666: 83 ec 1c sub $0x1c,%esp int i, c, locking; uint *argp; char *s; locking = cons.locking; 80100669: a1 54 a5 10 80 mov 0x8010a554,%eax if(locking) 8010066e: 85 c0 test %eax,%eax { int i, c, locking; uint *argp; char *s; locking = cons.locking; 80100670: 89 45 e0 mov %eax,-0x20(%ebp) if(locking) 80100673: 0f 85 47 01 00 00 jne 801007c0 <cprintf+0x160> acquire(&cons.lock); if (fmt == 0) 80100679: 8b 45 08 mov 0x8(%ebp),%eax 8010067c: 85 c0 test %eax,%eax 8010067e: 89 c1 mov %eax,%ecx 80100680: 0f 84 4f 01 00 00 je 801007d5 <cprintf+0x175> panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 80100686: 0f b6 00 movzbl (%eax),%eax 80100689: 31 db xor %ebx,%ebx 8010068b: 8d 75 0c lea 0xc(%ebp),%esi 8010068e: 89 cf mov %ecx,%edi 80100690: 85 c0 test %eax,%eax 80100692: 75 55 jne 801006e9 <cprintf+0x89> 80100694: eb 68 jmp 801006fe <cprintf+0x9e> 80100696: 8d 76 00 lea 0x0(%esi),%esi 80100699: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if(c != '%'){ consputc(c); continue; } c = fmt[++i] & 0xff; 801006a0: 83 c3 01 add $0x1,%ebx 801006a3: 0f b6 14 1f movzbl (%edi,%ebx,1),%edx if(c == 0) 801006a7: 85 d2 test %edx,%edx 801006a9: 74 53 je 801006fe <cprintf+0x9e> break; switch(c){ 801006ab: 83 fa 70 cmp $0x70,%edx 801006ae: 74 7a je 8010072a <cprintf+0xca> 801006b0: 7f 6e jg 80100720 <cprintf+0xc0> 801006b2: 83 fa 25 cmp $0x25,%edx 801006b5: 0f 84 ad 00 00 00 je 80100768 <cprintf+0x108> 801006bb: 83 fa 64 cmp $0x64,%edx 801006be: 0f 85 84 00 00 00 jne 80100748 <cprintf+0xe8> case 'd': printint(*argp++, 10, 1); 801006c4: 8d 46 04 lea 0x4(%esi),%eax 801006c7: b9 01 00 00 00 mov $0x1,%ecx 801006cc: ba 0a 00 00 00 mov $0xa,%edx 801006d1: 89 45 e4 mov %eax,-0x1c(%ebp) 801006d4: 8b 06 mov (%esi),%eax 801006d6: e8 a5 fe ff ff call 80100580 <printint> 801006db: 8b 75 e4 mov -0x1c(%ebp),%esi if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006de: 83 c3 01 add $0x1,%ebx 801006e1: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax 801006e5: 85 c0 test %eax,%eax 801006e7: 74 15 je 801006fe <cprintf+0x9e> if(c != '%'){ 801006e9: 83 f8 25 cmp $0x25,%eax 801006ec: 74 b2 je 801006a0 <cprintf+0x40> s = "(null)"; for(; *s; s++) consputc(*s); break; case '%': consputc('%'); 801006ee: e8 fd fc ff ff call 801003f0 <consputc> if (fmt == 0) panic("null fmt"); argp = (uint*)(void*)(&fmt + 1); for(i = 0; (c = fmt[i] & 0xff) != 0; i++){ 801006f3: 83 c3 01 add $0x1,%ebx 801006f6: 0f b6 04 1f movzbl (%edi,%ebx,1),%eax 801006fa: 85 c0 test %eax,%eax 801006fc: 75 eb jne 801006e9 <cprintf+0x89> consputc(c); break; } } if(locking) 801006fe: 8b 45 e0 mov -0x20(%ebp),%eax 80100701: 85 c0 test %eax,%eax 80100703: 74 10 je 80100715 <cprintf+0xb5> release(&cons.lock); 80100705: 83 ec 0c sub $0xc,%esp 80100708: 68 20 a5 10 80 push $0x8010a520 8010070d: e8 ee 3c 00 00 call 80104400 <release> 80100712: 83 c4 10 add $0x10,%esp } 80100715: 8d 65 f4 lea -0xc(%ebp),%esp 80100718: 5b pop %ebx 80100719: 5e pop %esi 8010071a: 5f pop %edi 8010071b: 5d pop %ebp 8010071c: c3 ret 8010071d: 8d 76 00 lea 0x0(%esi),%esi continue; } c = fmt[++i] & 0xff; if(c == 0) break; switch(c){ 80100720: 83 fa 73 cmp $0x73,%edx 80100723: 74 5b je 80100780 <cprintf+0x120> 80100725: 83 fa 78 cmp $0x78,%edx 80100728: 75 1e jne 80100748 <cprintf+0xe8> case 'd': printint(*argp++, 10, 1); break; case 'x': case 'p': printint(*argp++, 16, 0); 8010072a: 8d 46 04 lea 0x4(%esi),%eax 8010072d: 31 c9 xor %ecx,%ecx 8010072f: ba 10 00 00 00 mov $0x10,%edx 80100734: 89 45 e4 mov %eax,-0x1c(%ebp) 80100737: 8b 06 mov (%esi),%eax 80100739: e8 42 fe ff ff call 80100580 <printint> 8010073e: 8b 75 e4 mov -0x1c(%ebp),%esi break; 80100741: eb 9b jmp 801006de <cprintf+0x7e> 80100743: 90 nop 80100744: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi case '%': consputc('%'); break; default: // Print unknown % sequence to draw attention. consputc('%'); 80100748: b8 25 00 00 00 mov $0x25,%eax 8010074d: 89 55 e4 mov %edx,-0x1c(%ebp) 80100750: e8 9b fc ff ff call 801003f0 <consputc> consputc(c); 80100755: 8b 55 e4 mov -0x1c(%ebp),%edx 80100758: 89 d0 mov %edx,%eax 8010075a: e8 91 fc ff ff call 801003f0 <consputc> break; 8010075f: e9 7a ff ff ff jmp 801006de <cprintf+0x7e> 80100764: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s = "(null)"; for(; *s; s++) consputc(*s); break; case '%': consputc('%'); 80100768: b8 25 00 00 00 mov $0x25,%eax 8010076d: e8 7e fc ff ff call 801003f0 <consputc> 80100772: e9 7c ff ff ff jmp 801006f3 <cprintf+0x93> 80100777: 89 f6 mov %esi,%esi 80100779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi case 'x': case 'p': printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) 80100780: 8d 46 04 lea 0x4(%esi),%eax 80100783: 8b 36 mov (%esi),%esi 80100785: 89 45 e4 mov %eax,-0x1c(%ebp) s = "(null)"; 80100788: b8 78 6f 10 80 mov $0x80106f78,%eax 8010078d: 85 f6 test %esi,%esi 8010078f: 0f 44 f0 cmove %eax,%esi for(; *s; s++) 80100792: 0f be 06 movsbl (%esi),%eax 80100795: 84 c0 test %al,%al 80100797: 74 16 je 801007af <cprintf+0x14f> 80100799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801007a0: 83 c6 01 add $0x1,%esi consputc(*s); 801007a3: e8 48 fc ff ff call 801003f0 <consputc> printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) s = "(null)"; for(; *s; s++) 801007a8: 0f be 06 movsbl (%esi),%eax 801007ab: 84 c0 test %al,%al 801007ad: 75 f1 jne 801007a0 <cprintf+0x140> case 'x': case 'p': printint(*argp++, 16, 0); break; case 's': if((s = (char*)*argp++) == 0) 801007af: 8b 75 e4 mov -0x1c(%ebp),%esi 801007b2: e9 27 ff ff ff jmp 801006de <cprintf+0x7e> 801007b7: 89 f6 mov %esi,%esi 801007b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi uint *argp; char *s; locking = cons.locking; if(locking) acquire(&cons.lock); 801007c0: 83 ec 0c sub $0xc,%esp 801007c3: 68 20 a5 10 80 push $0x8010a520 801007c8: e8 83 3b 00 00 call 80104350 <acquire> 801007cd: 83 c4 10 add $0x10,%esp 801007d0: e9 a4 fe ff ff jmp 80100679 <cprintf+0x19> if (fmt == 0) panic("null fmt"); 801007d5: 83 ec 0c sub $0xc,%esp 801007d8: 68 7f 6f 10 80 push $0x80106f7f 801007dd: e8 8e fb ff ff call 80100370 <panic> 801007e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801007e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801007f0 <consoleintr>: #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007f0: 55 push %ebp 801007f1: 89 e5 mov %esp,%ebp 801007f3: 57 push %edi 801007f4: 56 push %esi 801007f5: 53 push %ebx int c, doprocdump = 0; 801007f6: 31 f6 xor %esi,%esi #define C(x) ((x)-'@') // Control-x void consoleintr(int (*getc)(void)) { 801007f8: 83 ec 18 sub $0x18,%esp 801007fb: 8b 5d 08 mov 0x8(%ebp),%ebx int c, doprocdump = 0; acquire(&cons.lock); 801007fe: 68 20 a5 10 80 push $0x8010a520 80100803: e8 48 3b 00 00 call 80104350 <acquire> while((c = getc()) >= 0){ 80100808: 83 c4 10 add $0x10,%esp 8010080b: 90 nop 8010080c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100810: ff d3 call *%ebx 80100812: 85 c0 test %eax,%eax 80100814: 89 c7 mov %eax,%edi 80100816: 78 48 js 80100860 <consoleintr+0x70> switch(c){ 80100818: 83 ff 10 cmp $0x10,%edi 8010081b: 0f 84 3f 01 00 00 je 80100960 <consoleintr+0x170> 80100821: 7e 5d jle 80100880 <consoleintr+0x90> 80100823: 83 ff 15 cmp $0x15,%edi 80100826: 0f 84 dc 00 00 00 je 80100908 <consoleintr+0x118> 8010082c: 83 ff 7f cmp $0x7f,%edi 8010082f: 75 54 jne 80100885 <consoleintr+0x95> input.e--; consputc(BACKSPACE); } break; case C('H'): case '\x7f': // Backspace if(input.e != input.w){ 80100831: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 80100836: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 8010083c: 74 d2 je 80100810 <consoleintr+0x20> input.e--; 8010083e: 83 e8 01 sub $0x1,%eax 80100841: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(BACKSPACE); 80100846: b8 00 01 00 00 mov $0x100,%eax 8010084b: e8 a0 fb ff ff call 801003f0 <consputc> consoleintr(int (*getc)(void)) { int c, doprocdump = 0; acquire(&cons.lock); while((c = getc()) >= 0){ 80100850: ff d3 call *%ebx 80100852: 85 c0 test %eax,%eax 80100854: 89 c7 mov %eax,%edi 80100856: 79 c0 jns 80100818 <consoleintr+0x28> 80100858: 90 nop 80100859: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } } break; } } release(&cons.lock); 80100860: 83 ec 0c sub $0xc,%esp 80100863: 68 20 a5 10 80 push $0x8010a520 80100868: e8 93 3b 00 00 call 80104400 <release> if(doprocdump) { 8010086d: 83 c4 10 add $0x10,%esp 80100870: 85 f6 test %esi,%esi 80100872: 0f 85 f8 00 00 00 jne 80100970 <consoleintr+0x180> procdump(); // now call procdump() wo. cons.lock held } } 80100878: 8d 65 f4 lea -0xc(%ebp),%esp 8010087b: 5b pop %ebx 8010087c: 5e pop %esi 8010087d: 5f pop %edi 8010087e: 5d pop %ebp 8010087f: c3 ret { int c, doprocdump = 0; acquire(&cons.lock); while((c = getc()) >= 0){ switch(c){ 80100880: 83 ff 08 cmp $0x8,%edi 80100883: 74 ac je 80100831 <consoleintr+0x41> input.e--; consputc(BACKSPACE); } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ 80100885: 85 ff test %edi,%edi 80100887: 74 87 je 80100810 <consoleintr+0x20> 80100889: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 8010088e: 89 c2 mov %eax,%edx 80100890: 2b 15 a0 ff 10 80 sub 0x8010ffa0,%edx 80100896: 83 fa 7f cmp $0x7f,%edx 80100899: 0f 87 71 ff ff ff ja 80100810 <consoleintr+0x20> c = (c == '\r') ? '\n' : c; input.buf[input.e++ % INPUT_BUF] = c; 8010089f: 8d 50 01 lea 0x1(%eax),%edx 801008a2: 83 e0 7f and $0x7f,%eax consputc(BACKSPACE); } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; 801008a5: 83 ff 0d cmp $0xd,%edi input.buf[input.e++ % INPUT_BUF] = c; 801008a8: 89 15 a8 ff 10 80 mov %edx,0x8010ffa8 consputc(BACKSPACE); } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; 801008ae: 0f 84 c8 00 00 00 je 8010097c <consoleintr+0x18c> input.buf[input.e++ % INPUT_BUF] = c; 801008b4: 89 f9 mov %edi,%ecx 801008b6: 88 88 20 ff 10 80 mov %cl,-0x7fef00e0(%eax) consputc(c); 801008bc: 89 f8 mov %edi,%eax 801008be: e8 2d fb ff ff call 801003f0 <consputc> if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ 801008c3: 83 ff 0a cmp $0xa,%edi 801008c6: 0f 84 c1 00 00 00 je 8010098d <consoleintr+0x19d> 801008cc: 83 ff 04 cmp $0x4,%edi 801008cf: 0f 84 b8 00 00 00 je 8010098d <consoleintr+0x19d> 801008d5: a1 a0 ff 10 80 mov 0x8010ffa0,%eax 801008da: 83 e8 80 sub $0xffffff80,%eax 801008dd: 39 05 a8 ff 10 80 cmp %eax,0x8010ffa8 801008e3: 0f 85 27 ff ff ff jne 80100810 <consoleintr+0x20> input.w = input.e; wakeup(&input.r); 801008e9: 83 ec 0c sub $0xc,%esp if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; input.buf[input.e++ % INPUT_BUF] = c; consputc(c); if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){ input.w = input.e; 801008ec: a3 a4 ff 10 80 mov %eax,0x8010ffa4 wakeup(&input.r); 801008f1: 68 a0 ff 10 80 push $0x8010ffa0 801008f6: e8 e5 35 00 00 call 80103ee0 <wakeup> 801008fb: 83 c4 10 add $0x10,%esp 801008fe: e9 0d ff ff ff jmp 80100810 <consoleintr+0x20> 80100903: 90 nop 80100904: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; break; case C('U'): // Kill line. while(input.e != input.w && 80100908: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 8010090d: 39 05 a4 ff 10 80 cmp %eax,0x8010ffa4 80100913: 75 2b jne 80100940 <consoleintr+0x150> 80100915: e9 f6 fe ff ff jmp 80100810 <consoleintr+0x20> 8010091a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi input.buf[(input.e-1) % INPUT_BUF] != '\n'){ input.e--; 80100920: a3 a8 ff 10 80 mov %eax,0x8010ffa8 consputc(BACKSPACE); 80100925: b8 00 01 00 00 mov $0x100,%eax 8010092a: e8 c1 fa ff ff call 801003f0 <consputc> case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; break; case C('U'): // Kill line. while(input.e != input.w && 8010092f: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 80100934: 3b 05 a4 ff 10 80 cmp 0x8010ffa4,%eax 8010093a: 0f 84 d0 fe ff ff je 80100810 <consoleintr+0x20> input.buf[(input.e-1) % INPUT_BUF] != '\n'){ 80100940: 83 e8 01 sub $0x1,%eax 80100943: 89 c2 mov %eax,%edx 80100945: 83 e2 7f and $0x7f,%edx case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; break; case C('U'): // Kill line. while(input.e != input.w && 80100948: 80 ba 20 ff 10 80 0a cmpb $0xa,-0x7fef00e0(%edx) 8010094f: 75 cf jne 80100920 <consoleintr+0x130> 80100951: e9 ba fe ff ff jmp 80100810 <consoleintr+0x20> 80100956: 8d 76 00 lea 0x0(%esi),%esi 80100959: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi acquire(&cons.lock); while((c = getc()) >= 0){ switch(c){ case C('P'): // Process listing. // procdump() locks cons.lock indirectly; invoke later doprocdump = 1; 80100960: be 01 00 00 00 mov $0x1,%esi 80100965: e9 a6 fe ff ff jmp 80100810 <consoleintr+0x20> 8010096a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } release(&cons.lock); if(doprocdump) { procdump(); // now call procdump() wo. cons.lock held } } 80100970: 8d 65 f4 lea -0xc(%ebp),%esp 80100973: 5b pop %ebx 80100974: 5e pop %esi 80100975: 5f pop %edi 80100976: 5d pop %ebp break; } } release(&cons.lock); if(doprocdump) { procdump(); // now call procdump() wo. cons.lock held 80100977: e9 54 36 00 00 jmp 80103fd0 <procdump> } break; default: if(c != 0 && input.e-input.r < INPUT_BUF){ c = (c == '\r') ? '\n' : c; input.buf[input.e++ % INPUT_BUF] = c; 8010097c: c6 80 20 ff 10 80 0a movb $0xa,-0x7fef00e0(%eax) consputc(c); 80100983: b8 0a 00 00 00 mov $0xa,%eax 80100988: e8 63 fa ff ff call 801003f0 <consputc> 8010098d: a1 a8 ff 10 80 mov 0x8010ffa8,%eax 80100992: e9 52 ff ff ff jmp 801008e9 <consoleintr+0xf9> 80100997: 89 f6 mov %esi,%esi 80100999: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801009a0 <consoleinit>: return n; } void consoleinit(void) { 801009a0: 55 push %ebp 801009a1: 89 e5 mov %esp,%ebp 801009a3: 83 ec 10 sub $0x10,%esp initlock(&cons.lock, "console"); 801009a6: 68 88 6f 10 80 push $0x80106f88 801009ab: 68 20 a5 10 80 push $0x8010a520 801009b0: e8 3b 38 00 00 call 801041f0 <initlock> devsw[CONSOLE].write = consolewrite; devsw[CONSOLE].read = consoleread; cons.locking = 1; ioapicenable(IRQ_KBD, 0); 801009b5: 58 pop %eax 801009b6: 5a pop %edx 801009b7: 6a 00 push $0x0 801009b9: 6a 01 push $0x1 void consoleinit(void) { initlock(&cons.lock, "console"); devsw[CONSOLE].write = consolewrite; 801009bb: c7 05 6c 09 11 80 00 movl $0x80100600,0x8011096c 801009c2: 06 10 80 devsw[CONSOLE].read = consoleread; 801009c5: c7 05 68 09 11 80 70 movl $0x80100270,0x80110968 801009cc: 02 10 80 cons.locking = 1; 801009cf: c7 05 54 a5 10 80 01 movl $0x1,0x8010a554 801009d6: 00 00 00 ioapicenable(IRQ_KBD, 0); 801009d9: e8 c2 18 00 00 call 801022a0 <ioapicenable> } 801009de: 83 c4 10 add $0x10,%esp 801009e1: c9 leave 801009e2: c3 ret 801009e3: 66 90 xchg %ax,%ax 801009e5: 66 90 xchg %ax,%ax 801009e7: 66 90 xchg %ax,%ax 801009e9: 66 90 xchg %ax,%ax 801009eb: 66 90 xchg %ax,%ax 801009ed: 66 90 xchg %ax,%ax 801009ef: 90 nop 801009f0 <exec>: #include "x86.h" #include "elf.h" int exec(char *path, char **argv) { 801009f0: 55 push %ebp 801009f1: 89 e5 mov %esp,%ebp 801009f3: 57 push %edi 801009f4: 56 push %esi 801009f5: 53 push %ebx 801009f6: 81 ec 0c 01 00 00 sub $0x10c,%esp uint argc, sz, sp, ustack[3+MAXARG+1]; struct elfhdr elf; struct inode *ip; struct proghdr ph; pde_t *pgdir, *oldpgdir; struct proc *curproc = myproc(); 801009fc: e8 7f 2d 00 00 call 80103780 <myproc> 80100a01: 89 85 f4 fe ff ff mov %eax,-0x10c(%ebp) begin_op(); 80100a07: e8 44 21 00 00 call 80102b50 <begin_op> if((ip = namei(path)) == 0){ 80100a0c: 83 ec 0c sub $0xc,%esp 80100a0f: ff 75 08 pushl 0x8(%ebp) 80100a12: e8 a9 14 00 00 call 80101ec0 <namei> 80100a17: 83 c4 10 add $0x10,%esp 80100a1a: 85 c0 test %eax,%eax 80100a1c: 0f 84 9c 01 00 00 je 80100bbe <exec+0x1ce> end_op(); cprintf("exec: fail\n"); return -1; } ilock(ip); 80100a22: 83 ec 0c sub $0xc,%esp 80100a25: 89 c3 mov %eax,%ebx 80100a27: 50 push %eax 80100a28: e8 43 0c 00 00 call 80101670 <ilock> pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) 80100a2d: 8d 85 24 ff ff ff lea -0xdc(%ebp),%eax 80100a33: 6a 34 push $0x34 80100a35: 6a 00 push $0x0 80100a37: 50 push %eax 80100a38: 53 push %ebx 80100a39: e8 12 0f 00 00 call 80101950 <readi> 80100a3e: 83 c4 20 add $0x20,%esp 80100a41: 83 f8 34 cmp $0x34,%eax 80100a44: 74 22 je 80100a68 <exec+0x78> bad: if(pgdir) freevm(pgdir); if(ip){ iunlockput(ip); 80100a46: 83 ec 0c sub $0xc,%esp 80100a49: 53 push %ebx 80100a4a: e8 b1 0e 00 00 call 80101900 <iunlockput> end_op(); 80100a4f: e8 6c 21 00 00 call 80102bc0 <end_op> 80100a54: 83 c4 10 add $0x10,%esp } return -1; 80100a57: b8 ff ff ff ff mov $0xffffffff,%eax } 80100a5c: 8d 65 f4 lea -0xc(%ebp),%esp 80100a5f: 5b pop %ebx 80100a60: 5e pop %esi 80100a61: 5f pop %edi 80100a62: 5d pop %ebp 80100a63: c3 ret 80100a64: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi pgdir = 0; // Check ELF header if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf)) goto bad; if(elf.magic != ELF_MAGIC) 80100a68: 81 bd 24 ff ff ff 7f cmpl $0x464c457f,-0xdc(%ebp) 80100a6f: 45 4c 46 80100a72: 75 d2 jne 80100a46 <exec+0x56> goto bad; if((pgdir = setupkvm()) == 0) 80100a74: e8 f7 61 00 00 call 80106c70 <setupkvm> 80100a79: 85 c0 test %eax,%eax 80100a7b: 89 85 f0 fe ff ff mov %eax,-0x110(%ebp) 80100a81: 74 c3 je 80100a46 <exec+0x56> goto bad; // Load program into memory. sz = 0; for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){ 80100a83: 66 83 bd 50 ff ff ff cmpw $0x0,-0xb0(%ebp) 80100a8a: 00 80100a8b: 8b b5 40 ff ff ff mov -0xc0(%ebp),%esi 80100a91: c7 85 ec fe ff ff 00 movl $0x0,-0x114(%ebp) 80100a98: 00 00 00 80100a9b: 0f 84 c5 00 00 00 je 80100b66 <exec+0x176> 80100aa1: 31 ff xor %edi,%edi 80100aa3: eb 18 jmp 80100abd <exec+0xcd> 80100aa5: 8d 76 00 lea 0x0(%esi),%esi 80100aa8: 0f b7 85 50 ff ff ff movzwl -0xb0(%ebp),%eax 80100aaf: 83 c7 01 add $0x1,%edi 80100ab2: 83 c6 20 add $0x20,%esi 80100ab5: 39 f8 cmp %edi,%eax 80100ab7: 0f 8e a9 00 00 00 jle 80100b66 <exec+0x176> if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph)) 80100abd: 8d 85 04 ff ff ff lea -0xfc(%ebp),%eax 80100ac3: 6a 20 push $0x20 80100ac5: 56 push %esi 80100ac6: 50 push %eax 80100ac7: 53 push %ebx 80100ac8: e8 83 0e 00 00 call 80101950 <readi> 80100acd: 83 c4 10 add $0x10,%esp 80100ad0: 83 f8 20 cmp $0x20,%eax 80100ad3: 75 7b jne 80100b50 <exec+0x160> goto bad; if(ph.type != ELF_PROG_LOAD) 80100ad5: 83 bd 04 ff ff ff 01 cmpl $0x1,-0xfc(%ebp) 80100adc: 75 ca jne 80100aa8 <exec+0xb8> continue; if(ph.memsz < ph.filesz) 80100ade: 8b 85 18 ff ff ff mov -0xe8(%ebp),%eax 80100ae4: 3b 85 14 ff ff ff cmp -0xec(%ebp),%eax 80100aea: 72 64 jb 80100b50 <exec+0x160> goto bad; if(ph.vaddr + ph.memsz < ph.vaddr) 80100aec: 03 85 0c ff ff ff add -0xf4(%ebp),%eax 80100af2: 72 5c jb 80100b50 <exec+0x160> goto bad; if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0) 80100af4: 83 ec 04 sub $0x4,%esp 80100af7: 50 push %eax 80100af8: ff b5 ec fe ff ff pushl -0x114(%ebp) 80100afe: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100b04: e8 b7 5f 00 00 call 80106ac0 <allocuvm> 80100b09: 83 c4 10 add $0x10,%esp 80100b0c: 85 c0 test %eax,%eax 80100b0e: 89 85 ec fe ff ff mov %eax,-0x114(%ebp) 80100b14: 74 3a je 80100b50 <exec+0x160> goto bad; if(ph.vaddr % PGSIZE != 0) 80100b16: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax 80100b1c: a9 ff 0f 00 00 test $0xfff,%eax 80100b21: 75 2d jne 80100b50 <exec+0x160> goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) 80100b23: 83 ec 0c sub $0xc,%esp 80100b26: ff b5 14 ff ff ff pushl -0xec(%ebp) 80100b2c: ff b5 08 ff ff ff pushl -0xf8(%ebp) 80100b32: 53 push %ebx 80100b33: 50 push %eax 80100b34: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100b3a: e8 c1 5e 00 00 call 80106a00 <loaduvm> 80100b3f: 83 c4 20 add $0x20,%esp 80100b42: 85 c0 test %eax,%eax 80100b44: 0f 89 5e ff ff ff jns 80100aa8 <exec+0xb8> 80100b4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi freevm(oldpgdir); return 0; bad: if(pgdir) freevm(pgdir); 80100b50: 83 ec 0c sub $0xc,%esp 80100b53: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100b59: e8 92 60 00 00 call 80106bf0 <freevm> 80100b5e: 83 c4 10 add $0x10,%esp 80100b61: e9 e0 fe ff ff jmp 80100a46 <exec+0x56> if(ph.vaddr % PGSIZE != 0) goto bad; if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0) goto bad; } iunlockput(ip); 80100b66: 83 ec 0c sub $0xc,%esp 80100b69: 53 push %ebx 80100b6a: e8 91 0d 00 00 call 80101900 <iunlockput> end_op(); 80100b6f: e8 4c 20 00 00 call 80102bc0 <end_op> ip = 0; // Allocate two pages at the next page boundary. // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); 80100b74: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100b7a: 83 c4 0c add $0xc,%esp end_op(); ip = 0; // Allocate two pages at the next page boundary. // Make the first inaccessible. Use the second as the user stack. sz = PGROUNDUP(sz); 80100b7d: 05 ff 0f 00 00 add $0xfff,%eax 80100b82: 25 00 f0 ff ff and $0xfffff000,%eax if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0) 80100b87: 8d 90 00 20 00 00 lea 0x2000(%eax),%edx 80100b8d: 52 push %edx 80100b8e: 50 push %eax 80100b8f: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100b95: e8 26 5f 00 00 call 80106ac0 <allocuvm> 80100b9a: 83 c4 10 add $0x10,%esp 80100b9d: 85 c0 test %eax,%eax 80100b9f: 89 c6 mov %eax,%esi 80100ba1: 75 3a jne 80100bdd <exec+0x1ed> freevm(oldpgdir); return 0; bad: if(pgdir) freevm(pgdir); 80100ba3: 83 ec 0c sub $0xc,%esp 80100ba6: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100bac: e8 3f 60 00 00 call 80106bf0 <freevm> 80100bb1: 83 c4 10 add $0x10,%esp if(ip){ iunlockput(ip); end_op(); } return -1; 80100bb4: b8 ff ff ff ff mov $0xffffffff,%eax 80100bb9: e9 9e fe ff ff jmp 80100a5c <exec+0x6c> struct proc *curproc = myproc(); begin_op(); if((ip = namei(path)) == 0){ end_op(); 80100bbe: e8 fd 1f 00 00 call 80102bc0 <end_op> cprintf("exec: fail\n"); 80100bc3: 83 ec 0c sub $0xc,%esp 80100bc6: 68 a1 6f 10 80 push $0x80106fa1 80100bcb: e8 90 fa ff ff call 80100660 <cprintf> return -1; 80100bd0: 83 c4 10 add $0x10,%esp 80100bd3: b8 ff ff ff ff mov $0xffffffff,%eax 80100bd8: e9 7f fe ff ff jmp 80100a5c <exec+0x6c> // 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; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100bdd: 8d 80 00 e0 ff ff lea -0x2000(%eax),%eax 80100be3: 83 ec 08 sub $0x8,%esp sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100be6: 31 ff xor %edi,%edi 80100be8: 89 f3 mov %esi,%ebx // 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; clearpteu(pgdir, (char*)(sz - 2*PGSIZE)); 80100bea: 50 push %eax 80100beb: ff b5 f0 fe ff ff pushl -0x110(%ebp) 80100bf1: e8 1a 61 00 00 call 80106d10 <clearpteu> sp = sz; // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { 80100bf6: 8b 45 0c mov 0xc(%ebp),%eax 80100bf9: 83 c4 10 add $0x10,%esp 80100bfc: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx 80100c02: 8b 00 mov (%eax),%eax 80100c04: 85 c0 test %eax,%eax 80100c06: 74 79 je 80100c81 <exec+0x291> 80100c08: 89 b5 ec fe ff ff mov %esi,-0x114(%ebp) 80100c0e: 8b b5 f0 fe ff ff mov -0x110(%ebp),%esi 80100c14: eb 13 jmp 80100c29 <exec+0x239> 80100c16: 8d 76 00 lea 0x0(%esi),%esi 80100c19: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if(argc >= MAXARG) 80100c20: 83 ff 20 cmp $0x20,%edi 80100c23: 0f 84 7a ff ff ff je 80100ba3 <exec+0x1b3> goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100c29: 83 ec 0c sub $0xc,%esp 80100c2c: 50 push %eax 80100c2d: e8 5e 3a 00 00 call 80104690 <strlen> 80100c32: f7 d0 not %eax 80100c34: 01 c3 add %eax,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100c36: 8b 45 0c mov 0xc(%ebp),%eax 80100c39: 5a pop %edx // Push argument strings, prepare rest of stack in ustack. for(argc = 0; argv[argc]; argc++) { if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; 80100c3a: 83 e3 fc and $0xfffffffc,%ebx if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) 80100c3d: ff 34 b8 pushl (%eax,%edi,4) 80100c40: e8 4b 3a 00 00 call 80104690 <strlen> 80100c45: 83 c0 01 add $0x1,%eax 80100c48: 50 push %eax 80100c49: 8b 45 0c mov 0xc(%ebp),%eax 80100c4c: ff 34 b8 pushl (%eax,%edi,4) 80100c4f: 53 push %ebx 80100c50: 56 push %esi 80100c51: e8 2a 62 00 00 call 80106e80 <copyout> 80100c56: 83 c4 20 add $0x20,%esp 80100c59: 85 c0 test %eax,%eax 80100c5b: 0f 88 42 ff ff ff js 80100ba3 <exec+0x1b3> 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++) { 80100c61: 8b 45 0c mov 0xc(%ebp),%eax if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; 80100c64: 89 9c bd 64 ff ff ff mov %ebx,-0x9c(%ebp,%edi,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++) { 80100c6b: 83 c7 01 add $0x1,%edi if(argc >= MAXARG) goto bad; sp = (sp - (strlen(argv[argc]) + 1)) & ~3; if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0) goto bad; ustack[3+argc] = sp; 80100c6e: 8d 95 58 ff ff ff lea -0xa8(%ebp),%edx 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++) { 80100c74: 8b 04 b8 mov (%eax,%edi,4),%eax 80100c77: 85 c0 test %eax,%eax 80100c79: 75 a5 jne 80100c20 <exec+0x230> 80100c7b: 8b b5 ec fe ff ff mov -0x114(%ebp),%esi } ustack[3+argc] = 0; ustack[0] = 0xffffffff; // fake return PC ustack[1] = argc; ustack[2] = sp - (argc+1)*4; // argv pointer 80100c81: 8d 04 bd 04 00 00 00 lea 0x4(,%edi,4),%eax 80100c88: 89 d9 mov %ebx,%ecx 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; 80100c8a: c7 84 bd 64 ff ff ff movl $0x0,-0x9c(%ebp,%edi,4) 80100c91: 00 00 00 00 ustack[0] = 0xffffffff; // fake return PC 80100c95: c7 85 58 ff ff ff ff movl $0xffffffff,-0xa8(%ebp) 80100c9c: ff ff ff ustack[1] = argc; 80100c9f: 89 bd 5c ff ff ff mov %edi,-0xa4(%ebp) ustack[2] = sp - (argc+1)*4; // argv pointer 80100ca5: 29 c1 sub %eax,%ecx sp -= (3+argc+1) * 4; 80100ca7: 83 c0 0c add $0xc,%eax 80100caa: 29 c3 sub %eax,%ebx if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100cac: 50 push %eax 80100cad: 52 push %edx 80100cae: 53 push %ebx 80100caf: ff b5 f0 fe ff ff pushl -0x110(%ebp) } ustack[3+argc] = 0; ustack[0] = 0xffffffff; // fake return PC ustack[1] = argc; ustack[2] = sp - (argc+1)*4; // argv pointer 80100cb5: 89 8d 60 ff ff ff mov %ecx,-0xa0(%ebp) sp -= (3+argc+1) * 4; if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0) 80100cbb: e8 c0 61 00 00 call 80106e80 <copyout> 80100cc0: 83 c4 10 add $0x10,%esp 80100cc3: 85 c0 test %eax,%eax 80100cc5: 0f 88 d8 fe ff ff js 80100ba3 <exec+0x1b3> goto bad; // Save program name for debugging. for(last=s=path; *s; s++) 80100ccb: 8b 45 08 mov 0x8(%ebp),%eax 80100cce: 0f b6 10 movzbl (%eax),%edx 80100cd1: 84 d2 test %dl,%dl 80100cd3: 74 19 je 80100cee <exec+0x2fe> 80100cd5: 8b 4d 08 mov 0x8(%ebp),%ecx 80100cd8: 83 c0 01 add $0x1,%eax if(*s == '/') last = s+1; 80100cdb: 80 fa 2f cmp $0x2f,%dl 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++) 80100cde: 0f b6 10 movzbl (%eax),%edx if(*s == '/') last = s+1; 80100ce1: 0f 44 c8 cmove %eax,%ecx 80100ce4: 83 c0 01 add $0x1,%eax 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++) 80100ce7: 84 d2 test %dl,%dl 80100ce9: 75 f0 jne 80100cdb <exec+0x2eb> 80100ceb: 89 4d 08 mov %ecx,0x8(%ebp) if(*s == '/') last = s+1; safestrcpy(curproc->name, last, sizeof(curproc->name)); 80100cee: 8b bd f4 fe ff ff mov -0x10c(%ebp),%edi 80100cf4: 50 push %eax 80100cf5: 6a 10 push $0x10 80100cf7: ff 75 08 pushl 0x8(%ebp) 80100cfa: 89 f8 mov %edi,%eax 80100cfc: 83 c0 6c add $0x6c,%eax 80100cff: 50 push %eax 80100d00: e8 4b 39 00 00 call 80104650 <safestrcpy> // Commit to the user image. oldpgdir = curproc->pgdir; curproc->pgdir = pgdir; 80100d05: 8b 8d f0 fe ff ff mov -0x110(%ebp),%ecx if(*s == '/') last = s+1; safestrcpy(curproc->name, last, sizeof(curproc->name)); // Commit to the user image. oldpgdir = curproc->pgdir; 80100d0b: 89 f8 mov %edi,%eax 80100d0d: 8b 7f 04 mov 0x4(%edi),%edi curproc->pgdir = pgdir; curproc->sz = sz; 80100d10: 89 30 mov %esi,(%eax) last = s+1; safestrcpy(curproc->name, last, sizeof(curproc->name)); // Commit to the user image. oldpgdir = curproc->pgdir; curproc->pgdir = pgdir; 80100d12: 89 48 04 mov %ecx,0x4(%eax) curproc->sz = sz; curproc->tf->eip = elf.entry; // main 80100d15: 89 c1 mov %eax,%ecx 80100d17: 8b 95 3c ff ff ff mov -0xc4(%ebp),%edx 80100d1d: 8b 40 18 mov 0x18(%eax),%eax 80100d20: 89 50 38 mov %edx,0x38(%eax) curproc->tf->esp = sp; 80100d23: 8b 41 18 mov 0x18(%ecx),%eax 80100d26: 89 58 44 mov %ebx,0x44(%eax) switchuvm(curproc); 80100d29: 89 0c 24 mov %ecx,(%esp) 80100d2c: e8 3f 5b 00 00 call 80106870 <switchuvm> freevm(oldpgdir); 80100d31: 89 3c 24 mov %edi,(%esp) 80100d34: e8 b7 5e 00 00 call 80106bf0 <freevm> return 0; 80100d39: 83 c4 10 add $0x10,%esp 80100d3c: 31 c0 xor %eax,%eax 80100d3e: e9 19 fd ff ff jmp 80100a5c <exec+0x6c> 80100d43: 66 90 xchg %ax,%ax 80100d45: 66 90 xchg %ax,%ax 80100d47: 66 90 xchg %ax,%ax 80100d49: 66 90 xchg %ax,%ax 80100d4b: 66 90 xchg %ax,%ax 80100d4d: 66 90 xchg %ax,%ax 80100d4f: 90 nop 80100d50 <fileinit>: struct file file[NFILE]; } ftable; void fileinit(void) { 80100d50: 55 push %ebp 80100d51: 89 e5 mov %esp,%ebp 80100d53: 83 ec 10 sub $0x10,%esp initlock(&ftable.lock, "ftable"); 80100d56: 68 ad 6f 10 80 push $0x80106fad 80100d5b: 68 c0 ff 10 80 push $0x8010ffc0 80100d60: e8 8b 34 00 00 call 801041f0 <initlock> } 80100d65: 83 c4 10 add $0x10,%esp 80100d68: c9 leave 80100d69: c3 ret 80100d6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100d70 <filealloc>: // Allocate a file structure. struct file* filealloc(void) { 80100d70: 55 push %ebp 80100d71: 89 e5 mov %esp,%ebp 80100d73: 53 push %ebx struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100d74: bb f4 ff 10 80 mov $0x8010fff4,%ebx } // Allocate a file structure. struct file* filealloc(void) { 80100d79: 83 ec 10 sub $0x10,%esp struct file *f; acquire(&ftable.lock); 80100d7c: 68 c0 ff 10 80 push $0x8010ffc0 80100d81: e8 ca 35 00 00 call 80104350 <acquire> 80100d86: 83 c4 10 add $0x10,%esp 80100d89: eb 10 jmp 80100d9b <filealloc+0x2b> 80100d8b: 90 nop 80100d8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(f = ftable.file; f < ftable.file + NFILE; f++){ 80100d90: 83 c3 18 add $0x18,%ebx 80100d93: 81 fb 54 09 11 80 cmp $0x80110954,%ebx 80100d99: 74 25 je 80100dc0 <filealloc+0x50> if(f->ref == 0){ 80100d9b: 8b 43 04 mov 0x4(%ebx),%eax 80100d9e: 85 c0 test %eax,%eax 80100da0: 75 ee jne 80100d90 <filealloc+0x20> f->ref = 1; release(&ftable.lock); 80100da2: 83 ec 0c sub $0xc,%esp struct file *f; acquire(&ftable.lock); for(f = ftable.file; f < ftable.file + NFILE; f++){ if(f->ref == 0){ f->ref = 1; 80100da5: c7 43 04 01 00 00 00 movl $0x1,0x4(%ebx) release(&ftable.lock); 80100dac: 68 c0 ff 10 80 push $0x8010ffc0 80100db1: e8 4a 36 00 00 call 80104400 <release> return f; 80100db6: 89 d8 mov %ebx,%eax 80100db8: 83 c4 10 add $0x10,%esp } } release(&ftable.lock); return 0; } 80100dbb: 8b 5d fc mov -0x4(%ebp),%ebx 80100dbe: c9 leave 80100dbf: c3 ret f->ref = 1; release(&ftable.lock); return f; } } release(&ftable.lock); 80100dc0: 83 ec 0c sub $0xc,%esp 80100dc3: 68 c0 ff 10 80 push $0x8010ffc0 80100dc8: e8 33 36 00 00 call 80104400 <release> return 0; 80100dcd: 83 c4 10 add $0x10,%esp 80100dd0: 31 c0 xor %eax,%eax } 80100dd2: 8b 5d fc mov -0x4(%ebp),%ebx 80100dd5: c9 leave 80100dd6: c3 ret 80100dd7: 89 f6 mov %esi,%esi 80100dd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100de0 <filedup>: // Increment ref count for file f. struct file* filedup(struct file *f) { 80100de0: 55 push %ebp 80100de1: 89 e5 mov %esp,%ebp 80100de3: 53 push %ebx 80100de4: 83 ec 10 sub $0x10,%esp 80100de7: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ftable.lock); 80100dea: 68 c0 ff 10 80 push $0x8010ffc0 80100def: e8 5c 35 00 00 call 80104350 <acquire> if(f->ref < 1) 80100df4: 8b 43 04 mov 0x4(%ebx),%eax 80100df7: 83 c4 10 add $0x10,%esp 80100dfa: 85 c0 test %eax,%eax 80100dfc: 7e 1a jle 80100e18 <filedup+0x38> panic("filedup"); f->ref++; 80100dfe: 83 c0 01 add $0x1,%eax release(&ftable.lock); 80100e01: 83 ec 0c sub $0xc,%esp filedup(struct file *f) { acquire(&ftable.lock); if(f->ref < 1) panic("filedup"); f->ref++; 80100e04: 89 43 04 mov %eax,0x4(%ebx) release(&ftable.lock); 80100e07: 68 c0 ff 10 80 push $0x8010ffc0 80100e0c: e8 ef 35 00 00 call 80104400 <release> return f; } 80100e11: 89 d8 mov %ebx,%eax 80100e13: 8b 5d fc mov -0x4(%ebp),%ebx 80100e16: c9 leave 80100e17: c3 ret struct file* filedup(struct file *f) { acquire(&ftable.lock); if(f->ref < 1) panic("filedup"); 80100e18: 83 ec 0c sub $0xc,%esp 80100e1b: 68 b4 6f 10 80 push $0x80106fb4 80100e20: e8 4b f5 ff ff call 80100370 <panic> 80100e25: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100e29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80100e30 <fileclose>: } // Close file f. (Decrement ref count, close when reaches 0.) void fileclose(struct file *f) { 80100e30: 55 push %ebp 80100e31: 89 e5 mov %esp,%ebp 80100e33: 57 push %edi 80100e34: 56 push %esi 80100e35: 53 push %ebx 80100e36: 83 ec 28 sub $0x28,%esp 80100e39: 8b 7d 08 mov 0x8(%ebp),%edi struct file ff; acquire(&ftable.lock); 80100e3c: 68 c0 ff 10 80 push $0x8010ffc0 80100e41: e8 0a 35 00 00 call 80104350 <acquire> if(f->ref < 1) 80100e46: 8b 47 04 mov 0x4(%edi),%eax 80100e49: 83 c4 10 add $0x10,%esp 80100e4c: 85 c0 test %eax,%eax 80100e4e: 0f 8e 9b 00 00 00 jle 80100eef <fileclose+0xbf> panic("fileclose"); if(--f->ref > 0){ 80100e54: 83 e8 01 sub $0x1,%eax 80100e57: 85 c0 test %eax,%eax 80100e59: 89 47 04 mov %eax,0x4(%edi) 80100e5c: 74 1a je 80100e78 <fileclose+0x48> release(&ftable.lock); 80100e5e: c7 45 08 c0 ff 10 80 movl $0x8010ffc0,0x8(%ebp) else if(ff.type == FD_INODE){ begin_op(); iput(ff.ip); end_op(); } } 80100e65: 8d 65 f4 lea -0xc(%ebp),%esp 80100e68: 5b pop %ebx 80100e69: 5e pop %esi 80100e6a: 5f pop %edi 80100e6b: 5d pop %ebp acquire(&ftable.lock); if(f->ref < 1) panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); 80100e6c: e9 8f 35 00 00 jmp 80104400 <release> 80100e71: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return; } ff = *f; 80100e78: 0f b6 47 09 movzbl 0x9(%edi),%eax 80100e7c: 8b 1f mov (%edi),%ebx f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100e7e: 83 ec 0c sub $0xc,%esp panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); return; } ff = *f; 80100e81: 8b 77 0c mov 0xc(%edi),%esi f->ref = 0; f->type = FD_NONE; 80100e84: c7 07 00 00 00 00 movl $0x0,(%edi) panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); return; } ff = *f; 80100e8a: 88 45 e7 mov %al,-0x19(%ebp) 80100e8d: 8b 47 10 mov 0x10(%edi),%eax f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100e90: 68 c0 ff 10 80 push $0x8010ffc0 panic("fileclose"); if(--f->ref > 0){ release(&ftable.lock); return; } ff = *f; 80100e95: 89 45 e0 mov %eax,-0x20(%ebp) f->ref = 0; f->type = FD_NONE; release(&ftable.lock); 80100e98: e8 63 35 00 00 call 80104400 <release> if(ff.type == FD_PIPE) 80100e9d: 83 c4 10 add $0x10,%esp 80100ea0: 83 fb 01 cmp $0x1,%ebx 80100ea3: 74 13 je 80100eb8 <fileclose+0x88> pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ 80100ea5: 83 fb 02 cmp $0x2,%ebx 80100ea8: 74 26 je 80100ed0 <fileclose+0xa0> begin_op(); iput(ff.ip); end_op(); } } 80100eaa: 8d 65 f4 lea -0xc(%ebp),%esp 80100ead: 5b pop %ebx 80100eae: 5e pop %esi 80100eaf: 5f pop %edi 80100eb0: 5d pop %ebp 80100eb1: c3 ret 80100eb2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi f->ref = 0; f->type = FD_NONE; release(&ftable.lock); if(ff.type == FD_PIPE) pipeclose(ff.pipe, ff.writable); 80100eb8: 0f be 5d e7 movsbl -0x19(%ebp),%ebx 80100ebc: 83 ec 08 sub $0x8,%esp 80100ebf: 53 push %ebx 80100ec0: 56 push %esi 80100ec1: e8 2a 24 00 00 call 801032f0 <pipeclose> 80100ec6: 83 c4 10 add $0x10,%esp 80100ec9: eb df jmp 80100eaa <fileclose+0x7a> 80100ecb: 90 nop 80100ecc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi else if(ff.type == FD_INODE){ begin_op(); 80100ed0: e8 7b 1c 00 00 call 80102b50 <begin_op> iput(ff.ip); 80100ed5: 83 ec 0c sub $0xc,%esp 80100ed8: ff 75 e0 pushl -0x20(%ebp) 80100edb: e8 c0 08 00 00 call 801017a0 <iput> end_op(); 80100ee0: 83 c4 10 add $0x10,%esp } } 80100ee3: 8d 65 f4 lea -0xc(%ebp),%esp 80100ee6: 5b pop %ebx 80100ee7: 5e pop %esi 80100ee8: 5f pop %edi 80100ee9: 5d pop %ebp if(ff.type == FD_PIPE) pipeclose(ff.pipe, ff.writable); else if(ff.type == FD_INODE){ begin_op(); iput(ff.ip); end_op(); 80100eea: e9 d1 1c 00 00 jmp 80102bc0 <end_op> { struct file ff; acquire(&ftable.lock); if(f->ref < 1) panic("fileclose"); 80100eef: 83 ec 0c sub $0xc,%esp 80100ef2: 68 bc 6f 10 80 push $0x80106fbc 80100ef7: e8 74 f4 ff ff call 80100370 <panic> 80100efc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100f00 <filestat>: } // Get metadata about file f. int filestat(struct file *f, struct stat *st) { 80100f00: 55 push %ebp 80100f01: 89 e5 mov %esp,%ebp 80100f03: 53 push %ebx 80100f04: 83 ec 04 sub $0x4,%esp 80100f07: 8b 5d 08 mov 0x8(%ebp),%ebx if(f->type == FD_INODE){ 80100f0a: 83 3b 02 cmpl $0x2,(%ebx) 80100f0d: 75 31 jne 80100f40 <filestat+0x40> ilock(f->ip); 80100f0f: 83 ec 0c sub $0xc,%esp 80100f12: ff 73 10 pushl 0x10(%ebx) 80100f15: e8 56 07 00 00 call 80101670 <ilock> stati(f->ip, st); 80100f1a: 58 pop %eax 80100f1b: 5a pop %edx 80100f1c: ff 75 0c pushl 0xc(%ebp) 80100f1f: ff 73 10 pushl 0x10(%ebx) 80100f22: e8 f9 09 00 00 call 80101920 <stati> iunlock(f->ip); 80100f27: 59 pop %ecx 80100f28: ff 73 10 pushl 0x10(%ebx) 80100f2b: e8 20 08 00 00 call 80101750 <iunlock> return 0; 80100f30: 83 c4 10 add $0x10,%esp 80100f33: 31 c0 xor %eax,%eax } return -1; } 80100f35: 8b 5d fc mov -0x4(%ebp),%ebx 80100f38: c9 leave 80100f39: c3 ret 80100f3a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ilock(f->ip); stati(f->ip, st); iunlock(f->ip); return 0; } return -1; 80100f40: b8 ff ff ff ff mov $0xffffffff,%eax } 80100f45: 8b 5d fc mov -0x4(%ebp),%ebx 80100f48: c9 leave 80100f49: c3 ret 80100f4a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80100f50 <fileread>: // Read from file f. int fileread(struct file *f, char *addr, int n) { 80100f50: 55 push %ebp 80100f51: 89 e5 mov %esp,%ebp 80100f53: 57 push %edi 80100f54: 56 push %esi 80100f55: 53 push %ebx 80100f56: 83 ec 0c sub $0xc,%esp 80100f59: 8b 5d 08 mov 0x8(%ebp),%ebx 80100f5c: 8b 75 0c mov 0xc(%ebp),%esi 80100f5f: 8b 7d 10 mov 0x10(%ebp),%edi int r; if(f->readable == 0) 80100f62: 80 7b 08 00 cmpb $0x0,0x8(%ebx) 80100f66: 74 60 je 80100fc8 <fileread+0x78> return -1; if(f->type == FD_PIPE) 80100f68: 8b 03 mov (%ebx),%eax 80100f6a: 83 f8 01 cmp $0x1,%eax 80100f6d: 74 41 je 80100fb0 <fileread+0x60> return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ 80100f6f: 83 f8 02 cmp $0x2,%eax 80100f72: 75 5b jne 80100fcf <fileread+0x7f> ilock(f->ip); 80100f74: 83 ec 0c sub $0xc,%esp 80100f77: ff 73 10 pushl 0x10(%ebx) 80100f7a: e8 f1 06 00 00 call 80101670 <ilock> if((r = readi(f->ip, addr, f->off, n)) > 0) 80100f7f: 57 push %edi 80100f80: ff 73 14 pushl 0x14(%ebx) 80100f83: 56 push %esi 80100f84: ff 73 10 pushl 0x10(%ebx) 80100f87: e8 c4 09 00 00 call 80101950 <readi> 80100f8c: 83 c4 20 add $0x20,%esp 80100f8f: 85 c0 test %eax,%eax 80100f91: 89 c6 mov %eax,%esi 80100f93: 7e 03 jle 80100f98 <fileread+0x48> f->off += r; 80100f95: 01 43 14 add %eax,0x14(%ebx) iunlock(f->ip); 80100f98: 83 ec 0c sub $0xc,%esp 80100f9b: ff 73 10 pushl 0x10(%ebx) 80100f9e: e8 ad 07 00 00 call 80101750 <iunlock> return r; 80100fa3: 83 c4 10 add $0x10,%esp return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); if(f->type == FD_INODE){ ilock(f->ip); if((r = readi(f->ip, addr, f->off, n)) > 0) 80100fa6: 89 f0 mov %esi,%eax f->off += r; iunlock(f->ip); return r; } panic("fileread"); } 80100fa8: 8d 65 f4 lea -0xc(%ebp),%esp 80100fab: 5b pop %ebx 80100fac: 5e pop %esi 80100fad: 5f pop %edi 80100fae: 5d pop %ebp 80100faf: c3 ret int r; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); 80100fb0: 8b 43 0c mov 0xc(%ebx),%eax 80100fb3: 89 45 08 mov %eax,0x8(%ebp) f->off += r; iunlock(f->ip); return r; } panic("fileread"); } 80100fb6: 8d 65 f4 lea -0xc(%ebp),%esp 80100fb9: 5b pop %ebx 80100fba: 5e pop %esi 80100fbb: 5f pop %edi 80100fbc: 5d pop %ebp int r; if(f->readable == 0) return -1; if(f->type == FD_PIPE) return piperead(f->pipe, addr, n); 80100fbd: e9 ce 24 00 00 jmp 80103490 <piperead> 80100fc2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi fileread(struct file *f, char *addr, int n) { int r; if(f->readable == 0) return -1; 80100fc8: b8 ff ff ff ff mov $0xffffffff,%eax 80100fcd: eb d9 jmp 80100fa8 <fileread+0x58> if((r = readi(f->ip, addr, f->off, n)) > 0) f->off += r; iunlock(f->ip); return r; } panic("fileread"); 80100fcf: 83 ec 0c sub $0xc,%esp 80100fd2: 68 c6 6f 10 80 push $0x80106fc6 80100fd7: e8 94 f3 ff ff call 80100370 <panic> 80100fdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80100fe0 <filewrite>: //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80100fe0: 55 push %ebp 80100fe1: 89 e5 mov %esp,%ebp 80100fe3: 57 push %edi 80100fe4: 56 push %esi 80100fe5: 53 push %ebx 80100fe6: 83 ec 1c sub $0x1c,%esp 80100fe9: 8b 75 08 mov 0x8(%ebp),%esi 80100fec: 8b 45 0c mov 0xc(%ebp),%eax int r; if(f->writable == 0) 80100fef: 80 7e 09 00 cmpb $0x0,0x9(%esi) //PAGEBREAK! // Write to file f. int filewrite(struct file *f, char *addr, int n) { 80100ff3: 89 45 dc mov %eax,-0x24(%ebp) 80100ff6: 8b 45 10 mov 0x10(%ebp),%eax 80100ff9: 89 45 e4 mov %eax,-0x1c(%ebp) int r; if(f->writable == 0) 80100ffc: 0f 84 aa 00 00 00 je 801010ac <filewrite+0xcc> return -1; if(f->type == FD_PIPE) 80101002: 8b 06 mov (%esi),%eax 80101004: 83 f8 01 cmp $0x1,%eax 80101007: 0f 84 c2 00 00 00 je 801010cf <filewrite+0xef> return pipewrite(f->pipe, addr, n); if(f->type == FD_INODE){ 8010100d: 83 f8 02 cmp $0x2,%eax 80101010: 0f 85 d8 00 00 00 jne 801010ee <filewrite+0x10e> // 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 = ((MAXOPBLOCKS-1-1-2) / 2) * 512; int i = 0; while(i < n){ 80101016: 8b 45 e4 mov -0x1c(%ebp),%eax 80101019: 31 ff xor %edi,%edi 8010101b: 85 c0 test %eax,%eax 8010101d: 7f 34 jg 80101053 <filewrite+0x73> 8010101f: e9 9c 00 00 00 jmp 801010c0 <filewrite+0xe0> 80101024: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi n1 = max; begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) f->off += r; 80101028: 01 46 14 add %eax,0x14(%esi) iunlock(f->ip); 8010102b: 83 ec 0c sub $0xc,%esp 8010102e: ff 76 10 pushl 0x10(%esi) n1 = max; begin_op(); ilock(f->ip); if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) f->off += r; 80101031: 89 45 e0 mov %eax,-0x20(%ebp) iunlock(f->ip); 80101034: e8 17 07 00 00 call 80101750 <iunlock> end_op(); 80101039: e8 82 1b 00 00 call 80102bc0 <end_op> 8010103e: 8b 45 e0 mov -0x20(%ebp),%eax 80101041: 83 c4 10 add $0x10,%esp if(r < 0) break; if(r != n1) 80101044: 39 d8 cmp %ebx,%eax 80101046: 0f 85 95 00 00 00 jne 801010e1 <filewrite+0x101> panic("short filewrite"); i += r; 8010104c: 01 c7 add %eax,%edi // 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 = ((MAXOPBLOCKS-1-1-2) / 2) * 512; int i = 0; while(i < n){ 8010104e: 39 7d e4 cmp %edi,-0x1c(%ebp) 80101051: 7e 6d jle 801010c0 <filewrite+0xe0> int n1 = n - i; 80101053: 8b 5d e4 mov -0x1c(%ebp),%ebx 80101056: b8 00 06 00 00 mov $0x600,%eax 8010105b: 29 fb sub %edi,%ebx 8010105d: 81 fb 00 06 00 00 cmp $0x600,%ebx 80101063: 0f 4f d8 cmovg %eax,%ebx if(n1 > max) n1 = max; begin_op(); 80101066: e8 e5 1a 00 00 call 80102b50 <begin_op> ilock(f->ip); 8010106b: 83 ec 0c sub $0xc,%esp 8010106e: ff 76 10 pushl 0x10(%esi) 80101071: e8 fa 05 00 00 call 80101670 <ilock> if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) 80101076: 8b 45 dc mov -0x24(%ebp),%eax 80101079: 53 push %ebx 8010107a: ff 76 14 pushl 0x14(%esi) 8010107d: 01 f8 add %edi,%eax 8010107f: 50 push %eax 80101080: ff 76 10 pushl 0x10(%esi) 80101083: e8 c8 09 00 00 call 80101a50 <writei> 80101088: 83 c4 20 add $0x20,%esp 8010108b: 85 c0 test %eax,%eax 8010108d: 7f 99 jg 80101028 <filewrite+0x48> f->off += r; iunlock(f->ip); 8010108f: 83 ec 0c sub $0xc,%esp 80101092: ff 76 10 pushl 0x10(%esi) 80101095: 89 45 e0 mov %eax,-0x20(%ebp) 80101098: e8 b3 06 00 00 call 80101750 <iunlock> end_op(); 8010109d: e8 1e 1b 00 00 call 80102bc0 <end_op> if(r < 0) 801010a2: 8b 45 e0 mov -0x20(%ebp),%eax 801010a5: 83 c4 10 add $0x10,%esp 801010a8: 85 c0 test %eax,%eax 801010aa: 74 98 je 80101044 <filewrite+0x64> i += r; } return i == n ? n : -1; } panic("filewrite"); } 801010ac: 8d 65 f4 lea -0xc(%ebp),%esp break; if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 801010af: b8 ff ff ff ff mov $0xffffffff,%eax } panic("filewrite"); } 801010b4: 5b pop %ebx 801010b5: 5e pop %esi 801010b6: 5f pop %edi 801010b7: 5d pop %ebp 801010b8: c3 ret 801010b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; if(r != n1) panic("short filewrite"); i += r; } return i == n ? n : -1; 801010c0: 3b 7d e4 cmp -0x1c(%ebp),%edi 801010c3: 75 e7 jne 801010ac <filewrite+0xcc> } panic("filewrite"); } 801010c5: 8d 65 f4 lea -0xc(%ebp),%esp 801010c8: 89 f8 mov %edi,%eax 801010ca: 5b pop %ebx 801010cb: 5e pop %esi 801010cc: 5f pop %edi 801010cd: 5d pop %ebp 801010ce: c3 ret int r; if(f->writable == 0) return -1; if(f->type == FD_PIPE) return pipewrite(f->pipe, addr, n); 801010cf: 8b 46 0c mov 0xc(%esi),%eax 801010d2: 89 45 08 mov %eax,0x8(%ebp) i += r; } return i == n ? n : -1; } panic("filewrite"); } 801010d5: 8d 65 f4 lea -0xc(%ebp),%esp 801010d8: 5b pop %ebx 801010d9: 5e pop %esi 801010da: 5f pop %edi 801010db: 5d pop %ebp int r; if(f->writable == 0) return -1; if(f->type == FD_PIPE) return pipewrite(f->pipe, addr, n); 801010dc: e9 af 22 00 00 jmp 80103390 <pipewrite> end_op(); if(r < 0) break; if(r != n1) panic("short filewrite"); 801010e1: 83 ec 0c sub $0xc,%esp 801010e4: 68 cf 6f 10 80 push $0x80106fcf 801010e9: e8 82 f2 ff ff call 80100370 <panic> i += r; } return i == n ? n : -1; } panic("filewrite"); 801010ee: 83 ec 0c sub $0xc,%esp 801010f1: 68 d5 6f 10 80 push $0x80106fd5 801010f6: e8 75 f2 ff ff call 80100370 <panic> 801010fb: 66 90 xchg %ax,%ax 801010fd: 66 90 xchg %ax,%ax 801010ff: 90 nop 80101100 <balloc>: // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 80101100: 55 push %ebp 80101101: 89 e5 mov %esp,%ebp 80101103: 57 push %edi 80101104: 56 push %esi 80101105: 53 push %ebx 80101106: 83 ec 1c sub $0x1c,%esp int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 80101109: 8b 0d c0 09 11 80 mov 0x801109c0,%ecx // Blocks. // Allocate a zeroed disk block. static uint balloc(uint dev) { 8010110f: 89 45 d8 mov %eax,-0x28(%ebp) int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 80101112: 85 c9 test %ecx,%ecx 80101114: 0f 84 85 00 00 00 je 8010119f <balloc+0x9f> 8010111a: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp) bp = bread(dev, BBLOCK(b, sb)); 80101121: 8b 75 dc mov -0x24(%ebp),%esi 80101124: 83 ec 08 sub $0x8,%esp 80101127: 89 f0 mov %esi,%eax 80101129: c1 f8 0c sar $0xc,%eax 8010112c: 03 05 d8 09 11 80 add 0x801109d8,%eax 80101132: 50 push %eax 80101133: ff 75 d8 pushl -0x28(%ebp) 80101136: e8 95 ef ff ff call 801000d0 <bread> 8010113b: 89 45 e4 mov %eax,-0x1c(%ebp) 8010113e: a1 c0 09 11 80 mov 0x801109c0,%eax 80101143: 83 c4 10 add $0x10,%esp 80101146: 89 45 e0 mov %eax,-0x20(%ebp) for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 80101149: 31 c0 xor %eax,%eax 8010114b: eb 2d jmp 8010117a <balloc+0x7a> 8010114d: 8d 76 00 lea 0x0(%esi),%esi m = 1 << (bi % 8); 80101150: 89 c1 mov %eax,%ecx 80101152: ba 01 00 00 00 mov $0x1,%edx if((bp->data[bi/8] & m) == 0){ // Is block free? 80101157: 8b 5d e4 mov -0x1c(%ebp),%ebx bp = 0; for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); 8010115a: 83 e1 07 and $0x7,%ecx 8010115d: d3 e2 shl %cl,%edx if((bp->data[bi/8] & m) == 0){ // Is block free? 8010115f: 89 c1 mov %eax,%ecx 80101161: c1 f9 03 sar $0x3,%ecx 80101164: 0f b6 7c 0b 5c movzbl 0x5c(%ebx,%ecx,1),%edi 80101169: 85 d7 test %edx,%edi 8010116b: 74 43 je 801011b0 <balloc+0xb0> struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ 8010116d: 83 c0 01 add $0x1,%eax 80101170: 83 c6 01 add $0x1,%esi 80101173: 3d 00 10 00 00 cmp $0x1000,%eax 80101178: 74 05 je 8010117f <balloc+0x7f> 8010117a: 3b 75 e0 cmp -0x20(%ebp),%esi 8010117d: 72 d1 jb 80101150 <balloc+0x50> brelse(bp); bzero(dev, b + bi); return b + bi; } } brelse(bp); 8010117f: 83 ec 0c sub $0xc,%esp 80101182: ff 75 e4 pushl -0x1c(%ebp) 80101185: e8 56 f0 ff ff call 801001e0 <brelse> { int b, bi, m; struct buf *bp; bp = 0; for(b = 0; b < sb.size; b += BPB){ 8010118a: 81 45 dc 00 10 00 00 addl $0x1000,-0x24(%ebp) 80101191: 83 c4 10 add $0x10,%esp 80101194: 8b 45 dc mov -0x24(%ebp),%eax 80101197: 39 05 c0 09 11 80 cmp %eax,0x801109c0 8010119d: 77 82 ja 80101121 <balloc+0x21> return b + bi; } } brelse(bp); } panic("balloc: out of blocks"); 8010119f: 83 ec 0c sub $0xc,%esp 801011a2: 68 df 6f 10 80 push $0x80106fdf 801011a7: e8 c4 f1 ff ff call 80100370 <panic> 801011ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0){ // Is block free? bp->data[bi/8] |= m; // Mark block in use. 801011b0: 09 fa or %edi,%edx 801011b2: 8b 7d e4 mov -0x1c(%ebp),%edi log_write(bp); 801011b5: 83 ec 0c sub $0xc,%esp for(b = 0; b < sb.size; b += BPB){ bp = bread(dev, BBLOCK(b, sb)); for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0){ // Is block free? bp->data[bi/8] |= m; // Mark block in use. 801011b8: 88 54 0f 5c mov %dl,0x5c(%edi,%ecx,1) log_write(bp); 801011bc: 57 push %edi 801011bd: e8 6e 1b 00 00 call 80102d30 <log_write> brelse(bp); 801011c2: 89 3c 24 mov %edi,(%esp) 801011c5: e8 16 f0 ff ff call 801001e0 <brelse> static void bzero(int dev, int bno) { struct buf *bp; bp = bread(dev, bno); 801011ca: 58 pop %eax 801011cb: 5a pop %edx 801011cc: 56 push %esi 801011cd: ff 75 d8 pushl -0x28(%ebp) 801011d0: e8 fb ee ff ff call 801000d0 <bread> 801011d5: 89 c3 mov %eax,%ebx memset(bp->data, 0, BSIZE); 801011d7: 8d 40 5c lea 0x5c(%eax),%eax 801011da: 83 c4 0c add $0xc,%esp 801011dd: 68 00 02 00 00 push $0x200 801011e2: 6a 00 push $0x0 801011e4: 50 push %eax 801011e5: e8 66 32 00 00 call 80104450 <memset> log_write(bp); 801011ea: 89 1c 24 mov %ebx,(%esp) 801011ed: e8 3e 1b 00 00 call 80102d30 <log_write> brelse(bp); 801011f2: 89 1c 24 mov %ebx,(%esp) 801011f5: e8 e6 ef ff ff call 801001e0 <brelse> } } brelse(bp); } panic("balloc: out of blocks"); } 801011fa: 8d 65 f4 lea -0xc(%ebp),%esp 801011fd: 89 f0 mov %esi,%eax 801011ff: 5b pop %ebx 80101200: 5e pop %esi 80101201: 5f pop %edi 80101202: 5d pop %ebp 80101203: c3 ret 80101204: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010120a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80101210 <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) { 80101210: 55 push %ebp 80101211: 89 e5 mov %esp,%ebp 80101213: 57 push %edi 80101214: 56 push %esi 80101215: 53 push %ebx 80101216: 89 c7 mov %eax,%edi struct inode *ip, *empty; acquire(&icache.lock); // Is the inode already cached? empty = 0; 80101218: 31 f6 xor %esi,%esi for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010121a: bb 14 0a 11 80 mov $0x80110a14,%ebx // 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) { 8010121f: 83 ec 28 sub $0x28,%esp 80101222: 89 55 e4 mov %edx,-0x1c(%ebp) struct inode *ip, *empty; acquire(&icache.lock); 80101225: 68 e0 09 11 80 push $0x801109e0 8010122a: e8 21 31 00 00 call 80104350 <acquire> 8010122f: 83 c4 10 add $0x10,%esp // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101232: 8b 55 e4 mov -0x1c(%ebp),%edx 80101235: eb 1b jmp 80101252 <iget+0x42> 80101237: 89 f6 mov %esi,%esi 80101239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; release(&icache.lock); return ip; } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101240: 85 f6 test %esi,%esi 80101242: 74 44 je 80101288 <iget+0x78> acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 80101244: 81 c3 90 00 00 00 add $0x90,%ebx 8010124a: 81 fb 34 26 11 80 cmp $0x80112634,%ebx 80101250: 74 4e je 801012a0 <iget+0x90> if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ 80101252: 8b 4b 08 mov 0x8(%ebx),%ecx 80101255: 85 c9 test %ecx,%ecx 80101257: 7e e7 jle 80101240 <iget+0x30> 80101259: 39 3b cmp %edi,(%ebx) 8010125b: 75 e3 jne 80101240 <iget+0x30> 8010125d: 39 53 04 cmp %edx,0x4(%ebx) 80101260: 75 de jne 80101240 <iget+0x30> ip->ref++; release(&icache.lock); 80101262: 83 ec 0c sub $0xc,%esp // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; 80101265: 83 c1 01 add $0x1,%ecx release(&icache.lock); return ip; 80101268: 89 de mov %ebx,%esi // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; release(&icache.lock); 8010126a: 68 e0 09 11 80 push $0x801109e0 // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; 8010126f: 89 4b 08 mov %ecx,0x8(%ebx) release(&icache.lock); 80101272: e8 89 31 00 00 call 80104400 <release> return ip; 80101277: 83 c4 10 add $0x10,%esp ip->ref = 1; ip->valid = 0; release(&icache.lock); return ip; } 8010127a: 8d 65 f4 lea -0xc(%ebp),%esp 8010127d: 89 f0 mov %esi,%eax 8010127f: 5b pop %ebx 80101280: 5e pop %esi 80101281: 5f pop %edi 80101282: 5d pop %ebp 80101283: c3 ret 80101284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){ ip->ref++; release(&icache.lock); return ip; } if(empty == 0 && ip->ref == 0) // Remember empty slot. 80101288: 85 c9 test %ecx,%ecx 8010128a: 0f 44 f3 cmove %ebx,%esi acquire(&icache.lock); // Is the inode already cached? empty = 0; for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){ 8010128d: 81 c3 90 00 00 00 add $0x90,%ebx 80101293: 81 fb 34 26 11 80 cmp $0x80112634,%ebx 80101299: 75 b7 jne 80101252 <iget+0x42> 8010129b: 90 nop 8010129c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(empty == 0 && ip->ref == 0) // Remember empty slot. empty = ip; } // Recycle an inode cache entry. if(empty == 0) 801012a0: 85 f6 test %esi,%esi 801012a2: 74 2d je 801012d1 <iget+0xc1> ip = empty; ip->dev = dev; ip->inum = inum; ip->ref = 1; ip->valid = 0; release(&icache.lock); 801012a4: 83 ec 0c sub $0xc,%esp // Recycle an inode cache entry. if(empty == 0) panic("iget: no inodes"); ip = empty; ip->dev = dev; 801012a7: 89 3e mov %edi,(%esi) ip->inum = inum; 801012a9: 89 56 04 mov %edx,0x4(%esi) ip->ref = 1; 801012ac: c7 46 08 01 00 00 00 movl $0x1,0x8(%esi) ip->valid = 0; 801012b3: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) release(&icache.lock); 801012ba: 68 e0 09 11 80 push $0x801109e0 801012bf: e8 3c 31 00 00 call 80104400 <release> return ip; 801012c4: 83 c4 10 add $0x10,%esp } 801012c7: 8d 65 f4 lea -0xc(%ebp),%esp 801012ca: 89 f0 mov %esi,%eax 801012cc: 5b pop %ebx 801012cd: 5e pop %esi 801012ce: 5f pop %edi 801012cf: 5d pop %ebp 801012d0: c3 ret empty = ip; } // Recycle an inode cache entry. if(empty == 0) panic("iget: no inodes"); 801012d1: 83 ec 0c sub $0xc,%esp 801012d4: 68 f5 6f 10 80 push $0x80106ff5 801012d9: e8 92 f0 ff ff call 80100370 <panic> 801012de: 66 90 xchg %ax,%ax 801012e0 <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) { 801012e0: 55 push %ebp 801012e1: 89 e5 mov %esp,%ebp 801012e3: 57 push %edi 801012e4: 56 push %esi 801012e5: 53 push %ebx 801012e6: 89 c6 mov %eax,%esi 801012e8: 83 ec 1c sub $0x1c,%esp uint addr, *a; struct buf *bp; if(bn < NDIRECT){ 801012eb: 83 fa 0b cmp $0xb,%edx 801012ee: 77 18 ja 80101308 <bmap+0x28> 801012f0: 8d 1c 90 lea (%eax,%edx,4),%ebx if((addr = ip->addrs[bn]) == 0) 801012f3: 8b 43 5c mov 0x5c(%ebx),%eax 801012f6: 85 c0 test %eax,%eax 801012f8: 74 76 je 80101370 <bmap+0x90> brelse(bp); return addr; } panic("bmap: out of range"); } 801012fa: 8d 65 f4 lea -0xc(%ebp),%esp 801012fd: 5b pop %ebx 801012fe: 5e pop %esi 801012ff: 5f pop %edi 80101300: 5d pop %ebp 80101301: c3 ret 80101302: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); return addr; } bn -= NDIRECT; 80101308: 8d 5a f4 lea -0xc(%edx),%ebx if(bn < NINDIRECT){ 8010130b: 83 fb 7f cmp $0x7f,%ebx 8010130e: 0f 87 83 00 00 00 ja 80101397 <bmap+0xb7> // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) 80101314: 8b 80 8c 00 00 00 mov 0x8c(%eax),%eax 8010131a: 85 c0 test %eax,%eax 8010131c: 74 6a je 80101388 <bmap+0xa8> ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 8010131e: 83 ec 08 sub $0x8,%esp 80101321: 50 push %eax 80101322: ff 36 pushl (%esi) 80101324: e8 a7 ed ff ff call 801000d0 <bread> a = (uint*)bp->data; if((addr = a[bn]) == 0){ 80101329: 8d 54 98 5c lea 0x5c(%eax,%ebx,4),%edx 8010132d: 83 c4 10 add $0x10,%esp if(bn < NINDIRECT){ // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); 80101330: 89 c7 mov %eax,%edi a = (uint*)bp->data; if((addr = a[bn]) == 0){ 80101332: 8b 1a mov (%edx),%ebx 80101334: 85 db test %ebx,%ebx 80101336: 75 1d jne 80101355 <bmap+0x75> a[bn] = addr = balloc(ip->dev); 80101338: 8b 06 mov (%esi),%eax 8010133a: 89 55 e4 mov %edx,-0x1c(%ebp) 8010133d: e8 be fd ff ff call 80101100 <balloc> 80101342: 8b 55 e4 mov -0x1c(%ebp),%edx log_write(bp); 80101345: 83 ec 0c sub $0xc,%esp if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr = balloc(ip->dev); bp = bread(ip->dev, addr); a = (uint*)bp->data; if((addr = a[bn]) == 0){ a[bn] = addr = balloc(ip->dev); 80101348: 89 c3 mov %eax,%ebx 8010134a: 89 02 mov %eax,(%edx) log_write(bp); 8010134c: 57 push %edi 8010134d: e8 de 19 00 00 call 80102d30 <log_write> 80101352: 83 c4 10 add $0x10,%esp } brelse(bp); 80101355: 83 ec 0c sub $0xc,%esp 80101358: 57 push %edi 80101359: e8 82 ee ff ff call 801001e0 <brelse> 8010135e: 83 c4 10 add $0x10,%esp return addr; } panic("bmap: out of range"); } 80101361: 8d 65 f4 lea -0xc(%ebp),%esp a = (uint*)bp->data; if((addr = a[bn]) == 0){ a[bn] = addr = balloc(ip->dev); log_write(bp); } brelse(bp); 80101364: 89 d8 mov %ebx,%eax return addr; } panic("bmap: out of range"); } 80101366: 5b pop %ebx 80101367: 5e pop %esi 80101368: 5f pop %edi 80101369: 5d pop %ebp 8010136a: c3 ret 8010136b: 90 nop 8010136c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uint addr, *a; struct buf *bp; if(bn < NDIRECT){ if((addr = ip->addrs[bn]) == 0) ip->addrs[bn] = addr = balloc(ip->dev); 80101370: 8b 06 mov (%esi),%eax 80101372: e8 89 fd ff ff call 80101100 <balloc> 80101377: 89 43 5c mov %eax,0x5c(%ebx) brelse(bp); return addr; } panic("bmap: out of range"); } 8010137a: 8d 65 f4 lea -0xc(%ebp),%esp 8010137d: 5b pop %ebx 8010137e: 5e pop %esi 8010137f: 5f pop %edi 80101380: 5d pop %ebp 80101381: c3 ret 80101382: 8d b6 00 00 00 00 lea 0x0(%esi),%esi bn -= NDIRECT; if(bn < NINDIRECT){ // Load indirect block, allocating if necessary. if((addr = ip->addrs[NDIRECT]) == 0) ip->addrs[NDIRECT] = addr = balloc(ip->dev); 80101388: 8b 06 mov (%esi),%eax 8010138a: e8 71 fd ff ff call 80101100 <balloc> 8010138f: 89 86 8c 00 00 00 mov %eax,0x8c(%esi) 80101395: eb 87 jmp 8010131e <bmap+0x3e> } brelse(bp); return addr; } panic("bmap: out of range"); 80101397: 83 ec 0c sub $0xc,%esp 8010139a: 68 05 70 10 80 push $0x80107005 8010139f: e8 cc ef ff ff call 80100370 <panic> 801013a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801013aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 801013b0 <readsb>: struct superblock sb; // Read the super block. void readsb(int dev, struct superblock *sb) { 801013b0: 55 push %ebp 801013b1: 89 e5 mov %esp,%ebp 801013b3: 56 push %esi 801013b4: 53 push %ebx 801013b5: 8b 75 0c mov 0xc(%ebp),%esi struct buf *bp; bp = bread(dev, 1); 801013b8: 83 ec 08 sub $0x8,%esp 801013bb: 6a 01 push $0x1 801013bd: ff 75 08 pushl 0x8(%ebp) 801013c0: e8 0b ed ff ff call 801000d0 <bread> 801013c5: 89 c3 mov %eax,%ebx memmove(sb, bp->data, sizeof(*sb)); 801013c7: 8d 40 5c lea 0x5c(%eax),%eax 801013ca: 83 c4 0c add $0xc,%esp 801013cd: 6a 1c push $0x1c 801013cf: 50 push %eax 801013d0: 56 push %esi 801013d1: e8 2a 31 00 00 call 80104500 <memmove> brelse(bp); 801013d6: 89 5d 08 mov %ebx,0x8(%ebp) 801013d9: 83 c4 10 add $0x10,%esp } 801013dc: 8d 65 f8 lea -0x8(%ebp),%esp 801013df: 5b pop %ebx 801013e0: 5e pop %esi 801013e1: 5d pop %ebp { struct buf *bp; bp = bread(dev, 1); memmove(sb, bp->data, sizeof(*sb)); brelse(bp); 801013e2: e9 f9 ed ff ff jmp 801001e0 <brelse> 801013e7: 89 f6 mov %esi,%esi 801013e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801013f0 <bfree>: } // Free a disk block. static void bfree(int dev, uint b) { 801013f0: 55 push %ebp 801013f1: 89 e5 mov %esp,%ebp 801013f3: 56 push %esi 801013f4: 53 push %ebx 801013f5: 89 d3 mov %edx,%ebx 801013f7: 89 c6 mov %eax,%esi struct buf *bp; int bi, m; readsb(dev, &sb); 801013f9: 83 ec 08 sub $0x8,%esp 801013fc: 68 c0 09 11 80 push $0x801109c0 80101401: 50 push %eax 80101402: e8 a9 ff ff ff call 801013b0 <readsb> bp = bread(dev, BBLOCK(b, sb)); 80101407: 58 pop %eax 80101408: 5a pop %edx 80101409: 89 da mov %ebx,%edx 8010140b: c1 ea 0c shr $0xc,%edx 8010140e: 03 15 d8 09 11 80 add 0x801109d8,%edx 80101414: 52 push %edx 80101415: 56 push %esi 80101416: e8 b5 ec ff ff call 801000d0 <bread> bi = b % BPB; m = 1 << (bi % 8); 8010141b: 89 d9 mov %ebx,%ecx if((bp->data[bi/8] & m) == 0) 8010141d: 81 e3 ff 0f 00 00 and $0xfff,%ebx int bi, m; readsb(dev, &sb); bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; m = 1 << (bi % 8); 80101423: ba 01 00 00 00 mov $0x1,%edx 80101428: 83 e1 07 and $0x7,%ecx if((bp->data[bi/8] & m) == 0) 8010142b: c1 fb 03 sar $0x3,%ebx 8010142e: 83 c4 10 add $0x10,%esp int bi, m; readsb(dev, &sb); bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; m = 1 << (bi % 8); 80101431: d3 e2 shl %cl,%edx if((bp->data[bi/8] & m) == 0) 80101433: 0f b6 4c 18 5c movzbl 0x5c(%eax,%ebx,1),%ecx 80101438: 85 d1 test %edx,%ecx 8010143a: 74 27 je 80101463 <bfree+0x73> 8010143c: 89 c6 mov %eax,%esi panic("freeing free block"); bp->data[bi/8] &= ~m; 8010143e: f7 d2 not %edx 80101440: 89 c8 mov %ecx,%eax log_write(bp); 80101442: 83 ec 0c sub $0xc,%esp bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0) panic("freeing free block"); bp->data[bi/8] &= ~m; 80101445: 21 d0 and %edx,%eax 80101447: 88 44 1e 5c mov %al,0x5c(%esi,%ebx,1) log_write(bp); 8010144b: 56 push %esi 8010144c: e8 df 18 00 00 call 80102d30 <log_write> brelse(bp); 80101451: 89 34 24 mov %esi,(%esp) 80101454: e8 87 ed ff ff call 801001e0 <brelse> } 80101459: 83 c4 10 add $0x10,%esp 8010145c: 8d 65 f8 lea -0x8(%ebp),%esp 8010145f: 5b pop %ebx 80101460: 5e pop %esi 80101461: 5d pop %ebp 80101462: c3 ret readsb(dev, &sb); bp = bread(dev, BBLOCK(b, sb)); bi = b % BPB; m = 1 << (bi % 8); if((bp->data[bi/8] & m) == 0) panic("freeing free block"); 80101463: 83 ec 0c sub $0xc,%esp 80101466: 68 18 70 10 80 push $0x80107018 8010146b: e8 00 ef ff ff call 80100370 <panic> 80101470 <iinit>: struct inode inode[NINODE]; } icache; void iinit(int dev) { 80101470: 55 push %ebp 80101471: 89 e5 mov %esp,%ebp 80101473: 53 push %ebx 80101474: bb 20 0a 11 80 mov $0x80110a20,%ebx 80101479: 83 ec 0c sub $0xc,%esp int i = 0; initlock(&icache.lock, "icache"); 8010147c: 68 2b 70 10 80 push $0x8010702b 80101481: 68 e0 09 11 80 push $0x801109e0 80101486: e8 65 2d 00 00 call 801041f0 <initlock> 8010148b: 83 c4 10 add $0x10,%esp 8010148e: 66 90 xchg %ax,%ax for(i = 0; i < NINODE; i++) { initsleeplock(&icache.inode[i].lock, "inode"); 80101490: 83 ec 08 sub $0x8,%esp 80101493: 68 32 70 10 80 push $0x80107032 80101498: 53 push %ebx 80101499: 81 c3 90 00 00 00 add $0x90,%ebx 8010149f: e8 1c 2c 00 00 call 801040c0 <initsleeplock> iinit(int dev) { int i = 0; initlock(&icache.lock, "icache"); for(i = 0; i < NINODE; i++) { 801014a4: 83 c4 10 add $0x10,%esp 801014a7: 81 fb 40 26 11 80 cmp $0x80112640,%ebx 801014ad: 75 e1 jne 80101490 <iinit+0x20> initsleeplock(&icache.inode[i].lock, "inode"); } readsb(dev, &sb); 801014af: 83 ec 08 sub $0x8,%esp 801014b2: 68 c0 09 11 80 push $0x801109c0 801014b7: ff 75 08 pushl 0x8(%ebp) 801014ba: e8 f1 fe ff ff call 801013b0 <readsb> cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d\ 801014bf: ff 35 d8 09 11 80 pushl 0x801109d8 801014c5: ff 35 d4 09 11 80 pushl 0x801109d4 801014cb: ff 35 d0 09 11 80 pushl 0x801109d0 801014d1: ff 35 cc 09 11 80 pushl 0x801109cc 801014d7: ff 35 c8 09 11 80 pushl 0x801109c8 801014dd: ff 35 c4 09 11 80 pushl 0x801109c4 801014e3: ff 35 c0 09 11 80 pushl 0x801109c0 801014e9: 68 98 70 10 80 push $0x80107098 801014ee: e8 6d f1 ff ff call 80100660 <cprintf> inodestart %d bmap start %d\n", sb.size, sb.nblocks, sb.ninodes, sb.nlog, sb.logstart, sb.inodestart, sb.bmapstart); } 801014f3: 83 c4 30 add $0x30,%esp 801014f6: 8b 5d fc mov -0x4(%ebp),%ebx 801014f9: c9 leave 801014fa: c3 ret 801014fb: 90 nop 801014fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101500 <ialloc>: // Allocate an inode on device dev. // Mark it as allocated by giving it type type. // Returns an unlocked but allocated and referenced inode. struct inode* ialloc(uint dev, short type) { 80101500: 55 push %ebp 80101501: 89 e5 mov %esp,%ebp 80101503: 57 push %edi 80101504: 56 push %esi 80101505: 53 push %ebx 80101506: 83 ec 1c sub $0x1c,%esp int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101509: 83 3d c8 09 11 80 01 cmpl $0x1,0x801109c8 // Allocate an inode on device dev. // Mark it as allocated by giving it type type. // Returns an unlocked but allocated and referenced inode. struct inode* ialloc(uint dev, short type) { 80101510: 8b 45 0c mov 0xc(%ebp),%eax 80101513: 8b 75 08 mov 0x8(%ebp),%esi 80101516: 89 45 e4 mov %eax,-0x1c(%ebp) int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101519: 0f 86 91 00 00 00 jbe 801015b0 <ialloc+0xb0> 8010151f: bb 01 00 00 00 mov $0x1,%ebx 80101524: eb 21 jmp 80101547 <ialloc+0x47> 80101526: 8d 76 00 lea 0x0(%esi),%esi 80101529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); } brelse(bp); 80101530: 83 ec 0c sub $0xc,%esp { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 80101533: 83 c3 01 add $0x1,%ebx dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); } brelse(bp); 80101536: 57 push %edi 80101537: e8 a4 ec ff ff call 801001e0 <brelse> { int inum; struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ 8010153c: 83 c4 10 add $0x10,%esp 8010153f: 39 1d c8 09 11 80 cmp %ebx,0x801109c8 80101545: 76 69 jbe 801015b0 <ialloc+0xb0> bp = bread(dev, IBLOCK(inum, sb)); 80101547: 89 d8 mov %ebx,%eax 80101549: 83 ec 08 sub $0x8,%esp 8010154c: c1 e8 03 shr $0x3,%eax 8010154f: 03 05 d4 09 11 80 add 0x801109d4,%eax 80101555: 50 push %eax 80101556: 56 push %esi 80101557: e8 74 eb ff ff call 801000d0 <bread> 8010155c: 89 c7 mov %eax,%edi dip = (struct dinode*)bp->data + inum%IPB; 8010155e: 89 d8 mov %ebx,%eax if(dip->type == 0){ // a free inode 80101560: 83 c4 10 add $0x10,%esp struct buf *bp; struct dinode *dip; for(inum = 1; inum < sb.ninodes; inum++){ bp = bread(dev, IBLOCK(inum, sb)); dip = (struct dinode*)bp->data + inum%IPB; 80101563: 83 e0 07 and $0x7,%eax 80101566: c1 e0 06 shl $0x6,%eax 80101569: 8d 4c 07 5c lea 0x5c(%edi,%eax,1),%ecx if(dip->type == 0){ // a free inode 8010156d: 66 83 39 00 cmpw $0x0,(%ecx) 80101571: 75 bd jne 80101530 <ialloc+0x30> memset(dip, 0, sizeof(*dip)); 80101573: 83 ec 04 sub $0x4,%esp 80101576: 89 4d e0 mov %ecx,-0x20(%ebp) 80101579: 6a 40 push $0x40 8010157b: 6a 00 push $0x0 8010157d: 51 push %ecx 8010157e: e8 cd 2e 00 00 call 80104450 <memset> dip->type = type; 80101583: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax 80101587: 8b 4d e0 mov -0x20(%ebp),%ecx 8010158a: 66 89 01 mov %ax,(%ecx) log_write(bp); // mark it allocated on the disk 8010158d: 89 3c 24 mov %edi,(%esp) 80101590: e8 9b 17 00 00 call 80102d30 <log_write> brelse(bp); 80101595: 89 3c 24 mov %edi,(%esp) 80101598: e8 43 ec ff ff call 801001e0 <brelse> return iget(dev, inum); 8010159d: 83 c4 10 add $0x10,%esp } brelse(bp); } panic("ialloc: no inodes"); } 801015a0: 8d 65 f4 lea -0xc(%ebp),%esp if(dip->type == 0){ // a free inode memset(dip, 0, sizeof(*dip)); dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); 801015a3: 89 da mov %ebx,%edx 801015a5: 89 f0 mov %esi,%eax } brelse(bp); } panic("ialloc: no inodes"); } 801015a7: 5b pop %ebx 801015a8: 5e pop %esi 801015a9: 5f pop %edi 801015aa: 5d pop %ebp if(dip->type == 0){ // a free inode memset(dip, 0, sizeof(*dip)); dip->type = type; log_write(bp); // mark it allocated on the disk brelse(bp); return iget(dev, inum); 801015ab: e9 60 fc ff ff jmp 80101210 <iget> } brelse(bp); } panic("ialloc: no inodes"); 801015b0: 83 ec 0c sub $0xc,%esp 801015b3: 68 38 70 10 80 push $0x80107038 801015b8: e8 b3 ed ff ff call 80100370 <panic> 801015bd: 8d 76 00 lea 0x0(%esi),%esi 801015c0 <iupdate>: // Must be called after every change to an ip->xxx field // that lives on disk, since i-node cache is write-through. // Caller must hold ip->lock. void iupdate(struct inode *ip) { 801015c0: 55 push %ebp 801015c1: 89 e5 mov %esp,%ebp 801015c3: 56 push %esi 801015c4: 53 push %ebx 801015c5: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801015c8: 83 ec 08 sub $0x8,%esp 801015cb: 8b 43 04 mov 0x4(%ebx),%eax dip->type = ip->type; dip->major = ip->major; dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801015ce: 83 c3 5c add $0x5c,%ebx iupdate(struct inode *ip) { struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801015d1: c1 e8 03 shr $0x3,%eax 801015d4: 03 05 d4 09 11 80 add 0x801109d4,%eax 801015da: 50 push %eax 801015db: ff 73 a4 pushl -0x5c(%ebx) 801015de: e8 ed ea ff ff call 801000d0 <bread> 801015e3: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 801015e5: 8b 43 a8 mov -0x58(%ebx),%eax dip->type = ip->type; 801015e8: 0f b7 53 f4 movzwl -0xc(%ebx),%edx dip->major = ip->major; dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 801015ec: 83 c4 0c add $0xc,%esp { struct buf *bp; struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); dip = (struct dinode*)bp->data + ip->inum%IPB; 801015ef: 83 e0 07 and $0x7,%eax 801015f2: c1 e0 06 shl $0x6,%eax 801015f5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax dip->type = ip->type; 801015f9: 66 89 10 mov %dx,(%eax) dip->major = ip->major; 801015fc: 0f b7 53 f6 movzwl -0xa(%ebx),%edx dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 80101600: 83 c0 0c add $0xc,%eax struct dinode *dip; bp = bread(ip->dev, IBLOCK(ip->inum, sb)); dip = (struct dinode*)bp->data + ip->inum%IPB; dip->type = ip->type; dip->major = ip->major; 80101603: 66 89 50 f6 mov %dx,-0xa(%eax) dip->minor = ip->minor; 80101607: 0f b7 53 f8 movzwl -0x8(%ebx),%edx 8010160b: 66 89 50 f8 mov %dx,-0x8(%eax) dip->nlink = ip->nlink; 8010160f: 0f b7 53 fa movzwl -0x6(%ebx),%edx 80101613: 66 89 50 fa mov %dx,-0x6(%eax) dip->size = ip->size; 80101617: 8b 53 fc mov -0x4(%ebx),%edx 8010161a: 89 50 fc mov %edx,-0x4(%eax) memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); 8010161d: 6a 34 push $0x34 8010161f: 53 push %ebx 80101620: 50 push %eax 80101621: e8 da 2e 00 00 call 80104500 <memmove> log_write(bp); 80101626: 89 34 24 mov %esi,(%esp) 80101629: e8 02 17 00 00 call 80102d30 <log_write> brelse(bp); 8010162e: 89 75 08 mov %esi,0x8(%ebp) 80101631: 83 c4 10 add $0x10,%esp } 80101634: 8d 65 f8 lea -0x8(%ebp),%esp 80101637: 5b pop %ebx 80101638: 5e pop %esi 80101639: 5d pop %ebp dip->minor = ip->minor; dip->nlink = ip->nlink; dip->size = ip->size; memmove(dip->addrs, ip->addrs, sizeof(ip->addrs)); log_write(bp); brelse(bp); 8010163a: e9 a1 eb ff ff jmp 801001e0 <brelse> 8010163f: 90 nop 80101640 <idup>: // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { 80101640: 55 push %ebp 80101641: 89 e5 mov %esp,%ebp 80101643: 53 push %ebx 80101644: 83 ec 10 sub $0x10,%esp 80101647: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&icache.lock); 8010164a: 68 e0 09 11 80 push $0x801109e0 8010164f: e8 fc 2c 00 00 call 80104350 <acquire> ip->ref++; 80101654: 83 43 08 01 addl $0x1,0x8(%ebx) release(&icache.lock); 80101658: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 8010165f: e8 9c 2d 00 00 call 80104400 <release> return ip; } 80101664: 89 d8 mov %ebx,%eax 80101666: 8b 5d fc mov -0x4(%ebp),%ebx 80101669: c9 leave 8010166a: c3 ret 8010166b: 90 nop 8010166c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101670 <ilock>: // Lock the given inode. // Reads the inode from disk if necessary. void ilock(struct inode *ip) { 80101670: 55 push %ebp 80101671: 89 e5 mov %esp,%ebp 80101673: 56 push %esi 80101674: 53 push %ebx 80101675: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) 80101678: 85 db test %ebx,%ebx 8010167a: 0f 84 b7 00 00 00 je 80101737 <ilock+0xc7> 80101680: 8b 53 08 mov 0x8(%ebx),%edx 80101683: 85 d2 test %edx,%edx 80101685: 0f 8e ac 00 00 00 jle 80101737 <ilock+0xc7> panic("ilock"); acquiresleep(&ip->lock); 8010168b: 8d 43 0c lea 0xc(%ebx),%eax 8010168e: 83 ec 0c sub $0xc,%esp 80101691: 50 push %eax 80101692: e8 69 2a 00 00 call 80104100 <acquiresleep> if(ip->valid == 0){ 80101697: 8b 43 4c mov 0x4c(%ebx),%eax 8010169a: 83 c4 10 add $0x10,%esp 8010169d: 85 c0 test %eax,%eax 8010169f: 74 0f je 801016b0 <ilock+0x40> brelse(bp); ip->valid = 1; if(ip->type == 0) panic("ilock: no type"); } } 801016a1: 8d 65 f8 lea -0x8(%ebp),%esp 801016a4: 5b pop %ebx 801016a5: 5e pop %esi 801016a6: 5d pop %ebp 801016a7: c3 ret 801016a8: 90 nop 801016a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi panic("ilock"); acquiresleep(&ip->lock); if(ip->valid == 0){ bp = bread(ip->dev, IBLOCK(ip->inum, sb)); 801016b0: 8b 43 04 mov 0x4(%ebx),%eax 801016b3: 83 ec 08 sub $0x8,%esp 801016b6: c1 e8 03 shr $0x3,%eax 801016b9: 03 05 d4 09 11 80 add 0x801109d4,%eax 801016bf: 50 push %eax 801016c0: ff 33 pushl (%ebx) 801016c2: e8 09 ea ff ff call 801000d0 <bread> 801016c7: 89 c6 mov %eax,%esi dip = (struct dinode*)bp->data + ip->inum%IPB; 801016c9: 8b 43 04 mov 0x4(%ebx),%eax ip->type = dip->type; ip->major = dip->major; ip->minor = dip->minor; ip->nlink = dip->nlink; ip->size = dip->size; memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801016cc: 83 c4 0c add $0xc,%esp acquiresleep(&ip->lock); if(ip->valid == 0){ bp = bread(ip->dev, IBLOCK(ip->inum, sb)); dip = (struct dinode*)bp->data + ip->inum%IPB; 801016cf: 83 e0 07 and $0x7,%eax 801016d2: c1 e0 06 shl $0x6,%eax 801016d5: 8d 44 06 5c lea 0x5c(%esi,%eax,1),%eax ip->type = dip->type; 801016d9: 0f b7 10 movzwl (%eax),%edx ip->major = dip->major; ip->minor = dip->minor; ip->nlink = dip->nlink; ip->size = dip->size; memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 801016dc: 83 c0 0c add $0xc,%eax acquiresleep(&ip->lock); if(ip->valid == 0){ bp = bread(ip->dev, IBLOCK(ip->inum, sb)); dip = (struct dinode*)bp->data + ip->inum%IPB; ip->type = dip->type; 801016df: 66 89 53 50 mov %dx,0x50(%ebx) ip->major = dip->major; 801016e3: 0f b7 50 f6 movzwl -0xa(%eax),%edx 801016e7: 66 89 53 52 mov %dx,0x52(%ebx) ip->minor = dip->minor; 801016eb: 0f b7 50 f8 movzwl -0x8(%eax),%edx 801016ef: 66 89 53 54 mov %dx,0x54(%ebx) ip->nlink = dip->nlink; 801016f3: 0f b7 50 fa movzwl -0x6(%eax),%edx 801016f7: 66 89 53 56 mov %dx,0x56(%ebx) ip->size = dip->size; 801016fb: 8b 50 fc mov -0x4(%eax),%edx 801016fe: 89 53 58 mov %edx,0x58(%ebx) memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); 80101701: 6a 34 push $0x34 80101703: 50 push %eax 80101704: 8d 43 5c lea 0x5c(%ebx),%eax 80101707: 50 push %eax 80101708: e8 f3 2d 00 00 call 80104500 <memmove> brelse(bp); 8010170d: 89 34 24 mov %esi,(%esp) 80101710: e8 cb ea ff ff call 801001e0 <brelse> ip->valid = 1; if(ip->type == 0) 80101715: 83 c4 10 add $0x10,%esp 80101718: 66 83 7b 50 00 cmpw $0x0,0x50(%ebx) ip->minor = dip->minor; ip->nlink = dip->nlink; ip->size = dip->size; memmove(ip->addrs, dip->addrs, sizeof(ip->addrs)); brelse(bp); ip->valid = 1; 8010171d: c7 43 4c 01 00 00 00 movl $0x1,0x4c(%ebx) if(ip->type == 0) 80101724: 0f 85 77 ff ff ff jne 801016a1 <ilock+0x31> panic("ilock: no type"); 8010172a: 83 ec 0c sub $0xc,%esp 8010172d: 68 50 70 10 80 push $0x80107050 80101732: e8 39 ec ff ff call 80100370 <panic> { struct buf *bp; struct dinode *dip; if(ip == 0 || ip->ref < 1) panic("ilock"); 80101737: 83 ec 0c sub $0xc,%esp 8010173a: 68 4a 70 10 80 push $0x8010704a 8010173f: e8 2c ec ff ff call 80100370 <panic> 80101744: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010174a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80101750 <iunlock>: } // Unlock the given inode. void iunlock(struct inode *ip) { 80101750: 55 push %ebp 80101751: 89 e5 mov %esp,%ebp 80101753: 56 push %esi 80101754: 53 push %ebx 80101755: 8b 5d 08 mov 0x8(%ebp),%ebx if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) 80101758: 85 db test %ebx,%ebx 8010175a: 74 28 je 80101784 <iunlock+0x34> 8010175c: 8d 73 0c lea 0xc(%ebx),%esi 8010175f: 83 ec 0c sub $0xc,%esp 80101762: 56 push %esi 80101763: e8 38 2a 00 00 call 801041a0 <holdingsleep> 80101768: 83 c4 10 add $0x10,%esp 8010176b: 85 c0 test %eax,%eax 8010176d: 74 15 je 80101784 <iunlock+0x34> 8010176f: 8b 43 08 mov 0x8(%ebx),%eax 80101772: 85 c0 test %eax,%eax 80101774: 7e 0e jle 80101784 <iunlock+0x34> panic("iunlock"); releasesleep(&ip->lock); 80101776: 89 75 08 mov %esi,0x8(%ebp) } 80101779: 8d 65 f8 lea -0x8(%ebp),%esp 8010177c: 5b pop %ebx 8010177d: 5e pop %esi 8010177e: 5d pop %ebp iunlock(struct inode *ip) { if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) panic("iunlock"); releasesleep(&ip->lock); 8010177f: e9 dc 29 00 00 jmp 80104160 <releasesleep> // Unlock the given inode. void iunlock(struct inode *ip) { if(ip == 0 || !holdingsleep(&ip->lock) || ip->ref < 1) panic("iunlock"); 80101784: 83 ec 0c sub $0xc,%esp 80101787: 68 5f 70 10 80 push $0x8010705f 8010178c: e8 df eb ff ff call 80100370 <panic> 80101791: eb 0d jmp 801017a0 <iput> 80101793: 90 nop 80101794: 90 nop 80101795: 90 nop 80101796: 90 nop 80101797: 90 nop 80101798: 90 nop 80101799: 90 nop 8010179a: 90 nop 8010179b: 90 nop 8010179c: 90 nop 8010179d: 90 nop 8010179e: 90 nop 8010179f: 90 nop 801017a0 <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) { 801017a0: 55 push %ebp 801017a1: 89 e5 mov %esp,%ebp 801017a3: 57 push %edi 801017a4: 56 push %esi 801017a5: 53 push %ebx 801017a6: 83 ec 28 sub $0x28,%esp 801017a9: 8b 75 08 mov 0x8(%ebp),%esi acquiresleep(&ip->lock); 801017ac: 8d 7e 0c lea 0xc(%esi),%edi 801017af: 57 push %edi 801017b0: e8 4b 29 00 00 call 80104100 <acquiresleep> if(ip->valid && ip->nlink == 0){ 801017b5: 8b 56 4c mov 0x4c(%esi),%edx 801017b8: 83 c4 10 add $0x10,%esp 801017bb: 85 d2 test %edx,%edx 801017bd: 74 07 je 801017c6 <iput+0x26> 801017bf: 66 83 7e 56 00 cmpw $0x0,0x56(%esi) 801017c4: 74 32 je 801017f8 <iput+0x58> ip->type = 0; iupdate(ip); ip->valid = 0; } } releasesleep(&ip->lock); 801017c6: 83 ec 0c sub $0xc,%esp 801017c9: 57 push %edi 801017ca: e8 91 29 00 00 call 80104160 <releasesleep> acquire(&icache.lock); 801017cf: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 801017d6: e8 75 2b 00 00 call 80104350 <acquire> ip->ref--; 801017db: 83 6e 08 01 subl $0x1,0x8(%esi) release(&icache.lock); 801017df: 83 c4 10 add $0x10,%esp 801017e2: c7 45 08 e0 09 11 80 movl $0x801109e0,0x8(%ebp) } 801017e9: 8d 65 f4 lea -0xc(%ebp),%esp 801017ec: 5b pop %ebx 801017ed: 5e pop %esi 801017ee: 5f pop %edi 801017ef: 5d pop %ebp } releasesleep(&ip->lock); acquire(&icache.lock); ip->ref--; release(&icache.lock); 801017f0: e9 0b 2c 00 00 jmp 80104400 <release> 801017f5: 8d 76 00 lea 0x0(%esi),%esi void iput(struct inode *ip) { acquiresleep(&ip->lock); if(ip->valid && ip->nlink == 0){ acquire(&icache.lock); 801017f8: 83 ec 0c sub $0xc,%esp 801017fb: 68 e0 09 11 80 push $0x801109e0 80101800: e8 4b 2b 00 00 call 80104350 <acquire> int r = ip->ref; 80101805: 8b 5e 08 mov 0x8(%esi),%ebx release(&icache.lock); 80101808: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 8010180f: e8 ec 2b 00 00 call 80104400 <release> if(r == 1){ 80101814: 83 c4 10 add $0x10,%esp 80101817: 83 fb 01 cmp $0x1,%ebx 8010181a: 75 aa jne 801017c6 <iput+0x26> 8010181c: 8d 8e 8c 00 00 00 lea 0x8c(%esi),%ecx 80101822: 89 7d e4 mov %edi,-0x1c(%ebp) 80101825: 8d 5e 5c lea 0x5c(%esi),%ebx 80101828: 89 cf mov %ecx,%edi 8010182a: eb 0b jmp 80101837 <iput+0x97> 8010182c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101830: 83 c3 04 add $0x4,%ebx { int i, j; struct buf *bp; uint *a; for(i = 0; i < NDIRECT; i++){ 80101833: 39 fb cmp %edi,%ebx 80101835: 74 19 je 80101850 <iput+0xb0> if(ip->addrs[i]){ 80101837: 8b 13 mov (%ebx),%edx 80101839: 85 d2 test %edx,%edx 8010183b: 74 f3 je 80101830 <iput+0x90> bfree(ip->dev, ip->addrs[i]); 8010183d: 8b 06 mov (%esi),%eax 8010183f: e8 ac fb ff ff call 801013f0 <bfree> ip->addrs[i] = 0; 80101844: c7 03 00 00 00 00 movl $0x0,(%ebx) 8010184a: eb e4 jmp 80101830 <iput+0x90> 8010184c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } } if(ip->addrs[NDIRECT]){ 80101850: 8b 86 8c 00 00 00 mov 0x8c(%esi),%eax 80101856: 8b 7d e4 mov -0x1c(%ebp),%edi 80101859: 85 c0 test %eax,%eax 8010185b: 75 33 jne 80101890 <iput+0xf0> bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; iupdate(ip); 8010185d: 83 ec 0c sub $0xc,%esp brelse(bp); bfree(ip->dev, ip->addrs[NDIRECT]); ip->addrs[NDIRECT] = 0; } ip->size = 0; 80101860: c7 46 58 00 00 00 00 movl $0x0,0x58(%esi) iupdate(ip); 80101867: 56 push %esi 80101868: e8 53 fd ff ff call 801015c0 <iupdate> int r = ip->ref; release(&icache.lock); if(r == 1){ // inode has no links and no other references: truncate and free. itrunc(ip); ip->type = 0; 8010186d: 31 c0 xor %eax,%eax 8010186f: 66 89 46 50 mov %ax,0x50(%esi) iupdate(ip); 80101873: 89 34 24 mov %esi,(%esp) 80101876: e8 45 fd ff ff call 801015c0 <iupdate> ip->valid = 0; 8010187b: c7 46 4c 00 00 00 00 movl $0x0,0x4c(%esi) 80101882: 83 c4 10 add $0x10,%esp 80101885: e9 3c ff ff ff jmp 801017c6 <iput+0x26> 8010188a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi ip->addrs[i] = 0; } } if(ip->addrs[NDIRECT]){ bp = bread(ip->dev, ip->addrs[NDIRECT]); 80101890: 83 ec 08 sub $0x8,%esp 80101893: 50 push %eax 80101894: ff 36 pushl (%esi) 80101896: e8 35 e8 ff ff call 801000d0 <bread> 8010189b: 8d 88 5c 02 00 00 lea 0x25c(%eax),%ecx 801018a1: 89 7d e0 mov %edi,-0x20(%ebp) 801018a4: 89 45 e4 mov %eax,-0x1c(%ebp) a = (uint*)bp->data; 801018a7: 8d 58 5c lea 0x5c(%eax),%ebx 801018aa: 83 c4 10 add $0x10,%esp 801018ad: 89 cf mov %ecx,%edi 801018af: eb 0e jmp 801018bf <iput+0x11f> 801018b1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801018b8: 83 c3 04 add $0x4,%ebx for(j = 0; j < NINDIRECT; j++){ 801018bb: 39 fb cmp %edi,%ebx 801018bd: 74 0f je 801018ce <iput+0x12e> if(a[j]) 801018bf: 8b 13 mov (%ebx),%edx 801018c1: 85 d2 test %edx,%edx 801018c3: 74 f3 je 801018b8 <iput+0x118> bfree(ip->dev, a[j]); 801018c5: 8b 06 mov (%esi),%eax 801018c7: e8 24 fb ff ff call 801013f0 <bfree> 801018cc: eb ea jmp 801018b8 <iput+0x118> } brelse(bp); 801018ce: 83 ec 0c sub $0xc,%esp 801018d1: ff 75 e4 pushl -0x1c(%ebp) 801018d4: 8b 7d e0 mov -0x20(%ebp),%edi 801018d7: e8 04 e9 ff ff call 801001e0 <brelse> bfree(ip->dev, ip->addrs[NDIRECT]); 801018dc: 8b 96 8c 00 00 00 mov 0x8c(%esi),%edx 801018e2: 8b 06 mov (%esi),%eax 801018e4: e8 07 fb ff ff call 801013f0 <bfree> ip->addrs[NDIRECT] = 0; 801018e9: c7 86 8c 00 00 00 00 movl $0x0,0x8c(%esi) 801018f0: 00 00 00 801018f3: 83 c4 10 add $0x10,%esp 801018f6: e9 62 ff ff ff jmp 8010185d <iput+0xbd> 801018fb: 90 nop 801018fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101900 <iunlockput>: } // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { 80101900: 55 push %ebp 80101901: 89 e5 mov %esp,%ebp 80101903: 53 push %ebx 80101904: 83 ec 10 sub $0x10,%esp 80101907: 8b 5d 08 mov 0x8(%ebp),%ebx iunlock(ip); 8010190a: 53 push %ebx 8010190b: e8 40 fe ff ff call 80101750 <iunlock> iput(ip); 80101910: 89 5d 08 mov %ebx,0x8(%ebp) 80101913: 83 c4 10 add $0x10,%esp } 80101916: 8b 5d fc mov -0x4(%ebp),%ebx 80101919: c9 leave // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { iunlock(ip); iput(ip); 8010191a: e9 81 fe ff ff jmp 801017a0 <iput> 8010191f: 90 nop 80101920 <stati>: // Copy stat information from inode. // Caller must hold ip->lock. void stati(struct inode *ip, struct stat *st) { 80101920: 55 push %ebp 80101921: 89 e5 mov %esp,%ebp 80101923: 8b 55 08 mov 0x8(%ebp),%edx 80101926: 8b 45 0c mov 0xc(%ebp),%eax st->dev = ip->dev; 80101929: 8b 0a mov (%edx),%ecx 8010192b: 89 48 04 mov %ecx,0x4(%eax) st->ino = ip->inum; 8010192e: 8b 4a 04 mov 0x4(%edx),%ecx 80101931: 89 48 08 mov %ecx,0x8(%eax) st->type = ip->type; 80101934: 0f b7 4a 50 movzwl 0x50(%edx),%ecx 80101938: 66 89 08 mov %cx,(%eax) st->nlink = ip->nlink; 8010193b: 0f b7 4a 56 movzwl 0x56(%edx),%ecx 8010193f: 66 89 48 0c mov %cx,0xc(%eax) st->size = ip->size; 80101943: 8b 52 58 mov 0x58(%edx),%edx 80101946: 89 50 10 mov %edx,0x10(%eax) } 80101949: 5d pop %ebp 8010194a: c3 ret 8010194b: 90 nop 8010194c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101950 <readi>: //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101950: 55 push %ebp 80101951: 89 e5 mov %esp,%ebp 80101953: 57 push %edi 80101954: 56 push %esi 80101955: 53 push %ebx 80101956: 83 ec 1c sub $0x1c,%esp 80101959: 8b 45 08 mov 0x8(%ebp),%eax 8010195c: 8b 7d 0c mov 0xc(%ebp),%edi 8010195f: 8b 75 10 mov 0x10(%ebp),%esi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101962: 66 83 78 50 03 cmpw $0x3,0x50(%eax) //PAGEBREAK! // Read data from inode. // Caller must hold ip->lock. int readi(struct inode *ip, char *dst, uint off, uint n) { 80101967: 89 7d e0 mov %edi,-0x20(%ebp) 8010196a: 8b 7d 14 mov 0x14(%ebp),%edi 8010196d: 89 45 d8 mov %eax,-0x28(%ebp) 80101970: 89 7d e4 mov %edi,-0x1c(%ebp) uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101973: 0f 84 a7 00 00 00 je 80101a20 <readi+0xd0> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); } if(off > ip->size || off + n < off) 80101979: 8b 45 d8 mov -0x28(%ebp),%eax 8010197c: 8b 40 58 mov 0x58(%eax),%eax 8010197f: 39 f0 cmp %esi,%eax 80101981: 0f 82 c1 00 00 00 jb 80101a48 <readi+0xf8> 80101987: 8b 7d e4 mov -0x1c(%ebp),%edi 8010198a: 89 fa mov %edi,%edx 8010198c: 01 f2 add %esi,%edx 8010198e: 0f 82 b4 00 00 00 jb 80101a48 <readi+0xf8> return -1; if(off + n > ip->size) n = ip->size - off; 80101994: 89 c1 mov %eax,%ecx 80101996: 29 f1 sub %esi,%ecx 80101998: 39 d0 cmp %edx,%eax 8010199a: 0f 43 cf cmovae %edi,%ecx for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 8010199d: 31 ff xor %edi,%edi 8010199f: 85 c9 test %ecx,%ecx } if(off > ip->size || off + n < off) return -1; if(off + n > ip->size) n = ip->size - off; 801019a1: 89 4d e4 mov %ecx,-0x1c(%ebp) for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ 801019a4: 74 6d je 80101a13 <readi+0xc3> 801019a6: 8d 76 00 lea 0x0(%esi),%esi 801019a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi bp = bread(ip->dev, bmap(ip, off/BSIZE)); 801019b0: 8b 5d d8 mov -0x28(%ebp),%ebx 801019b3: 89 f2 mov %esi,%edx 801019b5: c1 ea 09 shr $0x9,%edx 801019b8: 89 d8 mov %ebx,%eax 801019ba: e8 21 f9 ff ff call 801012e0 <bmap> 801019bf: 83 ec 08 sub $0x8,%esp 801019c2: 50 push %eax 801019c3: ff 33 pushl (%ebx) m = min(n - tot, BSIZE - off%BSIZE); 801019c5: bb 00 02 00 00 mov $0x200,%ebx return -1; if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 801019ca: e8 01 e7 ff ff call 801000d0 <bread> 801019cf: 89 c2 mov %eax,%edx m = min(n - tot, BSIZE - off%BSIZE); 801019d1: 8b 45 e4 mov -0x1c(%ebp),%eax 801019d4: 89 f1 mov %esi,%ecx 801019d6: 81 e1 ff 01 00 00 and $0x1ff,%ecx 801019dc: 83 c4 0c add $0xc,%esp memmove(dst, bp->data + off%BSIZE, m); 801019df: 89 55 dc mov %edx,-0x24(%ebp) if(off + n > ip->size) n = ip->size - off; for(tot=0; tot<n; tot+=m, off+=m, dst+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); 801019e2: 29 cb sub %ecx,%ebx 801019e4: 29 f8 sub %edi,%eax 801019e6: 39 c3 cmp %eax,%ebx 801019e8: 0f 47 d8 cmova %eax,%ebx memmove(dst, bp->data + off%BSIZE, m); 801019eb: 8d 44 0a 5c lea 0x5c(%edx,%ecx,1),%eax 801019ef: 53 push %ebx 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){ 801019f0: 01 df add %ebx,%edi 801019f2: 01 de add %ebx,%esi bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); 801019f4: 50 push %eax 801019f5: ff 75 e0 pushl -0x20(%ebp) 801019f8: e8 03 2b 00 00 call 80104500 <memmove> brelse(bp); 801019fd: 8b 55 dc mov -0x24(%ebp),%edx 80101a00: 89 14 24 mov %edx,(%esp) 80101a03: e8 d8 e7 ff ff call 801001e0 <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){ 80101a08: 01 5d e0 add %ebx,-0x20(%ebp) 80101a0b: 83 c4 10 add $0x10,%esp 80101a0e: 39 7d e4 cmp %edi,-0x1c(%ebp) 80101a11: 77 9d ja 801019b0 <readi+0x60> 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; 80101a13: 8b 45 e4 mov -0x1c(%ebp),%eax } 80101a16: 8d 65 f4 lea -0xc(%ebp),%esp 80101a19: 5b pop %ebx 80101a1a: 5e pop %esi 80101a1b: 5f pop %edi 80101a1c: 5d pop %ebp 80101a1d: c3 ret 80101a1e: 66 90 xchg %ax,%ax { uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) 80101a20: 0f bf 40 52 movswl 0x52(%eax),%eax 80101a24: 66 83 f8 09 cmp $0x9,%ax 80101a28: 77 1e ja 80101a48 <readi+0xf8> 80101a2a: 8b 04 c5 60 09 11 80 mov -0x7feef6a0(,%eax,8),%eax 80101a31: 85 c0 test %eax,%eax 80101a33: 74 13 je 80101a48 <readi+0xf8> return -1; return devsw[ip->major].read(ip, dst, n); 80101a35: 89 7d 10 mov %edi,0x10(%ebp) m = min(n - tot, BSIZE - off%BSIZE); memmove(dst, bp->data + off%BSIZE, m); brelse(bp); } return n; } 80101a38: 8d 65 f4 lea -0xc(%ebp),%esp 80101a3b: 5b pop %ebx 80101a3c: 5e pop %esi 80101a3d: 5f pop %edi 80101a3e: 5d pop %ebp struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; return devsw[ip->major].read(ip, dst, n); 80101a3f: ff e0 jmp *%eax 80101a41: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read) return -1; 80101a48: b8 ff ff ff ff mov $0xffffffff,%eax 80101a4d: eb c7 jmp 80101a16 <readi+0xc6> 80101a4f: 90 nop 80101a50 <writei>: // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101a50: 55 push %ebp 80101a51: 89 e5 mov %esp,%ebp 80101a53: 57 push %edi 80101a54: 56 push %esi 80101a55: 53 push %ebx 80101a56: 83 ec 1c sub $0x1c,%esp 80101a59: 8b 45 08 mov 0x8(%ebp),%eax 80101a5c: 8b 75 0c mov 0xc(%ebp),%esi 80101a5f: 8b 7d 14 mov 0x14(%ebp),%edi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101a62: 66 83 78 50 03 cmpw $0x3,0x50(%eax) // PAGEBREAK! // Write data to inode. // Caller must hold ip->lock. int writei(struct inode *ip, char *src, uint off, uint n) { 80101a67: 89 75 dc mov %esi,-0x24(%ebp) 80101a6a: 89 45 d8 mov %eax,-0x28(%ebp) 80101a6d: 8b 75 10 mov 0x10(%ebp),%esi 80101a70: 89 7d e0 mov %edi,-0x20(%ebp) uint tot, m; struct buf *bp; if(ip->type == T_DEV){ 80101a73: 0f 84 b7 00 00 00 je 80101b30 <writei+0xe0> if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); } if(off > ip->size || off + n < off) 80101a79: 8b 45 d8 mov -0x28(%ebp),%eax 80101a7c: 39 70 58 cmp %esi,0x58(%eax) 80101a7f: 0f 82 eb 00 00 00 jb 80101b70 <writei+0x120> 80101a85: 8b 7d e0 mov -0x20(%ebp),%edi 80101a88: 89 f8 mov %edi,%eax 80101a8a: 01 f0 add %esi,%eax return -1; if(off + n > MAXFILE*BSIZE) 80101a8c: 3d 00 18 01 00 cmp $0x11800,%eax 80101a91: 0f 87 d9 00 00 00 ja 80101b70 <writei+0x120> 80101a97: 39 c6 cmp %eax,%esi 80101a99: 0f 87 d1 00 00 00 ja 80101b70 <writei+0x120> return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ 80101a9f: 85 ff test %edi,%edi 80101aa1: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp) 80101aa8: 74 78 je 80101b22 <writei+0xd2> 80101aaa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101ab0: 8b 7d d8 mov -0x28(%ebp),%edi 80101ab3: 89 f2 mov %esi,%edx m = min(n - tot, BSIZE - off%BSIZE); 80101ab5: bb 00 02 00 00 mov $0x200,%ebx return -1; if(off + n > MAXFILE*BSIZE) return -1; for(tot=0; tot<n; tot+=m, off+=m, src+=m){ bp = bread(ip->dev, bmap(ip, off/BSIZE)); 80101aba: c1 ea 09 shr $0x9,%edx 80101abd: 89 f8 mov %edi,%eax 80101abf: e8 1c f8 ff ff call 801012e0 <bmap> 80101ac4: 83 ec 08 sub $0x8,%esp 80101ac7: 50 push %eax 80101ac8: ff 37 pushl (%edi) 80101aca: e8 01 e6 ff ff call 801000d0 <bread> 80101acf: 89 c7 mov %eax,%edi m = min(n - tot, BSIZE - off%BSIZE); 80101ad1: 8b 45 e0 mov -0x20(%ebp),%eax 80101ad4: 2b 45 e4 sub -0x1c(%ebp),%eax 80101ad7: 89 f1 mov %esi,%ecx 80101ad9: 83 c4 0c add $0xc,%esp 80101adc: 81 e1 ff 01 00 00 and $0x1ff,%ecx 80101ae2: 29 cb sub %ecx,%ebx 80101ae4: 39 c3 cmp %eax,%ebx 80101ae6: 0f 47 d8 cmova %eax,%ebx memmove(bp->data + off%BSIZE, src, m); 80101ae9: 8d 44 0f 5c lea 0x5c(%edi,%ecx,1),%eax 80101aed: 53 push %ebx 80101aee: ff 75 dc pushl -0x24(%ebp) 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){ 80101af1: 01 de add %ebx,%esi bp = bread(ip->dev, bmap(ip, off/BSIZE)); m = min(n - tot, BSIZE - off%BSIZE); memmove(bp->data + off%BSIZE, src, m); 80101af3: 50 push %eax 80101af4: e8 07 2a 00 00 call 80104500 <memmove> log_write(bp); 80101af9: 89 3c 24 mov %edi,(%esp) 80101afc: e8 2f 12 00 00 call 80102d30 <log_write> brelse(bp); 80101b01: 89 3c 24 mov %edi,(%esp) 80101b04: e8 d7 e6 ff ff call 801001e0 <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){ 80101b09: 01 5d e4 add %ebx,-0x1c(%ebp) 80101b0c: 01 5d dc add %ebx,-0x24(%ebp) 80101b0f: 83 c4 10 add $0x10,%esp 80101b12: 8b 55 e4 mov -0x1c(%ebp),%edx 80101b15: 39 55 e0 cmp %edx,-0x20(%ebp) 80101b18: 77 96 ja 80101ab0 <writei+0x60> memmove(bp->data + off%BSIZE, src, m); log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ 80101b1a: 8b 45 d8 mov -0x28(%ebp),%eax 80101b1d: 3b 70 58 cmp 0x58(%eax),%esi 80101b20: 77 36 ja 80101b58 <writei+0x108> ip->size = off; iupdate(ip); } return n; 80101b22: 8b 45 e0 mov -0x20(%ebp),%eax } 80101b25: 8d 65 f4 lea -0xc(%ebp),%esp 80101b28: 5b pop %ebx 80101b29: 5e pop %esi 80101b2a: 5f pop %edi 80101b2b: 5d pop %ebp 80101b2c: c3 ret 80101b2d: 8d 76 00 lea 0x0(%esi),%esi { uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) 80101b30: 0f bf 40 52 movswl 0x52(%eax),%eax 80101b34: 66 83 f8 09 cmp $0x9,%ax 80101b38: 77 36 ja 80101b70 <writei+0x120> 80101b3a: 8b 04 c5 64 09 11 80 mov -0x7feef69c(,%eax,8),%eax 80101b41: 85 c0 test %eax,%eax 80101b43: 74 2b je 80101b70 <writei+0x120> return -1; return devsw[ip->major].write(ip, src, n); 80101b45: 89 7d 10 mov %edi,0x10(%ebp) if(n > 0 && off > ip->size){ ip->size = off; iupdate(ip); } return n; } 80101b48: 8d 65 f4 lea -0xc(%ebp),%esp 80101b4b: 5b pop %ebx 80101b4c: 5e pop %esi 80101b4d: 5f pop %edi 80101b4e: 5d pop %ebp struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; return devsw[ip->major].write(ip, src, n); 80101b4f: ff e0 jmp *%eax 80101b51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ ip->size = off; 80101b58: 8b 45 d8 mov -0x28(%ebp),%eax iupdate(ip); 80101b5b: 83 ec 0c sub $0xc,%esp log_write(bp); brelse(bp); } if(n > 0 && off > ip->size){ ip->size = off; 80101b5e: 89 70 58 mov %esi,0x58(%eax) iupdate(ip); 80101b61: 50 push %eax 80101b62: e8 59 fa ff ff call 801015c0 <iupdate> 80101b67: 83 c4 10 add $0x10,%esp 80101b6a: eb b6 jmp 80101b22 <writei+0xd2> 80101b6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uint tot, m; struct buf *bp; if(ip->type == T_DEV){ if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write) return -1; 80101b70: b8 ff ff ff ff mov $0xffffffff,%eax 80101b75: eb ae jmp 80101b25 <writei+0xd5> 80101b77: 89 f6 mov %esi,%esi 80101b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101b80 <namecmp>: //PAGEBREAK! // Directories int namecmp(const char *s, const char *t) { 80101b80: 55 push %ebp 80101b81: 89 e5 mov %esp,%ebp 80101b83: 83 ec 0c sub $0xc,%esp return strncmp(s, t, DIRSIZ); 80101b86: 6a 0e push $0xe 80101b88: ff 75 0c pushl 0xc(%ebp) 80101b8b: ff 75 08 pushl 0x8(%ebp) 80101b8e: e8 ed 29 00 00 call 80104580 <strncmp> } 80101b93: c9 leave 80101b94: c3 ret 80101b95: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101b99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101ba0 <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) { 80101ba0: 55 push %ebp 80101ba1: 89 e5 mov %esp,%ebp 80101ba3: 57 push %edi 80101ba4: 56 push %esi 80101ba5: 53 push %ebx 80101ba6: 83 ec 1c sub $0x1c,%esp 80101ba9: 8b 5d 08 mov 0x8(%ebp),%ebx uint off, inum; struct dirent de; if(dp->type != T_DIR) 80101bac: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80101bb1: 0f 85 80 00 00 00 jne 80101c37 <dirlookup+0x97> panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ 80101bb7: 8b 53 58 mov 0x58(%ebx),%edx 80101bba: 31 ff xor %edi,%edi 80101bbc: 8d 75 d8 lea -0x28(%ebp),%esi 80101bbf: 85 d2 test %edx,%edx 80101bc1: 75 0d jne 80101bd0 <dirlookup+0x30> 80101bc3: eb 5b jmp 80101c20 <dirlookup+0x80> 80101bc5: 8d 76 00 lea 0x0(%esi),%esi 80101bc8: 83 c7 10 add $0x10,%edi 80101bcb: 39 7b 58 cmp %edi,0x58(%ebx) 80101bce: 76 50 jbe 80101c20 <dirlookup+0x80> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101bd0: 6a 10 push $0x10 80101bd2: 57 push %edi 80101bd3: 56 push %esi 80101bd4: 53 push %ebx 80101bd5: e8 76 fd ff ff call 80101950 <readi> 80101bda: 83 c4 10 add $0x10,%esp 80101bdd: 83 f8 10 cmp $0x10,%eax 80101be0: 75 48 jne 80101c2a <dirlookup+0x8a> panic("dirlookup read"); if(de.inum == 0) 80101be2: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101be7: 74 df je 80101bc8 <dirlookup+0x28> // Directories int namecmp(const char *s, const char *t) { return strncmp(s, t, DIRSIZ); 80101be9: 8d 45 da lea -0x26(%ebp),%eax 80101bec: 83 ec 04 sub $0x4,%esp 80101bef: 6a 0e push $0xe 80101bf1: 50 push %eax 80101bf2: ff 75 0c pushl 0xc(%ebp) 80101bf5: e8 86 29 00 00 call 80104580 <strncmp> for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlookup read"); if(de.inum == 0) continue; if(namecmp(name, de.name) == 0){ 80101bfa: 83 c4 10 add $0x10,%esp 80101bfd: 85 c0 test %eax,%eax 80101bff: 75 c7 jne 80101bc8 <dirlookup+0x28> // entry matches path element if(poff) 80101c01: 8b 45 10 mov 0x10(%ebp),%eax 80101c04: 85 c0 test %eax,%eax 80101c06: 74 05 je 80101c0d <dirlookup+0x6d> *poff = off; 80101c08: 8b 45 10 mov 0x10(%ebp),%eax 80101c0b: 89 38 mov %edi,(%eax) inum = de.inum; return iget(dp->dev, inum); 80101c0d: 0f b7 55 d8 movzwl -0x28(%ebp),%edx 80101c11: 8b 03 mov (%ebx),%eax 80101c13: e8 f8 f5 ff ff call 80101210 <iget> } } return 0; } 80101c18: 8d 65 f4 lea -0xc(%ebp),%esp 80101c1b: 5b pop %ebx 80101c1c: 5e pop %esi 80101c1d: 5f pop %edi 80101c1e: 5d pop %ebp 80101c1f: c3 ret 80101c20: 8d 65 f4 lea -0xc(%ebp),%esp inum = de.inum; return iget(dp->dev, inum); } } return 0; 80101c23: 31 c0 xor %eax,%eax } 80101c25: 5b pop %ebx 80101c26: 5e pop %esi 80101c27: 5f pop %edi 80101c28: 5d pop %ebp 80101c29: c3 ret if(dp->type != T_DIR) panic("dirlookup not DIR"); for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlookup read"); 80101c2a: 83 ec 0c sub $0xc,%esp 80101c2d: 68 79 70 10 80 push $0x80107079 80101c32: e8 39 e7 ff ff call 80100370 <panic> { uint off, inum; struct dirent de; if(dp->type != T_DIR) panic("dirlookup not DIR"); 80101c37: 83 ec 0c sub $0xc,%esp 80101c3a: 68 67 70 10 80 push $0x80107067 80101c3f: e8 2c e7 ff ff call 80100370 <panic> 80101c44: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101c4a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80101c50 <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) { 80101c50: 55 push %ebp 80101c51: 89 e5 mov %esp,%ebp 80101c53: 57 push %edi 80101c54: 56 push %esi 80101c55: 53 push %ebx 80101c56: 89 cf mov %ecx,%edi 80101c58: 89 c3 mov %eax,%ebx 80101c5a: 83 ec 1c sub $0x1c,%esp struct inode *ip, *next; if(*path == '/') 80101c5d: 80 38 2f cmpb $0x2f,(%eax) // 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) { 80101c60: 89 55 e0 mov %edx,-0x20(%ebp) struct inode *ip, *next; if(*path == '/') 80101c63: 0f 84 53 01 00 00 je 80101dbc <namex+0x16c> ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); 80101c69: e8 12 1b 00 00 call 80103780 <myproc> // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { acquire(&icache.lock); 80101c6e: 83 ec 0c sub $0xc,%esp struct inode *ip, *next; if(*path == '/') ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); 80101c71: 8b 70 68 mov 0x68(%eax),%esi // Increment reference count for ip. // Returns ip to enable ip = idup(ip1) idiom. struct inode* idup(struct inode *ip) { acquire(&icache.lock); 80101c74: 68 e0 09 11 80 push $0x801109e0 80101c79: e8 d2 26 00 00 call 80104350 <acquire> ip->ref++; 80101c7e: 83 46 08 01 addl $0x1,0x8(%esi) release(&icache.lock); 80101c82: c7 04 24 e0 09 11 80 movl $0x801109e0,(%esp) 80101c89: e8 72 27 00 00 call 80104400 <release> 80101c8e: 83 c4 10 add $0x10,%esp 80101c91: eb 08 jmp 80101c9b <namex+0x4b> 80101c93: 90 nop 80101c94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi { char *s; int len; while(*path == '/') path++; 80101c98: 83 c3 01 add $0x1,%ebx skipelem(char *path, char *name) { char *s; int len; while(*path == '/') 80101c9b: 0f b6 03 movzbl (%ebx),%eax 80101c9e: 3c 2f cmp $0x2f,%al 80101ca0: 74 f6 je 80101c98 <namex+0x48> path++; if(*path == 0) 80101ca2: 84 c0 test %al,%al 80101ca4: 0f 84 e3 00 00 00 je 80101d8d <namex+0x13d> return 0; s = path; while(*path != '/' && *path != 0) 80101caa: 0f b6 03 movzbl (%ebx),%eax 80101cad: 89 da mov %ebx,%edx 80101caf: 84 c0 test %al,%al 80101cb1: 0f 84 ac 00 00 00 je 80101d63 <namex+0x113> 80101cb7: 3c 2f cmp $0x2f,%al 80101cb9: 75 09 jne 80101cc4 <namex+0x74> 80101cbb: e9 a3 00 00 00 jmp 80101d63 <namex+0x113> 80101cc0: 84 c0 test %al,%al 80101cc2: 74 0a je 80101cce <namex+0x7e> path++; 80101cc4: 83 c2 01 add $0x1,%edx while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80101cc7: 0f b6 02 movzbl (%edx),%eax 80101cca: 3c 2f cmp $0x2f,%al 80101ccc: 75 f2 jne 80101cc0 <namex+0x70> 80101cce: 89 d1 mov %edx,%ecx 80101cd0: 29 d9 sub %ebx,%ecx path++; len = path - s; if(len >= DIRSIZ) 80101cd2: 83 f9 0d cmp $0xd,%ecx 80101cd5: 0f 8e 8d 00 00 00 jle 80101d68 <namex+0x118> memmove(name, s, DIRSIZ); 80101cdb: 83 ec 04 sub $0x4,%esp 80101cde: 89 55 e4 mov %edx,-0x1c(%ebp) 80101ce1: 6a 0e push $0xe 80101ce3: 53 push %ebx 80101ce4: 57 push %edi 80101ce5: e8 16 28 00 00 call 80104500 <memmove> path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) path++; 80101cea: 8b 55 e4 mov -0x1c(%ebp),%edx len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); 80101ced: 83 c4 10 add $0x10,%esp path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) path++; 80101cf0: 89 d3 mov %edx,%ebx memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80101cf2: 80 3a 2f cmpb $0x2f,(%edx) 80101cf5: 75 11 jne 80101d08 <namex+0xb8> 80101cf7: 89 f6 mov %esi,%esi 80101cf9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi path++; 80101d00: 83 c3 01 add $0x1,%ebx memmove(name, s, DIRSIZ); else { memmove(name, s, len); name[len] = 0; } while(*path == '/') 80101d03: 80 3b 2f cmpb $0x2f,(%ebx) 80101d06: 74 f8 je 80101d00 <namex+0xb0> ip = iget(ROOTDEV, ROOTINO); else ip = idup(myproc()->cwd); while((path = skipelem(path, name)) != 0){ ilock(ip); 80101d08: 83 ec 0c sub $0xc,%esp 80101d0b: 56 push %esi 80101d0c: e8 5f f9 ff ff call 80101670 <ilock> if(ip->type != T_DIR){ 80101d11: 83 c4 10 add $0x10,%esp 80101d14: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80101d19: 0f 85 7f 00 00 00 jne 80101d9e <namex+0x14e> iunlockput(ip); return 0; } if(nameiparent && *path == '\0'){ 80101d1f: 8b 55 e0 mov -0x20(%ebp),%edx 80101d22: 85 d2 test %edx,%edx 80101d24: 74 09 je 80101d2f <namex+0xdf> 80101d26: 80 3b 00 cmpb $0x0,(%ebx) 80101d29: 0f 84 a3 00 00 00 je 80101dd2 <namex+0x182> // Stop one level early. iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ 80101d2f: 83 ec 04 sub $0x4,%esp 80101d32: 6a 00 push $0x0 80101d34: 57 push %edi 80101d35: 56 push %esi 80101d36: e8 65 fe ff ff call 80101ba0 <dirlookup> 80101d3b: 83 c4 10 add $0x10,%esp 80101d3e: 85 c0 test %eax,%eax 80101d40: 74 5c je 80101d9e <namex+0x14e> // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { iunlock(ip); 80101d42: 83 ec 0c sub $0xc,%esp 80101d45: 89 45 e4 mov %eax,-0x1c(%ebp) 80101d48: 56 push %esi 80101d49: e8 02 fa ff ff call 80101750 <iunlock> iput(ip); 80101d4e: 89 34 24 mov %esi,(%esp) 80101d51: e8 4a fa ff ff call 801017a0 <iput> 80101d56: 8b 45 e4 mov -0x1c(%ebp),%eax 80101d59: 83 c4 10 add $0x10,%esp 80101d5c: 89 c6 mov %eax,%esi 80101d5e: e9 38 ff ff ff jmp 80101c9b <namex+0x4b> while(*path == '/') path++; if(*path == 0) return 0; s = path; while(*path != '/' && *path != 0) 80101d63: 31 c9 xor %ecx,%ecx 80101d65: 8d 76 00 lea 0x0(%esi),%esi path++; len = path - s; if(len >= DIRSIZ) memmove(name, s, DIRSIZ); else { memmove(name, s, len); 80101d68: 83 ec 04 sub $0x4,%esp 80101d6b: 89 55 dc mov %edx,-0x24(%ebp) 80101d6e: 89 4d e4 mov %ecx,-0x1c(%ebp) 80101d71: 51 push %ecx 80101d72: 53 push %ebx 80101d73: 57 push %edi 80101d74: e8 87 27 00 00 call 80104500 <memmove> name[len] = 0; 80101d79: 8b 4d e4 mov -0x1c(%ebp),%ecx 80101d7c: 8b 55 dc mov -0x24(%ebp),%edx 80101d7f: 83 c4 10 add $0x10,%esp 80101d82: c6 04 0f 00 movb $0x0,(%edi,%ecx,1) 80101d86: 89 d3 mov %edx,%ebx 80101d88: e9 65 ff ff ff jmp 80101cf2 <namex+0xa2> return 0; } iunlockput(ip); ip = next; } if(nameiparent){ 80101d8d: 8b 45 e0 mov -0x20(%ebp),%eax 80101d90: 85 c0 test %eax,%eax 80101d92: 75 54 jne 80101de8 <namex+0x198> 80101d94: 89 f0 mov %esi,%eax iput(ip); return 0; } return ip; } 80101d96: 8d 65 f4 lea -0xc(%ebp),%esp 80101d99: 5b pop %ebx 80101d9a: 5e pop %esi 80101d9b: 5f pop %edi 80101d9c: 5d pop %ebp 80101d9d: c3 ret // Common idiom: unlock, then put. void iunlockput(struct inode *ip) { iunlock(ip); 80101d9e: 83 ec 0c sub $0xc,%esp 80101da1: 56 push %esi 80101da2: e8 a9 f9 ff ff call 80101750 <iunlock> iput(ip); 80101da7: 89 34 24 mov %esi,(%esp) 80101daa: e8 f1 f9 ff ff call 801017a0 <iput> iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ iunlockput(ip); return 0; 80101daf: 83 c4 10 add $0x10,%esp if(nameiparent){ iput(ip); return 0; } return ip; } 80101db2: 8d 65 f4 lea -0xc(%ebp),%esp iunlock(ip); return ip; } if((next = dirlookup(ip, name, 0)) == 0){ iunlockput(ip); return 0; 80101db5: 31 c0 xor %eax,%eax if(nameiparent){ iput(ip); return 0; } return ip; } 80101db7: 5b pop %ebx 80101db8: 5e pop %esi 80101db9: 5f pop %edi 80101dba: 5d pop %ebp 80101dbb: c3 ret namex(char *path, int nameiparent, char *name) { struct inode *ip, *next; if(*path == '/') ip = iget(ROOTDEV, ROOTINO); 80101dbc: ba 01 00 00 00 mov $0x1,%edx 80101dc1: b8 01 00 00 00 mov $0x1,%eax 80101dc6: e8 45 f4 ff ff call 80101210 <iget> 80101dcb: 89 c6 mov %eax,%esi 80101dcd: e9 c9 fe ff ff jmp 80101c9b <namex+0x4b> iunlockput(ip); return 0; } if(nameiparent && *path == '\0'){ // Stop one level early. iunlock(ip); 80101dd2: 83 ec 0c sub $0xc,%esp 80101dd5: 56 push %esi 80101dd6: e8 75 f9 ff ff call 80101750 <iunlock> return ip; 80101ddb: 83 c4 10 add $0x10,%esp if(nameiparent){ iput(ip); return 0; } return ip; } 80101dde: 8d 65 f4 lea -0xc(%ebp),%esp return 0; } if(nameiparent && *path == '\0'){ // Stop one level early. iunlock(ip); return ip; 80101de1: 89 f0 mov %esi,%eax if(nameiparent){ iput(ip); return 0; } return ip; } 80101de3: 5b pop %ebx 80101de4: 5e pop %esi 80101de5: 5f pop %edi 80101de6: 5d pop %ebp 80101de7: c3 ret } iunlockput(ip); ip = next; } if(nameiparent){ iput(ip); 80101de8: 83 ec 0c sub $0xc,%esp 80101deb: 56 push %esi 80101dec: e8 af f9 ff ff call 801017a0 <iput> return 0; 80101df1: 83 c4 10 add $0x10,%esp 80101df4: 31 c0 xor %eax,%eax 80101df6: eb 9e jmp 80101d96 <namex+0x146> 80101df8: 90 nop 80101df9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101e00 <dirlink>: } // Write a new directory entry (name, inum) into the directory dp. int dirlink(struct inode *dp, char *name, uint inum) { 80101e00: 55 push %ebp 80101e01: 89 e5 mov %esp,%ebp 80101e03: 57 push %edi 80101e04: 56 push %esi 80101e05: 53 push %ebx 80101e06: 83 ec 20 sub $0x20,%esp 80101e09: 8b 5d 08 mov 0x8(%ebp),%ebx int off; struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ 80101e0c: 6a 00 push $0x0 80101e0e: ff 75 0c pushl 0xc(%ebp) 80101e11: 53 push %ebx 80101e12: e8 89 fd ff ff call 80101ba0 <dirlookup> 80101e17: 83 c4 10 add $0x10,%esp 80101e1a: 85 c0 test %eax,%eax 80101e1c: 75 67 jne 80101e85 <dirlink+0x85> iput(ip); return -1; } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ 80101e1e: 8b 7b 58 mov 0x58(%ebx),%edi 80101e21: 8d 75 d8 lea -0x28(%ebp),%esi 80101e24: 85 ff test %edi,%edi 80101e26: 74 29 je 80101e51 <dirlink+0x51> 80101e28: 31 ff xor %edi,%edi 80101e2a: 8d 75 d8 lea -0x28(%ebp),%esi 80101e2d: eb 09 jmp 80101e38 <dirlink+0x38> 80101e2f: 90 nop 80101e30: 83 c7 10 add $0x10,%edi 80101e33: 39 7b 58 cmp %edi,0x58(%ebx) 80101e36: 76 19 jbe 80101e51 <dirlink+0x51> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101e38: 6a 10 push $0x10 80101e3a: 57 push %edi 80101e3b: 56 push %esi 80101e3c: 53 push %ebx 80101e3d: e8 0e fb ff ff call 80101950 <readi> 80101e42: 83 c4 10 add $0x10,%esp 80101e45: 83 f8 10 cmp $0x10,%eax 80101e48: 75 4e jne 80101e98 <dirlink+0x98> panic("dirlink read"); if(de.inum == 0) 80101e4a: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80101e4f: 75 df jne 80101e30 <dirlink+0x30> break; } strncpy(de.name, name, DIRSIZ); 80101e51: 8d 45 da lea -0x26(%ebp),%eax 80101e54: 83 ec 04 sub $0x4,%esp 80101e57: 6a 0e push $0xe 80101e59: ff 75 0c pushl 0xc(%ebp) 80101e5c: 50 push %eax 80101e5d: e8 8e 27 00 00 call 801045f0 <strncpy> de.inum = inum; 80101e62: 8b 45 10 mov 0x10(%ebp),%eax if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101e65: 6a 10 push $0x10 80101e67: 57 push %edi 80101e68: 56 push %esi 80101e69: 53 push %ebx if(de.inum == 0) break; } strncpy(de.name, name, DIRSIZ); de.inum = inum; 80101e6a: 66 89 45 d8 mov %ax,-0x28(%ebp) if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80101e6e: e8 dd fb ff ff call 80101a50 <writei> 80101e73: 83 c4 20 add $0x20,%esp 80101e76: 83 f8 10 cmp $0x10,%eax 80101e79: 75 2a jne 80101ea5 <dirlink+0xa5> panic("dirlink"); return 0; 80101e7b: 31 c0 xor %eax,%eax } 80101e7d: 8d 65 f4 lea -0xc(%ebp),%esp 80101e80: 5b pop %ebx 80101e81: 5e pop %esi 80101e82: 5f pop %edi 80101e83: 5d pop %ebp 80101e84: c3 ret struct dirent de; struct inode *ip; // Check that name is not present. if((ip = dirlookup(dp, name, 0)) != 0){ iput(ip); 80101e85: 83 ec 0c sub $0xc,%esp 80101e88: 50 push %eax 80101e89: e8 12 f9 ff ff call 801017a0 <iput> return -1; 80101e8e: 83 c4 10 add $0x10,%esp 80101e91: b8 ff ff ff ff mov $0xffffffff,%eax 80101e96: eb e5 jmp 80101e7d <dirlink+0x7d> } // Look for an empty dirent. for(off = 0; off < dp->size; off += sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink read"); 80101e98: 83 ec 0c sub $0xc,%esp 80101e9b: 68 88 70 10 80 push $0x80107088 80101ea0: e8 cb e4 ff ff call 80100370 <panic> } strncpy(de.name, name, DIRSIZ); de.inum = inum; if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("dirlink"); 80101ea5: 83 ec 0c sub $0xc,%esp 80101ea8: 68 c2 76 10 80 push $0x801076c2 80101ead: e8 be e4 ff ff call 80100370 <panic> 80101eb2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80101eb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101ec0 <namei>: return ip; } struct inode* namei(char *path) { 80101ec0: 55 push %ebp char name[DIRSIZ]; return namex(path, 0, name); 80101ec1: 31 d2 xor %edx,%edx return ip; } struct inode* namei(char *path) { 80101ec3: 89 e5 mov %esp,%ebp 80101ec5: 83 ec 18 sub $0x18,%esp char name[DIRSIZ]; return namex(path, 0, name); 80101ec8: 8b 45 08 mov 0x8(%ebp),%eax 80101ecb: 8d 4d ea lea -0x16(%ebp),%ecx 80101ece: e8 7d fd ff ff call 80101c50 <namex> } 80101ed3: c9 leave 80101ed4: c3 ret 80101ed5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101ed9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101ee0 <nameiparent>: struct inode* nameiparent(char *path, char *name) { 80101ee0: 55 push %ebp return namex(path, 1, name); 80101ee1: ba 01 00 00 00 mov $0x1,%edx return namex(path, 0, name); } struct inode* nameiparent(char *path, char *name) { 80101ee6: 89 e5 mov %esp,%ebp return namex(path, 1, name); 80101ee8: 8b 4d 0c mov 0xc(%ebp),%ecx 80101eeb: 8b 45 08 mov 0x8(%ebp),%eax } 80101eee: 5d pop %ebp } struct inode* nameiparent(char *path, char *name) { return namex(path, 1, name); 80101eef: e9 5c fd ff ff jmp 80101c50 <namex> 80101ef4: 66 90 xchg %ax,%ax 80101ef6: 66 90 xchg %ax,%ax 80101ef8: 66 90 xchg %ax,%ax 80101efa: 66 90 xchg %ax,%ax 80101efc: 66 90 xchg %ax,%ax 80101efe: 66 90 xchg %ax,%ax 80101f00 <idestart>: } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80101f00: 55 push %ebp if(b == 0) 80101f01: 85 c0 test %eax,%eax } // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { 80101f03: 89 e5 mov %esp,%ebp 80101f05: 56 push %esi 80101f06: 53 push %ebx if(b == 0) 80101f07: 0f 84 ad 00 00 00 je 80101fba <idestart+0xba> panic("idestart"); if(b->blockno >= FSSIZE) 80101f0d: 8b 58 08 mov 0x8(%eax),%ebx 80101f10: 89 c1 mov %eax,%ecx 80101f12: 81 fb e7 03 00 00 cmp $0x3e7,%ebx 80101f18: 0f 87 8f 00 00 00 ja 80101fad <idestart+0xad> static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80101f1e: ba f7 01 00 00 mov $0x1f7,%edx 80101f23: 90 nop 80101f24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80101f28: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80101f29: 83 e0 c0 and $0xffffffc0,%eax 80101f2c: 3c 40 cmp $0x40,%al 80101f2e: 75 f8 jne 80101f28 <idestart+0x28> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80101f30: 31 f6 xor %esi,%esi 80101f32: ba f6 03 00 00 mov $0x3f6,%edx 80101f37: 89 f0 mov %esi,%eax 80101f39: ee out %al,(%dx) 80101f3a: ba f2 01 00 00 mov $0x1f2,%edx 80101f3f: b8 01 00 00 00 mov $0x1,%eax 80101f44: ee out %al,(%dx) 80101f45: ba f3 01 00 00 mov $0x1f3,%edx 80101f4a: 89 d8 mov %ebx,%eax 80101f4c: ee out %al,(%dx) 80101f4d: 89 d8 mov %ebx,%eax 80101f4f: ba f4 01 00 00 mov $0x1f4,%edx 80101f54: c1 f8 08 sar $0x8,%eax 80101f57: ee out %al,(%dx) 80101f58: ba f5 01 00 00 mov $0x1f5,%edx 80101f5d: 89 f0 mov %esi,%eax 80101f5f: ee out %al,(%dx) 80101f60: 0f b6 41 04 movzbl 0x4(%ecx),%eax 80101f64: ba f6 01 00 00 mov $0x1f6,%edx 80101f69: 83 e0 01 and $0x1,%eax 80101f6c: c1 e0 04 shl $0x4,%eax 80101f6f: 83 c8 e0 or $0xffffffe0,%eax 80101f72: ee out %al,(%dx) outb(0x1f2, sector_per_block); // number of sectors outb(0x1f3, sector & 0xff); outb(0x1f4, (sector >> 8) & 0xff); outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); if(b->flags & B_DIRTY){ 80101f73: f6 01 04 testb $0x4,(%ecx) 80101f76: ba f7 01 00 00 mov $0x1f7,%edx 80101f7b: 75 13 jne 80101f90 <idestart+0x90> 80101f7d: b8 20 00 00 00 mov $0x20,%eax 80101f82: ee out %al,(%dx) outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); } else { outb(0x1f7, read_cmd); } } 80101f83: 8d 65 f8 lea -0x8(%ebp),%esp 80101f86: 5b pop %ebx 80101f87: 5e pop %esi 80101f88: 5d pop %ebp 80101f89: c3 ret 80101f8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80101f90: b8 30 00 00 00 mov $0x30,%eax 80101f95: ee out %al,(%dx) } static inline void outsl(int port, const void *addr, int cnt) { asm volatile("cld; rep outsl" : 80101f96: ba f0 01 00 00 mov $0x1f0,%edx outb(0x1f4, (sector >> 8) & 0xff); outb(0x1f5, (sector >> 16) & 0xff); outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); if(b->flags & B_DIRTY){ outb(0x1f7, write_cmd); outsl(0x1f0, b->data, BSIZE/4); 80101f9b: 8d 71 5c lea 0x5c(%ecx),%esi 80101f9e: b9 80 00 00 00 mov $0x80,%ecx 80101fa3: fc cld 80101fa4: f3 6f rep outsl %ds:(%esi),(%dx) } else { outb(0x1f7, read_cmd); } } 80101fa6: 8d 65 f8 lea -0x8(%ebp),%esp 80101fa9: 5b pop %ebx 80101faa: 5e pop %esi 80101fab: 5d pop %ebp 80101fac: c3 ret idestart(struct buf *b) { if(b == 0) panic("idestart"); if(b->blockno >= FSSIZE) panic("incorrect blockno"); 80101fad: 83 ec 0c sub $0xc,%esp 80101fb0: 68 f4 70 10 80 push $0x801070f4 80101fb5: e8 b6 e3 ff ff call 80100370 <panic> // Start the request for b. Caller must hold idelock. static void idestart(struct buf *b) { if(b == 0) panic("idestart"); 80101fba: 83 ec 0c sub $0xc,%esp 80101fbd: 68 eb 70 10 80 push $0x801070eb 80101fc2: e8 a9 e3 ff ff call 80100370 <panic> 80101fc7: 89 f6 mov %esi,%esi 80101fc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80101fd0 <ideinit>: return 0; } void ideinit(void) { 80101fd0: 55 push %ebp 80101fd1: 89 e5 mov %esp,%ebp 80101fd3: 83 ec 10 sub $0x10,%esp int i; initlock(&idelock, "ide"); 80101fd6: 68 06 71 10 80 push $0x80107106 80101fdb: 68 80 a5 10 80 push $0x8010a580 80101fe0: e8 0b 22 00 00 call 801041f0 <initlock> ioapicenable(IRQ_IDE, ncpu - 1); 80101fe5: 58 pop %eax 80101fe6: a1 00 2d 11 80 mov 0x80112d00,%eax 80101feb: 5a pop %edx 80101fec: 83 e8 01 sub $0x1,%eax 80101fef: 50 push %eax 80101ff0: 6a 0e push $0xe 80101ff2: e8 a9 02 00 00 call 801022a0 <ioapicenable> 80101ff7: 83 c4 10 add $0x10,%esp static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80101ffa: ba f7 01 00 00 mov $0x1f7,%edx 80101fff: 90 nop 80102000: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 80102001: 83 e0 c0 and $0xffffffc0,%eax 80102004: 3c 40 cmp $0x40,%al 80102006: 75 f8 jne 80102000 <ideinit+0x30> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102008: ba f6 01 00 00 mov $0x1f6,%edx 8010200d: b8 f0 ff ff ff mov $0xfffffff0,%eax 80102012: ee out %al,(%dx) 80102013: b9 e8 03 00 00 mov $0x3e8,%ecx static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102018: ba f7 01 00 00 mov $0x1f7,%edx 8010201d: eb 06 jmp 80102025 <ideinit+0x55> 8010201f: 90 nop ioapicenable(IRQ_IDE, ncpu - 1); idewait(0); // Check if disk 1 is present outb(0x1f6, 0xe0 | (1<<4)); for(i=0; i<1000; i++){ 80102020: 83 e9 01 sub $0x1,%ecx 80102023: 74 0f je 80102034 <ideinit+0x64> 80102025: ec in (%dx),%al if(inb(0x1f7) != 0){ 80102026: 84 c0 test %al,%al 80102028: 74 f6 je 80102020 <ideinit+0x50> havedisk1 = 1; 8010202a: c7 05 60 a5 10 80 01 movl $0x1,0x8010a560 80102031: 00 00 00 } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102034: ba f6 01 00 00 mov $0x1f6,%edx 80102039: b8 e0 ff ff ff mov $0xffffffe0,%eax 8010203e: ee out %al,(%dx) } } // Switch back to disk 0. outb(0x1f6, 0xe0 | (0<<4)); } 8010203f: c9 leave 80102040: c3 ret 80102041: eb 0d jmp 80102050 <ideintr> 80102043: 90 nop 80102044: 90 nop 80102045: 90 nop 80102046: 90 nop 80102047: 90 nop 80102048: 90 nop 80102049: 90 nop 8010204a: 90 nop 8010204b: 90 nop 8010204c: 90 nop 8010204d: 90 nop 8010204e: 90 nop 8010204f: 90 nop 80102050 <ideintr>: } // Interrupt handler. void ideintr(void) { 80102050: 55 push %ebp 80102051: 89 e5 mov %esp,%ebp 80102053: 57 push %edi 80102054: 56 push %esi 80102055: 53 push %ebx 80102056: 83 ec 18 sub $0x18,%esp struct buf *b; // First queued buffer is the active request. acquire(&idelock); 80102059: 68 80 a5 10 80 push $0x8010a580 8010205e: e8 ed 22 00 00 call 80104350 <acquire> if((b = idequeue) == 0){ 80102063: 8b 1d 64 a5 10 80 mov 0x8010a564,%ebx 80102069: 83 c4 10 add $0x10,%esp 8010206c: 85 db test %ebx,%ebx 8010206e: 74 34 je 801020a4 <ideintr+0x54> release(&idelock); return; } idequeue = b->qnext; 80102070: 8b 43 58 mov 0x58(%ebx),%eax 80102073: a3 64 a5 10 80 mov %eax,0x8010a564 // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) 80102078: 8b 33 mov (%ebx),%esi 8010207a: f7 c6 04 00 00 00 test $0x4,%esi 80102080: 74 3e je 801020c0 <ideintr+0x70> insl(0x1f0, b->data, BSIZE/4); // Wake process waiting for this buf. b->flags |= B_VALID; b->flags &= ~B_DIRTY; 80102082: 83 e6 fb and $0xfffffffb,%esi wakeup(b); 80102085: 83 ec 0c sub $0xc,%esp if(!(b->flags & B_DIRTY) && idewait(1) >= 0) insl(0x1f0, b->data, BSIZE/4); // Wake process waiting for this buf. b->flags |= B_VALID; b->flags &= ~B_DIRTY; 80102088: 83 ce 02 or $0x2,%esi 8010208b: 89 33 mov %esi,(%ebx) wakeup(b); 8010208d: 53 push %ebx 8010208e: e8 4d 1e 00 00 call 80103ee0 <wakeup> // Start disk on next buf in queue. if(idequeue != 0) 80102093: a1 64 a5 10 80 mov 0x8010a564,%eax 80102098: 83 c4 10 add $0x10,%esp 8010209b: 85 c0 test %eax,%eax 8010209d: 74 05 je 801020a4 <ideintr+0x54> idestart(idequeue); 8010209f: e8 5c fe ff ff call 80101f00 <idestart> // First queued buffer is the active request. acquire(&idelock); if((b = idequeue) == 0){ release(&idelock); 801020a4: 83 ec 0c sub $0xc,%esp 801020a7: 68 80 a5 10 80 push $0x8010a580 801020ac: e8 4f 23 00 00 call 80104400 <release> // Start disk on next buf in queue. if(idequeue != 0) idestart(idequeue); release(&idelock); } 801020b1: 8d 65 f4 lea -0xc(%ebp),%esp 801020b4: 5b pop %ebx 801020b5: 5e pop %esi 801020b6: 5f pop %edi 801020b7: 5d pop %ebp 801020b8: c3 ret 801020b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801020c0: ba f7 01 00 00 mov $0x1f7,%edx 801020c5: 8d 76 00 lea 0x0(%esi),%esi 801020c8: ec in (%dx),%al static int idewait(int checkerr) { int r; while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 801020c9: 89 c1 mov %eax,%ecx 801020cb: 83 e1 c0 and $0xffffffc0,%ecx 801020ce: 80 f9 40 cmp $0x40,%cl 801020d1: 75 f5 jne 801020c8 <ideintr+0x78> ; if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0) 801020d3: a8 21 test $0x21,%al 801020d5: 75 ab jne 80102082 <ideintr+0x32> } idequeue = b->qnext; // Read data if needed. if(!(b->flags & B_DIRTY) && idewait(1) >= 0) insl(0x1f0, b->data, BSIZE/4); 801020d7: 8d 7b 5c lea 0x5c(%ebx),%edi } static inline void insl(int port, void *addr, int cnt) { asm volatile("cld; rep insl" : 801020da: b9 80 00 00 00 mov $0x80,%ecx 801020df: ba f0 01 00 00 mov $0x1f0,%edx 801020e4: fc cld 801020e5: f3 6d rep insl (%dx),%es:(%edi) 801020e7: 8b 33 mov (%ebx),%esi 801020e9: eb 97 jmp 80102082 <ideintr+0x32> 801020eb: 90 nop 801020ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801020f0 <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) { 801020f0: 55 push %ebp 801020f1: 89 e5 mov %esp,%ebp 801020f3: 53 push %ebx 801020f4: 83 ec 10 sub $0x10,%esp 801020f7: 8b 5d 08 mov 0x8(%ebp),%ebx struct buf **pp; if(!holdingsleep(&b->lock)) 801020fa: 8d 43 0c lea 0xc(%ebx),%eax 801020fd: 50 push %eax 801020fe: e8 9d 20 00 00 call 801041a0 <holdingsleep> 80102103: 83 c4 10 add $0x10,%esp 80102106: 85 c0 test %eax,%eax 80102108: 0f 84 ad 00 00 00 je 801021bb <iderw+0xcb> panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) 8010210e: 8b 03 mov (%ebx),%eax 80102110: 83 e0 06 and $0x6,%eax 80102113: 83 f8 02 cmp $0x2,%eax 80102116: 0f 84 b9 00 00 00 je 801021d5 <iderw+0xe5> panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) 8010211c: 8b 53 04 mov 0x4(%ebx),%edx 8010211f: 85 d2 test %edx,%edx 80102121: 74 0d je 80102130 <iderw+0x40> 80102123: a1 60 a5 10 80 mov 0x8010a560,%eax 80102128: 85 c0 test %eax,%eax 8010212a: 0f 84 98 00 00 00 je 801021c8 <iderw+0xd8> panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock 80102130: 83 ec 0c sub $0xc,%esp 80102133: 68 80 a5 10 80 push $0x8010a580 80102138: e8 13 22 00 00 call 80104350 <acquire> // Append b to idequeue. b->qnext = 0; for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 8010213d: 8b 15 64 a5 10 80 mov 0x8010a564,%edx 80102143: 83 c4 10 add $0x10,%esp panic("iderw: ide disk 1 not present"); acquire(&idelock); //DOC:acquire-lock // Append b to idequeue. b->qnext = 0; 80102146: c7 43 58 00 00 00 00 movl $0x0,0x58(%ebx) for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 8010214d: 85 d2 test %edx,%edx 8010214f: 75 09 jne 8010215a <iderw+0x6a> 80102151: eb 58 jmp 801021ab <iderw+0xbb> 80102153: 90 nop 80102154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102158: 89 c2 mov %eax,%edx 8010215a: 8b 42 58 mov 0x58(%edx),%eax 8010215d: 85 c0 test %eax,%eax 8010215f: 75 f7 jne 80102158 <iderw+0x68> 80102161: 83 c2 58 add $0x58,%edx ; *pp = b; 80102164: 89 1a mov %ebx,(%edx) // Start disk if necessary. if(idequeue == b) 80102166: 3b 1d 64 a5 10 80 cmp 0x8010a564,%ebx 8010216c: 74 44 je 801021b2 <iderw+0xc2> idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 8010216e: 8b 03 mov (%ebx),%eax 80102170: 83 e0 06 and $0x6,%eax 80102173: 83 f8 02 cmp $0x2,%eax 80102176: 74 23 je 8010219b <iderw+0xab> 80102178: 90 nop 80102179: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi sleep(b, &idelock); 80102180: 83 ec 08 sub $0x8,%esp 80102183: 68 80 a5 10 80 push $0x8010a580 80102188: 53 push %ebx 80102189: e8 a2 1b 00 00 call 80103d30 <sleep> // Start disk if necessary. if(idequeue == b) idestart(b); // Wait for request to finish. while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ 8010218e: 8b 03 mov (%ebx),%eax 80102190: 83 c4 10 add $0x10,%esp 80102193: 83 e0 06 and $0x6,%eax 80102196: 83 f8 02 cmp $0x2,%eax 80102199: 75 e5 jne 80102180 <iderw+0x90> sleep(b, &idelock); } release(&idelock); 8010219b: c7 45 08 80 a5 10 80 movl $0x8010a580,0x8(%ebp) } 801021a2: 8b 5d fc mov -0x4(%ebp),%ebx 801021a5: c9 leave while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ sleep(b, &idelock); } release(&idelock); 801021a6: e9 55 22 00 00 jmp 80104400 <release> acquire(&idelock); //DOC:acquire-lock // Append b to idequeue. b->qnext = 0; for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue 801021ab: ba 64 a5 10 80 mov $0x8010a564,%edx 801021b0: eb b2 jmp 80102164 <iderw+0x74> ; *pp = b; // Start disk if necessary. if(idequeue == b) idestart(b); 801021b2: 89 d8 mov %ebx,%eax 801021b4: e8 47 fd ff ff call 80101f00 <idestart> 801021b9: eb b3 jmp 8010216e <iderw+0x7e> iderw(struct buf *b) { struct buf **pp; if(!holdingsleep(&b->lock)) panic("iderw: buf not locked"); 801021bb: 83 ec 0c sub $0xc,%esp 801021be: 68 0a 71 10 80 push $0x8010710a 801021c3: e8 a8 e1 ff ff call 80100370 <panic> if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) panic("iderw: nothing to do"); if(b->dev != 0 && !havedisk1) panic("iderw: ide disk 1 not present"); 801021c8: 83 ec 0c sub $0xc,%esp 801021cb: 68 35 71 10 80 push $0x80107135 801021d0: e8 9b e1 ff ff call 80100370 <panic> struct buf **pp; if(!holdingsleep(&b->lock)) panic("iderw: buf not locked"); if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) panic("iderw: nothing to do"); 801021d5: 83 ec 0c sub $0xc,%esp 801021d8: 68 20 71 10 80 push $0x80107120 801021dd: e8 8e e1 ff ff call 80100370 <panic> 801021e2: 66 90 xchg %ax,%ax 801021e4: 66 90 xchg %ax,%ax 801021e6: 66 90 xchg %ax,%ax 801021e8: 66 90 xchg %ax,%ax 801021ea: 66 90 xchg %ax,%ax 801021ec: 66 90 xchg %ax,%ax 801021ee: 66 90 xchg %ax,%ax 801021f0 <ioapicinit>: ioapic->data = data; } void ioapicinit(void) { 801021f0: 55 push %ebp int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; 801021f1: c7 05 34 26 11 80 00 movl $0xfec00000,0x80112634 801021f8: 00 c0 fe ioapic->data = data; } void ioapicinit(void) { 801021fb: 89 e5 mov %esp,%ebp 801021fd: 56 push %esi 801021fe: 53 push %ebx }; static uint ioapicread(int reg) { ioapic->reg = reg; 801021ff: c7 05 00 00 c0 fe 01 movl $0x1,0xfec00000 80102206: 00 00 00 return ioapic->data; 80102209: 8b 15 34 26 11 80 mov 0x80112634,%edx 8010220f: 8b 72 10 mov 0x10(%edx),%esi }; static uint ioapicread(int reg) { ioapic->reg = reg; 80102212: c7 02 00 00 00 00 movl $0x0,(%edx) return ioapic->data; 80102218: 8b 0d 34 26 11 80 mov 0x80112634,%ecx int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if(id != ioapicid) 8010221e: 0f b6 15 60 27 11 80 movzbl 0x80112760,%edx ioapicinit(void) { int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; 80102225: 89 f0 mov %esi,%eax 80102227: c1 e8 10 shr $0x10,%eax 8010222a: 0f b6 f0 movzbl %al,%esi static uint ioapicread(int reg) { ioapic->reg = reg; return ioapic->data; 8010222d: 8b 41 10 mov 0x10(%ecx),%eax int i, id, maxintr; ioapic = (volatile struct ioapic*)IOAPIC; maxintr = (ioapicread(REG_VER) >> 16) & 0xFF; id = ioapicread(REG_ID) >> 24; if(id != ioapicid) 80102230: c1 e8 18 shr $0x18,%eax 80102233: 39 d0 cmp %edx,%eax 80102235: 74 16 je 8010224d <ioapicinit+0x5d> cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n"); 80102237: 83 ec 0c sub $0xc,%esp 8010223a: 68 54 71 10 80 push $0x80107154 8010223f: e8 1c e4 ff ff call 80100660 <cprintf> 80102244: 8b 0d 34 26 11 80 mov 0x80112634,%ecx 8010224a: 83 c4 10 add $0x10,%esp 8010224d: 83 c6 21 add $0x21,%esi ioapic->data = data; } void ioapicinit(void) { 80102250: ba 10 00 00 00 mov $0x10,%edx 80102255: b8 20 00 00 00 mov $0x20,%eax 8010225a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 80102260: 89 11 mov %edx,(%ecx) ioapic->data = data; 80102262: 8b 0d 34 26 11 80 mov 0x80112634,%ecx 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++){ ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); 80102268: 89 c3 mov %eax,%ebx 8010226a: 81 cb 00 00 01 00 or $0x10000,%ebx 80102270: 83 c0 01 add $0x1,%eax static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; 80102273: 89 59 10 mov %ebx,0x10(%ecx) 80102276: 8d 5a 01 lea 0x1(%edx),%ebx 80102279: 83 c2 02 add $0x2,%edx 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++){ 8010227c: 39 f0 cmp %esi,%eax } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 8010227e: 89 19 mov %ebx,(%ecx) ioapic->data = data; 80102280: 8b 0d 34 26 11 80 mov 0x80112634,%ecx 80102286: c7 41 10 00 00 00 00 movl $0x0,0x10(%ecx) 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++){ 8010228d: 75 d1 jne 80102260 <ioapicinit+0x70> ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i)); ioapicwrite(REG_TABLE+2*i+1, 0); } } 8010228f: 8d 65 f8 lea -0x8(%ebp),%esp 80102292: 5b pop %ebx 80102293: 5e pop %esi 80102294: 5d pop %ebp 80102295: c3 ret 80102296: 8d 76 00 lea 0x0(%esi),%esi 80102299: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801022a0 <ioapicenable>: void ioapicenable(int irq, int cpunum) { 801022a0: 55 push %ebp } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022a1: 8b 0d 34 26 11 80 mov 0x80112634,%ecx } } void ioapicenable(int irq, int cpunum) { 801022a7: 89 e5 mov %esp,%ebp 801022a9: 8b 45 08 mov 0x8(%ebp),%eax // 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); 801022ac: 8d 50 20 lea 0x20(%eax),%edx 801022af: 8d 44 00 10 lea 0x10(%eax,%eax,1),%eax } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022b3: 89 01 mov %eax,(%ecx) ioapic->data = data; 801022b5: 8b 0d 34 26 11 80 mov 0x80112634,%ecx } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022bb: 83 c0 01 add $0x1,%eax ioapic->data = data; 801022be: 89 51 10 mov %edx,0x10(%ecx) { // 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); 801022c1: 8b 55 0c mov 0xc(%ebp),%edx } static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; 801022c4: 89 01 mov %eax,(%ecx) ioapic->data = data; 801022c6: a1 34 26 11 80 mov 0x80112634,%eax { // 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); 801022cb: c1 e2 18 shl $0x18,%edx static void ioapicwrite(int reg, uint data) { ioapic->reg = reg; ioapic->data = data; 801022ce: 89 50 10 mov %edx,0x10(%eax) // 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); } 801022d1: 5d pop %ebp 801022d2: c3 ret 801022d3: 66 90 xchg %ax,%ax 801022d5: 66 90 xchg %ax,%ax 801022d7: 66 90 xchg %ax,%ax 801022d9: 66 90 xchg %ax,%ax 801022db: 66 90 xchg %ax,%ax 801022dd: 66 90 xchg %ax,%ax 801022df: 90 nop 801022e0 <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) { 801022e0: 55 push %ebp 801022e1: 89 e5 mov %esp,%ebp 801022e3: 53 push %ebx 801022e4: 83 ec 04 sub $0x4,%esp 801022e7: 8b 5d 08 mov 0x8(%ebp),%ebx struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) 801022ea: f7 c3 ff 0f 00 00 test $0xfff,%ebx 801022f0: 75 70 jne 80102362 <kfree+0x82> 801022f2: 81 fb a8 54 11 80 cmp $0x801154a8,%ebx 801022f8: 72 68 jb 80102362 <kfree+0x82> 801022fa: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 80102300: 3d ff ff ff 0d cmp $0xdffffff,%eax 80102305: 77 5b ja 80102362 <kfree+0x82> panic("kfree"); // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); 80102307: 83 ec 04 sub $0x4,%esp 8010230a: 68 00 10 00 00 push $0x1000 8010230f: 6a 01 push $0x1 80102311: 53 push %ebx 80102312: e8 39 21 00 00 call 80104450 <memset> if(kmem.use_lock) 80102317: 8b 15 74 26 11 80 mov 0x80112674,%edx 8010231d: 83 c4 10 add $0x10,%esp 80102320: 85 d2 test %edx,%edx 80102322: 75 2c jne 80102350 <kfree+0x70> acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; 80102324: a1 78 26 11 80 mov 0x80112678,%eax 80102329: 89 03 mov %eax,(%ebx) kmem.freelist = r; if(kmem.use_lock) 8010232b: a1 74 26 11 80 mov 0x80112674,%eax if(kmem.use_lock) acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; 80102330: 89 1d 78 26 11 80 mov %ebx,0x80112678 if(kmem.use_lock) 80102336: 85 c0 test %eax,%eax 80102338: 75 06 jne 80102340 <kfree+0x60> release(&kmem.lock); } 8010233a: 8b 5d fc mov -0x4(%ebp),%ebx 8010233d: c9 leave 8010233e: c3 ret 8010233f: 90 nop acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; if(kmem.use_lock) release(&kmem.lock); 80102340: c7 45 08 40 26 11 80 movl $0x80112640,0x8(%ebp) } 80102347: 8b 5d fc mov -0x4(%ebp),%ebx 8010234a: c9 leave acquire(&kmem.lock); r = (struct run*)v; r->next = kmem.freelist; kmem.freelist = r; if(kmem.use_lock) release(&kmem.lock); 8010234b: e9 b0 20 00 00 jmp 80104400 <release> // Fill with junk to catch dangling refs. memset(v, 1, PGSIZE); if(kmem.use_lock) acquire(&kmem.lock); 80102350: 83 ec 0c sub $0xc,%esp 80102353: 68 40 26 11 80 push $0x80112640 80102358: e8 f3 1f 00 00 call 80104350 <acquire> 8010235d: 83 c4 10 add $0x10,%esp 80102360: eb c2 jmp 80102324 <kfree+0x44> kfree(char *v) { struct run *r; if((uint)v % PGSIZE || v < end || V2P(v) >= PHYSTOP) panic("kfree"); 80102362: 83 ec 0c sub $0xc,%esp 80102365: 68 86 71 10 80 push $0x80107186 8010236a: e8 01 e0 ff ff call 80100370 <panic> 8010236f: 90 nop 80102370 <freerange>: kmem.use_lock = 1; } void freerange(void *vstart, void *vend) { 80102370: 55 push %ebp 80102371: 89 e5 mov %esp,%ebp 80102373: 56 push %esi 80102374: 53 push %ebx char *p; p = (char*)PGROUNDUP((uint)vstart); 80102375: 8b 45 08 mov 0x8(%ebp),%eax kmem.use_lock = 1; } void freerange(void *vstart, void *vend) { 80102378: 8b 75 0c mov 0xc(%ebp),%esi char *p; p = (char*)PGROUNDUP((uint)vstart); 8010237b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102381: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102387: 81 c3 00 10 00 00 add $0x1000,%ebx 8010238d: 39 de cmp %ebx,%esi 8010238f: 72 23 jb 801023b4 <freerange+0x44> 80102391: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 80102398: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax 8010239e: 83 ec 0c sub $0xc,%esp void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801023a1: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 801023a7: 50 push %eax 801023a8: e8 33 ff ff ff call 801022e0 <kfree> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801023ad: 83 c4 10 add $0x10,%esp 801023b0: 39 f3 cmp %esi,%ebx 801023b2: 76 e4 jbe 80102398 <freerange+0x28> kfree(p); } 801023b4: 8d 65 f8 lea -0x8(%ebp),%esp 801023b7: 5b pop %ebx 801023b8: 5e pop %esi 801023b9: 5d pop %ebp 801023ba: c3 ret 801023bb: 90 nop 801023bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801023c0 <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) { 801023c0: 55 push %ebp 801023c1: 89 e5 mov %esp,%ebp 801023c3: 56 push %esi 801023c4: 53 push %ebx 801023c5: 8b 75 0c mov 0xc(%ebp),%esi initlock(&kmem.lock, "kmem"); 801023c8: 83 ec 08 sub $0x8,%esp 801023cb: 68 8c 71 10 80 push $0x8010718c 801023d0: 68 40 26 11 80 push $0x80112640 801023d5: e8 16 1e 00 00 call 801041f0 <initlock> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); 801023da: 8b 45 08 mov 0x8(%ebp),%eax for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801023dd: 83 c4 10 add $0x10,%esp // after installing a full page table that maps them on all cores. void kinit1(void *vstart, void *vend) { initlock(&kmem.lock, "kmem"); kmem.use_lock = 0; 801023e0: c7 05 74 26 11 80 00 movl $0x0,0x80112674 801023e7: 00 00 00 void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); 801023ea: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 801023f0: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 801023f6: 81 c3 00 10 00 00 add $0x1000,%ebx 801023fc: 39 de cmp %ebx,%esi 801023fe: 72 1c jb 8010241c <kinit1+0x5c> kfree(p); 80102400: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax 80102406: 83 ec 0c sub $0xc,%esp void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102409: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 8010240f: 50 push %eax 80102410: e8 cb fe ff ff call 801022e0 <kfree> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102415: 83 c4 10 add $0x10,%esp 80102418: 39 de cmp %ebx,%esi 8010241a: 73 e4 jae 80102400 <kinit1+0x40> kinit1(void *vstart, void *vend) { initlock(&kmem.lock, "kmem"); kmem.use_lock = 0; freerange(vstart, vend); } 8010241c: 8d 65 f8 lea -0x8(%ebp),%esp 8010241f: 5b pop %ebx 80102420: 5e pop %esi 80102421: 5d pop %ebp 80102422: c3 ret 80102423: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102430 <kinit2>: void kinit2(void *vstart, void *vend) { 80102430: 55 push %ebp 80102431: 89 e5 mov %esp,%ebp 80102433: 56 push %esi 80102434: 53 push %ebx void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); 80102435: 8b 45 08 mov 0x8(%ebp),%eax freerange(vstart, vend); } void kinit2(void *vstart, void *vend) { 80102438: 8b 75 0c mov 0xc(%ebp),%esi void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); 8010243b: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80102441: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102447: 81 c3 00 10 00 00 add $0x1000,%ebx 8010244d: 39 de cmp %ebx,%esi 8010244f: 72 23 jb 80102474 <kinit2+0x44> 80102451: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi kfree(p); 80102458: 8d 83 00 f0 ff ff lea -0x1000(%ebx),%eax 8010245e: 83 ec 0c sub $0xc,%esp void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 80102461: 81 c3 00 10 00 00 add $0x1000,%ebx kfree(p); 80102467: 50 push %eax 80102468: e8 73 fe ff ff call 801022e0 <kfree> void freerange(void *vstart, void *vend) { char *p; p = (char*)PGROUNDUP((uint)vstart); for(; p + PGSIZE <= (char*)vend; p += PGSIZE) 8010246d: 83 c4 10 add $0x10,%esp 80102470: 39 de cmp %ebx,%esi 80102472: 73 e4 jae 80102458 <kinit2+0x28> void kinit2(void *vstart, void *vend) { freerange(vstart, vend); kmem.use_lock = 1; 80102474: c7 05 74 26 11 80 01 movl $0x1,0x80112674 8010247b: 00 00 00 } 8010247e: 8d 65 f8 lea -0x8(%ebp),%esp 80102481: 5b pop %ebx 80102482: 5e pop %esi 80102483: 5d pop %ebp 80102484: c3 ret 80102485: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102489: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102490 <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) { 80102490: 55 push %ebp 80102491: 89 e5 mov %esp,%ebp 80102493: 53 push %ebx 80102494: 83 ec 04 sub $0x4,%esp struct run *r; if(kmem.use_lock) 80102497: a1 74 26 11 80 mov 0x80112674,%eax 8010249c: 85 c0 test %eax,%eax 8010249e: 75 30 jne 801024d0 <kalloc+0x40> acquire(&kmem.lock); r = kmem.freelist; 801024a0: 8b 1d 78 26 11 80 mov 0x80112678,%ebx if(r) 801024a6: 85 db test %ebx,%ebx 801024a8: 74 1c je 801024c6 <kalloc+0x36> kmem.freelist = r->next; 801024aa: 8b 13 mov (%ebx),%edx 801024ac: 89 15 78 26 11 80 mov %edx,0x80112678 if(kmem.use_lock) 801024b2: 85 c0 test %eax,%eax 801024b4: 74 10 je 801024c6 <kalloc+0x36> release(&kmem.lock); 801024b6: 83 ec 0c sub $0xc,%esp 801024b9: 68 40 26 11 80 push $0x80112640 801024be: e8 3d 1f 00 00 call 80104400 <release> 801024c3: 83 c4 10 add $0x10,%esp return (char*)r; } 801024c6: 89 d8 mov %ebx,%eax 801024c8: 8b 5d fc mov -0x4(%ebp),%ebx 801024cb: c9 leave 801024cc: c3 ret 801024cd: 8d 76 00 lea 0x0(%esi),%esi kalloc(void) { struct run *r; if(kmem.use_lock) acquire(&kmem.lock); 801024d0: 83 ec 0c sub $0xc,%esp 801024d3: 68 40 26 11 80 push $0x80112640 801024d8: e8 73 1e 00 00 call 80104350 <acquire> r = kmem.freelist; 801024dd: 8b 1d 78 26 11 80 mov 0x80112678,%ebx if(r) 801024e3: 83 c4 10 add $0x10,%esp 801024e6: a1 74 26 11 80 mov 0x80112674,%eax 801024eb: 85 db test %ebx,%ebx 801024ed: 75 bb jne 801024aa <kalloc+0x1a> 801024ef: eb c1 jmp 801024b2 <kalloc+0x22> 801024f1: 66 90 xchg %ax,%ax 801024f3: 66 90 xchg %ax,%ax 801024f5: 66 90 xchg %ax,%ax 801024f7: 66 90 xchg %ax,%ax 801024f9: 66 90 xchg %ax,%ax 801024fb: 66 90 xchg %ax,%ax 801024fd: 66 90 xchg %ax,%ax 801024ff: 90 nop 80102500 <kbdgetc>: #include "defs.h" #include "kbd.h" int kbdgetc(void) { 80102500: 55 push %ebp static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102501: ba 64 00 00 00 mov $0x64,%edx 80102506: 89 e5 mov %esp,%ebp 80102508: ec in (%dx),%al normalmap, shiftmap, ctlmap, ctlmap }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) 80102509: a8 01 test $0x1,%al 8010250b: 0f 84 af 00 00 00 je 801025c0 <kbdgetc+0xc0> 80102511: ba 60 00 00 00 mov $0x60,%edx 80102516: ec in (%dx),%al return -1; data = inb(KBDATAP); 80102517: 0f b6 d0 movzbl %al,%edx if(data == 0xE0){ 8010251a: 81 fa e0 00 00 00 cmp $0xe0,%edx 80102520: 74 7e je 801025a0 <kbdgetc+0xa0> shift |= E0ESC; return 0; } else if(data & 0x80){ 80102522: 84 c0 test %al,%al // Key released data = (shift & E0ESC ? data : data & 0x7F); 80102524: 8b 0d b4 a5 10 80 mov 0x8010a5b4,%ecx data = inb(KBDATAP); if(data == 0xE0){ shift |= E0ESC; return 0; } else if(data & 0x80){ 8010252a: 79 24 jns 80102550 <kbdgetc+0x50> // Key released data = (shift & E0ESC ? data : data & 0x7F); 8010252c: f6 c1 40 test $0x40,%cl 8010252f: 75 05 jne 80102536 <kbdgetc+0x36> 80102531: 89 c2 mov %eax,%edx 80102533: 83 e2 7f and $0x7f,%edx shift &= ~(shiftcode[data] | E0ESC); 80102536: 0f b6 82 c0 72 10 80 movzbl -0x7fef8d40(%edx),%eax 8010253d: 83 c8 40 or $0x40,%eax 80102540: 0f b6 c0 movzbl %al,%eax 80102543: f7 d0 not %eax 80102545: 21 c8 and %ecx,%eax 80102547: a3 b4 a5 10 80 mov %eax,0x8010a5b4 return 0; 8010254c: 31 c0 xor %eax,%eax c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 8010254e: 5d pop %ebp 8010254f: c3 ret } else if(data & 0x80){ // Key released data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); return 0; } else if(shift & E0ESC){ 80102550: f6 c1 40 test $0x40,%cl 80102553: 74 09 je 8010255e <kbdgetc+0x5e> // Last character was an E0 escape; or with 0x80 data |= 0x80; 80102555: 83 c8 80 or $0xffffff80,%eax shift &= ~E0ESC; 80102558: 83 e1 bf and $0xffffffbf,%ecx data = (shift & E0ESC ? data : data & 0x7F); shift &= ~(shiftcode[data] | E0ESC); return 0; } else if(shift & E0ESC){ // Last character was an E0 escape; or with 0x80 data |= 0x80; 8010255b: 0f b6 d0 movzbl %al,%edx shift &= ~E0ESC; } shift |= shiftcode[data]; shift ^= togglecode[data]; 8010255e: 0f b6 82 c0 72 10 80 movzbl -0x7fef8d40(%edx),%eax 80102565: 09 c1 or %eax,%ecx 80102567: 0f b6 82 c0 71 10 80 movzbl -0x7fef8e40(%edx),%eax 8010256e: 31 c1 xor %eax,%ecx c = charcode[shift & (CTL | SHIFT)][data]; 80102570: 89 c8 mov %ecx,%eax data |= 0x80; shift &= ~E0ESC; } shift |= shiftcode[data]; shift ^= togglecode[data]; 80102572: 89 0d b4 a5 10 80 mov %ecx,0x8010a5b4 c = charcode[shift & (CTL | SHIFT)][data]; 80102578: 83 e0 03 and $0x3,%eax if(shift & CAPSLOCK){ 8010257b: 83 e1 08 and $0x8,%ecx shift &= ~E0ESC; } shift |= shiftcode[data]; shift ^= togglecode[data]; c = charcode[shift & (CTL | SHIFT)][data]; 8010257e: 8b 04 85 a0 71 10 80 mov -0x7fef8e60(,%eax,4),%eax 80102585: 0f b6 04 10 movzbl (%eax,%edx,1),%eax if(shift & CAPSLOCK){ 80102589: 74 c3 je 8010254e <kbdgetc+0x4e> if('a' <= c && c <= 'z') 8010258b: 8d 50 9f lea -0x61(%eax),%edx 8010258e: 83 fa 19 cmp $0x19,%edx 80102591: 77 1d ja 801025b0 <kbdgetc+0xb0> c += 'A' - 'a'; 80102593: 83 e8 20 sub $0x20,%eax else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 80102596: 5d pop %ebp 80102597: c3 ret 80102598: 90 nop 80102599: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return -1; data = inb(KBDATAP); if(data == 0xE0){ shift |= E0ESC; return 0; 801025a0: 31 c0 xor %eax,%eax if((st & KBS_DIB) == 0) return -1; data = inb(KBDATAP); if(data == 0xE0){ shift |= E0ESC; 801025a2: 83 0d b4 a5 10 80 40 orl $0x40,0x8010a5b4 c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 801025a9: 5d pop %ebp 801025aa: c3 ret 801025ab: 90 nop 801025ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi shift ^= togglecode[data]; c = charcode[shift & (CTL | SHIFT)][data]; if(shift & CAPSLOCK){ if('a' <= c && c <= 'z') c += 'A' - 'a'; else if('A' <= c && c <= 'Z') 801025b0: 8d 48 bf lea -0x41(%eax),%ecx c += 'a' - 'A'; 801025b3: 8d 50 20 lea 0x20(%eax),%edx } return c; } 801025b6: 5d pop %ebp c = charcode[shift & (CTL | SHIFT)][data]; if(shift & CAPSLOCK){ if('a' <= c && c <= 'z') c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; 801025b7: 83 f9 19 cmp $0x19,%ecx 801025ba: 0f 46 c2 cmovbe %edx,%eax } return c; } 801025bd: c3 ret 801025be: 66 90 xchg %ax,%ax }; uint st, data, c; st = inb(KBSTATP); if((st & KBS_DIB) == 0) return -1; 801025c0: b8 ff ff ff ff mov $0xffffffff,%eax c += 'A' - 'a'; else if('A' <= c && c <= 'Z') c += 'a' - 'A'; } return c; } 801025c5: 5d pop %ebp 801025c6: c3 ret 801025c7: 89 f6 mov %esi,%esi 801025c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801025d0 <kbdintr>: void kbdintr(void) { 801025d0: 55 push %ebp 801025d1: 89 e5 mov %esp,%ebp 801025d3: 83 ec 14 sub $0x14,%esp consoleintr(kbdgetc); 801025d6: 68 00 25 10 80 push $0x80102500 801025db: e8 10 e2 ff ff call 801007f0 <consoleintr> } 801025e0: 83 c4 10 add $0x10,%esp 801025e3: c9 leave 801025e4: c3 ret 801025e5: 66 90 xchg %ax,%ax 801025e7: 66 90 xchg %ax,%ax 801025e9: 66 90 xchg %ax,%ax 801025eb: 66 90 xchg %ax,%ax 801025ed: 66 90 xchg %ax,%ax 801025ef: 90 nop 801025f0 <lapicinit>: } void lapicinit(void) { if(!lapic) 801025f0: a1 7c 26 11 80 mov 0x8011267c,%eax lapic[ID]; // wait for write to finish, by reading } void lapicinit(void) { 801025f5: 55 push %ebp 801025f6: 89 e5 mov %esp,%ebp if(!lapic) 801025f8: 85 c0 test %eax,%eax 801025fa: 0f 84 c8 00 00 00 je 801026c8 <lapicinit+0xd8> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102600: c7 80 f0 00 00 00 3f movl $0x13f,0xf0(%eax) 80102607: 01 00 00 lapic[ID]; // wait for write to finish, by reading 8010260a: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010260d: c7 80 e0 03 00 00 0b movl $0xb,0x3e0(%eax) 80102614: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102617: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010261a: c7 80 20 03 00 00 20 movl $0x20020,0x320(%eax) 80102621: 00 02 00 lapic[ID]; // wait for write to finish, by reading 80102624: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102627: c7 80 80 03 00 00 80 movl $0x989680,0x380(%eax) 8010262e: 96 98 00 lapic[ID]; // wait for write to finish, by reading 80102631: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102634: c7 80 50 03 00 00 00 movl $0x10000,0x350(%eax) 8010263b: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010263e: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102641: c7 80 60 03 00 00 00 movl $0x10000,0x360(%eax) 80102648: 00 01 00 lapic[ID]; // wait for write to finish, by reading 8010264b: 8b 50 20 mov 0x20(%eax),%edx lapicw(LINT0, MASKED); lapicw(LINT1, MASKED); // Disable performance counter overflow interrupts // on machines that provide that interrupt entry. if(((lapic[VER]>>16) & 0xFF) >= 4) 8010264e: 8b 50 30 mov 0x30(%eax),%edx 80102651: c1 ea 10 shr $0x10,%edx 80102654: 80 fa 03 cmp $0x3,%dl 80102657: 77 77 ja 801026d0 <lapicinit+0xe0> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102659: c7 80 70 03 00 00 33 movl $0x33,0x370(%eax) 80102660: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102663: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102666: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010266d: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102670: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102673: c7 80 80 02 00 00 00 movl $0x0,0x280(%eax) 8010267a: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010267d: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102680: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80102687: 00 00 00 lapic[ID]; // wait for write to finish, by reading 8010268a: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010268d: c7 80 10 03 00 00 00 movl $0x0,0x310(%eax) 80102694: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102697: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010269a: c7 80 00 03 00 00 00 movl $0x88500,0x300(%eax) 801026a1: 85 08 00 lapic[ID]; // wait for write to finish, by reading 801026a4: 8b 50 20 mov 0x20(%eax),%edx 801026a7: 89 f6 mov %esi,%esi 801026a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi lapicw(EOI, 0); // Send an Init Level De-Assert to synchronise arbitration ID's. lapicw(ICRHI, 0); lapicw(ICRLO, BCAST | INIT | LEVEL); while(lapic[ICRLO] & DELIVS) 801026b0: 8b 90 00 03 00 00 mov 0x300(%eax),%edx 801026b6: 80 e6 10 and $0x10,%dh 801026b9: 75 f5 jne 801026b0 <lapicinit+0xc0> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801026bb: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax) 801026c2: 00 00 00 lapic[ID]; // wait for write to finish, by reading 801026c5: 8b 40 20 mov 0x20(%eax),%eax while(lapic[ICRLO] & DELIVS) ; // Enable interrupts on the APIC (but not on the processor). lapicw(TPR, 0); } 801026c8: 5d pop %ebp 801026c9: c3 ret 801026ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801026d0: c7 80 40 03 00 00 00 movl $0x10000,0x340(%eax) 801026d7: 00 01 00 lapic[ID]; // wait for write to finish, by reading 801026da: 8b 50 20 mov 0x20(%eax),%edx 801026dd: e9 77 ff ff ff jmp 80102659 <lapicinit+0x69> 801026e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801026e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801026f0 <lapicid>: } int lapicid(void) { if (!lapic) 801026f0: a1 7c 26 11 80 mov 0x8011267c,%eax lapicw(TPR, 0); } int lapicid(void) { 801026f5: 55 push %ebp 801026f6: 89 e5 mov %esp,%ebp if (!lapic) 801026f8: 85 c0 test %eax,%eax 801026fa: 74 0c je 80102708 <lapicid+0x18> return 0; return lapic[ID] >> 24; 801026fc: 8b 40 20 mov 0x20(%eax),%eax } 801026ff: 5d pop %ebp int lapicid(void) { if (!lapic) return 0; return lapic[ID] >> 24; 80102700: c1 e8 18 shr $0x18,%eax } 80102703: c3 ret 80102704: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int lapicid(void) { if (!lapic) return 0; 80102708: 31 c0 xor %eax,%eax return lapic[ID] >> 24; } 8010270a: 5d pop %ebp 8010270b: c3 ret 8010270c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102710 <lapiceoi>: // Acknowledge interrupt. void lapiceoi(void) { if(lapic) 80102710: a1 7c 26 11 80 mov 0x8011267c,%eax } // Acknowledge interrupt. void lapiceoi(void) { 80102715: 55 push %ebp 80102716: 89 e5 mov %esp,%ebp if(lapic) 80102718: 85 c0 test %eax,%eax 8010271a: 74 0d je 80102729 <lapiceoi+0x19> //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010271c: c7 80 b0 00 00 00 00 movl $0x0,0xb0(%eax) 80102723: 00 00 00 lapic[ID]; // wait for write to finish, by reading 80102726: 8b 40 20 mov 0x20(%eax),%eax void lapiceoi(void) { if(lapic) lapicw(EOI, 0); } 80102729: 5d pop %ebp 8010272a: c3 ret 8010272b: 90 nop 8010272c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102730 <microdelay>: // Spin for a given number of microseconds. // On real hardware would want to tune this dynamically. void microdelay(int us) { 80102730: 55 push %ebp 80102731: 89 e5 mov %esp,%ebp } 80102733: 5d pop %ebp 80102734: c3 ret 80102735: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102739: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102740 <lapicstartap>: // Start additional processor running entry code at addr. // See Appendix B of MultiProcessor Specification. void lapicstartap(uchar apicid, uint addr) { 80102740: 55 push %ebp } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102741: ba 70 00 00 00 mov $0x70,%edx 80102746: b8 0f 00 00 00 mov $0xf,%eax 8010274b: 89 e5 mov %esp,%ebp 8010274d: 53 push %ebx 8010274e: 8b 4d 0c mov 0xc(%ebp),%ecx 80102751: 8b 5d 08 mov 0x8(%ebp),%ebx 80102754: ee out %al,(%dx) 80102755: ba 71 00 00 00 mov $0x71,%edx 8010275a: b8 0a 00 00 00 mov $0xa,%eax 8010275f: ee out %al,(%dx) // 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 outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; 80102760: 31 c0 xor %eax,%eax //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102762: c1 e3 18 shl $0x18,%ebx // 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 outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; 80102765: 66 a3 67 04 00 80 mov %ax,0x80000467 wrv[1] = addr >> 4; 8010276b: 89 c8 mov %ecx,%eax // 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++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); 8010276d: c1 e9 0c shr $0xc,%ecx // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; wrv[1] = addr >> 4; 80102770: c1 e8 04 shr $0x4,%eax //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102773: 89 da mov %ebx,%edx // 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++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); 80102775: 80 cd 06 or $0x6,%ch // the AP startup code prior to the [universal startup algorithm]." outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code outb(CMOS_PORT+1, 0x0A); wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector wrv[0] = 0; wrv[1] = addr >> 4; 80102778: 66 a3 69 04 00 80 mov %ax,0x80000469 //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010277e: a1 7c 26 11 80 mov 0x8011267c,%eax 80102783: 89 98 10 03 00 00 mov %ebx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 80102789: 8b 58 20 mov 0x20(%eax),%ebx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 8010278c: c7 80 00 03 00 00 00 movl $0xc500,0x300(%eax) 80102793: c5 00 00 lapic[ID]; // wait for write to finish, by reading 80102796: 8b 58 20 mov 0x20(%eax),%ebx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 80102799: c7 80 00 03 00 00 00 movl $0x8500,0x300(%eax) 801027a0: 85 00 00 lapic[ID]; // wait for write to finish, by reading 801027a3: 8b 58 20 mov 0x20(%eax),%ebx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027a6: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 801027ac: 8b 58 20 mov 0x20(%eax),%ebx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027af: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 801027b5: 8b 58 20 mov 0x20(%eax),%ebx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027b8: 89 90 10 03 00 00 mov %edx,0x310(%eax) lapic[ID]; // wait for write to finish, by reading 801027be: 8b 50 20 mov 0x20(%eax),%edx //PAGEBREAK! static void lapicw(int index, int value) { lapic[index] = value; 801027c1: 89 88 00 03 00 00 mov %ecx,0x300(%eax) lapic[ID]; // wait for write to finish, by reading 801027c7: 8b 40 20 mov 0x20(%eax),%eax for(i = 0; i < 2; i++){ lapicw(ICRHI, apicid<<24); lapicw(ICRLO, STARTUP | (addr>>12)); microdelay(200); } } 801027ca: 5b pop %ebx 801027cb: 5d pop %ebp 801027cc: c3 ret 801027cd: 8d 76 00 lea 0x0(%esi),%esi 801027d0 <cmostime>: } // qemu seems to use 24-hour GWT and the values are BCD encoded void cmostime(struct rtcdate *r) { 801027d0: 55 push %ebp 801027d1: ba 70 00 00 00 mov $0x70,%edx 801027d6: b8 0b 00 00 00 mov $0xb,%eax 801027db: 89 e5 mov %esp,%ebp 801027dd: 57 push %edi 801027de: 56 push %esi 801027df: 53 push %ebx 801027e0: 83 ec 4c sub $0x4c,%esp 801027e3: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801027e4: ba 71 00 00 00 mov $0x71,%edx 801027e9: ec in (%dx),%al 801027ea: 83 e0 04 and $0x4,%eax 801027ed: 8d 75 d0 lea -0x30(%ebp),%esi } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801027f0: 31 db xor %ebx,%ebx 801027f2: 88 45 b7 mov %al,-0x49(%ebp) 801027f5: bf 70 00 00 00 mov $0x70,%edi 801027fa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102800: 89 d8 mov %ebx,%eax 80102802: 89 fa mov %edi,%edx 80102804: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102805: b9 71 00 00 00 mov $0x71,%ecx 8010280a: 89 ca mov %ecx,%edx 8010280c: ec in (%dx),%al } static void fill_rtcdate(struct rtcdate *r) { r->second = cmos_read(SECS); 8010280d: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102810: 89 fa mov %edi,%edx 80102812: 89 45 b8 mov %eax,-0x48(%ebp) 80102815: b8 02 00 00 00 mov $0x2,%eax 8010281a: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010281b: 89 ca mov %ecx,%edx 8010281d: ec in (%dx),%al r->minute = cmos_read(MINS); 8010281e: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102821: 89 fa mov %edi,%edx 80102823: 89 45 bc mov %eax,-0x44(%ebp) 80102826: b8 04 00 00 00 mov $0x4,%eax 8010282b: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010282c: 89 ca mov %ecx,%edx 8010282e: ec in (%dx),%al r->hour = cmos_read(HOURS); 8010282f: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102832: 89 fa mov %edi,%edx 80102834: 89 45 c0 mov %eax,-0x40(%ebp) 80102837: b8 07 00 00 00 mov $0x7,%eax 8010283c: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010283d: 89 ca mov %ecx,%edx 8010283f: ec in (%dx),%al r->day = cmos_read(DAY); 80102840: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102843: 89 fa mov %edi,%edx 80102845: 89 45 c4 mov %eax,-0x3c(%ebp) 80102848: b8 08 00 00 00 mov $0x8,%eax 8010284d: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010284e: 89 ca mov %ecx,%edx 80102850: ec in (%dx),%al r->month = cmos_read(MONTH); 80102851: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102854: 89 fa mov %edi,%edx 80102856: 89 45 c8 mov %eax,-0x38(%ebp) 80102859: b8 09 00 00 00 mov $0x9,%eax 8010285e: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010285f: 89 ca mov %ecx,%edx 80102861: ec in (%dx),%al r->year = cmos_read(YEAR); 80102862: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102865: 89 fa mov %edi,%edx 80102867: 89 45 cc mov %eax,-0x34(%ebp) 8010286a: b8 0a 00 00 00 mov $0xa,%eax 8010286f: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80102870: 89 ca mov %ecx,%edx 80102872: ec in (%dx),%al bcd = (sb & (1 << 2)) == 0; // make sure CMOS doesn't modify time while we read it for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) 80102873: 84 c0 test %al,%al 80102875: 78 89 js 80102800 <cmostime+0x30> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102877: 89 d8 mov %ebx,%eax 80102879: 89 fa mov %edi,%edx 8010287b: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010287c: 89 ca mov %ecx,%edx 8010287e: ec in (%dx),%al } static void fill_rtcdate(struct rtcdate *r) { r->second = cmos_read(SECS); 8010287f: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102882: 89 fa mov %edi,%edx 80102884: 89 45 d0 mov %eax,-0x30(%ebp) 80102887: b8 02 00 00 00 mov $0x2,%eax 8010288c: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010288d: 89 ca mov %ecx,%edx 8010288f: ec in (%dx),%al r->minute = cmos_read(MINS); 80102890: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80102893: 89 fa mov %edi,%edx 80102895: 89 45 d4 mov %eax,-0x2c(%ebp) 80102898: b8 04 00 00 00 mov $0x4,%eax 8010289d: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 8010289e: 89 ca mov %ecx,%edx 801028a0: ec in (%dx),%al r->hour = cmos_read(HOURS); 801028a1: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028a4: 89 fa mov %edi,%edx 801028a6: 89 45 d8 mov %eax,-0x28(%ebp) 801028a9: b8 07 00 00 00 mov $0x7,%eax 801028ae: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028af: 89 ca mov %ecx,%edx 801028b1: ec in (%dx),%al r->day = cmos_read(DAY); 801028b2: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028b5: 89 fa mov %edi,%edx 801028b7: 89 45 dc mov %eax,-0x24(%ebp) 801028ba: b8 08 00 00 00 mov $0x8,%eax 801028bf: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028c0: 89 ca mov %ecx,%edx 801028c2: ec in (%dx),%al r->month = cmos_read(MONTH); 801028c3: 0f b6 c0 movzbl %al,%eax } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 801028c6: 89 fa mov %edi,%edx 801028c8: 89 45 e0 mov %eax,-0x20(%ebp) 801028cb: b8 09 00 00 00 mov $0x9,%eax 801028d0: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801028d1: 89 ca mov %ecx,%edx 801028d3: ec in (%dx),%al r->year = cmos_read(YEAR); 801028d4: 0f b6 c0 movzbl %al,%eax for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if(memcmp(&t1, &t2, sizeof(t1)) == 0) 801028d7: 83 ec 04 sub $0x4,%esp r->second = cmos_read(SECS); r->minute = cmos_read(MINS); r->hour = cmos_read(HOURS); r->day = cmos_read(DAY); r->month = cmos_read(MONTH); r->year = cmos_read(YEAR); 801028da: 89 45 e4 mov %eax,-0x1c(%ebp) for(;;) { fill_rtcdate(&t1); if(cmos_read(CMOS_STATA) & CMOS_UIP) continue; fill_rtcdate(&t2); if(memcmp(&t1, &t2, sizeof(t1)) == 0) 801028dd: 8d 45 b8 lea -0x48(%ebp),%eax 801028e0: 6a 18 push $0x18 801028e2: 56 push %esi 801028e3: 50 push %eax 801028e4: e8 b7 1b 00 00 call 801044a0 <memcmp> 801028e9: 83 c4 10 add $0x10,%esp 801028ec: 85 c0 test %eax,%eax 801028ee: 0f 85 0c ff ff ff jne 80102800 <cmostime+0x30> break; } // convert if(bcd) { 801028f4: 80 7d b7 00 cmpb $0x0,-0x49(%ebp) 801028f8: 75 78 jne 80102972 <cmostime+0x1a2> #define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf)) CONV(second); 801028fa: 8b 45 b8 mov -0x48(%ebp),%eax 801028fd: 89 c2 mov %eax,%edx 801028ff: 83 e0 0f and $0xf,%eax 80102902: c1 ea 04 shr $0x4,%edx 80102905: 8d 14 92 lea (%edx,%edx,4),%edx 80102908: 8d 04 50 lea (%eax,%edx,2),%eax 8010290b: 89 45 b8 mov %eax,-0x48(%ebp) CONV(minute); 8010290e: 8b 45 bc mov -0x44(%ebp),%eax 80102911: 89 c2 mov %eax,%edx 80102913: 83 e0 0f and $0xf,%eax 80102916: c1 ea 04 shr $0x4,%edx 80102919: 8d 14 92 lea (%edx,%edx,4),%edx 8010291c: 8d 04 50 lea (%eax,%edx,2),%eax 8010291f: 89 45 bc mov %eax,-0x44(%ebp) CONV(hour ); 80102922: 8b 45 c0 mov -0x40(%ebp),%eax 80102925: 89 c2 mov %eax,%edx 80102927: 83 e0 0f and $0xf,%eax 8010292a: c1 ea 04 shr $0x4,%edx 8010292d: 8d 14 92 lea (%edx,%edx,4),%edx 80102930: 8d 04 50 lea (%eax,%edx,2),%eax 80102933: 89 45 c0 mov %eax,-0x40(%ebp) CONV(day ); 80102936: 8b 45 c4 mov -0x3c(%ebp),%eax 80102939: 89 c2 mov %eax,%edx 8010293b: 83 e0 0f and $0xf,%eax 8010293e: c1 ea 04 shr $0x4,%edx 80102941: 8d 14 92 lea (%edx,%edx,4),%edx 80102944: 8d 04 50 lea (%eax,%edx,2),%eax 80102947: 89 45 c4 mov %eax,-0x3c(%ebp) CONV(month ); 8010294a: 8b 45 c8 mov -0x38(%ebp),%eax 8010294d: 89 c2 mov %eax,%edx 8010294f: 83 e0 0f and $0xf,%eax 80102952: c1 ea 04 shr $0x4,%edx 80102955: 8d 14 92 lea (%edx,%edx,4),%edx 80102958: 8d 04 50 lea (%eax,%edx,2),%eax 8010295b: 89 45 c8 mov %eax,-0x38(%ebp) CONV(year ); 8010295e: 8b 45 cc mov -0x34(%ebp),%eax 80102961: 89 c2 mov %eax,%edx 80102963: 83 e0 0f and $0xf,%eax 80102966: c1 ea 04 shr $0x4,%edx 80102969: 8d 14 92 lea (%edx,%edx,4),%edx 8010296c: 8d 04 50 lea (%eax,%edx,2),%eax 8010296f: 89 45 cc mov %eax,-0x34(%ebp) #undef CONV } *r = t1; 80102972: 8b 75 08 mov 0x8(%ebp),%esi 80102975: 8b 45 b8 mov -0x48(%ebp),%eax 80102978: 89 06 mov %eax,(%esi) 8010297a: 8b 45 bc mov -0x44(%ebp),%eax 8010297d: 89 46 04 mov %eax,0x4(%esi) 80102980: 8b 45 c0 mov -0x40(%ebp),%eax 80102983: 89 46 08 mov %eax,0x8(%esi) 80102986: 8b 45 c4 mov -0x3c(%ebp),%eax 80102989: 89 46 0c mov %eax,0xc(%esi) 8010298c: 8b 45 c8 mov -0x38(%ebp),%eax 8010298f: 89 46 10 mov %eax,0x10(%esi) 80102992: 8b 45 cc mov -0x34(%ebp),%eax 80102995: 89 46 14 mov %eax,0x14(%esi) r->year += 2000; 80102998: 81 46 14 d0 07 00 00 addl $0x7d0,0x14(%esi) } 8010299f: 8d 65 f4 lea -0xc(%ebp),%esp 801029a2: 5b pop %ebx 801029a3: 5e pop %esi 801029a4: 5f pop %edi 801029a5: 5d pop %ebp 801029a6: c3 ret 801029a7: 66 90 xchg %ax,%ax 801029a9: 66 90 xchg %ax,%ax 801029ab: 66 90 xchg %ax,%ax 801029ad: 66 90 xchg %ax,%ax 801029af: 90 nop 801029b0 <install_trans>: static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 801029b0: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx 801029b6: 85 c9 test %ecx,%ecx 801029b8: 0f 8e 85 00 00 00 jle 80102a43 <install_trans+0x93> } // Copy committed blocks from log to their home location static void install_trans(void) { 801029be: 55 push %ebp 801029bf: 89 e5 mov %esp,%ebp 801029c1: 57 push %edi 801029c2: 56 push %esi 801029c3: 53 push %ebx 801029c4: 31 db xor %ebx,%ebx 801029c6: 83 ec 0c sub $0xc,%esp 801029c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi int tail; for (tail = 0; tail < log.lh.n; tail++) { struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block 801029d0: a1 b4 26 11 80 mov 0x801126b4,%eax 801029d5: 83 ec 08 sub $0x8,%esp 801029d8: 01 d8 add %ebx,%eax 801029da: 83 c0 01 add $0x1,%eax 801029dd: 50 push %eax 801029de: ff 35 c4 26 11 80 pushl 0x801126c4 801029e4: e8 e7 d6 ff ff call 801000d0 <bread> 801029e9: 89 c7 mov %eax,%edi struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801029eb: 58 pop %eax 801029ec: 5a pop %edx 801029ed: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4) 801029f4: ff 35 c4 26 11 80 pushl 0x801126c4 static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 801029fa: 83 c3 01 add $0x1,%ebx struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst 801029fd: e8 ce d6 ff ff call 801000d0 <bread> 80102a02: 89 c6 mov %eax,%esi memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst 80102a04: 8d 47 5c lea 0x5c(%edi),%eax 80102a07: 83 c4 0c add $0xc,%esp 80102a0a: 68 00 02 00 00 push $0x200 80102a0f: 50 push %eax 80102a10: 8d 46 5c lea 0x5c(%esi),%eax 80102a13: 50 push %eax 80102a14: e8 e7 1a 00 00 call 80104500 <memmove> bwrite(dbuf); // write dst to disk 80102a19: 89 34 24 mov %esi,(%esp) 80102a1c: e8 7f d7 ff ff call 801001a0 <bwrite> brelse(lbuf); 80102a21: 89 3c 24 mov %edi,(%esp) 80102a24: e8 b7 d7 ff ff call 801001e0 <brelse> brelse(dbuf); 80102a29: 89 34 24 mov %esi,(%esp) 80102a2c: e8 af d7 ff ff call 801001e0 <brelse> static void install_trans(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102a31: 83 c4 10 add $0x10,%esp 80102a34: 39 1d c8 26 11 80 cmp %ebx,0x801126c8 80102a3a: 7f 94 jg 801029d0 <install_trans+0x20> memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst bwrite(dbuf); // write dst to disk brelse(lbuf); brelse(dbuf); } } 80102a3c: 8d 65 f4 lea -0xc(%ebp),%esp 80102a3f: 5b pop %ebx 80102a40: 5e pop %esi 80102a41: 5f pop %edi 80102a42: 5d pop %ebp 80102a43: f3 c3 repz ret 80102a45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80102a49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102a50 <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) { 80102a50: 55 push %ebp 80102a51: 89 e5 mov %esp,%ebp 80102a53: 53 push %ebx 80102a54: 83 ec 0c sub $0xc,%esp struct buf *buf = bread(log.dev, log.start); 80102a57: ff 35 b4 26 11 80 pushl 0x801126b4 80102a5d: ff 35 c4 26 11 80 pushl 0x801126c4 80102a63: e8 68 d6 ff ff call 801000d0 <bread> struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; 80102a68: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx for (i = 0; i < log.lh.n; i++) { 80102a6e: 83 c4 10 add $0x10,%esp // This is the true point at which the // current transaction commits. static void write_head(void) { struct buf *buf = bread(log.dev, log.start); 80102a71: 89 c3 mov %eax,%ebx struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; for (i = 0; i < log.lh.n; i++) { 80102a73: 85 c9 test %ecx,%ecx write_head(void) { struct buf *buf = bread(log.dev, log.start); struct logheader *hb = (struct logheader *) (buf->data); int i; hb->n = log.lh.n; 80102a75: 89 48 5c mov %ecx,0x5c(%eax) for (i = 0; i < log.lh.n; i++) { 80102a78: 7e 1f jle 80102a99 <write_head+0x49> 80102a7a: 8d 04 8d 00 00 00 00 lea 0x0(,%ecx,4),%eax 80102a81: 31 d2 xor %edx,%edx 80102a83: 90 nop 80102a84: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi hb->block[i] = log.lh.block[i]; 80102a88: 8b 8a cc 26 11 80 mov -0x7feed934(%edx),%ecx 80102a8e: 89 4c 13 60 mov %ecx,0x60(%ebx,%edx,1) 80102a92: 83 c2 04 add $0x4,%edx { 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++) { 80102a95: 39 c2 cmp %eax,%edx 80102a97: 75 ef jne 80102a88 <write_head+0x38> hb->block[i] = log.lh.block[i]; } bwrite(buf); 80102a99: 83 ec 0c sub $0xc,%esp 80102a9c: 53 push %ebx 80102a9d: e8 fe d6 ff ff call 801001a0 <bwrite> brelse(buf); 80102aa2: 89 1c 24 mov %ebx,(%esp) 80102aa5: e8 36 d7 ff ff call 801001e0 <brelse> } 80102aaa: 8b 5d fc mov -0x4(%ebp),%ebx 80102aad: c9 leave 80102aae: c3 ret 80102aaf: 90 nop 80102ab0 <initlog>: static void recover_from_log(void); static void commit(); void initlog(int dev) { 80102ab0: 55 push %ebp 80102ab1: 89 e5 mov %esp,%ebp 80102ab3: 53 push %ebx 80102ab4: 83 ec 2c sub $0x2c,%esp 80102ab7: 8b 5d 08 mov 0x8(%ebp),%ebx if (sizeof(struct logheader) >= BSIZE) panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); 80102aba: 68 c0 73 10 80 push $0x801073c0 80102abf: 68 80 26 11 80 push $0x80112680 80102ac4: e8 27 17 00 00 call 801041f0 <initlock> readsb(dev, &sb); 80102ac9: 58 pop %eax 80102aca: 8d 45 dc lea -0x24(%ebp),%eax 80102acd: 5a pop %edx 80102ace: 50 push %eax 80102acf: 53 push %ebx 80102ad0: e8 db e8 ff ff call 801013b0 <readsb> log.start = sb.logstart; log.size = sb.nlog; 80102ad5: 8b 55 e8 mov -0x18(%ebp),%edx panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); readsb(dev, &sb); log.start = sb.logstart; 80102ad8: 8b 45 ec mov -0x14(%ebp),%eax // Read the log header from disk into the in-memory log header static void read_head(void) { struct buf *buf = bread(log.dev, log.start); 80102adb: 59 pop %ecx struct superblock sb; initlock(&log.lock, "log"); readsb(dev, &sb); log.start = sb.logstart; log.size = sb.nlog; log.dev = dev; 80102adc: 89 1d c4 26 11 80 mov %ebx,0x801126c4 struct superblock sb; initlock(&log.lock, "log"); readsb(dev, &sb); log.start = sb.logstart; log.size = sb.nlog; 80102ae2: 89 15 b8 26 11 80 mov %edx,0x801126b8 panic("initlog: too big logheader"); struct superblock sb; initlock(&log.lock, "log"); readsb(dev, &sb); log.start = sb.logstart; 80102ae8: a3 b4 26 11 80 mov %eax,0x801126b4 // Read the log header from disk into the in-memory log header static void read_head(void) { struct buf *buf = bread(log.dev, log.start); 80102aed: 5a pop %edx 80102aee: 50 push %eax 80102aef: 53 push %ebx 80102af0: e8 db d5 ff ff call 801000d0 <bread> struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; 80102af5: 8b 48 5c mov 0x5c(%eax),%ecx for (i = 0; i < log.lh.n; i++) { 80102af8: 83 c4 10 add $0x10,%esp 80102afb: 85 c9 test %ecx,%ecx read_head(void) { struct buf *buf = bread(log.dev, log.start); struct logheader *lh = (struct logheader *) (buf->data); int i; log.lh.n = lh->n; 80102afd: 89 0d c8 26 11 80 mov %ecx,0x801126c8 for (i = 0; i < log.lh.n; i++) { 80102b03: 7e 1c jle 80102b21 <initlog+0x71> 80102b05: 8d 1c 8d 00 00 00 00 lea 0x0(,%ecx,4),%ebx 80102b0c: 31 d2 xor %edx,%edx 80102b0e: 66 90 xchg %ax,%ax log.lh.block[i] = lh->block[i]; 80102b10: 8b 4c 10 60 mov 0x60(%eax,%edx,1),%ecx 80102b14: 83 c2 04 add $0x4,%edx 80102b17: 89 8a c8 26 11 80 mov %ecx,-0x7feed938(%edx) { 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++) { 80102b1d: 39 da cmp %ebx,%edx 80102b1f: 75 ef jne 80102b10 <initlog+0x60> log.lh.block[i] = lh->block[i]; } brelse(buf); 80102b21: 83 ec 0c sub $0xc,%esp 80102b24: 50 push %eax 80102b25: e8 b6 d6 ff ff call 801001e0 <brelse> static void recover_from_log(void) { read_head(); install_trans(); // if committed, copy from log to disk 80102b2a: e8 81 fe ff ff call 801029b0 <install_trans> log.lh.n = 0; 80102b2f: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 80102b36: 00 00 00 write_head(); // clear the log 80102b39: e8 12 ff ff ff call 80102a50 <write_head> readsb(dev, &sb); log.start = sb.logstart; log.size = sb.nlog; log.dev = dev; recover_from_log(); } 80102b3e: 8b 5d fc mov -0x4(%ebp),%ebx 80102b41: c9 leave 80102b42: c3 ret 80102b43: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80102b49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102b50 <begin_op>: } // called at the start of each FS system call. void begin_op(void) { 80102b50: 55 push %ebp 80102b51: 89 e5 mov %esp,%ebp 80102b53: 83 ec 14 sub $0x14,%esp acquire(&log.lock); 80102b56: 68 80 26 11 80 push $0x80112680 80102b5b: e8 f0 17 00 00 call 80104350 <acquire> 80102b60: 83 c4 10 add $0x10,%esp 80102b63: eb 18 jmp 80102b7d <begin_op+0x2d> 80102b65: 8d 76 00 lea 0x0(%esi),%esi while(1){ if(log.committing){ sleep(&log, &log.lock); 80102b68: 83 ec 08 sub $0x8,%esp 80102b6b: 68 80 26 11 80 push $0x80112680 80102b70: 68 80 26 11 80 push $0x80112680 80102b75: e8 b6 11 00 00 call 80103d30 <sleep> 80102b7a: 83 c4 10 add $0x10,%esp void begin_op(void) { acquire(&log.lock); while(1){ if(log.committing){ 80102b7d: a1 c0 26 11 80 mov 0x801126c0,%eax 80102b82: 85 c0 test %eax,%eax 80102b84: 75 e2 jne 80102b68 <begin_op+0x18> sleep(&log, &log.lock); } else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){ 80102b86: a1 bc 26 11 80 mov 0x801126bc,%eax 80102b8b: 8b 15 c8 26 11 80 mov 0x801126c8,%edx 80102b91: 83 c0 01 add $0x1,%eax 80102b94: 8d 0c 80 lea (%eax,%eax,4),%ecx 80102b97: 8d 14 4a lea (%edx,%ecx,2),%edx 80102b9a: 83 fa 1e cmp $0x1e,%edx 80102b9d: 7f c9 jg 80102b68 <begin_op+0x18> // this op might exhaust log space; wait for commit. sleep(&log, &log.lock); } else { log.outstanding += 1; release(&log.lock); 80102b9f: 83 ec 0c sub $0xc,%esp 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; 80102ba2: a3 bc 26 11 80 mov %eax,0x801126bc release(&log.lock); 80102ba7: 68 80 26 11 80 push $0x80112680 80102bac: e8 4f 18 00 00 call 80104400 <release> break; } } } 80102bb1: 83 c4 10 add $0x10,%esp 80102bb4: c9 leave 80102bb5: c3 ret 80102bb6: 8d 76 00 lea 0x0(%esi),%esi 80102bb9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80102bc0 <end_op>: // called at the end of each FS system call. // commits if this was the last outstanding operation. void end_op(void) { 80102bc0: 55 push %ebp 80102bc1: 89 e5 mov %esp,%ebp 80102bc3: 57 push %edi 80102bc4: 56 push %esi 80102bc5: 53 push %ebx 80102bc6: 83 ec 18 sub $0x18,%esp int do_commit = 0; acquire(&log.lock); 80102bc9: 68 80 26 11 80 push $0x80112680 80102bce: e8 7d 17 00 00 call 80104350 <acquire> log.outstanding -= 1; 80102bd3: a1 bc 26 11 80 mov 0x801126bc,%eax if(log.committing) 80102bd8: 8b 1d c0 26 11 80 mov 0x801126c0,%ebx 80102bde: 83 c4 10 add $0x10,%esp end_op(void) { int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; 80102be1: 83 e8 01 sub $0x1,%eax if(log.committing) 80102be4: 85 db test %ebx,%ebx end_op(void) { int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; 80102be6: a3 bc 26 11 80 mov %eax,0x801126bc if(log.committing) 80102beb: 0f 85 23 01 00 00 jne 80102d14 <end_op+0x154> panic("log.committing"); if(log.outstanding == 0){ 80102bf1: 85 c0 test %eax,%eax 80102bf3: 0f 85 f7 00 00 00 jne 80102cf0 <end_op+0x130> // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); 80102bf9: 83 ec 0c sub $0xc,%esp log.outstanding -= 1; if(log.committing) panic("log.committing"); if(log.outstanding == 0){ do_commit = 1; log.committing = 1; 80102bfc: c7 05 c0 26 11 80 01 movl $0x1,0x801126c0 80102c03: 00 00 00 } static void commit() { if (log.lh.n > 0) { 80102c06: 31 db xor %ebx,%ebx // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); } release(&log.lock); 80102c08: 68 80 26 11 80 push $0x80112680 80102c0d: e8 ee 17 00 00 call 80104400 <release> } static void commit() { if (log.lh.n > 0) { 80102c12: 8b 0d c8 26 11 80 mov 0x801126c8,%ecx 80102c18: 83 c4 10 add $0x10,%esp 80102c1b: 85 c9 test %ecx,%ecx 80102c1d: 0f 8e 8a 00 00 00 jle 80102cad <end_op+0xed> 80102c23: 90 nop 80102c24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { struct buf *to = bread(log.dev, log.start+tail+1); // log block 80102c28: a1 b4 26 11 80 mov 0x801126b4,%eax 80102c2d: 83 ec 08 sub $0x8,%esp 80102c30: 01 d8 add %ebx,%eax 80102c32: 83 c0 01 add $0x1,%eax 80102c35: 50 push %eax 80102c36: ff 35 c4 26 11 80 pushl 0x801126c4 80102c3c: e8 8f d4 ff ff call 801000d0 <bread> 80102c41: 89 c6 mov %eax,%esi struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102c43: 58 pop %eax 80102c44: 5a pop %edx 80102c45: ff 34 9d cc 26 11 80 pushl -0x7feed934(,%ebx,4) 80102c4c: ff 35 c4 26 11 80 pushl 0x801126c4 static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102c52: 83 c3 01 add $0x1,%ebx struct buf *to = bread(log.dev, log.start+tail+1); // log block struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block 80102c55: e8 76 d4 ff ff call 801000d0 <bread> 80102c5a: 89 c7 mov %eax,%edi memmove(to->data, from->data, BSIZE); 80102c5c: 8d 40 5c lea 0x5c(%eax),%eax 80102c5f: 83 c4 0c add $0xc,%esp 80102c62: 68 00 02 00 00 push $0x200 80102c67: 50 push %eax 80102c68: 8d 46 5c lea 0x5c(%esi),%eax 80102c6b: 50 push %eax 80102c6c: e8 8f 18 00 00 call 80104500 <memmove> bwrite(to); // write the log 80102c71: 89 34 24 mov %esi,(%esp) 80102c74: e8 27 d5 ff ff call 801001a0 <bwrite> brelse(from); 80102c79: 89 3c 24 mov %edi,(%esp) 80102c7c: e8 5f d5 ff ff call 801001e0 <brelse> brelse(to); 80102c81: 89 34 24 mov %esi,(%esp) 80102c84: e8 57 d5 ff ff call 801001e0 <brelse> static void write_log(void) { int tail; for (tail = 0; tail < log.lh.n; tail++) { 80102c89: 83 c4 10 add $0x10,%esp 80102c8c: 3b 1d c8 26 11 80 cmp 0x801126c8,%ebx 80102c92: 7c 94 jl 80102c28 <end_op+0x68> static void commit() { if (log.lh.n > 0) { write_log(); // Write modified blocks from cache to log write_head(); // Write header to disk -- the real commit 80102c94: e8 b7 fd ff ff call 80102a50 <write_head> install_trans(); // Now install writes to home locations 80102c99: e8 12 fd ff ff call 801029b0 <install_trans> log.lh.n = 0; 80102c9e: c7 05 c8 26 11 80 00 movl $0x0,0x801126c8 80102ca5: 00 00 00 write_head(); // Erase the transaction from the log 80102ca8: e8 a3 fd ff ff call 80102a50 <write_head> if(do_commit){ // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); acquire(&log.lock); 80102cad: 83 ec 0c sub $0xc,%esp 80102cb0: 68 80 26 11 80 push $0x80112680 80102cb5: e8 96 16 00 00 call 80104350 <acquire> log.committing = 0; wakeup(&log); 80102cba: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) if(do_commit){ // call commit w/o holding locks, since not allowed // to sleep with locks. commit(); acquire(&log.lock); log.committing = 0; 80102cc1: c7 05 c0 26 11 80 00 movl $0x0,0x801126c0 80102cc8: 00 00 00 wakeup(&log); 80102ccb: e8 10 12 00 00 call 80103ee0 <wakeup> release(&log.lock); 80102cd0: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102cd7: e8 24 17 00 00 call 80104400 <release> 80102cdc: 83 c4 10 add $0x10,%esp } } 80102cdf: 8d 65 f4 lea -0xc(%ebp),%esp 80102ce2: 5b pop %ebx 80102ce3: 5e pop %esi 80102ce4: 5f pop %edi 80102ce5: 5d pop %ebp 80102ce6: c3 ret 80102ce7: 89 f6 mov %esi,%esi 80102ce9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi log.committing = 1; } else { // begin_op() may be waiting for log space, // and decrementing log.outstanding has decreased // the amount of reserved space. wakeup(&log); 80102cf0: 83 ec 0c sub $0xc,%esp 80102cf3: 68 80 26 11 80 push $0x80112680 80102cf8: e8 e3 11 00 00 call 80103ee0 <wakeup> } release(&log.lock); 80102cfd: c7 04 24 80 26 11 80 movl $0x80112680,(%esp) 80102d04: e8 f7 16 00 00 call 80104400 <release> 80102d09: 83 c4 10 add $0x10,%esp acquire(&log.lock); log.committing = 0; wakeup(&log); release(&log.lock); } } 80102d0c: 8d 65 f4 lea -0xc(%ebp),%esp 80102d0f: 5b pop %ebx 80102d10: 5e pop %esi 80102d11: 5f pop %edi 80102d12: 5d pop %ebp 80102d13: c3 ret int do_commit = 0; acquire(&log.lock); log.outstanding -= 1; if(log.committing) panic("log.committing"); 80102d14: 83 ec 0c sub $0xc,%esp 80102d17: 68 c4 73 10 80 push $0x801073c4 80102d1c: e8 4f d6 ff ff call 80100370 <panic> 80102d21: eb 0d jmp 80102d30 <log_write> 80102d23: 90 nop 80102d24: 90 nop 80102d25: 90 nop 80102d26: 90 nop 80102d27: 90 nop 80102d28: 90 nop 80102d29: 90 nop 80102d2a: 90 nop 80102d2b: 90 nop 80102d2c: 90 nop 80102d2d: 90 nop 80102d2e: 90 nop 80102d2f: 90 nop 80102d30 <log_write>: // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80102d30: 55 push %ebp 80102d31: 89 e5 mov %esp,%ebp 80102d33: 53 push %ebx 80102d34: 83 ec 04 sub $0x4,%esp int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102d37: 8b 15 c8 26 11 80 mov 0x801126c8,%edx // modify bp->data[] // log_write(bp) // brelse(bp) void log_write(struct buf *b) { 80102d3d: 8b 5d 08 mov 0x8(%ebp),%ebx int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) 80102d40: 83 fa 1d cmp $0x1d,%edx 80102d43: 0f 8f 97 00 00 00 jg 80102de0 <log_write+0xb0> 80102d49: a1 b8 26 11 80 mov 0x801126b8,%eax 80102d4e: 83 e8 01 sub $0x1,%eax 80102d51: 39 c2 cmp %eax,%edx 80102d53: 0f 8d 87 00 00 00 jge 80102de0 <log_write+0xb0> panic("too big a transaction"); if (log.outstanding < 1) 80102d59: a1 bc 26 11 80 mov 0x801126bc,%eax 80102d5e: 85 c0 test %eax,%eax 80102d60: 0f 8e 87 00 00 00 jle 80102ded <log_write+0xbd> panic("log_write outside of trans"); acquire(&log.lock); 80102d66: 83 ec 0c sub $0xc,%esp 80102d69: 68 80 26 11 80 push $0x80112680 80102d6e: e8 dd 15 00 00 call 80104350 <acquire> for (i = 0; i < log.lh.n; i++) { 80102d73: 8b 15 c8 26 11 80 mov 0x801126c8,%edx 80102d79: 83 c4 10 add $0x10,%esp 80102d7c: 83 fa 00 cmp $0x0,%edx 80102d7f: 7e 50 jle 80102dd1 <log_write+0xa1> if (log.lh.block[i] == b->blockno) // log absorbtion 80102d81: 8b 4b 08 mov 0x8(%ebx),%ecx panic("too big a transaction"); if (log.outstanding < 1) panic("log_write outside of trans"); acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { 80102d84: 31 c0 xor %eax,%eax if (log.lh.block[i] == b->blockno) // log absorbtion 80102d86: 3b 0d cc 26 11 80 cmp 0x801126cc,%ecx 80102d8c: 75 0b jne 80102d99 <log_write+0x69> 80102d8e: eb 38 jmp 80102dc8 <log_write+0x98> 80102d90: 39 0c 85 cc 26 11 80 cmp %ecx,-0x7feed934(,%eax,4) 80102d97: 74 2f je 80102dc8 <log_write+0x98> panic("too big a transaction"); if (log.outstanding < 1) panic("log_write outside of trans"); acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { 80102d99: 83 c0 01 add $0x1,%eax 80102d9c: 39 d0 cmp %edx,%eax 80102d9e: 75 f0 jne 80102d90 <log_write+0x60> if (log.lh.block[i] == b->blockno) // log absorbtion break; } log.lh.block[i] = b->blockno; 80102da0: 89 0c 95 cc 26 11 80 mov %ecx,-0x7feed934(,%edx,4) if (i == log.lh.n) log.lh.n++; 80102da7: 83 c2 01 add $0x1,%edx 80102daa: 89 15 c8 26 11 80 mov %edx,0x801126c8 b->flags |= B_DIRTY; // prevent eviction 80102db0: 83 0b 04 orl $0x4,(%ebx) release(&log.lock); 80102db3: c7 45 08 80 26 11 80 movl $0x80112680,0x8(%ebp) } 80102dba: 8b 5d fc mov -0x4(%ebp),%ebx 80102dbd: c9 leave } log.lh.block[i] = b->blockno; if (i == log.lh.n) log.lh.n++; b->flags |= B_DIRTY; // prevent eviction release(&log.lock); 80102dbe: e9 3d 16 00 00 jmp 80104400 <release> 80102dc3: 90 nop 80102dc4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi acquire(&log.lock); for (i = 0; i < log.lh.n; i++) { if (log.lh.block[i] == b->blockno) // log absorbtion break; } log.lh.block[i] = b->blockno; 80102dc8: 89 0c 85 cc 26 11 80 mov %ecx,-0x7feed934(,%eax,4) 80102dcf: eb df jmp 80102db0 <log_write+0x80> 80102dd1: 8b 43 08 mov 0x8(%ebx),%eax 80102dd4: a3 cc 26 11 80 mov %eax,0x801126cc if (i == log.lh.n) 80102dd9: 75 d5 jne 80102db0 <log_write+0x80> 80102ddb: eb ca jmp 80102da7 <log_write+0x77> 80102ddd: 8d 76 00 lea 0x0(%esi),%esi log_write(struct buf *b) { int i; if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1) panic("too big a transaction"); 80102de0: 83 ec 0c sub $0xc,%esp 80102de3: 68 d3 73 10 80 push $0x801073d3 80102de8: e8 83 d5 ff ff call 80100370 <panic> if (log.outstanding < 1) panic("log_write outside of trans"); 80102ded: 83 ec 0c sub $0xc,%esp 80102df0: 68 e9 73 10 80 push $0x801073e9 80102df5: e8 76 d5 ff ff call 80100370 <panic> 80102dfa: 66 90 xchg %ax,%ax 80102dfc: 66 90 xchg %ax,%ax 80102dfe: 66 90 xchg %ax,%ax 80102e00 <mpmain>: } // Common CPU setup code. static void mpmain(void) { 80102e00: 55 push %ebp 80102e01: 89 e5 mov %esp,%ebp 80102e03: 53 push %ebx 80102e04: 83 ec 04 sub $0x4,%esp cprintf("cpu%d: starting %d\n", cpuid(), cpuid()); 80102e07: e8 54 09 00 00 call 80103760 <cpuid> 80102e0c: 89 c3 mov %eax,%ebx 80102e0e: e8 4d 09 00 00 call 80103760 <cpuid> 80102e13: 83 ec 04 sub $0x4,%esp 80102e16: 53 push %ebx 80102e17: 50 push %eax 80102e18: 68 04 74 10 80 push $0x80107404 80102e1d: e8 3e d8 ff ff call 80100660 <cprintf> idtinit(); // load idt register 80102e22: e8 09 29 00 00 call 80105730 <idtinit> xchg(&(mycpu()->started), 1); // tell startothers() we're up 80102e27: e8 b4 08 00 00 call 801036e0 <mycpu> 80102e2c: 89 c2 mov %eax,%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80102e2e: b8 01 00 00 00 mov $0x1,%eax 80102e33: f0 87 82 a0 00 00 00 lock xchg %eax,0xa0(%edx) scheduler(); // start running processes 80102e3a: e8 01 0c 00 00 call 80103a40 <scheduler> 80102e3f: 90 nop 80102e40 <mpenter>: } // Other CPUs jump here from entryother.S. static void mpenter(void) { 80102e40: 55 push %ebp 80102e41: 89 e5 mov %esp,%ebp 80102e43: 83 ec 08 sub $0x8,%esp switchkvm(); 80102e46: e8 05 3a 00 00 call 80106850 <switchkvm> seginit(); 80102e4b: e8 00 39 00 00 call 80106750 <seginit> lapicinit(); 80102e50: e8 9b f7 ff ff call 801025f0 <lapicinit> mpmain(); 80102e55: e8 a6 ff ff ff call 80102e00 <mpmain> 80102e5a: 66 90 xchg %ax,%ax 80102e5c: 66 90 xchg %ax,%ax 80102e5e: 66 90 xchg %ax,%ax 80102e60 <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) { 80102e60: 8d 4c 24 04 lea 0x4(%esp),%ecx 80102e64: 83 e4 f0 and $0xfffffff0,%esp 80102e67: ff 71 fc pushl -0x4(%ecx) 80102e6a: 55 push %ebp 80102e6b: 89 e5 mov %esp,%ebp 80102e6d: 53 push %ebx 80102e6e: 51 push %ecx // 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++){ 80102e6f: bb 80 27 11 80 mov $0x80112780,%ebx // Allocate a real stack and switch to it, first // doing some setup required for memory allocator to work. int main(void) { kinit1(end, P2V(4*1024*1024)); // phys page allocator 80102e74: 83 ec 08 sub $0x8,%esp 80102e77: 68 00 00 40 80 push $0x80400000 80102e7c: 68 a8 54 11 80 push $0x801154a8 80102e81: e8 3a f5 ff ff call 801023c0 <kinit1> kvmalloc(); // kernel page table 80102e86: e8 65 3e 00 00 call 80106cf0 <kvmalloc> mpinit(); // detect other processors 80102e8b: e8 70 01 00 00 call 80103000 <mpinit> lapicinit(); // interrupt controller 80102e90: e8 5b f7 ff ff call 801025f0 <lapicinit> seginit(); // segment descriptors 80102e95: e8 b6 38 00 00 call 80106750 <seginit> picinit(); // disable pic 80102e9a: e8 31 03 00 00 call 801031d0 <picinit> ioapicinit(); // another interrupt controller 80102e9f: e8 4c f3 ff ff call 801021f0 <ioapicinit> consoleinit(); // console hardware 80102ea4: e8 f7 da ff ff call 801009a0 <consoleinit> uartinit(); // serial port 80102ea9: e8 72 2b 00 00 call 80105a20 <uartinit> pinit(); // process table 80102eae: e8 0d 08 00 00 call 801036c0 <pinit> tvinit(); // trap vectors 80102eb3: e8 d8 27 00 00 call 80105690 <tvinit> binit(); // buffer cache 80102eb8: e8 83 d1 ff ff call 80100040 <binit> fileinit(); // file table 80102ebd: e8 8e de ff ff call 80100d50 <fileinit> ideinit(); // disk 80102ec2: e8 09 f1 ff ff call 80101fd0 <ideinit> // Write entry code to unused memory at 0x7000. // 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); 80102ec7: 83 c4 0c add $0xc,%esp 80102eca: 68 8a 00 00 00 push $0x8a 80102ecf: 68 8c a4 10 80 push $0x8010a48c 80102ed4: 68 00 70 00 80 push $0x80007000 80102ed9: e8 22 16 00 00 call 80104500 <memmove> for(c = cpus; c < cpus+ncpu; c++){ 80102ede: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax 80102ee5: 00 00 00 80102ee8: 83 c4 10 add $0x10,%esp 80102eeb: 05 80 27 11 80 add $0x80112780,%eax 80102ef0: 39 d8 cmp %ebx,%eax 80102ef2: 76 6f jbe 80102f63 <main+0x103> 80102ef4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(c == mycpu()) // We've started already. 80102ef8: e8 e3 07 00 00 call 801036e0 <mycpu> 80102efd: 39 d8 cmp %ebx,%eax 80102eff: 74 49 je 80102f4a <main+0xea> 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(); 80102f01: e8 8a f5 ff ff call 80102490 <kalloc> *(void**)(code-4) = stack + KSTACKSIZE; 80102f06: 05 00 10 00 00 add $0x1000,%eax *(void(**)(void))(code-8) = mpenter; 80102f0b: c7 05 f8 6f 00 80 40 movl $0x80102e40,0x80006ff8 80102f12: 2e 10 80 *(int**)(code-12) = (void *) V2P(entrypgdir); 80102f15: c7 05 f4 6f 00 80 00 movl $0x109000,0x80006ff4 80102f1c: 90 10 00 // 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(); *(void**)(code-4) = stack + KSTACKSIZE; 80102f1f: a3 fc 6f 00 80 mov %eax,0x80006ffc *(void(**)(void))(code-8) = mpenter; *(int**)(code-12) = (void *) V2P(entrypgdir); lapicstartap(c->apicid, V2P(code)); 80102f24: 0f b6 03 movzbl (%ebx),%eax 80102f27: 83 ec 08 sub $0x8,%esp 80102f2a: 68 00 70 00 00 push $0x7000 80102f2f: 50 push %eax 80102f30: e8 0b f8 ff ff call 80102740 <lapicstartap> 80102f35: 83 c4 10 add $0x10,%esp 80102f38: 90 nop 80102f39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi // wait for cpu to finish mpmain() while(c->started == 0) 80102f40: 8b 83 a0 00 00 00 mov 0xa0(%ebx),%eax 80102f46: 85 c0 test %eax,%eax 80102f48: 74 f6 je 80102f40 <main+0xe0> // 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++){ 80102f4a: 69 05 00 2d 11 80 b0 imul $0xb0,0x80112d00,%eax 80102f51: 00 00 00 80102f54: 81 c3 b0 00 00 00 add $0xb0,%ebx 80102f5a: 05 80 27 11 80 add $0x80112780,%eax 80102f5f: 39 c3 cmp %eax,%ebx 80102f61: 72 95 jb 80102ef8 <main+0x98> tvinit(); // trap vectors binit(); // buffer cache fileinit(); // file table ideinit(); // disk startothers(); // start other processors kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers() 80102f63: 83 ec 08 sub $0x8,%esp 80102f66: 68 00 00 00 8e push $0x8e000000 80102f6b: 68 00 00 40 80 push $0x80400000 80102f70: e8 bb f4 ff ff call 80102430 <kinit2> userinit(); // first user process 80102f75: e8 36 08 00 00 call 801037b0 <userinit> mpmain(); // finish this processor's setup 80102f7a: e8 81 fe ff ff call 80102e00 <mpmain> 80102f7f: 90 nop 80102f80 <mpsearch1>: } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f80: 55 push %ebp 80102f81: 89 e5 mov %esp,%ebp 80102f83: 57 push %edi 80102f84: 56 push %esi uchar *e, *p, *addr; addr = P2V(a); 80102f85: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f8b: 53 push %ebx uchar *e, *p, *addr; addr = P2V(a); e = addr+len; 80102f8c: 8d 1c 16 lea (%esi,%edx,1),%ebx } // Look for an MP structure in the len bytes at addr. static struct mp* mpsearch1(uint a, int len) { 80102f8f: 83 ec 0c sub $0xc,%esp uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80102f92: 39 de cmp %ebx,%esi 80102f94: 73 48 jae 80102fde <mpsearch1+0x5e> 80102f96: 8d 76 00 lea 0x0(%esi),%esi 80102f99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80102fa0: 83 ec 04 sub $0x4,%esp 80102fa3: 8d 7e 10 lea 0x10(%esi),%edi 80102fa6: 6a 04 push $0x4 80102fa8: 68 18 74 10 80 push $0x80107418 80102fad: 56 push %esi 80102fae: e8 ed 14 00 00 call 801044a0 <memcmp> 80102fb3: 83 c4 10 add $0x10,%esp 80102fb6: 85 c0 test %eax,%eax 80102fb8: 75 1e jne 80102fd8 <mpsearch1+0x58> 80102fba: 8d 7e 10 lea 0x10(%esi),%edi 80102fbd: 89 f2 mov %esi,%edx 80102fbf: 31 c9 xor %ecx,%ecx 80102fc1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { int i, sum; sum = 0; for(i=0; i<len; i++) sum += addr[i]; 80102fc8: 0f b6 02 movzbl (%edx),%eax 80102fcb: 83 c2 01 add $0x1,%edx 80102fce: 01 c1 add %eax,%ecx sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 80102fd0: 39 fa cmp %edi,%edx 80102fd2: 75 f4 jne 80102fc8 <mpsearch1+0x48> uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) 80102fd4: 84 c9 test %cl,%cl 80102fd6: 74 10 je 80102fe8 <mpsearch1+0x68> { uchar *e, *p, *addr; addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) 80102fd8: 39 fb cmp %edi,%ebx 80102fda: 89 fe mov %edi,%esi 80102fdc: 77 c2 ja 80102fa0 <mpsearch1+0x20> if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; } 80102fde: 8d 65 f4 lea -0xc(%ebp),%esp addr = P2V(a); e = addr+len; for(p = addr; p < e; p += sizeof(struct mp)) if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0) return (struct mp*)p; return 0; 80102fe1: 31 c0 xor %eax,%eax } 80102fe3: 5b pop %ebx 80102fe4: 5e pop %esi 80102fe5: 5f pop %edi 80102fe6: 5d pop %ebp 80102fe7: c3 ret 80102fe8: 8d 65 f4 lea -0xc(%ebp),%esp 80102feb: 89 f0 mov %esi,%eax 80102fed: 5b pop %ebx 80102fee: 5e pop %esi 80102fef: 5f pop %edi 80102ff0: 5d pop %ebp 80102ff1: c3 ret 80102ff2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80102ff9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103000 <mpinit>: return conf; } void mpinit(void) { 80103000: 55 push %ebp 80103001: 89 e5 mov %esp,%ebp 80103003: 57 push %edi 80103004: 56 push %esi 80103005: 53 push %ebx 80103006: 83 ec 1c sub $0x1c,%esp uchar *bda; uint p; struct mp *mp; bda = (uchar *) P2V(0x400); if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ 80103009: 0f b6 05 0f 04 00 80 movzbl 0x8000040f,%eax 80103010: 0f b6 15 0e 04 00 80 movzbl 0x8000040e,%edx 80103017: c1 e0 08 shl $0x8,%eax 8010301a: 09 d0 or %edx,%eax 8010301c: c1 e0 04 shl $0x4,%eax 8010301f: 85 c0 test %eax,%eax 80103021: 75 1b jne 8010303e <mpinit+0x3e> if((mp = mpsearch1(p, 1024))) return mp; } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) 80103023: 0f b6 05 14 04 00 80 movzbl 0x80000414,%eax 8010302a: 0f b6 15 13 04 00 80 movzbl 0x80000413,%edx 80103031: c1 e0 08 shl $0x8,%eax 80103034: 09 d0 or %edx,%eax 80103036: c1 e0 0a shl $0xa,%eax 80103039: 2d 00 04 00 00 sub $0x400,%eax uint p; struct mp *mp; bda = (uchar *) P2V(0x400); if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){ if((mp = mpsearch1(p, 1024))) 8010303e: ba 00 04 00 00 mov $0x400,%edx 80103043: e8 38 ff ff ff call 80102f80 <mpsearch1> 80103048: 85 c0 test %eax,%eax 8010304a: 89 45 e4 mov %eax,-0x1c(%ebp) 8010304d: 0f 84 37 01 00 00 je 8010318a <mpinit+0x18a> mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103053: 8b 45 e4 mov -0x1c(%ebp),%eax 80103056: 8b 58 04 mov 0x4(%eax),%ebx 80103059: 85 db test %ebx,%ebx 8010305b: 0f 84 43 01 00 00 je 801031a4 <mpinit+0x1a4> return 0; conf = (struct mpconf*) P2V((uint) mp->physaddr); 80103061: 8d b3 00 00 00 80 lea -0x80000000(%ebx),%esi if(memcmp(conf, "PCMP", 4) != 0) 80103067: 83 ec 04 sub $0x4,%esp 8010306a: 6a 04 push $0x4 8010306c: 68 1d 74 10 80 push $0x8010741d 80103071: 56 push %esi 80103072: e8 29 14 00 00 call 801044a0 <memcmp> 80103077: 83 c4 10 add $0x10,%esp 8010307a: 85 c0 test %eax,%eax 8010307c: 0f 85 22 01 00 00 jne 801031a4 <mpinit+0x1a4> return 0; if(conf->version != 1 && conf->version != 4) 80103082: 0f b6 83 06 00 00 80 movzbl -0x7ffffffa(%ebx),%eax 80103089: 3c 01 cmp $0x1,%al 8010308b: 74 08 je 80103095 <mpinit+0x95> 8010308d: 3c 04 cmp $0x4,%al 8010308f: 0f 85 0f 01 00 00 jne 801031a4 <mpinit+0x1a4> return 0; if(sum((uchar*)conf, conf->length) != 0) 80103095: 0f b7 bb 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edi sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 8010309c: 85 ff test %edi,%edi 8010309e: 74 21 je 801030c1 <mpinit+0xc1> 801030a0: 31 d2 xor %edx,%edx 801030a2: 31 c0 xor %eax,%eax 801030a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi sum += addr[i]; 801030a8: 0f b6 8c 03 00 00 00 movzbl -0x80000000(%ebx,%eax,1),%ecx 801030af: 80 sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 801030b0: 83 c0 01 add $0x1,%eax sum += addr[i]; 801030b3: 01 ca add %ecx,%edx sum(uchar *addr, int len) { int i, sum; sum = 0; for(i=0; i<len; i++) 801030b5: 39 c7 cmp %eax,%edi 801030b7: 75 ef jne 801030a8 <mpinit+0xa8> conf = (struct mpconf*) P2V((uint) mp->physaddr); if(memcmp(conf, "PCMP", 4) != 0) return 0; if(conf->version != 1 && conf->version != 4) return 0; if(sum((uchar*)conf, conf->length) != 0) 801030b9: 84 d2 test %dl,%dl 801030bb: 0f 85 e3 00 00 00 jne 801031a4 <mpinit+0x1a4> struct mp *mp; struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) 801030c1: 85 f6 test %esi,%esi 801030c3: 0f 84 db 00 00 00 je 801031a4 <mpinit+0x1a4> panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; 801030c9: 8b 83 24 00 00 80 mov -0x7fffffdc(%ebx),%eax 801030cf: a3 7c 26 11 80 mov %eax,0x8011267c for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801030d4: 0f b7 93 04 00 00 80 movzwl -0x7ffffffc(%ebx),%edx 801030db: 8d 83 2c 00 00 80 lea -0x7fffffd4(%ebx),%eax struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; 801030e1: bb 01 00 00 00 mov $0x1,%ebx lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 801030e6: 01 d6 add %edx,%esi 801030e8: 90 nop 801030e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801030f0: 39 c6 cmp %eax,%esi 801030f2: 76 23 jbe 80103117 <mpinit+0x117> 801030f4: 0f b6 10 movzbl (%eax),%edx switch(*p){ 801030f7: 80 fa 04 cmp $0x4,%dl 801030fa: 0f 87 c0 00 00 00 ja 801031c0 <mpinit+0x1c0> 80103100: ff 24 95 5c 74 10 80 jmp *-0x7fef8ba4(,%edx,4) 80103107: 89 f6 mov %esi,%esi 80103109: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi p += sizeof(struct mpioapic); continue; case MPBUS: case MPIOINTR: case MPLINTR: p += 8; 80103110: 83 c0 08 add $0x8,%eax if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); ismp = 1; lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ 80103113: 39 c6 cmp %eax,%esi 80103115: 77 dd ja 801030f4 <mpinit+0xf4> default: ismp = 0; break; } } if(!ismp) 80103117: 85 db test %ebx,%ebx 80103119: 0f 84 92 00 00 00 je 801031b1 <mpinit+0x1b1> panic("Didn't find a suitable machine"); if(mp->imcrp){ 8010311f: 8b 45 e4 mov -0x1c(%ebp),%eax 80103122: 80 78 0c 00 cmpb $0x0,0xc(%eax) 80103126: 74 15 je 8010313d <mpinit+0x13d> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103128: ba 22 00 00 00 mov $0x22,%edx 8010312d: b8 70 00 00 00 mov $0x70,%eax 80103132: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80103133: ba 23 00 00 00 mov $0x23,%edx 80103138: ec in (%dx),%al } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80103139: 83 c8 01 or $0x1,%eax 8010313c: ee out %al,(%dx) // 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. } } 8010313d: 8d 65 f4 lea -0xc(%ebp),%esp 80103140: 5b pop %ebx 80103141: 5e pop %esi 80103142: 5f pop %edi 80103143: 5d pop %ebp 80103144: c3 ret 80103145: 8d 76 00 lea 0x0(%esi),%esi lapic = (uint*)conf->lapicaddr; for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ switch(*p){ case MPPROC: proc = (struct mpproc*)p; if(ncpu < NCPU) { 80103148: 8b 0d 00 2d 11 80 mov 0x80112d00,%ecx 8010314e: 83 f9 07 cmp $0x7,%ecx 80103151: 7f 19 jg 8010316c <mpinit+0x16c> cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 80103153: 0f b6 50 01 movzbl 0x1(%eax),%edx 80103157: 69 f9 b0 00 00 00 imul $0xb0,%ecx,%edi ncpu++; 8010315d: 83 c1 01 add $0x1,%ecx 80103160: 89 0d 00 2d 11 80 mov %ecx,0x80112d00 for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){ switch(*p){ case MPPROC: proc = (struct mpproc*)p; if(ncpu < NCPU) { cpus[ncpu].apicid = proc->apicid; // apicid may differ from ncpu 80103166: 88 97 80 27 11 80 mov %dl,-0x7feed880(%edi) ncpu++; } p += sizeof(struct mpproc); 8010316c: 83 c0 14 add $0x14,%eax continue; 8010316f: e9 7c ff ff ff jmp 801030f0 <mpinit+0xf0> 80103174: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi case MPIOAPIC: ioapic = (struct mpioapic*)p; ioapicid = ioapic->apicno; 80103178: 0f b6 50 01 movzbl 0x1(%eax),%edx p += sizeof(struct mpioapic); 8010317c: 83 c0 08 add $0x8,%eax } p += sizeof(struct mpproc); continue; case MPIOAPIC: ioapic = (struct mpioapic*)p; ioapicid = ioapic->apicno; 8010317f: 88 15 60 27 11 80 mov %dl,0x80112760 p += sizeof(struct mpioapic); continue; 80103185: e9 66 ff ff ff jmp 801030f0 <mpinit+0xf0> } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); 8010318a: ba 00 00 01 00 mov $0x10000,%edx 8010318f: b8 00 00 0f 00 mov $0xf0000,%eax 80103194: e8 e7 fd ff ff call 80102f80 <mpsearch1> mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 80103199: 85 c0 test %eax,%eax } else { p = ((bda[0x14]<<8)|bda[0x13])*1024; if((mp = mpsearch1(p-1024, 1024))) return mp; } return mpsearch1(0xF0000, 0x10000); 8010319b: 89 45 e4 mov %eax,-0x1c(%ebp) mpconfig(struct mp **pmp) { struct mpconf *conf; struct mp *mp; if((mp = mpsearch()) == 0 || mp->physaddr == 0) 8010319e: 0f 85 af fe ff ff jne 80103053 <mpinit+0x53> struct mpconf *conf; struct mpproc *proc; struct mpioapic *ioapic; if((conf = mpconfig(&mp)) == 0) panic("Expect to run on an SMP"); 801031a4: 83 ec 0c sub $0xc,%esp 801031a7: 68 22 74 10 80 push $0x80107422 801031ac: e8 bf d1 ff ff call 80100370 <panic> ismp = 0; break; } } if(!ismp) panic("Didn't find a suitable machine"); 801031b1: 83 ec 0c sub $0xc,%esp 801031b4: 68 3c 74 10 80 push $0x8010743c 801031b9: e8 b2 d1 ff ff call 80100370 <panic> 801031be: 66 90 xchg %ax,%ax case MPIOINTR: case MPLINTR: p += 8; continue; default: ismp = 0; 801031c0: 31 db xor %ebx,%ebx 801031c2: e9 30 ff ff ff jmp 801030f7 <mpinit+0xf7> 801031c7: 66 90 xchg %ax,%ax 801031c9: 66 90 xchg %ax,%ax 801031cb: 66 90 xchg %ax,%ax 801031cd: 66 90 xchg %ax,%ax 801031cf: 90 nop 801031d0 <picinit>: #define IO_PIC2 0xA0 // Slave (IRQs 8-15) // Don't use the 8259A interrupt controllers. Xv6 assumes SMP hardware. void picinit(void) { 801031d0: 55 push %ebp 801031d1: ba 21 00 00 00 mov $0x21,%edx 801031d6: b8 ff ff ff ff mov $0xffffffff,%eax 801031db: 89 e5 mov %esp,%ebp 801031dd: ee out %al,(%dx) 801031de: ba a1 00 00 00 mov $0xa1,%edx 801031e3: ee out %al,(%dx) // mask all interrupts outb(IO_PIC1+1, 0xFF); outb(IO_PIC2+1, 0xFF); } 801031e4: 5d pop %ebp 801031e5: c3 ret 801031e6: 66 90 xchg %ax,%ax 801031e8: 66 90 xchg %ax,%ax 801031ea: 66 90 xchg %ax,%ax 801031ec: 66 90 xchg %ax,%ax 801031ee: 66 90 xchg %ax,%ax 801031f0 <pipealloc>: int writeopen; // write fd is still open }; int pipealloc(struct file **f0, struct file **f1) { 801031f0: 55 push %ebp 801031f1: 89 e5 mov %esp,%ebp 801031f3: 57 push %edi 801031f4: 56 push %esi 801031f5: 53 push %ebx 801031f6: 83 ec 0c sub $0xc,%esp 801031f9: 8b 75 08 mov 0x8(%ebp),%esi 801031fc: 8b 5d 0c mov 0xc(%ebp),%ebx struct pipe *p; p = 0; *f0 = *f1 = 0; 801031ff: c7 03 00 00 00 00 movl $0x0,(%ebx) 80103205: c7 06 00 00 00 00 movl $0x0,(%esi) if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) 8010320b: e8 60 db ff ff call 80100d70 <filealloc> 80103210: 85 c0 test %eax,%eax 80103212: 89 06 mov %eax,(%esi) 80103214: 0f 84 a8 00 00 00 je 801032c2 <pipealloc+0xd2> 8010321a: e8 51 db ff ff call 80100d70 <filealloc> 8010321f: 85 c0 test %eax,%eax 80103221: 89 03 mov %eax,(%ebx) 80103223: 0f 84 87 00 00 00 je 801032b0 <pipealloc+0xc0> goto bad; if((p = (struct pipe*)kalloc()) == 0) 80103229: e8 62 f2 ff ff call 80102490 <kalloc> 8010322e: 85 c0 test %eax,%eax 80103230: 89 c7 mov %eax,%edi 80103232: 0f 84 b0 00 00 00 je 801032e8 <pipealloc+0xf8> goto bad; p->readopen = 1; p->writeopen = 1; p->nwrite = 0; p->nread = 0; initlock(&p->lock, "pipe"); 80103238: 83 ec 08 sub $0x8,%esp *f0 = *f1 = 0; if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0) goto bad; if((p = (struct pipe*)kalloc()) == 0) goto bad; p->readopen = 1; 8010323b: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax) 80103242: 00 00 00 p->writeopen = 1; 80103245: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax) 8010324c: 00 00 00 p->nwrite = 0; 8010324f: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax) 80103256: 00 00 00 p->nread = 0; 80103259: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax) 80103260: 00 00 00 initlock(&p->lock, "pipe"); 80103263: 68 70 74 10 80 push $0x80107470 80103268: 50 push %eax 80103269: e8 82 0f 00 00 call 801041f0 <initlock> (*f0)->type = FD_PIPE; 8010326e: 8b 06 mov (%esi),%eax (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; return 0; 80103270: 83 c4 10 add $0x10,%esp p->readopen = 1; p->writeopen = 1; p->nwrite = 0; p->nread = 0; initlock(&p->lock, "pipe"); (*f0)->type = FD_PIPE; 80103273: c7 00 01 00 00 00 movl $0x1,(%eax) (*f0)->readable = 1; 80103279: 8b 06 mov (%esi),%eax 8010327b: c6 40 08 01 movb $0x1,0x8(%eax) (*f0)->writable = 0; 8010327f: 8b 06 mov (%esi),%eax 80103281: c6 40 09 00 movb $0x0,0x9(%eax) (*f0)->pipe = p; 80103285: 8b 06 mov (%esi),%eax 80103287: 89 78 0c mov %edi,0xc(%eax) (*f1)->type = FD_PIPE; 8010328a: 8b 03 mov (%ebx),%eax 8010328c: c7 00 01 00 00 00 movl $0x1,(%eax) (*f1)->readable = 0; 80103292: 8b 03 mov (%ebx),%eax 80103294: c6 40 08 00 movb $0x0,0x8(%eax) (*f1)->writable = 1; 80103298: 8b 03 mov (%ebx),%eax 8010329a: c6 40 09 01 movb $0x1,0x9(%eax) (*f1)->pipe = p; 8010329e: 8b 03 mov (%ebx),%eax 801032a0: 89 78 0c mov %edi,0xc(%eax) if(*f0) fileclose(*f0); if(*f1) fileclose(*f1); return -1; } 801032a3: 8d 65 f4 lea -0xc(%ebp),%esp (*f0)->pipe = p; (*f1)->type = FD_PIPE; (*f1)->readable = 0; (*f1)->writable = 1; (*f1)->pipe = p; return 0; 801032a6: 31 c0 xor %eax,%eax if(*f0) fileclose(*f0); if(*f1) fileclose(*f1); return -1; } 801032a8: 5b pop %ebx 801032a9: 5e pop %esi 801032aa: 5f pop %edi 801032ab: 5d pop %ebp 801032ac: c3 ret 801032ad: 8d 76 00 lea 0x0(%esi),%esi //PAGEBREAK: 20 bad: if(p) kfree((char*)p); if(*f0) 801032b0: 8b 06 mov (%esi),%eax 801032b2: 85 c0 test %eax,%eax 801032b4: 74 1e je 801032d4 <pipealloc+0xe4> fileclose(*f0); 801032b6: 83 ec 0c sub $0xc,%esp 801032b9: 50 push %eax 801032ba: e8 71 db ff ff call 80100e30 <fileclose> 801032bf: 83 c4 10 add $0x10,%esp if(*f1) 801032c2: 8b 03 mov (%ebx),%eax 801032c4: 85 c0 test %eax,%eax 801032c6: 74 0c je 801032d4 <pipealloc+0xe4> fileclose(*f1); 801032c8: 83 ec 0c sub $0xc,%esp 801032cb: 50 push %eax 801032cc: e8 5f db ff ff call 80100e30 <fileclose> 801032d1: 83 c4 10 add $0x10,%esp return -1; } 801032d4: 8d 65 f4 lea -0xc(%ebp),%esp kfree((char*)p); if(*f0) fileclose(*f0); if(*f1) fileclose(*f1); return -1; 801032d7: b8 ff ff ff ff mov $0xffffffff,%eax } 801032dc: 5b pop %ebx 801032dd: 5e pop %esi 801032de: 5f pop %edi 801032df: 5d pop %ebp 801032e0: c3 ret 801032e1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi //PAGEBREAK: 20 bad: if(p) kfree((char*)p); if(*f0) 801032e8: 8b 06 mov (%esi),%eax 801032ea: 85 c0 test %eax,%eax 801032ec: 75 c8 jne 801032b6 <pipealloc+0xc6> 801032ee: eb d2 jmp 801032c2 <pipealloc+0xd2> 801032f0 <pipeclose>: return -1; } void pipeclose(struct pipe *p, int writable) { 801032f0: 55 push %ebp 801032f1: 89 e5 mov %esp,%ebp 801032f3: 56 push %esi 801032f4: 53 push %ebx 801032f5: 8b 5d 08 mov 0x8(%ebp),%ebx 801032f8: 8b 75 0c mov 0xc(%ebp),%esi acquire(&p->lock); 801032fb: 83 ec 0c sub $0xc,%esp 801032fe: 53 push %ebx 801032ff: e8 4c 10 00 00 call 80104350 <acquire> if(writable){ 80103304: 83 c4 10 add $0x10,%esp 80103307: 85 f6 test %esi,%esi 80103309: 74 45 je 80103350 <pipeclose+0x60> p->writeopen = 0; wakeup(&p->nread); 8010330b: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 80103311: 83 ec 0c sub $0xc,%esp void pipeclose(struct pipe *p, int writable) { acquire(&p->lock); if(writable){ p->writeopen = 0; 80103314: c7 83 40 02 00 00 00 movl $0x0,0x240(%ebx) 8010331b: 00 00 00 wakeup(&p->nread); 8010331e: 50 push %eax 8010331f: e8 bc 0b 00 00 call 80103ee0 <wakeup> 80103324: 83 c4 10 add $0x10,%esp } else { p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ 80103327: 8b 93 3c 02 00 00 mov 0x23c(%ebx),%edx 8010332d: 85 d2 test %edx,%edx 8010332f: 75 0a jne 8010333b <pipeclose+0x4b> 80103331: 8b 83 40 02 00 00 mov 0x240(%ebx),%eax 80103337: 85 c0 test %eax,%eax 80103339: 74 35 je 80103370 <pipeclose+0x80> release(&p->lock); kfree((char*)p); } else release(&p->lock); 8010333b: 89 5d 08 mov %ebx,0x8(%ebp) } 8010333e: 8d 65 f8 lea -0x8(%ebp),%esp 80103341: 5b pop %ebx 80103342: 5e pop %esi 80103343: 5d pop %ebp } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); kfree((char*)p); } else release(&p->lock); 80103344: e9 b7 10 00 00 jmp 80104400 <release> 80103349: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(writable){ p->writeopen = 0; wakeup(&p->nread); } else { p->readopen = 0; wakeup(&p->nwrite); 80103350: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax 80103356: 83 ec 0c sub $0xc,%esp acquire(&p->lock); if(writable){ p->writeopen = 0; wakeup(&p->nread); } else { p->readopen = 0; 80103359: c7 83 3c 02 00 00 00 movl $0x0,0x23c(%ebx) 80103360: 00 00 00 wakeup(&p->nwrite); 80103363: 50 push %eax 80103364: e8 77 0b 00 00 call 80103ee0 <wakeup> 80103369: 83 c4 10 add $0x10,%esp 8010336c: eb b9 jmp 80103327 <pipeclose+0x37> 8010336e: 66 90 xchg %ax,%ax } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); 80103370: 83 ec 0c sub $0xc,%esp 80103373: 53 push %ebx 80103374: e8 87 10 00 00 call 80104400 <release> kfree((char*)p); 80103379: 89 5d 08 mov %ebx,0x8(%ebp) 8010337c: 83 c4 10 add $0x10,%esp } else release(&p->lock); } 8010337f: 8d 65 f8 lea -0x8(%ebp),%esp 80103382: 5b pop %ebx 80103383: 5e pop %esi 80103384: 5d pop %ebp p->readopen = 0; wakeup(&p->nwrite); } if(p->readopen == 0 && p->writeopen == 0){ release(&p->lock); kfree((char*)p); 80103385: e9 56 ef ff ff jmp 801022e0 <kfree> 8010338a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103390 <pipewrite>: } //PAGEBREAK: 40 int pipewrite(struct pipe *p, char *addr, int n) { 80103390: 55 push %ebp 80103391: 89 e5 mov %esp,%ebp 80103393: 57 push %edi 80103394: 56 push %esi 80103395: 53 push %ebx 80103396: 83 ec 28 sub $0x28,%esp 80103399: 8b 5d 08 mov 0x8(%ebp),%ebx int i; acquire(&p->lock); 8010339c: 53 push %ebx 8010339d: e8 ae 0f 00 00 call 80104350 <acquire> for(i = 0; i < n; i++){ 801033a2: 8b 45 10 mov 0x10(%ebp),%eax 801033a5: 83 c4 10 add $0x10,%esp 801033a8: 85 c0 test %eax,%eax 801033aa: 0f 8e b9 00 00 00 jle 80103469 <pipewrite+0xd9> 801033b0: 8b 4d 0c mov 0xc(%ebp),%ecx 801033b3: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full if(p->readopen == 0 || myproc()->killed){ release(&p->lock); return -1; } wakeup(&p->nread); 801033b9: 8d bb 34 02 00 00 lea 0x234(%ebx),%edi sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 801033bf: 8d b3 38 02 00 00 lea 0x238(%ebx),%esi 801033c5: 89 4d e4 mov %ecx,-0x1c(%ebp) 801033c8: 03 4d 10 add 0x10(%ebp),%ecx 801033cb: 89 4d e0 mov %ecx,-0x20(%ebp) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801033ce: 8b 8b 34 02 00 00 mov 0x234(%ebx),%ecx 801033d4: 8d 91 00 02 00 00 lea 0x200(%ecx),%edx 801033da: 39 d0 cmp %edx,%eax 801033dc: 74 38 je 80103416 <pipewrite+0x86> 801033de: eb 59 jmp 80103439 <pipewrite+0xa9> if(p->readopen == 0 || myproc()->killed){ 801033e0: e8 9b 03 00 00 call 80103780 <myproc> 801033e5: 8b 48 24 mov 0x24(%eax),%ecx 801033e8: 85 c9 test %ecx,%ecx 801033ea: 75 34 jne 80103420 <pipewrite+0x90> release(&p->lock); return -1; } wakeup(&p->nread); 801033ec: 83 ec 0c sub $0xc,%esp 801033ef: 57 push %edi 801033f0: e8 eb 0a 00 00 call 80103ee0 <wakeup> sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep 801033f5: 58 pop %eax 801033f6: 5a pop %edx 801033f7: 53 push %ebx 801033f8: 56 push %esi 801033f9: e8 32 09 00 00 call 80103d30 <sleep> { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 801033fe: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 80103404: 8b 93 38 02 00 00 mov 0x238(%ebx),%edx 8010340a: 83 c4 10 add $0x10,%esp 8010340d: 05 00 02 00 00 add $0x200,%eax 80103412: 39 c2 cmp %eax,%edx 80103414: 75 2a jne 80103440 <pipewrite+0xb0> if(p->readopen == 0 || myproc()->killed){ 80103416: 8b 83 3c 02 00 00 mov 0x23c(%ebx),%eax 8010341c: 85 c0 test %eax,%eax 8010341e: 75 c0 jne 801033e0 <pipewrite+0x50> release(&p->lock); 80103420: 83 ec 0c sub $0xc,%esp 80103423: 53 push %ebx 80103424: e8 d7 0f 00 00 call 80104400 <release> return -1; 80103429: 83 c4 10 add $0x10,%esp 8010342c: b8 ff ff ff ff mov $0xffffffff,%eax p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 release(&p->lock); return n; } 80103431: 8d 65 f4 lea -0xc(%ebp),%esp 80103434: 5b pop %ebx 80103435: 5e pop %esi 80103436: 5f pop %edi 80103437: 5d pop %ebp 80103438: c3 ret { int i; acquire(&p->lock); for(i = 0; i < n; i++){ while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full 80103439: 89 c2 mov %eax,%edx 8010343b: 90 nop 8010343c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return -1; } wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; 80103440: 8b 4d e4 mov -0x1c(%ebp),%ecx 80103443: 8d 42 01 lea 0x1(%edx),%eax 80103446: 83 45 e4 01 addl $0x1,-0x1c(%ebp) 8010344a: 81 e2 ff 01 00 00 and $0x1ff,%edx 80103450: 89 83 38 02 00 00 mov %eax,0x238(%ebx) 80103456: 0f b6 09 movzbl (%ecx),%ecx 80103459: 88 4c 13 34 mov %cl,0x34(%ebx,%edx,1) 8010345d: 8b 4d e4 mov -0x1c(%ebp),%ecx pipewrite(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); for(i = 0; i < n; i++){ 80103460: 3b 4d e0 cmp -0x20(%ebp),%ecx 80103463: 0f 85 65 ff ff ff jne 801033ce <pipewrite+0x3e> wakeup(&p->nread); sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep } p->data[p->nwrite++ % PIPESIZE] = addr[i]; } wakeup(&p->nread); //DOC: pipewrite-wakeup1 80103469: 8d 83 34 02 00 00 lea 0x234(%ebx),%eax 8010346f: 83 ec 0c sub $0xc,%esp 80103472: 50 push %eax 80103473: e8 68 0a 00 00 call 80103ee0 <wakeup> release(&p->lock); 80103478: 89 1c 24 mov %ebx,(%esp) 8010347b: e8 80 0f 00 00 call 80104400 <release> return n; 80103480: 83 c4 10 add $0x10,%esp 80103483: 8b 45 10 mov 0x10(%ebp),%eax 80103486: eb a9 jmp 80103431 <pipewrite+0xa1> 80103488: 90 nop 80103489: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103490 <piperead>: } int piperead(struct pipe *p, char *addr, int n) { 80103490: 55 push %ebp 80103491: 89 e5 mov %esp,%ebp 80103493: 57 push %edi 80103494: 56 push %esi 80103495: 53 push %ebx 80103496: 83 ec 18 sub $0x18,%esp 80103499: 8b 5d 08 mov 0x8(%ebp),%ebx 8010349c: 8b 7d 0c mov 0xc(%ebp),%edi int i; acquire(&p->lock); 8010349f: 53 push %ebx 801034a0: e8 ab 0e 00 00 call 80104350 <acquire> while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801034a5: 83 c4 10 add $0x10,%esp 801034a8: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 801034ae: 39 83 38 02 00 00 cmp %eax,0x238(%ebx) 801034b4: 75 6a jne 80103520 <piperead+0x90> 801034b6: 8b b3 40 02 00 00 mov 0x240(%ebx),%esi 801034bc: 85 f6 test %esi,%esi 801034be: 0f 84 cc 00 00 00 je 80103590 <piperead+0x100> if(myproc()->killed){ release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep 801034c4: 8d b3 34 02 00 00 lea 0x234(%ebx),%esi 801034ca: eb 2d jmp 801034f9 <piperead+0x69> 801034cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801034d0: 83 ec 08 sub $0x8,%esp 801034d3: 53 push %ebx 801034d4: 56 push %esi 801034d5: e8 56 08 00 00 call 80103d30 <sleep> piperead(struct pipe *p, char *addr, int n) { int i; acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty 801034da: 83 c4 10 add $0x10,%esp 801034dd: 8b 83 38 02 00 00 mov 0x238(%ebx),%eax 801034e3: 39 83 34 02 00 00 cmp %eax,0x234(%ebx) 801034e9: 75 35 jne 80103520 <piperead+0x90> 801034eb: 8b 93 40 02 00 00 mov 0x240(%ebx),%edx 801034f1: 85 d2 test %edx,%edx 801034f3: 0f 84 97 00 00 00 je 80103590 <piperead+0x100> if(myproc()->killed){ 801034f9: e8 82 02 00 00 call 80103780 <myproc> 801034fe: 8b 48 24 mov 0x24(%eax),%ecx 80103501: 85 c9 test %ecx,%ecx 80103503: 74 cb je 801034d0 <piperead+0x40> release(&p->lock); 80103505: 83 ec 0c sub $0xc,%esp 80103508: 53 push %ebx 80103509: e8 f2 0e 00 00 call 80104400 <release> return -1; 8010350e: 83 c4 10 add $0x10,%esp addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup release(&p->lock); return i; } 80103511: 8d 65 f4 lea -0xc(%ebp),%esp acquire(&p->lock); while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty if(myproc()->killed){ release(&p->lock); return -1; 80103514: b8 ff ff ff ff mov $0xffffffff,%eax addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup release(&p->lock); return i; } 80103519: 5b pop %ebx 8010351a: 5e pop %esi 8010351b: 5f pop %edi 8010351c: 5d pop %ebp 8010351d: c3 ret 8010351e: 66 90 xchg %ax,%ax release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80103520: 8b 45 10 mov 0x10(%ebp),%eax 80103523: 85 c0 test %eax,%eax 80103525: 7e 69 jle 80103590 <piperead+0x100> if(p->nread == p->nwrite) 80103527: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 8010352d: 31 c9 xor %ecx,%ecx 8010352f: eb 15 jmp 80103546 <piperead+0xb6> 80103531: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103538: 8b 83 34 02 00 00 mov 0x234(%ebx),%eax 8010353e: 3b 83 38 02 00 00 cmp 0x238(%ebx),%eax 80103544: 74 5a je 801035a0 <piperead+0x110> break; addr[i] = p->data[p->nread++ % PIPESIZE]; 80103546: 8d 70 01 lea 0x1(%eax),%esi 80103549: 25 ff 01 00 00 and $0x1ff,%eax 8010354e: 89 b3 34 02 00 00 mov %esi,0x234(%ebx) 80103554: 0f b6 44 03 34 movzbl 0x34(%ebx,%eax,1),%eax 80103559: 88 04 0f mov %al,(%edi,%ecx,1) release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 8010355c: 83 c1 01 add $0x1,%ecx 8010355f: 39 4d 10 cmp %ecx,0x10(%ebp) 80103562: 75 d4 jne 80103538 <piperead+0xa8> if(p->nread == p->nwrite) break; addr[i] = p->data[p->nread++ % PIPESIZE]; } wakeup(&p->nwrite); //DOC: piperead-wakeup 80103564: 8d 83 38 02 00 00 lea 0x238(%ebx),%eax 8010356a: 83 ec 0c sub $0xc,%esp 8010356d: 50 push %eax 8010356e: e8 6d 09 00 00 call 80103ee0 <wakeup> release(&p->lock); 80103573: 89 1c 24 mov %ebx,(%esp) 80103576: e8 85 0e 00 00 call 80104400 <release> return i; 8010357b: 8b 45 10 mov 0x10(%ebp),%eax 8010357e: 83 c4 10 add $0x10,%esp } 80103581: 8d 65 f4 lea -0xc(%ebp),%esp 80103584: 5b pop %ebx 80103585: 5e pop %esi 80103586: 5f pop %edi 80103587: 5d pop %ebp 80103588: c3 ret 80103589: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi release(&p->lock); return -1; } sleep(&p->nread, &p->lock); //DOC: piperead-sleep } for(i = 0; i < n; i++){ //DOC: piperead-copy 80103590: c7 45 10 00 00 00 00 movl $0x0,0x10(%ebp) 80103597: eb cb jmp 80103564 <piperead+0xd4> 80103599: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801035a0: 89 4d 10 mov %ecx,0x10(%ebp) 801035a3: eb bf jmp 80103564 <piperead+0xd4> 801035a5: 66 90 xchg %ax,%ax 801035a7: 66 90 xchg %ax,%ax 801035a9: 66 90 xchg %ax,%ax 801035ab: 66 90 xchg %ax,%ax 801035ad: 66 90 xchg %ax,%ax 801035af: 90 nop 801035b0 <allocproc>: // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 801035b0: 55 push %ebp 801035b1: 89 e5 mov %esp,%ebp 801035b3: 53 push %ebx struct proc *p; char *sp; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801035b4: bb 54 2d 11 80 mov $0x80112d54,%ebx // If found, change state to EMBRYO and initialize // state required to run in the kernel. // Otherwise return 0. static struct proc* allocproc(void) { 801035b9: 83 ec 10 sub $0x10,%esp struct proc *p; char *sp; acquire(&ptable.lock); 801035bc: 68 20 2d 11 80 push $0x80112d20 801035c1: e8 8a 0d 00 00 call 80104350 <acquire> 801035c6: 83 c4 10 add $0x10,%esp 801035c9: eb 10 jmp 801035db <allocproc+0x2b> 801035cb: 90 nop 801035cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 801035d0: 83 c3 7c add $0x7c,%ebx 801035d3: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 801035d9: 74 75 je 80103650 <allocproc+0xa0> if(p->state == UNUSED) 801035db: 8b 43 0c mov 0xc(%ebx),%eax 801035de: 85 c0 test %eax,%eax 801035e0: 75 ee jne 801035d0 <allocproc+0x20> release(&ptable.lock); return 0; found: p->state = EMBRYO; p->pid = nextpid++; 801035e2: a1 04 a0 10 80 mov 0x8010a004,%eax release(&ptable.lock); 801035e7: 83 ec 0c sub $0xc,%esp release(&ptable.lock); return 0; found: p->state = EMBRYO; 801035ea: c7 43 0c 01 00 00 00 movl $0x1,0xc(%ebx) p->pid = nextpid++; release(&ptable.lock); 801035f1: 68 20 2d 11 80 push $0x80112d20 release(&ptable.lock); return 0; found: p->state = EMBRYO; p->pid = nextpid++; 801035f6: 8d 50 01 lea 0x1(%eax),%edx 801035f9: 89 43 10 mov %eax,0x10(%ebx) 801035fc: 89 15 04 a0 10 80 mov %edx,0x8010a004 release(&ptable.lock); 80103602: e8 f9 0d 00 00 call 80104400 <release> // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ 80103607: e8 84 ee ff ff call 80102490 <kalloc> 8010360c: 83 c4 10 add $0x10,%esp 8010360f: 85 c0 test %eax,%eax 80103611: 89 43 08 mov %eax,0x8(%ebx) 80103614: 74 51 je 80103667 <allocproc+0xb7> return 0; } sp = p->kstack + KSTACKSIZE; // Leave room for trap frame. sp -= sizeof *p->tf; 80103616: 8d 90 b4 0f 00 00 lea 0xfb4(%eax),%edx sp -= 4; *(uint*)sp = (uint)trapret; sp -= sizeof *p->context; p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); 8010361c: 83 ec 04 sub $0x4,%esp // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; *(uint*)sp = (uint)trapret; sp -= sizeof *p->context; 8010361f: 05 9c 0f 00 00 add $0xf9c,%eax return 0; } sp = p->kstack + KSTACKSIZE; // Leave room for trap frame. sp -= sizeof *p->tf; 80103624: 89 53 18 mov %edx,0x18(%ebx) p->tf = (struct trapframe*)sp; // Set up new context to start executing at forkret, // which returns to trapret. sp -= 4; *(uint*)sp = (uint)trapret; 80103627: c7 40 14 7a 56 10 80 movl $0x8010567a,0x14(%eax) sp -= sizeof *p->context; p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); 8010362e: 6a 14 push $0x14 80103630: 6a 00 push $0x0 80103632: 50 push %eax // which returns to trapret. sp -= 4; *(uint*)sp = (uint)trapret; sp -= sizeof *p->context; p->context = (struct context*)sp; 80103633: 89 43 1c mov %eax,0x1c(%ebx) memset(p->context, 0, sizeof *p->context); 80103636: e8 15 0e 00 00 call 80104450 <memset> p->context->eip = (uint)forkret; 8010363b: 8b 43 1c mov 0x1c(%ebx),%eax return p; 8010363e: 83 c4 10 add $0x10,%esp *(uint*)sp = (uint)trapret; sp -= sizeof *p->context; p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; 80103641: c7 40 10 70 36 10 80 movl $0x80103670,0x10(%eax) return p; 80103648: 89 d8 mov %ebx,%eax } 8010364a: 8b 5d fc mov -0x4(%ebp),%ebx 8010364d: c9 leave 8010364e: c3 ret 8010364f: 90 nop for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) if(p->state == UNUSED) goto found; release(&ptable.lock); 80103650: 83 ec 0c sub $0xc,%esp 80103653: 68 20 2d 11 80 push $0x80112d20 80103658: e8 a3 0d 00 00 call 80104400 <release> return 0; 8010365d: 83 c4 10 add $0x10,%esp 80103660: 31 c0 xor %eax,%eax p->context = (struct context*)sp; memset(p->context, 0, sizeof *p->context); p->context->eip = (uint)forkret; return p; } 80103662: 8b 5d fc mov -0x4(%ebp),%ebx 80103665: c9 leave 80103666: c3 ret release(&ptable.lock); // Allocate kernel stack. if((p->kstack = kalloc()) == 0){ p->state = UNUSED; 80103667: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) return 0; 8010366e: eb da jmp 8010364a <allocproc+0x9a> 80103670 <forkret>: // A fork child's very first scheduling by scheduler() // will swtch here. "Return" to user space. void forkret(void) { 80103670: 55 push %ebp 80103671: 89 e5 mov %esp,%ebp 80103673: 83 ec 14 sub $0x14,%esp static int first = 1; // Still holding ptable.lock from scheduler. release(&ptable.lock); 80103676: 68 20 2d 11 80 push $0x80112d20 8010367b: e8 80 0d 00 00 call 80104400 <release> if (first) { 80103680: a1 00 a0 10 80 mov 0x8010a000,%eax 80103685: 83 c4 10 add $0x10,%esp 80103688: 85 c0 test %eax,%eax 8010368a: 75 04 jne 80103690 <forkret+0x20> iinit(ROOTDEV); initlog(ROOTDEV); } // Return to "caller", actually trapret (see allocproc). } 8010368c: c9 leave 8010368d: c3 ret 8010368e: 66 90 xchg %ax,%ax if (first) { // 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; iinit(ROOTDEV); 80103690: 83 ec 0c sub $0xc,%esp if (first) { // 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; 80103693: c7 05 00 a0 10 80 00 movl $0x0,0x8010a000 8010369a: 00 00 00 iinit(ROOTDEV); 8010369d: 6a 01 push $0x1 8010369f: e8 cc dd ff ff call 80101470 <iinit> initlog(ROOTDEV); 801036a4: c7 04 24 01 00 00 00 movl $0x1,(%esp) 801036ab: e8 00 f4 ff ff call 80102ab0 <initlog> 801036b0: 83 c4 10 add $0x10,%esp } // Return to "caller", actually trapret (see allocproc). } 801036b3: c9 leave 801036b4: c3 ret 801036b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801036b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801036c0 <pinit>: static void wakeup1(void *chan); void pinit(void) { 801036c0: 55 push %ebp 801036c1: 89 e5 mov %esp,%ebp 801036c3: 83 ec 10 sub $0x10,%esp initlock(&ptable.lock, "ptable"); 801036c6: 68 75 74 10 80 push $0x80107475 801036cb: 68 20 2d 11 80 push $0x80112d20 801036d0: e8 1b 0b 00 00 call 801041f0 <initlock> } 801036d5: 83 c4 10 add $0x10,%esp 801036d8: c9 leave 801036d9: c3 ret 801036da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801036e0 <mycpu>: // Must be called with interrupts disabled to avoid the caller being // rescheduled between reading lapicid and running through the loop. struct cpu* mycpu(void) { 801036e0: 55 push %ebp 801036e1: 89 e5 mov %esp,%ebp 801036e3: 56 push %esi 801036e4: 53 push %ebx static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 801036e5: 9c pushf 801036e6: 58 pop %eax int apicid, i; if(readeflags()&FL_IF) 801036e7: f6 c4 02 test $0x2,%ah 801036ea: 75 5b jne 80103747 <mycpu+0x67> panic("mycpu called with interrupts enabled\n"); apicid = lapicid(); 801036ec: e8 ff ef ff ff call 801026f0 <lapicid> // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { 801036f1: 8b 35 00 2d 11 80 mov 0x80112d00,%esi 801036f7: 85 f6 test %esi,%esi 801036f9: 7e 3f jle 8010373a <mycpu+0x5a> if (cpus[i].apicid == apicid) 801036fb: 0f b6 15 80 27 11 80 movzbl 0x80112780,%edx 80103702: 39 d0 cmp %edx,%eax 80103704: 74 30 je 80103736 <mycpu+0x56> 80103706: b9 30 28 11 80 mov $0x80112830,%ecx 8010370b: 31 d2 xor %edx,%edx 8010370d: 8d 76 00 lea 0x0(%esi),%esi panic("mycpu called with interrupts enabled\n"); apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { 80103710: 83 c2 01 add $0x1,%edx 80103713: 39 f2 cmp %esi,%edx 80103715: 74 23 je 8010373a <mycpu+0x5a> if (cpus[i].apicid == apicid) 80103717: 0f b6 19 movzbl (%ecx),%ebx 8010371a: 81 c1 b0 00 00 00 add $0xb0,%ecx 80103720: 39 d8 cmp %ebx,%eax 80103722: 75 ec jne 80103710 <mycpu+0x30> return &cpus[i]; 80103724: 69 c2 b0 00 00 00 imul $0xb0,%edx,%eax } panic("unknown apicid\n"); } 8010372a: 8d 65 f8 lea -0x8(%ebp),%esp 8010372d: 5b pop %ebx apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { if (cpus[i].apicid == apicid) return &cpus[i]; 8010372e: 05 80 27 11 80 add $0x80112780,%eax } panic("unknown apicid\n"); } 80103733: 5e pop %esi 80103734: 5d pop %ebp 80103735: c3 ret panic("mycpu called with interrupts enabled\n"); apicid = lapicid(); // APIC IDs are not guaranteed to be contiguous. Maybe we should have // a reverse map, or reserve a register to store &cpus[i]. for (i = 0; i < ncpu; ++i) { 80103736: 31 d2 xor %edx,%edx 80103738: eb ea jmp 80103724 <mycpu+0x44> if (cpus[i].apicid == apicid) return &cpus[i]; } panic("unknown apicid\n"); 8010373a: 83 ec 0c sub $0xc,%esp 8010373d: 68 7c 74 10 80 push $0x8010747c 80103742: e8 29 cc ff ff call 80100370 <panic> mycpu(void) { int apicid, i; if(readeflags()&FL_IF) panic("mycpu called with interrupts enabled\n"); 80103747: 83 ec 0c sub $0xc,%esp 8010374a: 68 6c 75 10 80 push $0x8010756c 8010374f: e8 1c cc ff ff call 80100370 <panic> 80103754: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 8010375a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80103760 <cpuid>: initlock(&ptable.lock, "ptable"); } // Must be called with interrupts disabled int cpuid() { 80103760: 55 push %ebp 80103761: 89 e5 mov %esp,%ebp 80103763: 83 ec 08 sub $0x8,%esp return mycpu()-cpus; 80103766: e8 75 ff ff ff call 801036e0 <mycpu> 8010376b: 2d 80 27 11 80 sub $0x80112780,%eax } 80103770: c9 leave } // Must be called with interrupts disabled int cpuid() { return mycpu()-cpus; 80103771: c1 f8 04 sar $0x4,%eax 80103774: 69 c0 a3 8b 2e ba imul $0xba2e8ba3,%eax,%eax } 8010377a: c3 ret 8010377b: 90 nop 8010377c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103780 <myproc>: } // Disable interrupts so that we are not rescheduled // while reading proc from the cpu structure struct proc* myproc(void) { 80103780: 55 push %ebp 80103781: 89 e5 mov %esp,%ebp 80103783: 53 push %ebx 80103784: 83 ec 04 sub $0x4,%esp struct cpu *c; struct proc *p; pushcli(); 80103787: e8 e4 0a 00 00 call 80104270 <pushcli> c = mycpu(); 8010378c: e8 4f ff ff ff call 801036e0 <mycpu> p = c->proc; 80103791: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103797: e8 14 0b 00 00 call 801042b0 <popcli> return p; } 8010379c: 83 c4 04 add $0x4,%esp 8010379f: 89 d8 mov %ebx,%eax 801037a1: 5b pop %ebx 801037a2: 5d pop %ebp 801037a3: c3 ret 801037a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801037aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 801037b0 <userinit>: //PAGEBREAK: 32 // Set up first user process. void userinit(void) { 801037b0: 55 push %ebp 801037b1: 89 e5 mov %esp,%ebp 801037b3: 53 push %ebx 801037b4: 83 ec 04 sub $0x4,%esp struct proc *p; extern char _binary_initcode_start[], _binary_initcode_size[]; p = allocproc(); 801037b7: e8 f4 fd ff ff call 801035b0 <allocproc> 801037bc: 89 c3 mov %eax,%ebx initproc = p; 801037be: a3 b8 a5 10 80 mov %eax,0x8010a5b8 if((p->pgdir = setupkvm()) == 0) 801037c3: e8 a8 34 00 00 call 80106c70 <setupkvm> 801037c8: 85 c0 test %eax,%eax 801037ca: 89 43 04 mov %eax,0x4(%ebx) 801037cd: 0f 84 bd 00 00 00 je 80103890 <userinit+0xe0> panic("userinit: out of memory?"); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); 801037d3: 83 ec 04 sub $0x4,%esp 801037d6: 68 2c 00 00 00 push $0x2c 801037db: 68 60 a4 10 80 push $0x8010a460 801037e0: 50 push %eax 801037e1: e8 9a 31 00 00 call 80106980 <inituvm> p->sz = PGSIZE; memset(p->tf, 0, sizeof(*p->tf)); 801037e6: 83 c4 0c add $0xc,%esp initproc = p; if((p->pgdir = setupkvm()) == 0) panic("userinit: out of memory?"); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); p->sz = PGSIZE; 801037e9: c7 03 00 10 00 00 movl $0x1000,(%ebx) memset(p->tf, 0, sizeof(*p->tf)); 801037ef: 6a 4c push $0x4c 801037f1: 6a 00 push $0x0 801037f3: ff 73 18 pushl 0x18(%ebx) 801037f6: e8 55 0c 00 00 call 80104450 <memset> p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 801037fb: 8b 43 18 mov 0x18(%ebx),%eax 801037fe: ba 1b 00 00 00 mov $0x1b,%edx p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 80103803: b9 23 00 00 00 mov $0x23,%ecx p->tf->ss = p->tf->ds; p->tf->eflags = FL_IF; p->tf->esp = PGSIZE; p->tf->eip = 0; // beginning of initcode.S safestrcpy(p->name, "initcode", sizeof(p->name)); 80103808: 83 c4 0c add $0xc,%esp if((p->pgdir = setupkvm()) == 0) panic("userinit: out of memory?"); inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size); p->sz = PGSIZE; memset(p->tf, 0, sizeof(*p->tf)); p->tf->cs = (SEG_UCODE << 3) | DPL_USER; 8010380b: 66 89 50 3c mov %dx,0x3c(%eax) p->tf->ds = (SEG_UDATA << 3) | DPL_USER; 8010380f: 8b 43 18 mov 0x18(%ebx),%eax 80103812: 66 89 48 2c mov %cx,0x2c(%eax) p->tf->es = p->tf->ds; 80103816: 8b 43 18 mov 0x18(%ebx),%eax 80103819: 0f b7 50 2c movzwl 0x2c(%eax),%edx 8010381d: 66 89 50 28 mov %dx,0x28(%eax) p->tf->ss = p->tf->ds; 80103821: 8b 43 18 mov 0x18(%ebx),%eax 80103824: 0f b7 50 2c movzwl 0x2c(%eax),%edx 80103828: 66 89 50 48 mov %dx,0x48(%eax) p->tf->eflags = FL_IF; 8010382c: 8b 43 18 mov 0x18(%ebx),%eax 8010382f: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax) p->tf->esp = PGSIZE; 80103836: 8b 43 18 mov 0x18(%ebx),%eax 80103839: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax) p->tf->eip = 0; // beginning of initcode.S 80103840: 8b 43 18 mov 0x18(%ebx),%eax 80103843: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax) safestrcpy(p->name, "initcode", sizeof(p->name)); 8010384a: 8d 43 6c lea 0x6c(%ebx),%eax 8010384d: 6a 10 push $0x10 8010384f: 68 a5 74 10 80 push $0x801074a5 80103854: 50 push %eax 80103855: e8 f6 0d 00 00 call 80104650 <safestrcpy> p->cwd = namei("/"); 8010385a: c7 04 24 ae 74 10 80 movl $0x801074ae,(%esp) 80103861: e8 5a e6 ff ff call 80101ec0 <namei> 80103866: 89 43 68 mov %eax,0x68(%ebx) // this assignment to p->state lets other cores // run this process. the acquire forces the above // writes to be visible, and the lock is also needed // because the assignment might not be atomic. acquire(&ptable.lock); 80103869: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103870: e8 db 0a 00 00 call 80104350 <acquire> p->state = RUNNABLE; 80103875: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) release(&ptable.lock); 8010387c: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103883: e8 78 0b 00 00 call 80104400 <release> } 80103888: 83 c4 10 add $0x10,%esp 8010388b: 8b 5d fc mov -0x4(%ebp),%ebx 8010388e: c9 leave 8010388f: c3 ret p = allocproc(); initproc = p; if((p->pgdir = setupkvm()) == 0) panic("userinit: out of memory?"); 80103890: 83 ec 0c sub $0xc,%esp 80103893: 68 8c 74 10 80 push $0x8010748c 80103898: e8 d3 ca ff ff call 80100370 <panic> 8010389d: 8d 76 00 lea 0x0(%esi),%esi 801038a0 <growproc>: // Grow current process's memory by n bytes. // Return 0 on success, -1 on failure. int growproc(int n) { 801038a0: 55 push %ebp 801038a1: 89 e5 mov %esp,%ebp 801038a3: 56 push %esi 801038a4: 53 push %ebx 801038a5: 8b 75 08 mov 0x8(%ebp),%esi // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 801038a8: e8 c3 09 00 00 call 80104270 <pushcli> c = mycpu(); 801038ad: e8 2e fe ff ff call 801036e0 <mycpu> p = c->proc; 801038b2: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 801038b8: e8 f3 09 00 00 call 801042b0 <popcli> { uint sz; struct proc *curproc = myproc(); sz = curproc->sz; if(n > 0){ 801038bd: 83 fe 00 cmp $0x0,%esi growproc(int n) { uint sz; struct proc *curproc = myproc(); sz = curproc->sz; 801038c0: 8b 03 mov (%ebx),%eax if(n > 0){ 801038c2: 7e 34 jle 801038f8 <growproc+0x58> if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) 801038c4: 83 ec 04 sub $0x4,%esp 801038c7: 01 c6 add %eax,%esi 801038c9: 56 push %esi 801038ca: 50 push %eax 801038cb: ff 73 04 pushl 0x4(%ebx) 801038ce: e8 ed 31 00 00 call 80106ac0 <allocuvm> 801038d3: 83 c4 10 add $0x10,%esp 801038d6: 85 c0 test %eax,%eax 801038d8: 74 36 je 80103910 <growproc+0x70> } else if(n < 0){ if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } curproc->sz = sz; switchuvm(curproc); 801038da: 83 ec 0c sub $0xc,%esp return -1; } else if(n < 0){ if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } curproc->sz = sz; 801038dd: 89 03 mov %eax,(%ebx) switchuvm(curproc); 801038df: 53 push %ebx 801038e0: e8 8b 2f 00 00 call 80106870 <switchuvm> return 0; 801038e5: 83 c4 10 add $0x10,%esp 801038e8: 31 c0 xor %eax,%eax } 801038ea: 8d 65 f8 lea -0x8(%ebp),%esp 801038ed: 5b pop %ebx 801038ee: 5e pop %esi 801038ef: 5d pop %ebp 801038f0: c3 ret 801038f1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi sz = curproc->sz; if(n > 0){ if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; } else if(n < 0){ 801038f8: 74 e0 je 801038da <growproc+0x3a> if((sz = deallocuvm(curproc->pgdir, sz, sz + n)) == 0) 801038fa: 83 ec 04 sub $0x4,%esp 801038fd: 01 c6 add %eax,%esi 801038ff: 56 push %esi 80103900: 50 push %eax 80103901: ff 73 04 pushl 0x4(%ebx) 80103904: e8 b7 32 00 00 call 80106bc0 <deallocuvm> 80103909: 83 c4 10 add $0x10,%esp 8010390c: 85 c0 test %eax,%eax 8010390e: 75 ca jne 801038da <growproc+0x3a> struct proc *curproc = myproc(); sz = curproc->sz; if(n > 0){ if((sz = allocuvm(curproc->pgdir, sz, sz + n)) == 0) return -1; 80103910: b8 ff ff ff ff mov $0xffffffff,%eax 80103915: eb d3 jmp 801038ea <growproc+0x4a> 80103917: 89 f6 mov %esi,%esi 80103919: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103920 <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) { 80103920: 55 push %ebp 80103921: 89 e5 mov %esp,%ebp 80103923: 57 push %edi 80103924: 56 push %esi 80103925: 53 push %ebx 80103926: 83 ec 1c sub $0x1c,%esp // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103929: e8 42 09 00 00 call 80104270 <pushcli> c = mycpu(); 8010392e: e8 ad fd ff ff call 801036e0 <mycpu> p = c->proc; 80103933: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103939: e8 72 09 00 00 call 801042b0 <popcli> int i, pid; struct proc *np; struct proc *curproc = myproc(); // Allocate process. if((np = allocproc()) == 0){ 8010393e: e8 6d fc ff ff call 801035b0 <allocproc> 80103943: 85 c0 test %eax,%eax 80103945: 89 c7 mov %eax,%edi 80103947: 89 45 e4 mov %eax,-0x1c(%ebp) 8010394a: 0f 84 b5 00 00 00 je 80103a05 <fork+0xe5> return -1; } // Copy process state from proc. if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ 80103950: 83 ec 08 sub $0x8,%esp 80103953: ff 33 pushl (%ebx) 80103955: ff 73 04 pushl 0x4(%ebx) 80103958: e8 e3 33 00 00 call 80106d40 <copyuvm> 8010395d: 83 c4 10 add $0x10,%esp 80103960: 85 c0 test %eax,%eax 80103962: 89 47 04 mov %eax,0x4(%edi) 80103965: 0f 84 a1 00 00 00 je 80103a0c <fork+0xec> kfree(np->kstack); np->kstack = 0; np->state = UNUSED; return -1; } np->sz = curproc->sz; 8010396b: 8b 03 mov (%ebx),%eax 8010396d: 8b 4d e4 mov -0x1c(%ebp),%ecx 80103970: 89 01 mov %eax,(%ecx) np->parent = curproc; 80103972: 89 59 14 mov %ebx,0x14(%ecx) *np->tf = *curproc->tf; 80103975: 89 c8 mov %ecx,%eax 80103977: 8b 79 18 mov 0x18(%ecx),%edi 8010397a: 8b 73 18 mov 0x18(%ebx),%esi 8010397d: b9 13 00 00 00 mov $0x13,%ecx 80103982: f3 a5 rep movsl %ds:(%esi),%es:(%edi) // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 80103984: 31 f6 xor %esi,%esi np->sz = curproc->sz; np->parent = curproc; *np->tf = *curproc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; 80103986: 8b 40 18 mov 0x18(%eax),%eax 80103989: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax) for(i = 0; i < NOFILE; i++) if(curproc->ofile[i]) 80103990: 8b 44 b3 28 mov 0x28(%ebx,%esi,4),%eax 80103994: 85 c0 test %eax,%eax 80103996: 74 13 je 801039ab <fork+0x8b> np->ofile[i] = filedup(curproc->ofile[i]); 80103998: 83 ec 0c sub $0xc,%esp 8010399b: 50 push %eax 8010399c: e8 3f d4 ff ff call 80100de0 <filedup> 801039a1: 8b 55 e4 mov -0x1c(%ebp),%edx 801039a4: 83 c4 10 add $0x10,%esp 801039a7: 89 44 b2 28 mov %eax,0x28(%edx,%esi,4) *np->tf = *curproc->tf; // Clear %eax so that fork returns 0 in the child. np->tf->eax = 0; for(i = 0; i < NOFILE; i++) 801039ab: 83 c6 01 add $0x1,%esi 801039ae: 83 fe 10 cmp $0x10,%esi 801039b1: 75 dd jne 80103990 <fork+0x70> if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); 801039b3: 83 ec 0c sub $0xc,%esp 801039b6: ff 73 68 pushl 0x68(%ebx) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 801039b9: 83 c3 6c add $0x6c,%ebx np->tf->eax = 0; for(i = 0; i < NOFILE; i++) if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); 801039bc: e8 7f dc ff ff call 80101640 <idup> 801039c1: 8b 7d e4 mov -0x1c(%ebp),%edi safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 801039c4: 83 c4 0c add $0xc,%esp np->tf->eax = 0; for(i = 0; i < NOFILE; i++) if(curproc->ofile[i]) np->ofile[i] = filedup(curproc->ofile[i]); np->cwd = idup(curproc->cwd); 801039c7: 89 47 68 mov %eax,0x68(%edi) safestrcpy(np->name, curproc->name, sizeof(curproc->name)); 801039ca: 8d 47 6c lea 0x6c(%edi),%eax 801039cd: 6a 10 push $0x10 801039cf: 53 push %ebx 801039d0: 50 push %eax 801039d1: e8 7a 0c 00 00 call 80104650 <safestrcpy> pid = np->pid; 801039d6: 8b 5f 10 mov 0x10(%edi),%ebx acquire(&ptable.lock); 801039d9: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 801039e0: e8 6b 09 00 00 call 80104350 <acquire> np->state = RUNNABLE; 801039e5: c7 47 0c 03 00 00 00 movl $0x3,0xc(%edi) release(&ptable.lock); 801039ec: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 801039f3: e8 08 0a 00 00 call 80104400 <release> return pid; 801039f8: 83 c4 10 add $0x10,%esp 801039fb: 89 d8 mov %ebx,%eax } 801039fd: 8d 65 f4 lea -0xc(%ebp),%esp 80103a00: 5b pop %ebx 80103a01: 5e pop %esi 80103a02: 5f pop %edi 80103a03: 5d pop %ebp 80103a04: c3 ret struct proc *np; struct proc *curproc = myproc(); // Allocate process. if((np = allocproc()) == 0){ return -1; 80103a05: b8 ff ff ff ff mov $0xffffffff,%eax 80103a0a: eb f1 jmp 801039fd <fork+0xdd> } // Copy process state from proc. if((np->pgdir = copyuvm(curproc->pgdir, curproc->sz)) == 0){ kfree(np->kstack); 80103a0c: 8b 7d e4 mov -0x1c(%ebp),%edi 80103a0f: 83 ec 0c sub $0xc,%esp 80103a12: ff 77 08 pushl 0x8(%edi) 80103a15: e8 c6 e8 ff ff call 801022e0 <kfree> np->kstack = 0; 80103a1a: c7 47 08 00 00 00 00 movl $0x0,0x8(%edi) np->state = UNUSED; 80103a21: c7 47 0c 00 00 00 00 movl $0x0,0xc(%edi) return -1; 80103a28: 83 c4 10 add $0x10,%esp 80103a2b: b8 ff ff ff ff mov $0xffffffff,%eax 80103a30: eb cb jmp 801039fd <fork+0xdd> 80103a32: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103a39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103a40 <scheduler>: // - swtch to start running that process // - eventually that process transfers control // via swtch back to the scheduler. void scheduler(void) { 80103a40: 55 push %ebp 80103a41: 89 e5 mov %esp,%ebp 80103a43: 57 push %edi 80103a44: 56 push %esi 80103a45: 53 push %ebx 80103a46: 83 ec 0c sub $0xc,%esp struct proc *p; struct cpu *c = mycpu(); 80103a49: e8 92 fc ff ff call 801036e0 <mycpu> 80103a4e: 8d 78 04 lea 0x4(%eax),%edi 80103a51: 89 c6 mov %eax,%esi c->proc = 0; 80103a53: c7 80 ac 00 00 00 00 movl $0x0,0xac(%eax) 80103a5a: 00 00 00 80103a5d: 8d 76 00 lea 0x0(%esi),%esi } static inline void sti(void) { asm volatile("sti"); 80103a60: fb sti for(;;){ // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); 80103a61: 83 ec 0c sub $0xc,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a64: bb 54 2d 11 80 mov $0x80112d54,%ebx for(;;){ // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); 80103a69: 68 20 2d 11 80 push $0x80112d20 80103a6e: e8 dd 08 00 00 call 80104350 <acquire> 80103a73: 83 c4 10 add $0x10,%esp 80103a76: eb 13 jmp 80103a8b <scheduler+0x4b> 80103a78: 90 nop 80103a79: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103a80: 83 c3 7c add $0x7c,%ebx 80103a83: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103a89: 74 45 je 80103ad0 <scheduler+0x90> if(p->state != RUNNABLE) 80103a8b: 83 7b 0c 03 cmpl $0x3,0xc(%ebx) 80103a8f: 75 ef jne 80103a80 <scheduler+0x40> // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; switchuvm(p); 80103a91: 83 ec 0c sub $0xc,%esp continue; // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; 80103a94: 89 9e ac 00 00 00 mov %ebx,0xac(%esi) switchuvm(p); 80103a9a: 53 push %ebx // 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++){ 80103a9b: 83 c3 7c add $0x7c,%ebx // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; switchuvm(p); 80103a9e: e8 cd 2d 00 00 call 80106870 <switchuvm> p->state = RUNNING; swtch(&(c->scheduler), p->context); 80103aa3: 58 pop %eax 80103aa4: 5a pop %edx 80103aa5: ff 73 a0 pushl -0x60(%ebx) 80103aa8: 57 push %edi // Switch to chosen process. It is the process's job // to release ptable.lock and then reacquire it // before jumping back to us. c->proc = p; switchuvm(p); p->state = RUNNING; 80103aa9: c7 43 90 04 00 00 00 movl $0x4,-0x70(%ebx) swtch(&(c->scheduler), p->context); 80103ab0: e8 f6 0b 00 00 call 801046ab <swtch> switchkvm(); 80103ab5: e8 96 2d 00 00 call 80106850 <switchkvm> // Process is done running for now. // It should have changed its p->state before coming back. c->proc = 0; 80103aba: 83 c4 10 add $0x10,%esp // 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++){ 80103abd: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx swtch(&(c->scheduler), p->context); switchkvm(); // Process is done running for now. // It should have changed its p->state before coming back. c->proc = 0; 80103ac3: c7 86 ac 00 00 00 00 movl $0x0,0xac(%esi) 80103aca: 00 00 00 // Enable interrupts on this processor. sti(); // Loop over process table looking for process to run. acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103acd: 75 bc jne 80103a8b <scheduler+0x4b> 80103acf: 90 nop // Process is done running for now. // It should have changed its p->state before coming back. c->proc = 0; } release(&ptable.lock); 80103ad0: 83 ec 0c sub $0xc,%esp 80103ad3: 68 20 2d 11 80 push $0x80112d20 80103ad8: e8 23 09 00 00 call 80104400 <release> } 80103add: 83 c4 10 add $0x10,%esp 80103ae0: e9 7b ff ff ff jmp 80103a60 <scheduler+0x20> 80103ae5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103ae9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103af0 <sched>: // be proc->intena and proc->ncli, but that would // break in the few places where a lock is held but // there's no process. void sched(void) { 80103af0: 55 push %ebp 80103af1: 89 e5 mov %esp,%ebp 80103af3: 56 push %esi 80103af4: 53 push %ebx // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103af5: e8 76 07 00 00 call 80104270 <pushcli> c = mycpu(); 80103afa: e8 e1 fb ff ff call 801036e0 <mycpu> p = c->proc; 80103aff: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103b05: e8 a6 07 00 00 call 801042b0 <popcli> sched(void) { int intena; struct proc *p = myproc(); if(!holding(&ptable.lock)) 80103b0a: 83 ec 0c sub $0xc,%esp 80103b0d: 68 20 2d 11 80 push $0x80112d20 80103b12: e8 09 08 00 00 call 80104320 <holding> 80103b17: 83 c4 10 add $0x10,%esp 80103b1a: 85 c0 test %eax,%eax 80103b1c: 74 4f je 80103b6d <sched+0x7d> panic("sched ptable.lock"); if(mycpu()->ncli != 1) 80103b1e: e8 bd fb ff ff call 801036e0 <mycpu> 80103b23: 83 b8 a4 00 00 00 01 cmpl $0x1,0xa4(%eax) 80103b2a: 75 68 jne 80103b94 <sched+0xa4> panic("sched locks"); if(p->state == RUNNING) 80103b2c: 83 7b 0c 04 cmpl $0x4,0xc(%ebx) 80103b30: 74 55 je 80103b87 <sched+0x97> static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 80103b32: 9c pushf 80103b33: 58 pop %eax panic("sched running"); if(readeflags()&FL_IF) 80103b34: f6 c4 02 test $0x2,%ah 80103b37: 75 41 jne 80103b7a <sched+0x8a> panic("sched interruptible"); intena = mycpu()->intena; 80103b39: e8 a2 fb ff ff call 801036e0 <mycpu> swtch(&p->context, mycpu()->scheduler); 80103b3e: 83 c3 1c add $0x1c,%ebx panic("sched locks"); if(p->state == RUNNING) panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); intena = mycpu()->intena; 80103b41: 8b b0 a8 00 00 00 mov 0xa8(%eax),%esi swtch(&p->context, mycpu()->scheduler); 80103b47: e8 94 fb ff ff call 801036e0 <mycpu> 80103b4c: 83 ec 08 sub $0x8,%esp 80103b4f: ff 70 04 pushl 0x4(%eax) 80103b52: 53 push %ebx 80103b53: e8 53 0b 00 00 call 801046ab <swtch> mycpu()->intena = intena; 80103b58: e8 83 fb ff ff call 801036e0 <mycpu> } 80103b5d: 83 c4 10 add $0x10,%esp panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); intena = mycpu()->intena; swtch(&p->context, mycpu()->scheduler); mycpu()->intena = intena; 80103b60: 89 b0 a8 00 00 00 mov %esi,0xa8(%eax) } 80103b66: 8d 65 f8 lea -0x8(%ebp),%esp 80103b69: 5b pop %ebx 80103b6a: 5e pop %esi 80103b6b: 5d pop %ebp 80103b6c: c3 ret { int intena; struct proc *p = myproc(); if(!holding(&ptable.lock)) panic("sched ptable.lock"); 80103b6d: 83 ec 0c sub $0xc,%esp 80103b70: 68 b0 74 10 80 push $0x801074b0 80103b75: e8 f6 c7 ff ff call 80100370 <panic> if(mycpu()->ncli != 1) panic("sched locks"); if(p->state == RUNNING) panic("sched running"); if(readeflags()&FL_IF) panic("sched interruptible"); 80103b7a: 83 ec 0c sub $0xc,%esp 80103b7d: 68 dc 74 10 80 push $0x801074dc 80103b82: e8 e9 c7 ff ff call 80100370 <panic> if(!holding(&ptable.lock)) panic("sched ptable.lock"); if(mycpu()->ncli != 1) panic("sched locks"); if(p->state == RUNNING) panic("sched running"); 80103b87: 83 ec 0c sub $0xc,%esp 80103b8a: 68 ce 74 10 80 push $0x801074ce 80103b8f: e8 dc c7 ff ff call 80100370 <panic> struct proc *p = myproc(); if(!holding(&ptable.lock)) panic("sched ptable.lock"); if(mycpu()->ncli != 1) panic("sched locks"); 80103b94: 83 ec 0c sub $0xc,%esp 80103b97: 68 c2 74 10 80 push $0x801074c2 80103b9c: e8 cf c7 ff ff call 80100370 <panic> 80103ba1: eb 0d jmp 80103bb0 <exit> 80103ba3: 90 nop 80103ba4: 90 nop 80103ba5: 90 nop 80103ba6: 90 nop 80103ba7: 90 nop 80103ba8: 90 nop 80103ba9: 90 nop 80103baa: 90 nop 80103bab: 90 nop 80103bac: 90 nop 80103bad: 90 nop 80103bae: 90 nop 80103baf: 90 nop 80103bb0 <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) { 80103bb0: 55 push %ebp 80103bb1: 89 e5 mov %esp,%ebp 80103bb3: 57 push %edi 80103bb4: 56 push %esi 80103bb5: 53 push %ebx 80103bb6: 83 ec 0c sub $0xc,%esp // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103bb9: e8 b2 06 00 00 call 80104270 <pushcli> c = mycpu(); 80103bbe: e8 1d fb ff ff call 801036e0 <mycpu> p = c->proc; 80103bc3: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80103bc9: e8 e2 06 00 00 call 801042b0 <popcli> { struct proc *curproc = myproc(); struct proc *p; int fd; if(curproc == initproc) 80103bce: 39 35 b8 a5 10 80 cmp %esi,0x8010a5b8 80103bd4: 8d 5e 28 lea 0x28(%esi),%ebx 80103bd7: 8d 7e 68 lea 0x68(%esi),%edi 80103bda: 0f 84 e7 00 00 00 je 80103cc7 <exit+0x117> panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd]){ 80103be0: 8b 03 mov (%ebx),%eax 80103be2: 85 c0 test %eax,%eax 80103be4: 74 12 je 80103bf8 <exit+0x48> fileclose(curproc->ofile[fd]); 80103be6: 83 ec 0c sub $0xc,%esp 80103be9: 50 push %eax 80103bea: e8 41 d2 ff ff call 80100e30 <fileclose> curproc->ofile[fd] = 0; 80103bef: c7 03 00 00 00 00 movl $0x0,(%ebx) 80103bf5: 83 c4 10 add $0x10,%esp 80103bf8: 83 c3 04 add $0x4,%ebx if(curproc == initproc) panic("init exiting"); // Close all open files. for(fd = 0; fd < NOFILE; fd++){ 80103bfb: 39 df cmp %ebx,%edi 80103bfd: 75 e1 jne 80103be0 <exit+0x30> fileclose(curproc->ofile[fd]); curproc->ofile[fd] = 0; } } begin_op(); 80103bff: e8 4c ef ff ff call 80102b50 <begin_op> iput(curproc->cwd); 80103c04: 83 ec 0c sub $0xc,%esp 80103c07: ff 76 68 pushl 0x68(%esi) 80103c0a: e8 91 db ff ff call 801017a0 <iput> end_op(); 80103c0f: e8 ac ef ff ff call 80102bc0 <end_op> curproc->cwd = 0; 80103c14: c7 46 68 00 00 00 00 movl $0x0,0x68(%esi) acquire(&ptable.lock); 80103c1b: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103c22: e8 29 07 00 00 call 80104350 <acquire> // Parent might be sleeping in wait(). wakeup1(curproc->parent); 80103c27: 8b 56 14 mov 0x14(%esi),%edx 80103c2a: 83 c4 10 add $0x10,%esp static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103c2d: b8 54 2d 11 80 mov $0x80112d54,%eax 80103c32: eb 0e jmp 80103c42 <exit+0x92> 80103c34: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103c38: 83 c0 7c add $0x7c,%eax 80103c3b: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103c40: 74 1c je 80103c5e <exit+0xae> if(p->state == SLEEPING && p->chan == chan) 80103c42: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103c46: 75 f0 jne 80103c38 <exit+0x88> 80103c48: 3b 50 20 cmp 0x20(%eax),%edx 80103c4b: 75 eb jne 80103c38 <exit+0x88> p->state = RUNNABLE; 80103c4d: 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++) 80103c54: 83 c0 7c add $0x7c,%eax 80103c57: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103c5c: 75 e4 jne 80103c42 <exit+0x92> wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == curproc){ p->parent = initproc; 80103c5e: 8b 0d b8 a5 10 80 mov 0x8010a5b8,%ecx 80103c64: ba 54 2d 11 80 mov $0x80112d54,%edx 80103c69: eb 10 jmp 80103c7b <exit+0xcb> 80103c6b: 90 nop 80103c6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi // Parent might be sleeping in wait(). wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103c70: 83 c2 7c add $0x7c,%edx 80103c73: 81 fa 54 4c 11 80 cmp $0x80114c54,%edx 80103c79: 74 33 je 80103cae <exit+0xfe> if(p->parent == curproc){ 80103c7b: 39 72 14 cmp %esi,0x14(%edx) 80103c7e: 75 f0 jne 80103c70 <exit+0xc0> p->parent = initproc; if(p->state == ZOMBIE) 80103c80: 83 7a 0c 05 cmpl $0x5,0xc(%edx) wakeup1(curproc->parent); // Pass abandoned children to init. for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->parent == curproc){ p->parent = initproc; 80103c84: 89 4a 14 mov %ecx,0x14(%edx) if(p->state == ZOMBIE) 80103c87: 75 e7 jne 80103c70 <exit+0xc0> 80103c89: b8 54 2d 11 80 mov $0x80112d54,%eax 80103c8e: eb 0a jmp 80103c9a <exit+0xea> static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103c90: 83 c0 7c add $0x7c,%eax 80103c93: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103c98: 74 d6 je 80103c70 <exit+0xc0> if(p->state == SLEEPING && p->chan == chan) 80103c9a: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103c9e: 75 f0 jne 80103c90 <exit+0xe0> 80103ca0: 3b 48 20 cmp 0x20(%eax),%ecx 80103ca3: 75 eb jne 80103c90 <exit+0xe0> p->state = RUNNABLE; 80103ca5: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 80103cac: eb e2 jmp 80103c90 <exit+0xe0> wakeup1(initproc); } } // Jump into the scheduler, never to return. curproc->state = ZOMBIE; 80103cae: c7 46 0c 05 00 00 00 movl $0x5,0xc(%esi) sched(); 80103cb5: e8 36 fe ff ff call 80103af0 <sched> panic("zombie exit"); 80103cba: 83 ec 0c sub $0xc,%esp 80103cbd: 68 fd 74 10 80 push $0x801074fd 80103cc2: e8 a9 c6 ff ff call 80100370 <panic> struct proc *curproc = myproc(); struct proc *p; int fd; if(curproc == initproc) panic("init exiting"); 80103cc7: 83 ec 0c sub $0xc,%esp 80103cca: 68 f0 74 10 80 push $0x801074f0 80103ccf: e8 9c c6 ff ff call 80100370 <panic> 80103cd4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80103cda: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80103ce0 <yield>: } // Give up the CPU for one scheduling round. void yield(void) { 80103ce0: 55 push %ebp 80103ce1: 89 e5 mov %esp,%ebp 80103ce3: 53 push %ebx 80103ce4: 83 ec 10 sub $0x10,%esp acquire(&ptable.lock); //DOC: yieldlock 80103ce7: 68 20 2d 11 80 push $0x80112d20 80103cec: e8 5f 06 00 00 call 80104350 <acquire> // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103cf1: e8 7a 05 00 00 call 80104270 <pushcli> c = mycpu(); 80103cf6: e8 e5 f9 ff ff call 801036e0 <mycpu> p = c->proc; 80103cfb: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103d01: e8 aa 05 00 00 call 801042b0 <popcli> // Give up the CPU for one scheduling round. void yield(void) { acquire(&ptable.lock); //DOC: yieldlock myproc()->state = RUNNABLE; 80103d06: c7 43 0c 03 00 00 00 movl $0x3,0xc(%ebx) sched(); 80103d0d: e8 de fd ff ff call 80103af0 <sched> release(&ptable.lock); 80103d12: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103d19: e8 e2 06 00 00 call 80104400 <release> } 80103d1e: 83 c4 10 add $0x10,%esp 80103d21: 8b 5d fc mov -0x4(%ebp),%ebx 80103d24: c9 leave 80103d25: c3 ret 80103d26: 8d 76 00 lea 0x0(%esi),%esi 80103d29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103d30 <sleep>: // Atomically release lock and sleep on chan. // Reacquires lock when awakened. void sleep(void *chan, struct spinlock *lk) { 80103d30: 55 push %ebp 80103d31: 89 e5 mov %esp,%ebp 80103d33: 57 push %edi 80103d34: 56 push %esi 80103d35: 53 push %ebx 80103d36: 83 ec 0c sub $0xc,%esp 80103d39: 8b 7d 08 mov 0x8(%ebp),%edi 80103d3c: 8b 75 0c mov 0xc(%ebp),%esi // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103d3f: e8 2c 05 00 00 call 80104270 <pushcli> c = mycpu(); 80103d44: e8 97 f9 ff ff call 801036e0 <mycpu> p = c->proc; 80103d49: 8b 98 ac 00 00 00 mov 0xac(%eax),%ebx popcli(); 80103d4f: e8 5c 05 00 00 call 801042b0 <popcli> void sleep(void *chan, struct spinlock *lk) { struct proc *p = myproc(); if(p == 0) 80103d54: 85 db test %ebx,%ebx 80103d56: 0f 84 87 00 00 00 je 80103de3 <sleep+0xb3> panic("sleep"); if(lk == 0) 80103d5c: 85 f6 test %esi,%esi 80103d5e: 74 76 je 80103dd6 <sleep+0xa6> // 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 80103d60: 81 fe 20 2d 11 80 cmp $0x80112d20,%esi 80103d66: 74 50 je 80103db8 <sleep+0x88> acquire(&ptable.lock); //DOC: sleeplock1 80103d68: 83 ec 0c sub $0xc,%esp 80103d6b: 68 20 2d 11 80 push $0x80112d20 80103d70: e8 db 05 00 00 call 80104350 <acquire> release(lk); 80103d75: 89 34 24 mov %esi,(%esp) 80103d78: e8 83 06 00 00 call 80104400 <release> } // Go to sleep. p->chan = chan; 80103d7d: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 80103d80: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 80103d87: e8 64 fd ff ff call 80103af0 <sched> // Tidy up. p->chan = 0; 80103d8c: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); 80103d93: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103d9a: e8 61 06 00 00 call 80104400 <release> acquire(lk); 80103d9f: 89 75 08 mov %esi,0x8(%ebp) 80103da2: 83 c4 10 add $0x10,%esp } } 80103da5: 8d 65 f4 lea -0xc(%ebp),%esp 80103da8: 5b pop %ebx 80103da9: 5e pop %esi 80103daa: 5f pop %edi 80103dab: 5d pop %ebp p->chan = 0; // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); acquire(lk); 80103dac: e9 9f 05 00 00 jmp 80104350 <acquire> 80103db1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(lk != &ptable.lock){ //DOC: sleeplock0 acquire(&ptable.lock); //DOC: sleeplock1 release(lk); } // Go to sleep. p->chan = chan; 80103db8: 89 7b 20 mov %edi,0x20(%ebx) p->state = SLEEPING; 80103dbb: c7 43 0c 02 00 00 00 movl $0x2,0xc(%ebx) sched(); 80103dc2: e8 29 fd ff ff call 80103af0 <sched> // Tidy up. p->chan = 0; 80103dc7: c7 43 20 00 00 00 00 movl $0x0,0x20(%ebx) // Reacquire original lock. if(lk != &ptable.lock){ //DOC: sleeplock2 release(&ptable.lock); acquire(lk); } } 80103dce: 8d 65 f4 lea -0xc(%ebp),%esp 80103dd1: 5b pop %ebx 80103dd2: 5e pop %esi 80103dd3: 5f pop %edi 80103dd4: 5d pop %ebp 80103dd5: c3 ret if(p == 0) panic("sleep"); if(lk == 0) panic("sleep without lk"); 80103dd6: 83 ec 0c sub $0xc,%esp 80103dd9: 68 0f 75 10 80 push $0x8010750f 80103dde: e8 8d c5 ff ff call 80100370 <panic> sleep(void *chan, struct spinlock *lk) { struct proc *p = myproc(); if(p == 0) panic("sleep"); 80103de3: 83 ec 0c sub $0xc,%esp 80103de6: 68 09 75 10 80 push $0x80107509 80103deb: e8 80 c5 ff ff call 80100370 <panic> 80103df0 <wait>: // Wait for a child process to exit and return its pid. // Return -1 if this process has no children. int wait(void) { 80103df0: 55 push %ebp 80103df1: 89 e5 mov %esp,%ebp 80103df3: 56 push %esi 80103df4: 53 push %ebx // while reading proc from the cpu structure struct proc* myproc(void) { struct cpu *c; struct proc *p; pushcli(); 80103df5: e8 76 04 00 00 call 80104270 <pushcli> c = mycpu(); 80103dfa: e8 e1 f8 ff ff call 801036e0 <mycpu> p = c->proc; 80103dff: 8b b0 ac 00 00 00 mov 0xac(%eax),%esi popcli(); 80103e05: e8 a6 04 00 00 call 801042b0 <popcli> { struct proc *p; int havekids, pid; struct proc *curproc = myproc(); acquire(&ptable.lock); 80103e0a: 83 ec 0c sub $0xc,%esp 80103e0d: 68 20 2d 11 80 push $0x80112d20 80103e12: e8 39 05 00 00 call 80104350 <acquire> 80103e17: 83 c4 10 add $0x10,%esp for(;;){ // Scan through table looking for exited children. havekids = 0; 80103e1a: 31 c0 xor %eax,%eax for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103e1c: bb 54 2d 11 80 mov $0x80112d54,%ebx 80103e21: eb 10 jmp 80103e33 <wait+0x43> 80103e23: 90 nop 80103e24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80103e28: 83 c3 7c add $0x7c,%ebx 80103e2b: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103e31: 74 1d je 80103e50 <wait+0x60> if(p->parent != curproc) 80103e33: 39 73 14 cmp %esi,0x14(%ebx) 80103e36: 75 f0 jne 80103e28 <wait+0x38> continue; havekids = 1; if(p->state == ZOMBIE){ 80103e38: 83 7b 0c 05 cmpl $0x5,0xc(%ebx) 80103e3c: 74 30 je 80103e6e <wait+0x7e> acquire(&ptable.lock); for(;;){ // Scan through table looking for exited children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103e3e: 83 c3 7c add $0x7c,%ebx if(p->parent != curproc) continue; havekids = 1; 80103e41: b8 01 00 00 00 mov $0x1,%eax acquire(&ptable.lock); for(;;){ // Scan through table looking for exited children. havekids = 0; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103e46: 81 fb 54 4c 11 80 cmp $0x80114c54,%ebx 80103e4c: 75 e5 jne 80103e33 <wait+0x43> 80103e4e: 66 90 xchg %ax,%ax return pid; } } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ 80103e50: 85 c0 test %eax,%eax 80103e52: 74 70 je 80103ec4 <wait+0xd4> 80103e54: 8b 46 24 mov 0x24(%esi),%eax 80103e57: 85 c0 test %eax,%eax 80103e59: 75 69 jne 80103ec4 <wait+0xd4> release(&ptable.lock); return -1; } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep 80103e5b: 83 ec 08 sub $0x8,%esp 80103e5e: 68 20 2d 11 80 push $0x80112d20 80103e63: 56 push %esi 80103e64: e8 c7 fe ff ff call 80103d30 <sleep> } 80103e69: 83 c4 10 add $0x10,%esp 80103e6c: eb ac jmp 80103e1a <wait+0x2a> continue; havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; kfree(p->kstack); 80103e6e: 83 ec 0c sub $0xc,%esp 80103e71: ff 73 08 pushl 0x8(%ebx) if(p->parent != curproc) continue; havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; 80103e74: 8b 73 10 mov 0x10(%ebx),%esi kfree(p->kstack); 80103e77: e8 64 e4 ff ff call 801022e0 <kfree> p->kstack = 0; freevm(p->pgdir); 80103e7c: 5a pop %edx 80103e7d: ff 73 04 pushl 0x4(%ebx) havekids = 1; if(p->state == ZOMBIE){ // Found one. pid = p->pid; kfree(p->kstack); p->kstack = 0; 80103e80: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) freevm(p->pgdir); 80103e87: e8 64 2d 00 00 call 80106bf0 <freevm> p->pid = 0; 80103e8c: c7 43 10 00 00 00 00 movl $0x0,0x10(%ebx) p->parent = 0; 80103e93: c7 43 14 00 00 00 00 movl $0x0,0x14(%ebx) p->name[0] = 0; 80103e9a: c6 43 6c 00 movb $0x0,0x6c(%ebx) p->killed = 0; 80103e9e: c7 43 24 00 00 00 00 movl $0x0,0x24(%ebx) p->state = UNUSED; 80103ea5: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) release(&ptable.lock); 80103eac: c7 04 24 20 2d 11 80 movl $0x80112d20,(%esp) 80103eb3: e8 48 05 00 00 call 80104400 <release> return pid; 80103eb8: 83 c4 10 add $0x10,%esp } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103ebb: 8d 65 f8 lea -0x8(%ebp),%esp p->parent = 0; p->name[0] = 0; p->killed = 0; p->state = UNUSED; release(&ptable.lock); return pid; 80103ebe: 89 f0 mov %esi,%eax } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103ec0: 5b pop %ebx 80103ec1: 5e pop %esi 80103ec2: 5d pop %ebp 80103ec3: c3 ret } } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ release(&ptable.lock); 80103ec4: 83 ec 0c sub $0xc,%esp 80103ec7: 68 20 2d 11 80 push $0x80112d20 80103ecc: e8 2f 05 00 00 call 80104400 <release> return -1; 80103ed1: 83 c4 10 add $0x10,%esp } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103ed4: 8d 65 f8 lea -0x8(%ebp),%esp } // No point waiting if we don't have any children. if(!havekids || curproc->killed){ release(&ptable.lock); return -1; 80103ed7: b8 ff ff ff ff mov $0xffffffff,%eax } // Wait for children to exit. (See wakeup1 call in proc_exit.) sleep(curproc, &ptable.lock); //DOC: wait-sleep } } 80103edc: 5b pop %ebx 80103edd: 5e pop %esi 80103ede: 5d pop %ebp 80103edf: c3 ret 80103ee0 <wakeup>: } // Wake up all processes sleeping on chan. void wakeup(void *chan) { 80103ee0: 55 push %ebp 80103ee1: 89 e5 mov %esp,%ebp 80103ee3: 53 push %ebx 80103ee4: 83 ec 10 sub $0x10,%esp 80103ee7: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&ptable.lock); 80103eea: 68 20 2d 11 80 push $0x80112d20 80103eef: e8 5c 04 00 00 call 80104350 <acquire> 80103ef4: 83 c4 10 add $0x10,%esp static void wakeup1(void *chan) { struct proc *p; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++) 80103ef7: b8 54 2d 11 80 mov $0x80112d54,%eax 80103efc: eb 0c jmp 80103f0a <wakeup+0x2a> 80103efe: 66 90 xchg %ax,%ax 80103f00: 83 c0 7c add $0x7c,%eax 80103f03: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103f08: 74 1c je 80103f26 <wakeup+0x46> if(p->state == SLEEPING && p->chan == chan) 80103f0a: 83 78 0c 02 cmpl $0x2,0xc(%eax) 80103f0e: 75 f0 jne 80103f00 <wakeup+0x20> 80103f10: 3b 58 20 cmp 0x20(%eax),%ebx 80103f13: 75 eb jne 80103f00 <wakeup+0x20> p->state = RUNNABLE; 80103f15: 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++) 80103f1c: 83 c0 7c add $0x7c,%eax 80103f1f: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103f24: 75 e4 jne 80103f0a <wakeup+0x2a> void wakeup(void *chan) { acquire(&ptable.lock); wakeup1(chan); release(&ptable.lock); 80103f26: c7 45 08 20 2d 11 80 movl $0x80112d20,0x8(%ebp) } 80103f2d: 8b 5d fc mov -0x4(%ebp),%ebx 80103f30: c9 leave void wakeup(void *chan) { acquire(&ptable.lock); wakeup1(chan); release(&ptable.lock); 80103f31: e9 ca 04 00 00 jmp 80104400 <release> 80103f36: 8d 76 00 lea 0x0(%esi),%esi 80103f39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103f40 <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) { 80103f40: 55 push %ebp 80103f41: 89 e5 mov %esp,%ebp 80103f43: 53 push %ebx 80103f44: 83 ec 10 sub $0x10,%esp 80103f47: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *p; acquire(&ptable.lock); 80103f4a: 68 20 2d 11 80 push $0x80112d20 80103f4f: e8 fc 03 00 00 call 80104350 <acquire> 80103f54: 83 c4 10 add $0x10,%esp for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103f57: b8 54 2d 11 80 mov $0x80112d54,%eax 80103f5c: eb 0c jmp 80103f6a <kill+0x2a> 80103f5e: 66 90 xchg %ax,%ax 80103f60: 83 c0 7c add $0x7c,%eax 80103f63: 3d 54 4c 11 80 cmp $0x80114c54,%eax 80103f68: 74 3e je 80103fa8 <kill+0x68> if(p->pid == pid){ 80103f6a: 39 58 10 cmp %ebx,0x10(%eax) 80103f6d: 75 f1 jne 80103f60 <kill+0x20> p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) 80103f6f: 83 78 0c 02 cmpl $0x2,0xc(%eax) struct proc *p; acquire(&ptable.lock); for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->pid == pid){ p->killed = 1; 80103f73: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) // Wake process from sleep if necessary. if(p->state == SLEEPING) 80103f7a: 74 1c je 80103f98 <kill+0x58> p->state = RUNNABLE; release(&ptable.lock); 80103f7c: 83 ec 0c sub $0xc,%esp 80103f7f: 68 20 2d 11 80 push $0x80112d20 80103f84: e8 77 04 00 00 call 80104400 <release> return 0; 80103f89: 83 c4 10 add $0x10,%esp 80103f8c: 31 c0 xor %eax,%eax } } release(&ptable.lock); return -1; } 80103f8e: 8b 5d fc mov -0x4(%ebp),%ebx 80103f91: c9 leave 80103f92: c3 ret 80103f93: 90 nop 80103f94: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->pid == pid){ p->killed = 1; // Wake process from sleep if necessary. if(p->state == SLEEPING) p->state = RUNNABLE; 80103f98: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax) 80103f9f: eb db jmp 80103f7c <kill+0x3c> 80103fa1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi release(&ptable.lock); return 0; } } release(&ptable.lock); 80103fa8: 83 ec 0c sub $0xc,%esp 80103fab: 68 20 2d 11 80 push $0x80112d20 80103fb0: e8 4b 04 00 00 call 80104400 <release> return -1; 80103fb5: 83 c4 10 add $0x10,%esp 80103fb8: b8 ff ff ff ff mov $0xffffffff,%eax } 80103fbd: 8b 5d fc mov -0x4(%ebp),%ebx 80103fc0: c9 leave 80103fc1: c3 ret 80103fc2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80103fc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80103fd0 <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) { 80103fd0: 55 push %ebp 80103fd1: 89 e5 mov %esp,%ebp 80103fd3: 57 push %edi 80103fd4: 56 push %esi 80103fd5: 53 push %ebx 80103fd6: 8d 75 e8 lea -0x18(%ebp),%esi 80103fd9: bb c0 2d 11 80 mov $0x80112dc0,%ebx 80103fde: 83 ec 3c sub $0x3c,%esp 80103fe1: eb 24 jmp 80104007 <procdump+0x37> 80103fe3: 90 nop 80103fe4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p->state == SLEEPING){ getcallerpcs((uint*)p->context->ebp+2, pc); for(i=0; i<10 && pc[i] != 0; i++) cprintf(" %p", pc[i]); } cprintf("\n"); 80103fe8: 83 ec 0c sub $0xc,%esp 80103feb: 68 db 78 10 80 push $0x801078db 80103ff0: e8 6b c6 ff ff call 80100660 <cprintf> 80103ff5: 83 c4 10 add $0x10,%esp 80103ff8: 83 c3 7c add $0x7c,%ebx int i; struct proc *p; char *state; uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ 80103ffb: 81 fb c0 4c 11 80 cmp $0x80114cc0,%ebx 80104001: 0f 84 81 00 00 00 je 80104088 <procdump+0xb8> if(p->state == UNUSED) 80104007: 8b 43 a0 mov -0x60(%ebx),%eax 8010400a: 85 c0 test %eax,%eax 8010400c: 74 ea je 80103ff8 <procdump+0x28> continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 8010400e: 83 f8 05 cmp $0x5,%eax state = states[p->state]; else state = "???"; 80104011: ba 20 75 10 80 mov $0x80107520,%edx uint pc[10]; for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){ if(p->state == UNUSED) continue; if(p->state >= 0 && p->state < NELEM(states) && states[p->state]) 80104016: 77 11 ja 80104029 <procdump+0x59> 80104018: 8b 14 85 b4 75 10 80 mov -0x7fef8a4c(,%eax,4),%edx state = states[p->state]; else state = "???"; 8010401f: b8 20 75 10 80 mov $0x80107520,%eax 80104024: 85 d2 test %edx,%edx 80104026: 0f 44 d0 cmove %eax,%edx cprintf("%d %s %s", p->pid, state, p->name); 80104029: 53 push %ebx 8010402a: 52 push %edx 8010402b: ff 73 a4 pushl -0x5c(%ebx) 8010402e: 68 24 75 10 80 push $0x80107524 80104033: e8 28 c6 ff ff call 80100660 <cprintf> if(p->state == SLEEPING){ 80104038: 83 c4 10 add $0x10,%esp 8010403b: 83 7b a0 02 cmpl $0x2,-0x60(%ebx) 8010403f: 75 a7 jne 80103fe8 <procdump+0x18> getcallerpcs((uint*)p->context->ebp+2, pc); 80104041: 8d 45 c0 lea -0x40(%ebp),%eax 80104044: 83 ec 08 sub $0x8,%esp 80104047: 8d 7d c0 lea -0x40(%ebp),%edi 8010404a: 50 push %eax 8010404b: 8b 43 b0 mov -0x50(%ebx),%eax 8010404e: 8b 40 0c mov 0xc(%eax),%eax 80104051: 83 c0 08 add $0x8,%eax 80104054: 50 push %eax 80104055: e8 b6 01 00 00 call 80104210 <getcallerpcs> 8010405a: 83 c4 10 add $0x10,%esp 8010405d: 8d 76 00 lea 0x0(%esi),%esi for(i=0; i<10 && pc[i] != 0; i++) 80104060: 8b 17 mov (%edi),%edx 80104062: 85 d2 test %edx,%edx 80104064: 74 82 je 80103fe8 <procdump+0x18> cprintf(" %p", pc[i]); 80104066: 83 ec 08 sub $0x8,%esp 80104069: 83 c7 04 add $0x4,%edi 8010406c: 52 push %edx 8010406d: 68 61 6f 10 80 push $0x80106f61 80104072: e8 e9 c5 ff ff call 80100660 <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++) 80104077: 83 c4 10 add $0x10,%esp 8010407a: 39 f7 cmp %esi,%edi 8010407c: 75 e2 jne 80104060 <procdump+0x90> 8010407e: e9 65 ff ff ff jmp 80103fe8 <procdump+0x18> 80104083: 90 nop 80104084: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cprintf(" %p", pc[i]); } cprintf("\n"); } } 80104088: 8d 65 f4 lea -0xc(%ebp),%esp 8010408b: 5b pop %ebx 8010408c: 5e pop %esi 8010408d: 5f pop %edi 8010408e: 5d pop %ebp 8010408f: c3 ret 80104090 <abdur_rouf>: int abdur_rouf(void) { 80104090: 55 push %ebp 80104091: 89 e5 mov %esp,%ebp 80104093: 83 ec 14 sub $0x14,%esp cprintf("Name: Abdur Rouf\n"); 80104096: 68 2d 75 10 80 push $0x8010752d 8010409b: e8 c0 c5 ff ff call 80100660 <cprintf> cprintf("Date of Birth : 5th April,1997\n"); 801040a0: c7 04 24 94 75 10 80 movl $0x80107594,(%esp) 801040a7: e8 b4 c5 ff ff call 80100660 <cprintf> return 1505097; } 801040ac: b8 49 f7 16 00 mov $0x16f749,%eax 801040b1: c9 leave 801040b2: c3 ret 801040b3: 66 90 xchg %ax,%ax 801040b5: 66 90 xchg %ax,%ax 801040b7: 66 90 xchg %ax,%ax 801040b9: 66 90 xchg %ax,%ax 801040bb: 66 90 xchg %ax,%ax 801040bd: 66 90 xchg %ax,%ax 801040bf: 90 nop 801040c0 <initsleeplock>: #include "spinlock.h" #include "sleeplock.h" void initsleeplock(struct sleeplock *lk, char *name) { 801040c0: 55 push %ebp 801040c1: 89 e5 mov %esp,%ebp 801040c3: 53 push %ebx 801040c4: 83 ec 0c sub $0xc,%esp 801040c7: 8b 5d 08 mov 0x8(%ebp),%ebx initlock(&lk->lk, "sleep lock"); 801040ca: 68 cc 75 10 80 push $0x801075cc 801040cf: 8d 43 04 lea 0x4(%ebx),%eax 801040d2: 50 push %eax 801040d3: e8 18 01 00 00 call 801041f0 <initlock> lk->name = name; 801040d8: 8b 45 0c mov 0xc(%ebp),%eax lk->locked = 0; 801040db: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; } 801040e1: 83 c4 10 add $0x10,%esp initsleeplock(struct sleeplock *lk, char *name) { initlock(&lk->lk, "sleep lock"); lk->name = name; lk->locked = 0; lk->pid = 0; 801040e4: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) void initsleeplock(struct sleeplock *lk, char *name) { initlock(&lk->lk, "sleep lock"); lk->name = name; 801040eb: 89 43 38 mov %eax,0x38(%ebx) lk->locked = 0; lk->pid = 0; } 801040ee: 8b 5d fc mov -0x4(%ebp),%ebx 801040f1: c9 leave 801040f2: c3 ret 801040f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801040f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104100 <acquiresleep>: void acquiresleep(struct sleeplock *lk) { 80104100: 55 push %ebp 80104101: 89 e5 mov %esp,%ebp 80104103: 56 push %esi 80104104: 53 push %ebx 80104105: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 80104108: 83 ec 0c sub $0xc,%esp 8010410b: 8d 73 04 lea 0x4(%ebx),%esi 8010410e: 56 push %esi 8010410f: e8 3c 02 00 00 call 80104350 <acquire> while (lk->locked) { 80104114: 8b 13 mov (%ebx),%edx 80104116: 83 c4 10 add $0x10,%esp 80104119: 85 d2 test %edx,%edx 8010411b: 74 16 je 80104133 <acquiresleep+0x33> 8010411d: 8d 76 00 lea 0x0(%esi),%esi sleep(lk, &lk->lk); 80104120: 83 ec 08 sub $0x8,%esp 80104123: 56 push %esi 80104124: 53 push %ebx 80104125: e8 06 fc ff ff call 80103d30 <sleep> void acquiresleep(struct sleeplock *lk) { acquire(&lk->lk); while (lk->locked) { 8010412a: 8b 03 mov (%ebx),%eax 8010412c: 83 c4 10 add $0x10,%esp 8010412f: 85 c0 test %eax,%eax 80104131: 75 ed jne 80104120 <acquiresleep+0x20> sleep(lk, &lk->lk); } lk->locked = 1; 80104133: c7 03 01 00 00 00 movl $0x1,(%ebx) lk->pid = myproc()->pid; 80104139: e8 42 f6 ff ff call 80103780 <myproc> 8010413e: 8b 40 10 mov 0x10(%eax),%eax 80104141: 89 43 3c mov %eax,0x3c(%ebx) release(&lk->lk); 80104144: 89 75 08 mov %esi,0x8(%ebp) } 80104147: 8d 65 f8 lea -0x8(%ebp),%esp 8010414a: 5b pop %ebx 8010414b: 5e pop %esi 8010414c: 5d pop %ebp while (lk->locked) { sleep(lk, &lk->lk); } lk->locked = 1; lk->pid = myproc()->pid; release(&lk->lk); 8010414d: e9 ae 02 00 00 jmp 80104400 <release> 80104152: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104159: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104160 <releasesleep>: } void releasesleep(struct sleeplock *lk) { 80104160: 55 push %ebp 80104161: 89 e5 mov %esp,%ebp 80104163: 56 push %esi 80104164: 53 push %ebx 80104165: 8b 5d 08 mov 0x8(%ebp),%ebx acquire(&lk->lk); 80104168: 83 ec 0c sub $0xc,%esp 8010416b: 8d 73 04 lea 0x4(%ebx),%esi 8010416e: 56 push %esi 8010416f: e8 dc 01 00 00 call 80104350 <acquire> lk->locked = 0; 80104174: c7 03 00 00 00 00 movl $0x0,(%ebx) lk->pid = 0; 8010417a: c7 43 3c 00 00 00 00 movl $0x0,0x3c(%ebx) wakeup(lk); 80104181: 89 1c 24 mov %ebx,(%esp) 80104184: e8 57 fd ff ff call 80103ee0 <wakeup> release(&lk->lk); 80104189: 89 75 08 mov %esi,0x8(%ebp) 8010418c: 83 c4 10 add $0x10,%esp } 8010418f: 8d 65 f8 lea -0x8(%ebp),%esp 80104192: 5b pop %ebx 80104193: 5e pop %esi 80104194: 5d pop %ebp { acquire(&lk->lk); lk->locked = 0; lk->pid = 0; wakeup(lk); release(&lk->lk); 80104195: e9 66 02 00 00 jmp 80104400 <release> 8010419a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801041a0 <holdingsleep>: } int holdingsleep(struct sleeplock *lk) { 801041a0: 55 push %ebp 801041a1: 89 e5 mov %esp,%ebp 801041a3: 57 push %edi 801041a4: 56 push %esi 801041a5: 53 push %ebx 801041a6: 31 ff xor %edi,%edi 801041a8: 83 ec 18 sub $0x18,%esp 801041ab: 8b 5d 08 mov 0x8(%ebp),%ebx int r; acquire(&lk->lk); 801041ae: 8d 73 04 lea 0x4(%ebx),%esi 801041b1: 56 push %esi 801041b2: e8 99 01 00 00 call 80104350 <acquire> r = lk->locked && (lk->pid == myproc()->pid); 801041b7: 8b 03 mov (%ebx),%eax 801041b9: 83 c4 10 add $0x10,%esp 801041bc: 85 c0 test %eax,%eax 801041be: 74 13 je 801041d3 <holdingsleep+0x33> 801041c0: 8b 5b 3c mov 0x3c(%ebx),%ebx 801041c3: e8 b8 f5 ff ff call 80103780 <myproc> 801041c8: 39 58 10 cmp %ebx,0x10(%eax) 801041cb: 0f 94 c0 sete %al 801041ce: 0f b6 c0 movzbl %al,%eax 801041d1: 89 c7 mov %eax,%edi release(&lk->lk); 801041d3: 83 ec 0c sub $0xc,%esp 801041d6: 56 push %esi 801041d7: e8 24 02 00 00 call 80104400 <release> return r; } 801041dc: 8d 65 f4 lea -0xc(%ebp),%esp 801041df: 89 f8 mov %edi,%eax 801041e1: 5b pop %ebx 801041e2: 5e pop %esi 801041e3: 5f pop %edi 801041e4: 5d pop %ebp 801041e5: c3 ret 801041e6: 66 90 xchg %ax,%ax 801041e8: 66 90 xchg %ax,%ax 801041ea: 66 90 xchg %ax,%ax 801041ec: 66 90 xchg %ax,%ax 801041ee: 66 90 xchg %ax,%ax 801041f0 <initlock>: #include "proc.h" #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { 801041f0: 55 push %ebp 801041f1: 89 e5 mov %esp,%ebp 801041f3: 8b 45 08 mov 0x8(%ebp),%eax lk->name = name; 801041f6: 8b 55 0c mov 0xc(%ebp),%edx lk->locked = 0; 801041f9: c7 00 00 00 00 00 movl $0x0,(%eax) #include "spinlock.h" void initlock(struct spinlock *lk, char *name) { lk->name = name; 801041ff: 89 50 04 mov %edx,0x4(%eax) lk->locked = 0; lk->cpu = 0; 80104202: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 80104209: 5d pop %ebp 8010420a: c3 ret 8010420b: 90 nop 8010420c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104210 <getcallerpcs>: } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104210: 55 push %ebp 80104211: 89 e5 mov %esp,%ebp 80104213: 53 push %ebx uint *ebp; int i; ebp = (uint*)v - 2; 80104214: 8b 45 08 mov 0x8(%ebp),%eax } // Record the current call stack in pcs[] by following the %ebp chain. void getcallerpcs(void *v, uint pcs[]) { 80104217: 8b 4d 0c mov 0xc(%ebp),%ecx uint *ebp; int i; ebp = (uint*)v - 2; 8010421a: 8d 50 f8 lea -0x8(%eax),%edx for(i = 0; i < 10; i++){ 8010421d: 31 c0 xor %eax,%eax 8010421f: 90 nop if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 80104220: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx 80104226: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 8010422c: 77 1a ja 80104248 <getcallerpcs+0x38> break; pcs[i] = ebp[1]; // saved %eip 8010422e: 8b 5a 04 mov 0x4(%edx),%ebx 80104231: 89 1c 81 mov %ebx,(%ecx,%eax,4) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104234: 83 c0 01 add $0x1,%eax if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp 80104237: 8b 12 mov (%edx),%edx { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 80104239: 83 f8 0a cmp $0xa,%eax 8010423c: 75 e2 jne 80104220 <getcallerpcs+0x10> pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) pcs[i] = 0; } 8010423e: 5b pop %ebx 8010423f: 5d pop %ebp 80104240: c3 ret 80104241: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) pcs[i] = 0; 80104248: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) 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++) 8010424f: 83 c0 01 add $0x1,%eax 80104252: 83 f8 0a cmp $0xa,%eax 80104255: 74 e7 je 8010423e <getcallerpcs+0x2e> pcs[i] = 0; 80104257: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) 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++) 8010425e: 83 c0 01 add $0x1,%eax 80104261: 83 f8 0a cmp $0xa,%eax 80104264: 75 e2 jne 80104248 <getcallerpcs+0x38> 80104266: eb d6 jmp 8010423e <getcallerpcs+0x2e> 80104268: 90 nop 80104269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104270 <pushcli>: // it takes two popcli to undo two pushcli. Also, if interrupts // are off, then pushcli, popcli leaves them off. void pushcli(void) { 80104270: 55 push %ebp 80104271: 89 e5 mov %esp,%ebp 80104273: 53 push %ebx 80104274: 83 ec 04 sub $0x4,%esp 80104277: 9c pushf 80104278: 5b pop %ebx } static inline void cli(void) { asm volatile("cli"); 80104279: fa cli int eflags; eflags = readeflags(); cli(); if(mycpu()->ncli == 0) 8010427a: e8 61 f4 ff ff call 801036e0 <mycpu> 8010427f: 8b 80 a4 00 00 00 mov 0xa4(%eax),%eax 80104285: 85 c0 test %eax,%eax 80104287: 75 11 jne 8010429a <pushcli+0x2a> mycpu()->intena = eflags & FL_IF; 80104289: 81 e3 00 02 00 00 and $0x200,%ebx 8010428f: e8 4c f4 ff ff call 801036e0 <mycpu> 80104294: 89 98 a8 00 00 00 mov %ebx,0xa8(%eax) mycpu()->ncli += 1; 8010429a: e8 41 f4 ff ff call 801036e0 <mycpu> 8010429f: 83 80 a4 00 00 00 01 addl $0x1,0xa4(%eax) } 801042a6: 83 c4 04 add $0x4,%esp 801042a9: 5b pop %ebx 801042aa: 5d pop %ebp 801042ab: c3 ret 801042ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801042b0 <popcli>: void popcli(void) { 801042b0: 55 push %ebp 801042b1: 89 e5 mov %esp,%ebp 801042b3: 83 ec 08 sub $0x8,%esp static inline uint readeflags(void) { uint eflags; asm volatile("pushfl; popl %0" : "=r" (eflags)); 801042b6: 9c pushf 801042b7: 58 pop %eax if(readeflags()&FL_IF) 801042b8: f6 c4 02 test $0x2,%ah 801042bb: 75 52 jne 8010430f <popcli+0x5f> panic("popcli - interruptible"); if(--mycpu()->ncli < 0) 801042bd: e8 1e f4 ff ff call 801036e0 <mycpu> 801042c2: 8b 88 a4 00 00 00 mov 0xa4(%eax),%ecx 801042c8: 8d 51 ff lea -0x1(%ecx),%edx 801042cb: 85 d2 test %edx,%edx 801042cd: 89 90 a4 00 00 00 mov %edx,0xa4(%eax) 801042d3: 78 2d js 80104302 <popcli+0x52> panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) 801042d5: e8 06 f4 ff ff call 801036e0 <mycpu> 801042da: 8b 90 a4 00 00 00 mov 0xa4(%eax),%edx 801042e0: 85 d2 test %edx,%edx 801042e2: 74 0c je 801042f0 <popcli+0x40> sti(); } 801042e4: c9 leave 801042e5: c3 ret 801042e6: 8d 76 00 lea 0x0(%esi),%esi 801042e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi { if(readeflags()&FL_IF) panic("popcli - interruptible"); if(--mycpu()->ncli < 0) panic("popcli"); if(mycpu()->ncli == 0 && mycpu()->intena) 801042f0: e8 eb f3 ff ff call 801036e0 <mycpu> 801042f5: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax 801042fb: 85 c0 test %eax,%eax 801042fd: 74 e5 je 801042e4 <popcli+0x34> } static inline void sti(void) { asm volatile("sti"); 801042ff: fb sti sti(); } 80104300: c9 leave 80104301: c3 ret popcli(void) { if(readeflags()&FL_IF) panic("popcli - interruptible"); if(--mycpu()->ncli < 0) panic("popcli"); 80104302: 83 ec 0c sub $0xc,%esp 80104305: 68 ee 75 10 80 push $0x801075ee 8010430a: e8 61 c0 ff ff call 80100370 <panic> void popcli(void) { if(readeflags()&FL_IF) panic("popcli - interruptible"); 8010430f: 83 ec 0c sub $0xc,%esp 80104312: 68 d7 75 10 80 push $0x801075d7 80104317: e8 54 c0 ff ff call 80100370 <panic> 8010431c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104320 <holding>: } // Check whether this cpu is holding the lock. int holding(struct spinlock *lock) { 80104320: 55 push %ebp 80104321: 89 e5 mov %esp,%ebp 80104323: 56 push %esi 80104324: 53 push %ebx 80104325: 8b 75 08 mov 0x8(%ebp),%esi 80104328: 31 db xor %ebx,%ebx int r; pushcli(); 8010432a: e8 41 ff ff ff call 80104270 <pushcli> r = lock->locked && lock->cpu == mycpu(); 8010432f: 8b 06 mov (%esi),%eax 80104331: 85 c0 test %eax,%eax 80104333: 74 10 je 80104345 <holding+0x25> 80104335: 8b 5e 08 mov 0x8(%esi),%ebx 80104338: e8 a3 f3 ff ff call 801036e0 <mycpu> 8010433d: 39 c3 cmp %eax,%ebx 8010433f: 0f 94 c3 sete %bl 80104342: 0f b6 db movzbl %bl,%ebx popcli(); 80104345: e8 66 ff ff ff call 801042b0 <popcli> return r; } 8010434a: 89 d8 mov %ebx,%eax 8010434c: 5b pop %ebx 8010434d: 5e pop %esi 8010434e: 5d pop %ebp 8010434f: c3 ret 80104350 <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) { 80104350: 55 push %ebp 80104351: 89 e5 mov %esp,%ebp 80104353: 53 push %ebx 80104354: 83 ec 04 sub $0x4,%esp pushcli(); // disable interrupts to avoid deadlock. 80104357: e8 14 ff ff ff call 80104270 <pushcli> if(holding(lk)) 8010435c: 8b 5d 08 mov 0x8(%ebp),%ebx 8010435f: 83 ec 0c sub $0xc,%esp 80104362: 53 push %ebx 80104363: e8 b8 ff ff ff call 80104320 <holding> 80104368: 83 c4 10 add $0x10,%esp 8010436b: 85 c0 test %eax,%eax 8010436d: 0f 85 7d 00 00 00 jne 801043f0 <acquire+0xa0> xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 80104373: ba 01 00 00 00 mov $0x1,%edx 80104378: eb 09 jmp 80104383 <acquire+0x33> 8010437a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104380: 8b 5d 08 mov 0x8(%ebp),%ebx 80104383: 89 d0 mov %edx,%eax 80104385: f0 87 03 lock xchg %eax,(%ebx) panic("acquire"); // The xchg is atomic. while(xchg(&lk->locked, 1) != 0) 80104388: 85 c0 test %eax,%eax 8010438a: 75 f4 jne 80104380 <acquire+0x30> ; // Tell the C compiler and the processor to not move loads or stores // past this point, to ensure that the critical section's memory // references happen after the lock is acquired. __sync_synchronize(); 8010438c: f0 83 0c 24 00 lock orl $0x0,(%esp) // Record info about lock acquisition for debugging. lk->cpu = mycpu(); 80104391: 8b 5d 08 mov 0x8(%ebp),%ebx 80104394: e8 47 f3 ff ff call 801036e0 <mycpu> getcallerpcs(void *v, uint pcs[]) { uint *ebp; int i; ebp = (uint*)v - 2; 80104399: 89 ea mov %ebp,%edx // references happen after the lock is acquired. __sync_synchronize(); // Record info about lock acquisition for debugging. lk->cpu = mycpu(); getcallerpcs(&lk, lk->pcs); 8010439b: 8d 4b 0c lea 0xc(%ebx),%ecx // past this point, to ensure that the critical section's memory // references happen after the lock is acquired. __sync_synchronize(); // Record info about lock acquisition for debugging. lk->cpu = mycpu(); 8010439e: 89 43 08 mov %eax,0x8(%ebx) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 801043a1: 31 c0 xor %eax,%eax 801043a3: 90 nop 801043a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) 801043a8: 8d 9a 00 00 00 80 lea -0x80000000(%edx),%ebx 801043ae: 81 fb fe ff ff 7f cmp $0x7ffffffe,%ebx 801043b4: 77 1a ja 801043d0 <acquire+0x80> break; pcs[i] = ebp[1]; // saved %eip 801043b6: 8b 5a 04 mov 0x4(%edx),%ebx 801043b9: 89 1c 81 mov %ebx,(%ecx,%eax,4) { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 801043bc: 83 c0 01 add $0x1,%eax if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff) break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp 801043bf: 8b 12 mov (%edx),%edx { uint *ebp; int i; ebp = (uint*)v - 2; for(i = 0; i < 10; i++){ 801043c1: 83 f8 0a cmp $0xa,%eax 801043c4: 75 e2 jne 801043a8 <acquire+0x58> __sync_synchronize(); // Record info about lock acquisition for debugging. lk->cpu = mycpu(); getcallerpcs(&lk, lk->pcs); } 801043c6: 8b 5d fc mov -0x4(%ebp),%ebx 801043c9: c9 leave 801043ca: c3 ret 801043cb: 90 nop 801043cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi break; pcs[i] = ebp[1]; // saved %eip ebp = (uint*)ebp[0]; // saved %ebp } for(; i < 10; i++) pcs[i] = 0; 801043d0: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) 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++) 801043d7: 83 c0 01 add $0x1,%eax 801043da: 83 f8 0a cmp $0xa,%eax 801043dd: 74 e7 je 801043c6 <acquire+0x76> pcs[i] = 0; 801043df: c7 04 81 00 00 00 00 movl $0x0,(%ecx,%eax,4) 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++) 801043e6: 83 c0 01 add $0x1,%eax 801043e9: 83 f8 0a cmp $0xa,%eax 801043ec: 75 e2 jne 801043d0 <acquire+0x80> 801043ee: eb d6 jmp 801043c6 <acquire+0x76> void acquire(struct spinlock *lk) { pushcli(); // disable interrupts to avoid deadlock. if(holding(lk)) panic("acquire"); 801043f0: 83 ec 0c sub $0xc,%esp 801043f3: 68 f5 75 10 80 push $0x801075f5 801043f8: e8 73 bf ff ff call 80100370 <panic> 801043fd: 8d 76 00 lea 0x0(%esi),%esi 80104400 <release>: } // Release the lock. void release(struct spinlock *lk) { 80104400: 55 push %ebp 80104401: 89 e5 mov %esp,%ebp 80104403: 53 push %ebx 80104404: 83 ec 10 sub $0x10,%esp 80104407: 8b 5d 08 mov 0x8(%ebp),%ebx if(!holding(lk)) 8010440a: 53 push %ebx 8010440b: e8 10 ff ff ff call 80104320 <holding> 80104410: 83 c4 10 add $0x10,%esp 80104413: 85 c0 test %eax,%eax 80104415: 74 22 je 80104439 <release+0x39> panic("release"); lk->pcs[0] = 0; 80104417: c7 43 0c 00 00 00 00 movl $0x0,0xc(%ebx) lk->cpu = 0; 8010441e: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx) // Tell the C compiler and the processor to not move loads or stores // past this point, to ensure that all the stores in the critical // section are visible to other cores before the lock is released. // Both the C compiler and the hardware may re-order loads and // stores; __sync_synchronize() tells them both not to. __sync_synchronize(); 80104425: f0 83 0c 24 00 lock orl $0x0,(%esp) // Release the lock, equivalent to lk->locked = 0. // This code can't use a C assignment, since it might // not be atomic. A real OS would use C atomics here. asm volatile("movl $0, %0" : "+m" (lk->locked) : ); 8010442a: c7 03 00 00 00 00 movl $0x0,(%ebx) popcli(); } 80104430: 8b 5d fc mov -0x4(%ebp),%ebx 80104433: c9 leave // Release the lock, equivalent to lk->locked = 0. // This code can't use a C assignment, since it might // not be atomic. A real OS would use C atomics here. asm volatile("movl $0, %0" : "+m" (lk->locked) : ); popcli(); 80104434: e9 77 fe ff ff jmp 801042b0 <popcli> // Release the lock. void release(struct spinlock *lk) { if(!holding(lk)) panic("release"); 80104439: 83 ec 0c sub $0xc,%esp 8010443c: 68 fd 75 10 80 push $0x801075fd 80104441: e8 2a bf ff ff call 80100370 <panic> 80104446: 66 90 xchg %ax,%ax 80104448: 66 90 xchg %ax,%ax 8010444a: 66 90 xchg %ax,%ax 8010444c: 66 90 xchg %ax,%ax 8010444e: 66 90 xchg %ax,%ax 80104450 <memset>: #include "types.h" #include "x86.h" void* memset(void *dst, int c, uint n) { 80104450: 55 push %ebp 80104451: 89 e5 mov %esp,%ebp 80104453: 57 push %edi 80104454: 53 push %ebx 80104455: 8b 55 08 mov 0x8(%ebp),%edx 80104458: 8b 4d 10 mov 0x10(%ebp),%ecx if ((int)dst%4 == 0 && n%4 == 0){ 8010445b: f6 c2 03 test $0x3,%dl 8010445e: 75 05 jne 80104465 <memset+0x15> 80104460: f6 c1 03 test $0x3,%cl 80104463: 74 13 je 80104478 <memset+0x28> } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 80104465: 89 d7 mov %edx,%edi 80104467: 8b 45 0c mov 0xc(%ebp),%eax 8010446a: fc cld 8010446b: f3 aa rep stos %al,%es:(%edi) c &= 0xFF; stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); } else stosb(dst, c, n); return dst; } 8010446d: 5b pop %ebx 8010446e: 89 d0 mov %edx,%eax 80104470: 5f pop %edi 80104471: 5d pop %ebp 80104472: c3 ret 80104473: 90 nop 80104474: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi void* memset(void *dst, int c, uint n) { if ((int)dst%4 == 0 && n%4 == 0){ c &= 0xFF; 80104478: 0f b6 7d 0c movzbl 0xc(%ebp),%edi } static inline void stosl(void *addr, int data, int cnt) { asm volatile("cld; rep stosl" : 8010447c: c1 e9 02 shr $0x2,%ecx 8010447f: 89 fb mov %edi,%ebx 80104481: 89 f8 mov %edi,%eax 80104483: c1 e3 18 shl $0x18,%ebx 80104486: c1 e0 10 shl $0x10,%eax 80104489: 09 d8 or %ebx,%eax 8010448b: 09 f8 or %edi,%eax 8010448d: c1 e7 08 shl $0x8,%edi 80104490: 09 f8 or %edi,%eax 80104492: 89 d7 mov %edx,%edi 80104494: fc cld 80104495: f3 ab rep stos %eax,%es:(%edi) stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4); } else stosb(dst, c, n); return dst; } 80104497: 5b pop %ebx 80104498: 89 d0 mov %edx,%eax 8010449a: 5f pop %edi 8010449b: 5d pop %ebp 8010449c: c3 ret 8010449d: 8d 76 00 lea 0x0(%esi),%esi 801044a0 <memcmp>: int memcmp(const void *v1, const void *v2, uint n) { 801044a0: 55 push %ebp 801044a1: 89 e5 mov %esp,%ebp 801044a3: 57 push %edi 801044a4: 56 push %esi 801044a5: 8b 45 10 mov 0x10(%ebp),%eax 801044a8: 53 push %ebx 801044a9: 8b 75 0c mov 0xc(%ebp),%esi 801044ac: 8b 5d 08 mov 0x8(%ebp),%ebx const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801044af: 85 c0 test %eax,%eax 801044b1: 74 29 je 801044dc <memcmp+0x3c> if(*s1 != *s2) 801044b3: 0f b6 13 movzbl (%ebx),%edx 801044b6: 0f b6 0e movzbl (%esi),%ecx 801044b9: 38 d1 cmp %dl,%cl 801044bb: 75 2b jne 801044e8 <memcmp+0x48> 801044bd: 8d 78 ff lea -0x1(%eax),%edi 801044c0: 31 c0 xor %eax,%eax 801044c2: eb 14 jmp 801044d8 <memcmp+0x38> 801044c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801044c8: 0f b6 54 03 01 movzbl 0x1(%ebx,%eax,1),%edx 801044cd: 83 c0 01 add $0x1,%eax 801044d0: 0f b6 0c 06 movzbl (%esi,%eax,1),%ecx 801044d4: 38 ca cmp %cl,%dl 801044d6: 75 10 jne 801044e8 <memcmp+0x48> { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ 801044d8: 39 f8 cmp %edi,%eax 801044da: 75 ec jne 801044c8 <memcmp+0x28> return *s1 - *s2; s1++, s2++; } return 0; } 801044dc: 5b pop %ebx if(*s1 != *s2) return *s1 - *s2; s1++, s2++; } return 0; 801044dd: 31 c0 xor %eax,%eax } 801044df: 5e pop %esi 801044e0: 5f pop %edi 801044e1: 5d pop %ebp 801044e2: c3 ret 801044e3: 90 nop 801044e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s1 = v1; s2 = v2; while(n-- > 0){ if(*s1 != *s2) return *s1 - *s2; 801044e8: 0f b6 c2 movzbl %dl,%eax s1++, s2++; } return 0; } 801044eb: 5b pop %ebx s1 = v1; s2 = v2; while(n-- > 0){ if(*s1 != *s2) return *s1 - *s2; 801044ec: 29 c8 sub %ecx,%eax s1++, s2++; } return 0; } 801044ee: 5e pop %esi 801044ef: 5f pop %edi 801044f0: 5d pop %ebp 801044f1: c3 ret 801044f2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801044f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104500 <memmove>: void* memmove(void *dst, const void *src, uint n) { 80104500: 55 push %ebp 80104501: 89 e5 mov %esp,%ebp 80104503: 56 push %esi 80104504: 53 push %ebx 80104505: 8b 45 08 mov 0x8(%ebp),%eax 80104508: 8b 75 0c mov 0xc(%ebp),%esi 8010450b: 8b 5d 10 mov 0x10(%ebp),%ebx const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ 8010450e: 39 c6 cmp %eax,%esi 80104510: 73 2e jae 80104540 <memmove+0x40> 80104512: 8d 0c 1e lea (%esi,%ebx,1),%ecx 80104515: 39 c8 cmp %ecx,%eax 80104517: 73 27 jae 80104540 <memmove+0x40> s += n; d += n; while(n-- > 0) 80104519: 85 db test %ebx,%ebx 8010451b: 8d 53 ff lea -0x1(%ebx),%edx 8010451e: 74 17 je 80104537 <memmove+0x37> *--d = *--s; 80104520: 29 d9 sub %ebx,%ecx 80104522: 89 cb mov %ecx,%ebx 80104524: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104528: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx 8010452c: 88 0c 10 mov %cl,(%eax,%edx,1) s = src; d = dst; if(s < d && s + n > d){ s += n; d += n; while(n-- > 0) 8010452f: 83 ea 01 sub $0x1,%edx 80104532: 83 fa ff cmp $0xffffffff,%edx 80104535: 75 f1 jne 80104528 <memmove+0x28> } else while(n-- > 0) *d++ = *s++; return dst; } 80104537: 5b pop %ebx 80104538: 5e pop %esi 80104539: 5d pop %ebp 8010453a: c3 ret 8010453b: 90 nop 8010453c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 80104540: 31 d2 xor %edx,%edx 80104542: 85 db test %ebx,%ebx 80104544: 74 f1 je 80104537 <memmove+0x37> 80104546: 8d 76 00 lea 0x0(%esi),%esi 80104549: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi *d++ = *s++; 80104550: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 80104554: 88 0c 10 mov %cl,(%eax,%edx,1) 80104557: 83 c2 01 add $0x1,%edx s += n; d += n; while(n-- > 0) *--d = *--s; } else while(n-- > 0) 8010455a: 39 d3 cmp %edx,%ebx 8010455c: 75 f2 jne 80104550 <memmove+0x50> *d++ = *s++; return dst; } 8010455e: 5b pop %ebx 8010455f: 5e pop %esi 80104560: 5d pop %ebp 80104561: c3 ret 80104562: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104570 <memcpy>: // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { 80104570: 55 push %ebp 80104571: 89 e5 mov %esp,%ebp return memmove(dst, src, n); } 80104573: 5d pop %ebp // memcpy exists to placate GCC. Use memmove. void* memcpy(void *dst, const void *src, uint n) { return memmove(dst, src, n); 80104574: eb 8a jmp 80104500 <memmove> 80104576: 8d 76 00 lea 0x0(%esi),%esi 80104579: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104580 <strncmp>: } int strncmp(const char *p, const char *q, uint n) { 80104580: 55 push %ebp 80104581: 89 e5 mov %esp,%ebp 80104583: 57 push %edi 80104584: 56 push %esi 80104585: 8b 4d 10 mov 0x10(%ebp),%ecx 80104588: 53 push %ebx 80104589: 8b 7d 08 mov 0x8(%ebp),%edi 8010458c: 8b 75 0c mov 0xc(%ebp),%esi while(n > 0 && *p && *p == *q) 8010458f: 85 c9 test %ecx,%ecx 80104591: 74 37 je 801045ca <strncmp+0x4a> 80104593: 0f b6 17 movzbl (%edi),%edx 80104596: 0f b6 1e movzbl (%esi),%ebx 80104599: 84 d2 test %dl,%dl 8010459b: 74 3f je 801045dc <strncmp+0x5c> 8010459d: 38 d3 cmp %dl,%bl 8010459f: 75 3b jne 801045dc <strncmp+0x5c> 801045a1: 8d 47 01 lea 0x1(%edi),%eax 801045a4: 01 cf add %ecx,%edi 801045a6: eb 1b jmp 801045c3 <strncmp+0x43> 801045a8: 90 nop 801045a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045b0: 0f b6 10 movzbl (%eax),%edx 801045b3: 84 d2 test %dl,%dl 801045b5: 74 21 je 801045d8 <strncmp+0x58> 801045b7: 0f b6 19 movzbl (%ecx),%ebx 801045ba: 83 c0 01 add $0x1,%eax 801045bd: 89 ce mov %ecx,%esi 801045bf: 38 da cmp %bl,%dl 801045c1: 75 19 jne 801045dc <strncmp+0x5c> 801045c3: 39 c7 cmp %eax,%edi n--, p++, q++; 801045c5: 8d 4e 01 lea 0x1(%esi),%ecx } int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) 801045c8: 75 e6 jne 801045b0 <strncmp+0x30> n--, p++, q++; if(n == 0) return 0; return (uchar)*p - (uchar)*q; } 801045ca: 5b pop %ebx strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; 801045cb: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; } 801045cd: 5e pop %esi 801045ce: 5f pop %edi 801045cf: 5d pop %ebp 801045d0: c3 ret 801045d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801045d8: 0f b6 5e 01 movzbl 0x1(%esi),%ebx { while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; return (uchar)*p - (uchar)*q; 801045dc: 0f b6 c2 movzbl %dl,%eax 801045df: 29 d8 sub %ebx,%eax } 801045e1: 5b pop %ebx 801045e2: 5e pop %esi 801045e3: 5f pop %edi 801045e4: 5d pop %ebp 801045e5: c3 ret 801045e6: 8d 76 00 lea 0x0(%esi),%esi 801045e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801045f0 <strncpy>: char* strncpy(char *s, const char *t, int n) { 801045f0: 55 push %ebp 801045f1: 89 e5 mov %esp,%ebp 801045f3: 56 push %esi 801045f4: 53 push %ebx 801045f5: 8b 45 08 mov 0x8(%ebp),%eax 801045f8: 8b 5d 0c mov 0xc(%ebp),%ebx 801045fb: 8b 4d 10 mov 0x10(%ebp),%ecx char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) 801045fe: 89 c2 mov %eax,%edx 80104600: eb 19 jmp 8010461b <strncpy+0x2b> 80104602: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104608: 83 c3 01 add $0x1,%ebx 8010460b: 0f b6 4b ff movzbl -0x1(%ebx),%ecx 8010460f: 83 c2 01 add $0x1,%edx 80104612: 84 c9 test %cl,%cl 80104614: 88 4a ff mov %cl,-0x1(%edx) 80104617: 74 09 je 80104622 <strncpy+0x32> 80104619: 89 f1 mov %esi,%ecx 8010461b: 85 c9 test %ecx,%ecx 8010461d: 8d 71 ff lea -0x1(%ecx),%esi 80104620: 7f e6 jg 80104608 <strncpy+0x18> ; while(n-- > 0) 80104622: 31 c9 xor %ecx,%ecx 80104624: 85 f6 test %esi,%esi 80104626: 7e 17 jle 8010463f <strncpy+0x4f> 80104628: 90 nop 80104629: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi *s++ = 0; 80104630: c6 04 0a 00 movb $0x0,(%edx,%ecx,1) 80104634: 89 f3 mov %esi,%ebx 80104636: 83 c1 01 add $0x1,%ecx 80104639: 29 cb sub %ecx,%ebx char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) 8010463b: 85 db test %ebx,%ebx 8010463d: 7f f1 jg 80104630 <strncpy+0x40> *s++ = 0; return os; } 8010463f: 5b pop %ebx 80104640: 5e pop %esi 80104641: 5d pop %ebp 80104642: c3 ret 80104643: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104649: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104650 <safestrcpy>: // Like strncpy but guaranteed to NUL-terminate. char* safestrcpy(char *s, const char *t, int n) { 80104650: 55 push %ebp 80104651: 89 e5 mov %esp,%ebp 80104653: 56 push %esi 80104654: 53 push %ebx 80104655: 8b 4d 10 mov 0x10(%ebp),%ecx 80104658: 8b 45 08 mov 0x8(%ebp),%eax 8010465b: 8b 55 0c mov 0xc(%ebp),%edx char *os; os = s; if(n <= 0) 8010465e: 85 c9 test %ecx,%ecx 80104660: 7e 26 jle 80104688 <safestrcpy+0x38> 80104662: 8d 74 0a ff lea -0x1(%edx,%ecx,1),%esi 80104666: 89 c1 mov %eax,%ecx 80104668: eb 17 jmp 80104681 <safestrcpy+0x31> 8010466a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return os; while(--n > 0 && (*s++ = *t++) != 0) 80104670: 83 c2 01 add $0x1,%edx 80104673: 0f b6 5a ff movzbl -0x1(%edx),%ebx 80104677: 83 c1 01 add $0x1,%ecx 8010467a: 84 db test %bl,%bl 8010467c: 88 59 ff mov %bl,-0x1(%ecx) 8010467f: 74 04 je 80104685 <safestrcpy+0x35> 80104681: 39 f2 cmp %esi,%edx 80104683: 75 eb jne 80104670 <safestrcpy+0x20> ; *s = 0; 80104685: c6 01 00 movb $0x0,(%ecx) return os; } 80104688: 5b pop %ebx 80104689: 5e pop %esi 8010468a: 5d pop %ebp 8010468b: c3 ret 8010468c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104690 <strlen>: int strlen(const char *s) { 80104690: 55 push %ebp int n; for(n = 0; s[n]; n++) 80104691: 31 c0 xor %eax,%eax return os; } int strlen(const char *s) { 80104693: 89 e5 mov %esp,%ebp 80104695: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) 80104698: 80 3a 00 cmpb $0x0,(%edx) 8010469b: 74 0c je 801046a9 <strlen+0x19> 8010469d: 8d 76 00 lea 0x0(%esi),%esi 801046a0: 83 c0 01 add $0x1,%eax 801046a3: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 801046a7: 75 f7 jne 801046a0 <strlen+0x10> ; return n; } 801046a9: 5d pop %ebp 801046aa: c3 ret 801046ab <swtch>: # a struct context, and save its address in *old. # Switch stacks to new and pop previously-saved registers. .globl swtch swtch: movl 4(%esp), %eax 801046ab: 8b 44 24 04 mov 0x4(%esp),%eax movl 8(%esp), %edx 801046af: 8b 54 24 08 mov 0x8(%esp),%edx # Save old callee-saved registers pushl %ebp 801046b3: 55 push %ebp pushl %ebx 801046b4: 53 push %ebx pushl %esi 801046b5: 56 push %esi pushl %edi 801046b6: 57 push %edi # Switch stacks movl %esp, (%eax) 801046b7: 89 20 mov %esp,(%eax) movl %edx, %esp 801046b9: 89 d4 mov %edx,%esp # Load new callee-saved registers popl %edi 801046bb: 5f pop %edi popl %esi 801046bc: 5e pop %esi popl %ebx 801046bd: 5b pop %ebx popl %ebp 801046be: 5d pop %ebp ret 801046bf: c3 ret 801046c0 <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) { 801046c0: 55 push %ebp 801046c1: 89 e5 mov %esp,%ebp 801046c3: 53 push %ebx 801046c4: 83 ec 04 sub $0x4,%esp 801046c7: 8b 5d 08 mov 0x8(%ebp),%ebx struct proc *curproc = myproc(); 801046ca: e8 b1 f0 ff ff call 80103780 <myproc> if(addr >= curproc->sz || addr+4 > curproc->sz) 801046cf: 8b 00 mov (%eax),%eax 801046d1: 39 d8 cmp %ebx,%eax 801046d3: 76 1b jbe 801046f0 <fetchint+0x30> 801046d5: 8d 53 04 lea 0x4(%ebx),%edx 801046d8: 39 d0 cmp %edx,%eax 801046da: 72 14 jb 801046f0 <fetchint+0x30> return -1; *ip = *(int*)(addr); 801046dc: 8b 45 0c mov 0xc(%ebp),%eax 801046df: 8b 13 mov (%ebx),%edx 801046e1: 89 10 mov %edx,(%eax) return 0; 801046e3: 31 c0 xor %eax,%eax } 801046e5: 83 c4 04 add $0x4,%esp 801046e8: 5b pop %ebx 801046e9: 5d pop %ebp 801046ea: c3 ret 801046eb: 90 nop 801046ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi fetchint(uint addr, int *ip) { struct proc *curproc = myproc(); if(addr >= curproc->sz || addr+4 > curproc->sz) return -1; 801046f0: b8 ff ff ff ff mov $0xffffffff,%eax 801046f5: eb ee jmp 801046e5 <fetchint+0x25> 801046f7: 89 f6 mov %esi,%esi 801046f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104700 <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) { 80104700: 55 push %ebp 80104701: 89 e5 mov %esp,%ebp 80104703: 53 push %ebx 80104704: 83 ec 04 sub $0x4,%esp 80104707: 8b 5d 08 mov 0x8(%ebp),%ebx char *s, *ep; struct proc *curproc = myproc(); 8010470a: e8 71 f0 ff ff call 80103780 <myproc> if(addr >= curproc->sz) 8010470f: 39 18 cmp %ebx,(%eax) 80104711: 76 29 jbe 8010473c <fetchstr+0x3c> return -1; *pp = (char*)addr; 80104713: 8b 4d 0c mov 0xc(%ebp),%ecx 80104716: 89 da mov %ebx,%edx 80104718: 89 19 mov %ebx,(%ecx) ep = (char*)curproc->sz; 8010471a: 8b 00 mov (%eax),%eax for(s = *pp; s < ep; s++){ 8010471c: 39 c3 cmp %eax,%ebx 8010471e: 73 1c jae 8010473c <fetchstr+0x3c> if(*s == 0) 80104720: 80 3b 00 cmpb $0x0,(%ebx) 80104723: 75 10 jne 80104735 <fetchstr+0x35> 80104725: eb 29 jmp 80104750 <fetchstr+0x50> 80104727: 89 f6 mov %esi,%esi 80104729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104730: 80 3a 00 cmpb $0x0,(%edx) 80104733: 74 1b je 80104750 <fetchstr+0x50> if(addr >= curproc->sz) return -1; *pp = (char*)addr; ep = (char*)curproc->sz; for(s = *pp; s < ep; s++){ 80104735: 83 c2 01 add $0x1,%edx 80104738: 39 d0 cmp %edx,%eax 8010473a: 77 f4 ja 80104730 <fetchstr+0x30> if(*s == 0) return s - *pp; } return -1; } 8010473c: 83 c4 04 add $0x4,%esp { char *s, *ep; struct proc *curproc = myproc(); if(addr >= curproc->sz) return -1; 8010473f: b8 ff ff ff ff mov $0xffffffff,%eax for(s = *pp; s < ep; s++){ if(*s == 0) return s - *pp; } return -1; } 80104744: 5b pop %ebx 80104745: 5d pop %ebp 80104746: c3 ret 80104747: 89 f6 mov %esi,%esi 80104749: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104750: 83 c4 04 add $0x4,%esp return -1; *pp = (char*)addr; ep = (char*)curproc->sz; for(s = *pp; s < ep; s++){ if(*s == 0) return s - *pp; 80104753: 89 d0 mov %edx,%eax 80104755: 29 d8 sub %ebx,%eax } return -1; } 80104757: 5b pop %ebx 80104758: 5d pop %ebp 80104759: c3 ret 8010475a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104760 <argint>: // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { 80104760: 55 push %ebp 80104761: 89 e5 mov %esp,%ebp 80104763: 56 push %esi 80104764: 53 push %ebx return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 80104765: e8 16 f0 ff ff call 80103780 <myproc> 8010476a: 8b 40 18 mov 0x18(%eax),%eax 8010476d: 8b 55 08 mov 0x8(%ebp),%edx 80104770: 8b 40 44 mov 0x44(%eax),%eax 80104773: 8d 1c 90 lea (%eax,%edx,4),%ebx // Fetch the int at addr from the current process. int fetchint(uint addr, int *ip) { struct proc *curproc = myproc(); 80104776: e8 05 f0 ff ff call 80103780 <myproc> if(addr >= curproc->sz || addr+4 > curproc->sz) 8010477b: 8b 00 mov (%eax),%eax // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); 8010477d: 8d 73 04 lea 0x4(%ebx),%esi int fetchint(uint addr, int *ip) { struct proc *curproc = myproc(); if(addr >= curproc->sz || addr+4 > curproc->sz) 80104780: 39 c6 cmp %eax,%esi 80104782: 73 1c jae 801047a0 <argint+0x40> 80104784: 8d 53 08 lea 0x8(%ebx),%edx 80104787: 39 d0 cmp %edx,%eax 80104789: 72 15 jb 801047a0 <argint+0x40> return -1; *ip = *(int*)(addr); 8010478b: 8b 45 0c mov 0xc(%ebp),%eax 8010478e: 8b 53 04 mov 0x4(%ebx),%edx 80104791: 89 10 mov %edx,(%eax) return 0; 80104793: 31 c0 xor %eax,%eax // Fetch the nth 32-bit system call argument. int argint(int n, int *ip) { return fetchint((myproc()->tf->esp) + 4 + 4*n, ip); } 80104795: 5b pop %ebx 80104796: 5e pop %esi 80104797: 5d pop %ebp 80104798: c3 ret 80104799: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi fetchint(uint addr, int *ip) { struct proc *curproc = myproc(); if(addr >= curproc->sz || addr+4 > curproc->sz) return -1; 801047a0: b8 ff ff ff ff mov $0xffffffff,%eax 801047a5: eb ee jmp 80104795 <argint+0x35> 801047a7: 89 f6 mov %esi,%esi 801047a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801047b0 <argptr>: // Fetch the nth word-sized system call argument as a pointer // to a block of memory of size bytes. Check that the pointer // lies within the process address space. int argptr(int n, char **pp, int size) { 801047b0: 55 push %ebp 801047b1: 89 e5 mov %esp,%ebp 801047b3: 56 push %esi 801047b4: 53 push %ebx 801047b5: 83 ec 10 sub $0x10,%esp 801047b8: 8b 5d 10 mov 0x10(%ebp),%ebx int i; struct proc *curproc = myproc(); 801047bb: e8 c0 ef ff ff call 80103780 <myproc> 801047c0: 89 c6 mov %eax,%esi if(argint(n, &i) < 0) 801047c2: 8d 45 f4 lea -0xc(%ebp),%eax 801047c5: 83 ec 08 sub $0x8,%esp 801047c8: 50 push %eax 801047c9: ff 75 08 pushl 0x8(%ebp) 801047cc: e8 8f ff ff ff call 80104760 <argint> return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) 801047d1: c1 e8 1f shr $0x1f,%eax 801047d4: 83 c4 10 add $0x10,%esp 801047d7: 84 c0 test %al,%al 801047d9: 75 2d jne 80104808 <argptr+0x58> 801047db: 89 d8 mov %ebx,%eax 801047dd: c1 e8 1f shr $0x1f,%eax 801047e0: 84 c0 test %al,%al 801047e2: 75 24 jne 80104808 <argptr+0x58> 801047e4: 8b 16 mov (%esi),%edx 801047e6: 8b 45 f4 mov -0xc(%ebp),%eax 801047e9: 39 c2 cmp %eax,%edx 801047eb: 76 1b jbe 80104808 <argptr+0x58> 801047ed: 01 c3 add %eax,%ebx 801047ef: 39 da cmp %ebx,%edx 801047f1: 72 15 jb 80104808 <argptr+0x58> return -1; *pp = (char*)i; 801047f3: 8b 55 0c mov 0xc(%ebp),%edx 801047f6: 89 02 mov %eax,(%edx) return 0; 801047f8: 31 c0 xor %eax,%eax } 801047fa: 8d 65 f8 lea -0x8(%ebp),%esp 801047fd: 5b pop %ebx 801047fe: 5e pop %esi 801047ff: 5d pop %ebp 80104800: c3 ret 80104801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi struct proc *curproc = myproc(); if(argint(n, &i) < 0) return -1; if(size < 0 || (uint)i >= curproc->sz || (uint)i+size > curproc->sz) return -1; 80104808: b8 ff ff ff ff mov $0xffffffff,%eax 8010480d: eb eb jmp 801047fa <argptr+0x4a> 8010480f: 90 nop 80104810 <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) { 80104810: 55 push %ebp 80104811: 89 e5 mov %esp,%ebp 80104813: 83 ec 20 sub $0x20,%esp int addr; if(argint(n, &addr) < 0) 80104816: 8d 45 f4 lea -0xc(%ebp),%eax 80104819: 50 push %eax 8010481a: ff 75 08 pushl 0x8(%ebp) 8010481d: e8 3e ff ff ff call 80104760 <argint> 80104822: 83 c4 10 add $0x10,%esp 80104825: 85 c0 test %eax,%eax 80104827: 78 17 js 80104840 <argstr+0x30> return -1; return fetchstr(addr, pp); 80104829: 83 ec 08 sub $0x8,%esp 8010482c: ff 75 0c pushl 0xc(%ebp) 8010482f: ff 75 f4 pushl -0xc(%ebp) 80104832: e8 c9 fe ff ff call 80104700 <fetchstr> 80104837: 83 c4 10 add $0x10,%esp } 8010483a: c9 leave 8010483b: c3 ret 8010483c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int argstr(int n, char **pp) { int addr; if(argint(n, &addr) < 0) return -1; 80104840: b8 ff ff ff ff mov $0xffffffff,%eax return fetchstr(addr, pp); } 80104845: c9 leave 80104846: c3 ret 80104847: 89 f6 mov %esi,%esi 80104849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104850 <syscall>: [SYS_abdur_rouf] sys_abdur_rouf, }; void syscall(void) { 80104850: 55 push %ebp 80104851: 89 e5 mov %esp,%ebp 80104853: 56 push %esi 80104854: 53 push %ebx int num; struct proc *curproc = myproc(); 80104855: e8 26 ef ff ff call 80103780 <myproc> num = curproc->tf->eax; 8010485a: 8b 70 18 mov 0x18(%eax),%esi void syscall(void) { int num; struct proc *curproc = myproc(); 8010485d: 89 c3 mov %eax,%ebx num = curproc->tf->eax; 8010485f: 8b 46 1c mov 0x1c(%esi),%eax if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { 80104862: 8d 50 ff lea -0x1(%eax),%edx 80104865: 83 fa 15 cmp $0x15,%edx 80104868: 77 1e ja 80104888 <syscall+0x38> 8010486a: 8b 14 85 40 76 10 80 mov -0x7fef89c0(,%eax,4),%edx 80104871: 85 d2 test %edx,%edx 80104873: 74 13 je 80104888 <syscall+0x38> curproc->tf->eax = syscalls[num](); 80104875: ff d2 call *%edx 80104877: 89 46 1c mov %eax,0x1c(%esi) } else { cprintf("%d %s: unknown sys call %d\n", curproc->pid, curproc->name, num); curproc->tf->eax = -1; } } 8010487a: 8d 65 f8 lea -0x8(%ebp),%esp 8010487d: 5b pop %ebx 8010487e: 5e pop %esi 8010487f: 5d pop %ebp 80104880: c3 ret 80104881: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi num = curproc->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { curproc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 80104888: 50 push %eax curproc->pid, curproc->name, num); 80104889: 8d 43 6c lea 0x6c(%ebx),%eax num = curproc->tf->eax; if(num > 0 && num < NELEM(syscalls) && syscalls[num]) { curproc->tf->eax = syscalls[num](); } else { cprintf("%d %s: unknown sys call %d\n", 8010488c: 50 push %eax 8010488d: ff 73 10 pushl 0x10(%ebx) 80104890: 68 05 76 10 80 push $0x80107605 80104895: e8 c6 bd ff ff call 80100660 <cprintf> curproc->pid, curproc->name, num); curproc->tf->eax = -1; 8010489a: 8b 43 18 mov 0x18(%ebx),%eax 8010489d: 83 c4 10 add $0x10,%esp 801048a0: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax) } } 801048a7: 8d 65 f8 lea -0x8(%ebp),%esp 801048aa: 5b pop %ebx 801048ab: 5e pop %esi 801048ac: 5d pop %ebp 801048ad: c3 ret 801048ae: 66 90 xchg %ax,%ax 801048b0 <create>: return -1; } static struct inode* create(char *path, short type, short major, short minor) { 801048b0: 55 push %ebp 801048b1: 89 e5 mov %esp,%ebp 801048b3: 57 push %edi 801048b4: 56 push %esi 801048b5: 53 push %ebx uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801048b6: 8d 75 da lea -0x26(%ebp),%esi return -1; } static struct inode* create(char *path, short type, short major, short minor) { 801048b9: 83 ec 44 sub $0x44,%esp 801048bc: 89 4d c0 mov %ecx,-0x40(%ebp) 801048bf: 8b 4d 08 mov 0x8(%ebp),%ecx uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801048c2: 56 push %esi 801048c3: 50 push %eax return -1; } static struct inode* create(char *path, short type, short major, short minor) { 801048c4: 89 55 c4 mov %edx,-0x3c(%ebp) 801048c7: 89 4d bc mov %ecx,-0x44(%ebp) uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) 801048ca: e8 11 d6 ff ff call 80101ee0 <nameiparent> 801048cf: 83 c4 10 add $0x10,%esp 801048d2: 85 c0 test %eax,%eax 801048d4: 0f 84 f6 00 00 00 je 801049d0 <create+0x120> return 0; ilock(dp); 801048da: 83 ec 0c sub $0xc,%esp 801048dd: 89 c7 mov %eax,%edi 801048df: 50 push %eax 801048e0: e8 8b cd ff ff call 80101670 <ilock> if((ip = dirlookup(dp, name, &off)) != 0){ 801048e5: 8d 45 d4 lea -0x2c(%ebp),%eax 801048e8: 83 c4 0c add $0xc,%esp 801048eb: 50 push %eax 801048ec: 56 push %esi 801048ed: 57 push %edi 801048ee: e8 ad d2 ff ff call 80101ba0 <dirlookup> 801048f3: 83 c4 10 add $0x10,%esp 801048f6: 85 c0 test %eax,%eax 801048f8: 89 c3 mov %eax,%ebx 801048fa: 74 54 je 80104950 <create+0xa0> iunlockput(dp); 801048fc: 83 ec 0c sub $0xc,%esp 801048ff: 57 push %edi 80104900: e8 fb cf ff ff call 80101900 <iunlockput> ilock(ip); 80104905: 89 1c 24 mov %ebx,(%esp) 80104908: e8 63 cd ff ff call 80101670 <ilock> if(type == T_FILE && ip->type == T_FILE) 8010490d: 83 c4 10 add $0x10,%esp 80104910: 66 83 7d c4 02 cmpw $0x2,-0x3c(%ebp) 80104915: 75 19 jne 80104930 <create+0x80> 80104917: 66 83 7b 50 02 cmpw $0x2,0x50(%ebx) 8010491c: 89 d8 mov %ebx,%eax 8010491e: 75 10 jne 80104930 <create+0x80> panic("create: dirlink"); iunlockput(dp); return ip; } 80104920: 8d 65 f4 lea -0xc(%ebp),%esp 80104923: 5b pop %ebx 80104924: 5e pop %esi 80104925: 5f pop %edi 80104926: 5d pop %ebp 80104927: c3 ret 80104928: 90 nop 80104929: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if((ip = dirlookup(dp, name, &off)) != 0){ iunlockput(dp); ilock(ip); if(type == T_FILE && ip->type == T_FILE) return ip; iunlockput(ip); 80104930: 83 ec 0c sub $0xc,%esp 80104933: 53 push %ebx 80104934: e8 c7 cf ff ff call 80101900 <iunlockput> return 0; 80104939: 83 c4 10 add $0x10,%esp panic("create: dirlink"); iunlockput(dp); return ip; } 8010493c: 8d 65 f4 lea -0xc(%ebp),%esp iunlockput(dp); ilock(ip); if(type == T_FILE && ip->type == T_FILE) return ip; iunlockput(ip); return 0; 8010493f: 31 c0 xor %eax,%eax panic("create: dirlink"); iunlockput(dp); return ip; } 80104941: 5b pop %ebx 80104942: 5e pop %esi 80104943: 5f pop %edi 80104944: 5d pop %ebp 80104945: c3 ret 80104946: 8d 76 00 lea 0x0(%esi),%esi 80104949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi return ip; iunlockput(ip); return 0; } if((ip = ialloc(dp->dev, type)) == 0) 80104950: 0f bf 45 c4 movswl -0x3c(%ebp),%eax 80104954: 83 ec 08 sub $0x8,%esp 80104957: 50 push %eax 80104958: ff 37 pushl (%edi) 8010495a: e8 a1 cb ff ff call 80101500 <ialloc> 8010495f: 83 c4 10 add $0x10,%esp 80104962: 85 c0 test %eax,%eax 80104964: 89 c3 mov %eax,%ebx 80104966: 0f 84 cc 00 00 00 je 80104a38 <create+0x188> panic("create: ialloc"); ilock(ip); 8010496c: 83 ec 0c sub $0xc,%esp 8010496f: 50 push %eax 80104970: e8 fb cc ff ff call 80101670 <ilock> ip->major = major; 80104975: 0f b7 45 c0 movzwl -0x40(%ebp),%eax 80104979: 66 89 43 52 mov %ax,0x52(%ebx) ip->minor = minor; 8010497d: 0f b7 45 bc movzwl -0x44(%ebp),%eax 80104981: 66 89 43 54 mov %ax,0x54(%ebx) ip->nlink = 1; 80104985: b8 01 00 00 00 mov $0x1,%eax 8010498a: 66 89 43 56 mov %ax,0x56(%ebx) iupdate(ip); 8010498e: 89 1c 24 mov %ebx,(%esp) 80104991: e8 2a cc ff ff call 801015c0 <iupdate> if(type == T_DIR){ // Create . and .. entries. 80104996: 83 c4 10 add $0x10,%esp 80104999: 66 83 7d c4 01 cmpw $0x1,-0x3c(%ebp) 8010499e: 74 40 je 801049e0 <create+0x130> // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) panic("create dots"); } if(dirlink(dp, name, ip->inum) < 0) 801049a0: 83 ec 04 sub $0x4,%esp 801049a3: ff 73 04 pushl 0x4(%ebx) 801049a6: 56 push %esi 801049a7: 57 push %edi 801049a8: e8 53 d4 ff ff call 80101e00 <dirlink> 801049ad: 83 c4 10 add $0x10,%esp 801049b0: 85 c0 test %eax,%eax 801049b2: 78 77 js 80104a2b <create+0x17b> panic("create: dirlink"); iunlockput(dp); 801049b4: 83 ec 0c sub $0xc,%esp 801049b7: 57 push %edi 801049b8: e8 43 cf ff ff call 80101900 <iunlockput> return ip; 801049bd: 83 c4 10 add $0x10,%esp } 801049c0: 8d 65 f4 lea -0xc(%ebp),%esp if(dirlink(dp, name, ip->inum) < 0) panic("create: dirlink"); iunlockput(dp); return ip; 801049c3: 89 d8 mov %ebx,%eax } 801049c5: 5b pop %ebx 801049c6: 5e pop %esi 801049c7: 5f pop %edi 801049c8: 5d pop %ebp 801049c9: c3 ret 801049ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi uint off; struct inode *ip, *dp; char name[DIRSIZ]; if((dp = nameiparent(path, name)) == 0) return 0; 801049d0: 31 c0 xor %eax,%eax 801049d2: e9 49 ff ff ff jmp 80104920 <create+0x70> 801049d7: 89 f6 mov %esi,%esi 801049d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi ip->minor = minor; ip->nlink = 1; iupdate(ip); if(type == T_DIR){ // Create . and .. entries. dp->nlink++; // for ".." 801049e0: 66 83 47 56 01 addw $0x1,0x56(%edi) iupdate(dp); 801049e5: 83 ec 0c sub $0xc,%esp 801049e8: 57 push %edi 801049e9: e8 d2 cb ff ff call 801015c0 <iupdate> // No ip->nlink++ for ".": avoid cyclic ref count. if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0) 801049ee: 83 c4 0c add $0xc,%esp 801049f1: ff 73 04 pushl 0x4(%ebx) 801049f4: 68 b8 76 10 80 push $0x801076b8 801049f9: 53 push %ebx 801049fa: e8 01 d4 ff ff call 80101e00 <dirlink> 801049ff: 83 c4 10 add $0x10,%esp 80104a02: 85 c0 test %eax,%eax 80104a04: 78 18 js 80104a1e <create+0x16e> 80104a06: 83 ec 04 sub $0x4,%esp 80104a09: ff 77 04 pushl 0x4(%edi) 80104a0c: 68 b7 76 10 80 push $0x801076b7 80104a11: 53 push %ebx 80104a12: e8 e9 d3 ff ff call 80101e00 <dirlink> 80104a17: 83 c4 10 add $0x10,%esp 80104a1a: 85 c0 test %eax,%eax 80104a1c: 79 82 jns 801049a0 <create+0xf0> panic("create dots"); 80104a1e: 83 ec 0c sub $0xc,%esp 80104a21: 68 ab 76 10 80 push $0x801076ab 80104a26: e8 45 b9 ff ff call 80100370 <panic> } if(dirlink(dp, name, ip->inum) < 0) panic("create: dirlink"); 80104a2b: 83 ec 0c sub $0xc,%esp 80104a2e: 68 ba 76 10 80 push $0x801076ba 80104a33: e8 38 b9 ff ff call 80100370 <panic> iunlockput(ip); return 0; } if((ip = ialloc(dp->dev, type)) == 0) panic("create: ialloc"); 80104a38: 83 ec 0c sub $0xc,%esp 80104a3b: 68 9c 76 10 80 push $0x8010769c 80104a40: e8 2b b9 ff ff call 80100370 <panic> 80104a45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104a49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104a50 <argfd.constprop.0>: #include "fcntl.h" // 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) 80104a50: 55 push %ebp 80104a51: 89 e5 mov %esp,%ebp 80104a53: 56 push %esi 80104a54: 53 push %ebx 80104a55: 89 c6 mov %eax,%esi { int fd; struct file *f; if(argint(n, &fd) < 0) 80104a57: 8d 45 f4 lea -0xc(%ebp),%eax #include "fcntl.h" // 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) 80104a5a: 89 d3 mov %edx,%ebx 80104a5c: 83 ec 18 sub $0x18,%esp { int fd; struct file *f; if(argint(n, &fd) < 0) 80104a5f: 50 push %eax 80104a60: 6a 00 push $0x0 80104a62: e8 f9 fc ff ff call 80104760 <argint> 80104a67: 83 c4 10 add $0x10,%esp 80104a6a: 85 c0 test %eax,%eax 80104a6c: 78 32 js 80104aa0 <argfd.constprop.0+0x50> return -1; if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) 80104a6e: 83 7d f4 0f cmpl $0xf,-0xc(%ebp) 80104a72: 77 2c ja 80104aa0 <argfd.constprop.0+0x50> 80104a74: e8 07 ed ff ff call 80103780 <myproc> 80104a79: 8b 55 f4 mov -0xc(%ebp),%edx 80104a7c: 8b 44 90 28 mov 0x28(%eax,%edx,4),%eax 80104a80: 85 c0 test %eax,%eax 80104a82: 74 1c je 80104aa0 <argfd.constprop.0+0x50> return -1; if(pfd) 80104a84: 85 f6 test %esi,%esi 80104a86: 74 02 je 80104a8a <argfd.constprop.0+0x3a> *pfd = fd; 80104a88: 89 16 mov %edx,(%esi) if(pf) 80104a8a: 85 db test %ebx,%ebx 80104a8c: 74 22 je 80104ab0 <argfd.constprop.0+0x60> *pf = f; 80104a8e: 89 03 mov %eax,(%ebx) return 0; 80104a90: 31 c0 xor %eax,%eax } 80104a92: 8d 65 f8 lea -0x8(%ebp),%esp 80104a95: 5b pop %ebx 80104a96: 5e pop %esi 80104a97: 5d pop %ebp 80104a98: c3 ret 80104a99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80104aa0: 8d 65 f8 lea -0x8(%ebp),%esp { int fd; struct file *f; if(argint(n, &fd) < 0) return -1; 80104aa3: b8 ff ff ff ff mov $0xffffffff,%eax if(pfd) *pfd = fd; if(pf) *pf = f; return 0; } 80104aa8: 5b pop %ebx 80104aa9: 5e pop %esi 80104aaa: 5d pop %ebp 80104aab: c3 ret 80104aac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return -1; if(pfd) *pfd = fd; if(pf) *pf = f; return 0; 80104ab0: 31 c0 xor %eax,%eax 80104ab2: eb de jmp 80104a92 <argfd.constprop.0+0x42> 80104ab4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104aba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80104ac0 <sys_dup>: return -1; } int sys_dup(void) { 80104ac0: 55 push %ebp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80104ac1: 31 c0 xor %eax,%eax return -1; } int sys_dup(void) { 80104ac3: 89 e5 mov %esp,%ebp 80104ac5: 56 push %esi 80104ac6: 53 push %ebx struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80104ac7: 8d 55 f4 lea -0xc(%ebp),%edx return -1; } int sys_dup(void) { 80104aca: 83 ec 10 sub $0x10,%esp struct file *f; int fd; if(argfd(0, 0, &f) < 0) 80104acd: e8 7e ff ff ff call 80104a50 <argfd.constprop.0> 80104ad2: 85 c0 test %eax,%eax 80104ad4: 78 1a js 80104af0 <sys_dup+0x30> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80104ad6: 31 db xor %ebx,%ebx struct file *f; int fd; if(argfd(0, 0, &f) < 0) return -1; if((fd=fdalloc(f)) < 0) 80104ad8: 8b 75 f4 mov -0xc(%ebp),%esi // Takes over file reference from caller on success. static int fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); 80104adb: e8 a0 ec ff ff call 80103780 <myproc> for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ 80104ae0: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80104ae4: 85 d2 test %edx,%edx 80104ae6: 74 18 je 80104b00 <sys_dup+0x40> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80104ae8: 83 c3 01 add $0x1,%ebx 80104aeb: 83 fb 10 cmp $0x10,%ebx 80104aee: 75 f0 jne 80104ae0 <sys_dup+0x20> return -1; if((fd=fdalloc(f)) < 0) return -1; filedup(f); return fd; } 80104af0: 8d 65 f8 lea -0x8(%ebp),%esp { struct file *f; int fd; if(argfd(0, 0, &f) < 0) return -1; 80104af3: b8 ff ff ff ff mov $0xffffffff,%eax if((fd=fdalloc(f)) < 0) return -1; filedup(f); return fd; } 80104af8: 5b pop %ebx 80104af9: 5e pop %esi 80104afa: 5d pop %ebp 80104afb: c3 ret 80104afc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; 80104b00: 89 74 98 28 mov %esi,0x28(%eax,%ebx,4) if(argfd(0, 0, &f) < 0) return -1; if((fd=fdalloc(f)) < 0) return -1; filedup(f); 80104b04: 83 ec 0c sub $0xc,%esp 80104b07: ff 75 f4 pushl -0xc(%ebp) 80104b0a: e8 d1 c2 ff ff call 80100de0 <filedup> return fd; 80104b0f: 83 c4 10 add $0x10,%esp } 80104b12: 8d 65 f8 lea -0x8(%ebp),%esp if(argfd(0, 0, &f) < 0) return -1; if((fd=fdalloc(f)) < 0) return -1; filedup(f); return fd; 80104b15: 89 d8 mov %ebx,%eax } 80104b17: 5b pop %ebx 80104b18: 5e pop %esi 80104b19: 5d pop %ebp 80104b1a: c3 ret 80104b1b: 90 nop 80104b1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80104b20 <sys_read>: int sys_read(void) { 80104b20: 55 push %ebp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104b21: 31 c0 xor %eax,%eax return fd; } int sys_read(void) { 80104b23: 89 e5 mov %esp,%ebp 80104b25: 83 ec 18 sub $0x18,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104b28: 8d 55 ec lea -0x14(%ebp),%edx 80104b2b: e8 20 ff ff ff call 80104a50 <argfd.constprop.0> 80104b30: 85 c0 test %eax,%eax 80104b32: 78 4c js 80104b80 <sys_read+0x60> 80104b34: 8d 45 f0 lea -0x10(%ebp),%eax 80104b37: 83 ec 08 sub $0x8,%esp 80104b3a: 50 push %eax 80104b3b: 6a 02 push $0x2 80104b3d: e8 1e fc ff ff call 80104760 <argint> 80104b42: 83 c4 10 add $0x10,%esp 80104b45: 85 c0 test %eax,%eax 80104b47: 78 37 js 80104b80 <sys_read+0x60> 80104b49: 8d 45 f4 lea -0xc(%ebp),%eax 80104b4c: 83 ec 04 sub $0x4,%esp 80104b4f: ff 75 f0 pushl -0x10(%ebp) 80104b52: 50 push %eax 80104b53: 6a 01 push $0x1 80104b55: e8 56 fc ff ff call 801047b0 <argptr> 80104b5a: 83 c4 10 add $0x10,%esp 80104b5d: 85 c0 test %eax,%eax 80104b5f: 78 1f js 80104b80 <sys_read+0x60> return -1; return fileread(f, p, n); 80104b61: 83 ec 04 sub $0x4,%esp 80104b64: ff 75 f0 pushl -0x10(%ebp) 80104b67: ff 75 f4 pushl -0xc(%ebp) 80104b6a: ff 75 ec pushl -0x14(%ebp) 80104b6d: e8 de c3 ff ff call 80100f50 <fileread> 80104b72: 83 c4 10 add $0x10,%esp } 80104b75: c9 leave 80104b76: c3 ret 80104b77: 89 f6 mov %esi,%esi 80104b79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) return -1; 80104b80: b8 ff ff ff ff mov $0xffffffff,%eax return fileread(f, p, n); } 80104b85: c9 leave 80104b86: c3 ret 80104b87: 89 f6 mov %esi,%esi 80104b89: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104b90 <sys_write>: int sys_write(void) { 80104b90: 55 push %ebp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104b91: 31 c0 xor %eax,%eax return fileread(f, p, n); } int sys_write(void) { 80104b93: 89 e5 mov %esp,%ebp 80104b95: 83 ec 18 sub $0x18,%esp struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) 80104b98: 8d 55 ec lea -0x14(%ebp),%edx 80104b9b: e8 b0 fe ff ff call 80104a50 <argfd.constprop.0> 80104ba0: 85 c0 test %eax,%eax 80104ba2: 78 4c js 80104bf0 <sys_write+0x60> 80104ba4: 8d 45 f0 lea -0x10(%ebp),%eax 80104ba7: 83 ec 08 sub $0x8,%esp 80104baa: 50 push %eax 80104bab: 6a 02 push $0x2 80104bad: e8 ae fb ff ff call 80104760 <argint> 80104bb2: 83 c4 10 add $0x10,%esp 80104bb5: 85 c0 test %eax,%eax 80104bb7: 78 37 js 80104bf0 <sys_write+0x60> 80104bb9: 8d 45 f4 lea -0xc(%ebp),%eax 80104bbc: 83 ec 04 sub $0x4,%esp 80104bbf: ff 75 f0 pushl -0x10(%ebp) 80104bc2: 50 push %eax 80104bc3: 6a 01 push $0x1 80104bc5: e8 e6 fb ff ff call 801047b0 <argptr> 80104bca: 83 c4 10 add $0x10,%esp 80104bcd: 85 c0 test %eax,%eax 80104bcf: 78 1f js 80104bf0 <sys_write+0x60> return -1; return filewrite(f, p, n); 80104bd1: 83 ec 04 sub $0x4,%esp 80104bd4: ff 75 f0 pushl -0x10(%ebp) 80104bd7: ff 75 f4 pushl -0xc(%ebp) 80104bda: ff 75 ec pushl -0x14(%ebp) 80104bdd: e8 fe c3 ff ff call 80100fe0 <filewrite> 80104be2: 83 c4 10 add $0x10,%esp } 80104be5: c9 leave 80104be6: c3 ret 80104be7: 89 f6 mov %esi,%esi 80104be9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi struct file *f; int n; char *p; if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0) return -1; 80104bf0: b8 ff ff ff ff mov $0xffffffff,%eax return filewrite(f, p, n); } 80104bf5: c9 leave 80104bf6: c3 ret 80104bf7: 89 f6 mov %esi,%esi 80104bf9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104c00 <sys_close>: int sys_close(void) { 80104c00: 55 push %ebp 80104c01: 89 e5 mov %esp,%ebp 80104c03: 83 ec 18 sub $0x18,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) 80104c06: 8d 55 f4 lea -0xc(%ebp),%edx 80104c09: 8d 45 f0 lea -0x10(%ebp),%eax 80104c0c: e8 3f fe ff ff call 80104a50 <argfd.constprop.0> 80104c11: 85 c0 test %eax,%eax 80104c13: 78 2b js 80104c40 <sys_close+0x40> return -1; myproc()->ofile[fd] = 0; 80104c15: e8 66 eb ff ff call 80103780 <myproc> 80104c1a: 8b 55 f0 mov -0x10(%ebp),%edx fileclose(f); 80104c1d: 83 ec 0c sub $0xc,%esp int fd; struct file *f; if(argfd(0, &fd, &f) < 0) return -1; myproc()->ofile[fd] = 0; 80104c20: c7 44 90 28 00 00 00 movl $0x0,0x28(%eax,%edx,4) 80104c27: 00 fileclose(f); 80104c28: ff 75 f4 pushl -0xc(%ebp) 80104c2b: e8 00 c2 ff ff call 80100e30 <fileclose> return 0; 80104c30: 83 c4 10 add $0x10,%esp 80104c33: 31 c0 xor %eax,%eax } 80104c35: c9 leave 80104c36: c3 ret 80104c37: 89 f6 mov %esi,%esi 80104c39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi { int fd; struct file *f; if(argfd(0, &fd, &f) < 0) return -1; 80104c40: b8 ff ff ff ff mov $0xffffffff,%eax myproc()->ofile[fd] = 0; fileclose(f); return 0; } 80104c45: c9 leave 80104c46: c3 ret 80104c47: 89 f6 mov %esi,%esi 80104c49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104c50 <sys_fstat>: int sys_fstat(void) { 80104c50: 55 push %ebp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80104c51: 31 c0 xor %eax,%eax return 0; } int sys_fstat(void) { 80104c53: 89 e5 mov %esp,%ebp 80104c55: 83 ec 18 sub $0x18,%esp struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) 80104c58: 8d 55 f0 lea -0x10(%ebp),%edx 80104c5b: e8 f0 fd ff ff call 80104a50 <argfd.constprop.0> 80104c60: 85 c0 test %eax,%eax 80104c62: 78 2c js 80104c90 <sys_fstat+0x40> 80104c64: 8d 45 f4 lea -0xc(%ebp),%eax 80104c67: 83 ec 04 sub $0x4,%esp 80104c6a: 6a 14 push $0x14 80104c6c: 50 push %eax 80104c6d: 6a 01 push $0x1 80104c6f: e8 3c fb ff ff call 801047b0 <argptr> 80104c74: 83 c4 10 add $0x10,%esp 80104c77: 85 c0 test %eax,%eax 80104c79: 78 15 js 80104c90 <sys_fstat+0x40> return -1; return filestat(f, st); 80104c7b: 83 ec 08 sub $0x8,%esp 80104c7e: ff 75 f4 pushl -0xc(%ebp) 80104c81: ff 75 f0 pushl -0x10(%ebp) 80104c84: e8 77 c2 ff ff call 80100f00 <filestat> 80104c89: 83 c4 10 add $0x10,%esp } 80104c8c: c9 leave 80104c8d: c3 ret 80104c8e: 66 90 xchg %ax,%ax { struct file *f; struct stat *st; if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0) return -1; 80104c90: b8 ff ff ff ff mov $0xffffffff,%eax return filestat(f, st); } 80104c95: c9 leave 80104c96: c3 ret 80104c97: 89 f6 mov %esi,%esi 80104c99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80104ca0 <sys_link>: // Create the path new as a link to the same inode as old. int sys_link(void) { 80104ca0: 55 push %ebp 80104ca1: 89 e5 mov %esp,%ebp 80104ca3: 57 push %edi 80104ca4: 56 push %esi 80104ca5: 53 push %ebx char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80104ca6: 8d 45 d4 lea -0x2c(%ebp),%eax } // Create the path new as a link to the same inode as old. int sys_link(void) { 80104ca9: 83 ec 34 sub $0x34,%esp char name[DIRSIZ], *new, *old; struct inode *dp, *ip; if(argstr(0, &old) < 0 || argstr(1, &new) < 0) 80104cac: 50 push %eax 80104cad: 6a 00 push $0x0 80104caf: e8 5c fb ff ff call 80104810 <argstr> 80104cb4: 83 c4 10 add $0x10,%esp 80104cb7: 85 c0 test %eax,%eax 80104cb9: 0f 88 fb 00 00 00 js 80104dba <sys_link+0x11a> 80104cbf: 8d 45 d0 lea -0x30(%ebp),%eax 80104cc2: 83 ec 08 sub $0x8,%esp 80104cc5: 50 push %eax 80104cc6: 6a 01 push $0x1 80104cc8: e8 43 fb ff ff call 80104810 <argstr> 80104ccd: 83 c4 10 add $0x10,%esp 80104cd0: 85 c0 test %eax,%eax 80104cd2: 0f 88 e2 00 00 00 js 80104dba <sys_link+0x11a> return -1; begin_op(); 80104cd8: e8 73 de ff ff call 80102b50 <begin_op> if((ip = namei(old)) == 0){ 80104cdd: 83 ec 0c sub $0xc,%esp 80104ce0: ff 75 d4 pushl -0x2c(%ebp) 80104ce3: e8 d8 d1 ff ff call 80101ec0 <namei> 80104ce8: 83 c4 10 add $0x10,%esp 80104ceb: 85 c0 test %eax,%eax 80104ced: 89 c3 mov %eax,%ebx 80104cef: 0f 84 f3 00 00 00 je 80104de8 <sys_link+0x148> end_op(); return -1; } ilock(ip); 80104cf5: 83 ec 0c sub $0xc,%esp 80104cf8: 50 push %eax 80104cf9: e8 72 c9 ff ff call 80101670 <ilock> if(ip->type == T_DIR){ 80104cfe: 83 c4 10 add $0x10,%esp 80104d01: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80104d06: 0f 84 c4 00 00 00 je 80104dd0 <sys_link+0x130> iunlockput(ip); end_op(); return -1; } ip->nlink++; 80104d0c: 66 83 43 56 01 addw $0x1,0x56(%ebx) iupdate(ip); 80104d11: 83 ec 0c sub $0xc,%esp iunlock(ip); if((dp = nameiparent(new, name)) == 0) 80104d14: 8d 7d da lea -0x26(%ebp),%edi end_op(); return -1; } ip->nlink++; iupdate(ip); 80104d17: 53 push %ebx 80104d18: e8 a3 c8 ff ff call 801015c0 <iupdate> iunlock(ip); 80104d1d: 89 1c 24 mov %ebx,(%esp) 80104d20: e8 2b ca ff ff call 80101750 <iunlock> if((dp = nameiparent(new, name)) == 0) 80104d25: 58 pop %eax 80104d26: 5a pop %edx 80104d27: 57 push %edi 80104d28: ff 75 d0 pushl -0x30(%ebp) 80104d2b: e8 b0 d1 ff ff call 80101ee0 <nameiparent> 80104d30: 83 c4 10 add $0x10,%esp 80104d33: 85 c0 test %eax,%eax 80104d35: 89 c6 mov %eax,%esi 80104d37: 74 5b je 80104d94 <sys_link+0xf4> goto bad; ilock(dp); 80104d39: 83 ec 0c sub $0xc,%esp 80104d3c: 50 push %eax 80104d3d: e8 2e c9 ff ff call 80101670 <ilock> if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ 80104d42: 83 c4 10 add $0x10,%esp 80104d45: 8b 03 mov (%ebx),%eax 80104d47: 39 06 cmp %eax,(%esi) 80104d49: 75 3d jne 80104d88 <sys_link+0xe8> 80104d4b: 83 ec 04 sub $0x4,%esp 80104d4e: ff 73 04 pushl 0x4(%ebx) 80104d51: 57 push %edi 80104d52: 56 push %esi 80104d53: e8 a8 d0 ff ff call 80101e00 <dirlink> 80104d58: 83 c4 10 add $0x10,%esp 80104d5b: 85 c0 test %eax,%eax 80104d5d: 78 29 js 80104d88 <sys_link+0xe8> iunlockput(dp); goto bad; } iunlockput(dp); 80104d5f: 83 ec 0c sub $0xc,%esp 80104d62: 56 push %esi 80104d63: e8 98 cb ff ff call 80101900 <iunlockput> iput(ip); 80104d68: 89 1c 24 mov %ebx,(%esp) 80104d6b: e8 30 ca ff ff call 801017a0 <iput> end_op(); 80104d70: e8 4b de ff ff call 80102bc0 <end_op> return 0; 80104d75: 83 c4 10 add $0x10,%esp 80104d78: 31 c0 xor %eax,%eax ip->nlink--; iupdate(ip); iunlockput(ip); end_op(); return -1; } 80104d7a: 8d 65 f4 lea -0xc(%ebp),%esp 80104d7d: 5b pop %ebx 80104d7e: 5e pop %esi 80104d7f: 5f pop %edi 80104d80: 5d pop %ebp 80104d81: c3 ret 80104d82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if((dp = nameiparent(new, name)) == 0) goto bad; ilock(dp); if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){ iunlockput(dp); 80104d88: 83 ec 0c sub $0xc,%esp 80104d8b: 56 push %esi 80104d8c: e8 6f cb ff ff call 80101900 <iunlockput> goto bad; 80104d91: 83 c4 10 add $0x10,%esp end_op(); return 0; bad: ilock(ip); 80104d94: 83 ec 0c sub $0xc,%esp 80104d97: 53 push %ebx 80104d98: e8 d3 c8 ff ff call 80101670 <ilock> ip->nlink--; 80104d9d: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 80104da2: 89 1c 24 mov %ebx,(%esp) 80104da5: e8 16 c8 ff ff call 801015c0 <iupdate> iunlockput(ip); 80104daa: 89 1c 24 mov %ebx,(%esp) 80104dad: e8 4e cb ff ff call 80101900 <iunlockput> end_op(); 80104db2: e8 09 de ff ff call 80102bc0 <end_op> return -1; 80104db7: 83 c4 10 add $0x10,%esp } 80104dba: 8d 65 f4 lea -0xc(%ebp),%esp ilock(ip); ip->nlink--; iupdate(ip); iunlockput(ip); end_op(); return -1; 80104dbd: b8 ff ff ff ff mov $0xffffffff,%eax } 80104dc2: 5b pop %ebx 80104dc3: 5e pop %esi 80104dc4: 5f pop %edi 80104dc5: 5d pop %ebp 80104dc6: c3 ret 80104dc7: 89 f6 mov %esi,%esi 80104dc9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi return -1; } ilock(ip); if(ip->type == T_DIR){ iunlockput(ip); 80104dd0: 83 ec 0c sub $0xc,%esp 80104dd3: 53 push %ebx 80104dd4: e8 27 cb ff ff call 80101900 <iunlockput> end_op(); 80104dd9: e8 e2 dd ff ff call 80102bc0 <end_op> return -1; 80104dde: 83 c4 10 add $0x10,%esp 80104de1: b8 ff ff ff ff mov $0xffffffff,%eax 80104de6: eb 92 jmp 80104d7a <sys_link+0xda> if(argstr(0, &old) < 0 || argstr(1, &new) < 0) return -1; begin_op(); if((ip = namei(old)) == 0){ end_op(); 80104de8: e8 d3 dd ff ff call 80102bc0 <end_op> return -1; 80104ded: b8 ff ff ff ff mov $0xffffffff,%eax 80104df2: eb 86 jmp 80104d7a <sys_link+0xda> 80104df4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80104dfa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80104e00 <sys_unlink>: } //PAGEBREAK! int sys_unlink(void) { 80104e00: 55 push %ebp 80104e01: 89 e5 mov %esp,%ebp 80104e03: 57 push %edi 80104e04: 56 push %esi 80104e05: 53 push %ebx struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 80104e06: 8d 45 c0 lea -0x40(%ebp),%eax } //PAGEBREAK! int sys_unlink(void) { 80104e09: 83 ec 54 sub $0x54,%esp struct inode *ip, *dp; struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) 80104e0c: 50 push %eax 80104e0d: 6a 00 push $0x0 80104e0f: e8 fc f9 ff ff call 80104810 <argstr> 80104e14: 83 c4 10 add $0x10,%esp 80104e17: 85 c0 test %eax,%eax 80104e19: 0f 88 82 01 00 00 js 80104fa1 <sys_unlink+0x1a1> return -1; begin_op(); if((dp = nameiparent(path, name)) == 0){ 80104e1f: 8d 5d ca lea -0x36(%ebp),%ebx uint off; if(argstr(0, &path) < 0) return -1; begin_op(); 80104e22: e8 29 dd ff ff call 80102b50 <begin_op> if((dp = nameiparent(path, name)) == 0){ 80104e27: 83 ec 08 sub $0x8,%esp 80104e2a: 53 push %ebx 80104e2b: ff 75 c0 pushl -0x40(%ebp) 80104e2e: e8 ad d0 ff ff call 80101ee0 <nameiparent> 80104e33: 83 c4 10 add $0x10,%esp 80104e36: 85 c0 test %eax,%eax 80104e38: 89 45 b4 mov %eax,-0x4c(%ebp) 80104e3b: 0f 84 6a 01 00 00 je 80104fab <sys_unlink+0x1ab> end_op(); return -1; } ilock(dp); 80104e41: 8b 75 b4 mov -0x4c(%ebp),%esi 80104e44: 83 ec 0c sub $0xc,%esp 80104e47: 56 push %esi 80104e48: e8 23 c8 ff ff call 80101670 <ilock> // Cannot unlink "." or "..". if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0) 80104e4d: 58 pop %eax 80104e4e: 5a pop %edx 80104e4f: 68 b8 76 10 80 push $0x801076b8 80104e54: 53 push %ebx 80104e55: e8 26 cd ff ff call 80101b80 <namecmp> 80104e5a: 83 c4 10 add $0x10,%esp 80104e5d: 85 c0 test %eax,%eax 80104e5f: 0f 84 fc 00 00 00 je 80104f61 <sys_unlink+0x161> 80104e65: 83 ec 08 sub $0x8,%esp 80104e68: 68 b7 76 10 80 push $0x801076b7 80104e6d: 53 push %ebx 80104e6e: e8 0d cd ff ff call 80101b80 <namecmp> 80104e73: 83 c4 10 add $0x10,%esp 80104e76: 85 c0 test %eax,%eax 80104e78: 0f 84 e3 00 00 00 je 80104f61 <sys_unlink+0x161> goto bad; if((ip = dirlookup(dp, name, &off)) == 0) 80104e7e: 8d 45 c4 lea -0x3c(%ebp),%eax 80104e81: 83 ec 04 sub $0x4,%esp 80104e84: 50 push %eax 80104e85: 53 push %ebx 80104e86: 56 push %esi 80104e87: e8 14 cd ff ff call 80101ba0 <dirlookup> 80104e8c: 83 c4 10 add $0x10,%esp 80104e8f: 85 c0 test %eax,%eax 80104e91: 89 c3 mov %eax,%ebx 80104e93: 0f 84 c8 00 00 00 je 80104f61 <sys_unlink+0x161> goto bad; ilock(ip); 80104e99: 83 ec 0c sub $0xc,%esp 80104e9c: 50 push %eax 80104e9d: e8 ce c7 ff ff call 80101670 <ilock> if(ip->nlink < 1) 80104ea2: 83 c4 10 add $0x10,%esp 80104ea5: 66 83 7b 56 00 cmpw $0x0,0x56(%ebx) 80104eaa: 0f 8e 24 01 00 00 jle 80104fd4 <sys_unlink+0x1d4> panic("unlink: nlink < 1"); if(ip->type == T_DIR && !isdirempty(ip)){ 80104eb0: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80104eb5: 8d 75 d8 lea -0x28(%ebp),%esi 80104eb8: 74 66 je 80104f20 <sys_unlink+0x120> iunlockput(ip); goto bad; } memset(&de, 0, sizeof(de)); 80104eba: 83 ec 04 sub $0x4,%esp 80104ebd: 6a 10 push $0x10 80104ebf: 6a 00 push $0x0 80104ec1: 56 push %esi 80104ec2: e8 89 f5 ff ff call 80104450 <memset> if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80104ec7: 6a 10 push $0x10 80104ec9: ff 75 c4 pushl -0x3c(%ebp) 80104ecc: 56 push %esi 80104ecd: ff 75 b4 pushl -0x4c(%ebp) 80104ed0: e8 7b cb ff ff call 80101a50 <writei> 80104ed5: 83 c4 20 add $0x20,%esp 80104ed8: 83 f8 10 cmp $0x10,%eax 80104edb: 0f 85 e6 00 00 00 jne 80104fc7 <sys_unlink+0x1c7> panic("unlink: writei"); if(ip->type == T_DIR){ 80104ee1: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 80104ee6: 0f 84 9c 00 00 00 je 80104f88 <sys_unlink+0x188> dp->nlink--; iupdate(dp); } iunlockput(dp); 80104eec: 83 ec 0c sub $0xc,%esp 80104eef: ff 75 b4 pushl -0x4c(%ebp) 80104ef2: e8 09 ca ff ff call 80101900 <iunlockput> ip->nlink--; 80104ef7: 66 83 6b 56 01 subw $0x1,0x56(%ebx) iupdate(ip); 80104efc: 89 1c 24 mov %ebx,(%esp) 80104eff: e8 bc c6 ff ff call 801015c0 <iupdate> iunlockput(ip); 80104f04: 89 1c 24 mov %ebx,(%esp) 80104f07: e8 f4 c9 ff ff call 80101900 <iunlockput> end_op(); 80104f0c: e8 af dc ff ff call 80102bc0 <end_op> return 0; 80104f11: 83 c4 10 add $0x10,%esp 80104f14: 31 c0 xor %eax,%eax bad: iunlockput(dp); end_op(); return -1; } 80104f16: 8d 65 f4 lea -0xc(%ebp),%esp 80104f19: 5b pop %ebx 80104f1a: 5e pop %esi 80104f1b: 5f pop %edi 80104f1c: 5d pop %ebp 80104f1d: c3 ret 80104f1e: 66 90 xchg %ax,%ax isdirempty(struct inode *dp) { int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ 80104f20: 83 7b 58 20 cmpl $0x20,0x58(%ebx) 80104f24: 76 94 jbe 80104eba <sys_unlink+0xba> 80104f26: bf 20 00 00 00 mov $0x20,%edi 80104f2b: eb 0f jmp 80104f3c <sys_unlink+0x13c> 80104f2d: 8d 76 00 lea 0x0(%esi),%esi 80104f30: 83 c7 10 add $0x10,%edi 80104f33: 3b 7b 58 cmp 0x58(%ebx),%edi 80104f36: 0f 83 7e ff ff ff jae 80104eba <sys_unlink+0xba> if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) 80104f3c: 6a 10 push $0x10 80104f3e: 57 push %edi 80104f3f: 56 push %esi 80104f40: 53 push %ebx 80104f41: e8 0a ca ff ff call 80101950 <readi> 80104f46: 83 c4 10 add $0x10,%esp 80104f49: 83 f8 10 cmp $0x10,%eax 80104f4c: 75 6c jne 80104fba <sys_unlink+0x1ba> panic("isdirempty: readi"); if(de.inum != 0) 80104f4e: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp) 80104f53: 74 db je 80104f30 <sys_unlink+0x130> ilock(ip); if(ip->nlink < 1) panic("unlink: nlink < 1"); if(ip->type == T_DIR && !isdirempty(ip)){ iunlockput(ip); 80104f55: 83 ec 0c sub $0xc,%esp 80104f58: 53 push %ebx 80104f59: e8 a2 c9 ff ff call 80101900 <iunlockput> goto bad; 80104f5e: 83 c4 10 add $0x10,%esp end_op(); return 0; bad: iunlockput(dp); 80104f61: 83 ec 0c sub $0xc,%esp 80104f64: ff 75 b4 pushl -0x4c(%ebp) 80104f67: e8 94 c9 ff ff call 80101900 <iunlockput> end_op(); 80104f6c: e8 4f dc ff ff call 80102bc0 <end_op> return -1; 80104f71: 83 c4 10 add $0x10,%esp } 80104f74: 8d 65 f4 lea -0xc(%ebp),%esp return 0; bad: iunlockput(dp); end_op(); return -1; 80104f77: b8 ff ff ff ff mov $0xffffffff,%eax } 80104f7c: 5b pop %ebx 80104f7d: 5e pop %esi 80104f7e: 5f pop %edi 80104f7f: 5d pop %ebp 80104f80: c3 ret 80104f81: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); if(ip->type == T_DIR){ dp->nlink--; 80104f88: 8b 45 b4 mov -0x4c(%ebp),%eax iupdate(dp); 80104f8b: 83 ec 0c sub $0xc,%esp memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); if(ip->type == T_DIR){ dp->nlink--; 80104f8e: 66 83 68 56 01 subw $0x1,0x56(%eax) iupdate(dp); 80104f93: 50 push %eax 80104f94: e8 27 c6 ff ff call 801015c0 <iupdate> 80104f99: 83 c4 10 add $0x10,%esp 80104f9c: e9 4b ff ff ff jmp 80104eec <sys_unlink+0xec> struct dirent de; char name[DIRSIZ], *path; uint off; if(argstr(0, &path) < 0) return -1; 80104fa1: b8 ff ff ff ff mov $0xffffffff,%eax 80104fa6: e9 6b ff ff ff jmp 80104f16 <sys_unlink+0x116> begin_op(); if((dp = nameiparent(path, name)) == 0){ end_op(); 80104fab: e8 10 dc ff ff call 80102bc0 <end_op> return -1; 80104fb0: b8 ff ff ff ff mov $0xffffffff,%eax 80104fb5: e9 5c ff ff ff jmp 80104f16 <sys_unlink+0x116> int off; struct dirent de; for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){ if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("isdirempty: readi"); 80104fba: 83 ec 0c sub $0xc,%esp 80104fbd: 68 dc 76 10 80 push $0x801076dc 80104fc2: e8 a9 b3 ff ff call 80100370 <panic> goto bad; } memset(&de, 0, sizeof(de)); if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de)) panic("unlink: writei"); 80104fc7: 83 ec 0c sub $0xc,%esp 80104fca: 68 ee 76 10 80 push $0x801076ee 80104fcf: e8 9c b3 ff ff call 80100370 <panic> if((ip = dirlookup(dp, name, &off)) == 0) goto bad; ilock(ip); if(ip->nlink < 1) panic("unlink: nlink < 1"); 80104fd4: 83 ec 0c sub $0xc,%esp 80104fd7: 68 ca 76 10 80 push $0x801076ca 80104fdc: e8 8f b3 ff ff call 80100370 <panic> 80104fe1: eb 0d jmp 80104ff0 <sys_open> 80104fe3: 90 nop 80104fe4: 90 nop 80104fe5: 90 nop 80104fe6: 90 nop 80104fe7: 90 nop 80104fe8: 90 nop 80104fe9: 90 nop 80104fea: 90 nop 80104feb: 90 nop 80104fec: 90 nop 80104fed: 90 nop 80104fee: 90 nop 80104fef: 90 nop 80104ff0 <sys_open>: return ip; } int sys_open(void) { 80104ff0: 55 push %ebp 80104ff1: 89 e5 mov %esp,%ebp 80104ff3: 57 push %edi 80104ff4: 56 push %esi 80104ff5: 53 push %ebx char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80104ff6: 8d 45 e0 lea -0x20(%ebp),%eax return ip; } int sys_open(void) { 80104ff9: 83 ec 24 sub $0x24,%esp char *path; int fd, omode; struct file *f; struct inode *ip; if(argstr(0, &path) < 0 || argint(1, &omode) < 0) 80104ffc: 50 push %eax 80104ffd: 6a 00 push $0x0 80104fff: e8 0c f8 ff ff call 80104810 <argstr> 80105004: 83 c4 10 add $0x10,%esp 80105007: 85 c0 test %eax,%eax 80105009: 0f 88 9e 00 00 00 js 801050ad <sys_open+0xbd> 8010500f: 8d 45 e4 lea -0x1c(%ebp),%eax 80105012: 83 ec 08 sub $0x8,%esp 80105015: 50 push %eax 80105016: 6a 01 push $0x1 80105018: e8 43 f7 ff ff call 80104760 <argint> 8010501d: 83 c4 10 add $0x10,%esp 80105020: 85 c0 test %eax,%eax 80105022: 0f 88 85 00 00 00 js 801050ad <sys_open+0xbd> return -1; begin_op(); 80105028: e8 23 db ff ff call 80102b50 <begin_op> if(omode & O_CREATE){ 8010502d: f6 45 e5 02 testb $0x2,-0x1b(%ebp) 80105031: 0f 85 89 00 00 00 jne 801050c0 <sys_open+0xd0> if(ip == 0){ end_op(); return -1; } } else { if((ip = namei(path)) == 0){ 80105037: 83 ec 0c sub $0xc,%esp 8010503a: ff 75 e0 pushl -0x20(%ebp) 8010503d: e8 7e ce ff ff call 80101ec0 <namei> 80105042: 83 c4 10 add $0x10,%esp 80105045: 85 c0 test %eax,%eax 80105047: 89 c6 mov %eax,%esi 80105049: 0f 84 8e 00 00 00 je 801050dd <sys_open+0xed> end_op(); return -1; } ilock(ip); 8010504f: 83 ec 0c sub $0xc,%esp 80105052: 50 push %eax 80105053: e8 18 c6 ff ff call 80101670 <ilock> if(ip->type == T_DIR && omode != O_RDONLY){ 80105058: 83 c4 10 add $0x10,%esp 8010505b: 66 83 7e 50 01 cmpw $0x1,0x50(%esi) 80105060: 0f 84 d2 00 00 00 je 80105138 <sys_open+0x148> end_op(); return -1; } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ 80105066: e8 05 bd ff ff call 80100d70 <filealloc> 8010506b: 85 c0 test %eax,%eax 8010506d: 89 c7 mov %eax,%edi 8010506f: 74 2b je 8010509c <sys_open+0xac> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80105071: 31 db xor %ebx,%ebx // Takes over file reference from caller on success. static int fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); 80105073: e8 08 e7 ff ff call 80103780 <myproc> 80105078: 90 nop 80105079: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ 80105080: 8b 54 98 28 mov 0x28(%eax,%ebx,4),%edx 80105084: 85 d2 test %edx,%edx 80105086: 74 68 je 801050f0 <sys_open+0x100> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80105088: 83 c3 01 add $0x1,%ebx 8010508b: 83 fb 10 cmp $0x10,%ebx 8010508e: 75 f0 jne 80105080 <sys_open+0x90> } } if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ if(f) fileclose(f); 80105090: 83 ec 0c sub $0xc,%esp 80105093: 57 push %edi 80105094: e8 97 bd ff ff call 80100e30 <fileclose> 80105099: 83 c4 10 add $0x10,%esp iunlockput(ip); 8010509c: 83 ec 0c sub $0xc,%esp 8010509f: 56 push %esi 801050a0: e8 5b c8 ff ff call 80101900 <iunlockput> end_op(); 801050a5: e8 16 db ff ff call 80102bc0 <end_op> return -1; 801050aa: 83 c4 10 add $0x10,%esp f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); f->writable = (omode & O_WRONLY) || (omode & O_RDWR); return fd; } 801050ad: 8d 65 f4 lea -0xc(%ebp),%esp if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){ if(f) fileclose(f); iunlockput(ip); end_op(); return -1; 801050b0: b8 ff ff ff ff mov $0xffffffff,%eax f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); f->writable = (omode & O_WRONLY) || (omode & O_RDWR); return fd; } 801050b5: 5b pop %ebx 801050b6: 5e pop %esi 801050b7: 5f pop %edi 801050b8: 5d pop %ebp 801050b9: c3 ret 801050ba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return -1; begin_op(); if(omode & O_CREATE){ ip = create(path, T_FILE, 0, 0); 801050c0: 83 ec 0c sub $0xc,%esp 801050c3: 8b 45 e0 mov -0x20(%ebp),%eax 801050c6: 31 c9 xor %ecx,%ecx 801050c8: 6a 00 push $0x0 801050ca: ba 02 00 00 00 mov $0x2,%edx 801050cf: e8 dc f7 ff ff call 801048b0 <create> if(ip == 0){ 801050d4: 83 c4 10 add $0x10,%esp 801050d7: 85 c0 test %eax,%eax return -1; begin_op(); if(omode & O_CREATE){ ip = create(path, T_FILE, 0, 0); 801050d9: 89 c6 mov %eax,%esi if(ip == 0){ 801050db: 75 89 jne 80105066 <sys_open+0x76> end_op(); 801050dd: e8 de da ff ff call 80102bc0 <end_op> return -1; 801050e2: b8 ff ff ff ff mov $0xffffffff,%eax 801050e7: eb 43 jmp 8010512c <sys_open+0x13c> 801050e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi fileclose(f); iunlockput(ip); end_op(); return -1; } iunlock(ip); 801050f0: 83 ec 0c sub $0xc,%esp int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; 801050f3: 89 7c 98 28 mov %edi,0x28(%eax,%ebx,4) fileclose(f); iunlockput(ip); end_op(); return -1; } iunlock(ip); 801050f7: 56 push %esi 801050f8: e8 53 c6 ff ff call 80101750 <iunlock> end_op(); 801050fd: e8 be da ff ff call 80102bc0 <end_op> f->type = FD_INODE; 80105102: c7 07 02 00 00 00 movl $0x2,(%edi) f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 80105108: 8b 55 e4 mov -0x1c(%ebp),%edx f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 8010510b: 83 c4 10 add $0x10,%esp } iunlock(ip); end_op(); f->type = FD_INODE; f->ip = ip; 8010510e: 89 77 10 mov %esi,0x10(%edi) f->off = 0; 80105111: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi) f->readable = !(omode & O_WRONLY); 80105118: 89 d0 mov %edx,%eax 8010511a: 83 e0 01 and $0x1,%eax 8010511d: 83 f0 01 xor $0x1,%eax f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80105120: 83 e2 03 and $0x3,%edx end_op(); f->type = FD_INODE; f->ip = ip; f->off = 0; f->readable = !(omode & O_WRONLY); 80105123: 88 47 08 mov %al,0x8(%edi) f->writable = (omode & O_WRONLY) || (omode & O_RDWR); 80105126: 0f 95 47 09 setne 0x9(%edi) return fd; 8010512a: 89 d8 mov %ebx,%eax } 8010512c: 8d 65 f4 lea -0xc(%ebp),%esp 8010512f: 5b pop %ebx 80105130: 5e pop %esi 80105131: 5f pop %edi 80105132: 5d pop %ebp 80105133: c3 ret 80105134: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if((ip = namei(path)) == 0){ end_op(); return -1; } ilock(ip); if(ip->type == T_DIR && omode != O_RDONLY){ 80105138: 8b 4d e4 mov -0x1c(%ebp),%ecx 8010513b: 85 c9 test %ecx,%ecx 8010513d: 0f 84 23 ff ff ff je 80105066 <sys_open+0x76> 80105143: e9 54 ff ff ff jmp 8010509c <sys_open+0xac> 80105148: 90 nop 80105149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105150 <sys_mkdir>: return fd; } int sys_mkdir(void) { 80105150: 55 push %ebp 80105151: 89 e5 mov %esp,%ebp 80105153: 83 ec 18 sub $0x18,%esp char *path; struct inode *ip; begin_op(); 80105156: e8 f5 d9 ff ff call 80102b50 <begin_op> if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ 8010515b: 8d 45 f4 lea -0xc(%ebp),%eax 8010515e: 83 ec 08 sub $0x8,%esp 80105161: 50 push %eax 80105162: 6a 00 push $0x0 80105164: e8 a7 f6 ff ff call 80104810 <argstr> 80105169: 83 c4 10 add $0x10,%esp 8010516c: 85 c0 test %eax,%eax 8010516e: 78 30 js 801051a0 <sys_mkdir+0x50> 80105170: 83 ec 0c sub $0xc,%esp 80105173: 8b 45 f4 mov -0xc(%ebp),%eax 80105176: 31 c9 xor %ecx,%ecx 80105178: 6a 00 push $0x0 8010517a: ba 01 00 00 00 mov $0x1,%edx 8010517f: e8 2c f7 ff ff call 801048b0 <create> 80105184: 83 c4 10 add $0x10,%esp 80105187: 85 c0 test %eax,%eax 80105189: 74 15 je 801051a0 <sys_mkdir+0x50> end_op(); return -1; } iunlockput(ip); 8010518b: 83 ec 0c sub $0xc,%esp 8010518e: 50 push %eax 8010518f: e8 6c c7 ff ff call 80101900 <iunlockput> end_op(); 80105194: e8 27 da ff ff call 80102bc0 <end_op> return 0; 80105199: 83 c4 10 add $0x10,%esp 8010519c: 31 c0 xor %eax,%eax } 8010519e: c9 leave 8010519f: c3 ret char *path; struct inode *ip; begin_op(); if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){ end_op(); 801051a0: e8 1b da ff ff call 80102bc0 <end_op> return -1; 801051a5: b8 ff ff ff ff mov $0xffffffff,%eax } iunlockput(ip); end_op(); return 0; } 801051aa: c9 leave 801051ab: c3 ret 801051ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801051b0 <sys_mknod>: int sys_mknod(void) { 801051b0: 55 push %ebp 801051b1: 89 e5 mov %esp,%ebp 801051b3: 83 ec 18 sub $0x18,%esp struct inode *ip; char *path; int major, minor; begin_op(); 801051b6: e8 95 d9 ff ff call 80102b50 <begin_op> if((argstr(0, &path)) < 0 || 801051bb: 8d 45 ec lea -0x14(%ebp),%eax 801051be: 83 ec 08 sub $0x8,%esp 801051c1: 50 push %eax 801051c2: 6a 00 push $0x0 801051c4: e8 47 f6 ff ff call 80104810 <argstr> 801051c9: 83 c4 10 add $0x10,%esp 801051cc: 85 c0 test %eax,%eax 801051ce: 78 60 js 80105230 <sys_mknod+0x80> argint(1, &major) < 0 || 801051d0: 8d 45 f0 lea -0x10(%ebp),%eax 801051d3: 83 ec 08 sub $0x8,%esp 801051d6: 50 push %eax 801051d7: 6a 01 push $0x1 801051d9: e8 82 f5 ff ff call 80104760 <argint> struct inode *ip; char *path; int major, minor; begin_op(); if((argstr(0, &path)) < 0 || 801051de: 83 c4 10 add $0x10,%esp 801051e1: 85 c0 test %eax,%eax 801051e3: 78 4b js 80105230 <sys_mknod+0x80> argint(1, &major) < 0 || argint(2, &minor) < 0 || 801051e5: 8d 45 f4 lea -0xc(%ebp),%eax 801051e8: 83 ec 08 sub $0x8,%esp 801051eb: 50 push %eax 801051ec: 6a 02 push $0x2 801051ee: e8 6d f5 ff ff call 80104760 <argint> char *path; int major, minor; begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || 801051f3: 83 c4 10 add $0x10,%esp 801051f6: 85 c0 test %eax,%eax 801051f8: 78 36 js 80105230 <sys_mknod+0x80> argint(2, &minor) < 0 || 801051fa: 0f bf 45 f4 movswl -0xc(%ebp),%eax 801051fe: 83 ec 0c sub $0xc,%esp 80105201: 0f bf 4d f0 movswl -0x10(%ebp),%ecx 80105205: ba 03 00 00 00 mov $0x3,%edx 8010520a: 50 push %eax 8010520b: 8b 45 ec mov -0x14(%ebp),%eax 8010520e: e8 9d f6 ff ff call 801048b0 <create> 80105213: 83 c4 10 add $0x10,%esp 80105216: 85 c0 test %eax,%eax 80105218: 74 16 je 80105230 <sys_mknod+0x80> (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); return -1; } iunlockput(ip); 8010521a: 83 ec 0c sub $0xc,%esp 8010521d: 50 push %eax 8010521e: e8 dd c6 ff ff call 80101900 <iunlockput> end_op(); 80105223: e8 98 d9 ff ff call 80102bc0 <end_op> return 0; 80105228: 83 c4 10 add $0x10,%esp 8010522b: 31 c0 xor %eax,%eax } 8010522d: c9 leave 8010522e: c3 ret 8010522f: 90 nop begin_op(); if((argstr(0, &path)) < 0 || argint(1, &major) < 0 || argint(2, &minor) < 0 || (ip = create(path, T_DEV, major, minor)) == 0){ end_op(); 80105230: e8 8b d9 ff ff call 80102bc0 <end_op> return -1; 80105235: b8 ff ff ff ff mov $0xffffffff,%eax } iunlockput(ip); end_op(); return 0; } 8010523a: c9 leave 8010523b: c3 ret 8010523c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105240 <sys_chdir>: int sys_chdir(void) { 80105240: 55 push %ebp 80105241: 89 e5 mov %esp,%ebp 80105243: 56 push %esi 80105244: 53 push %ebx 80105245: 83 ec 10 sub $0x10,%esp char *path; struct inode *ip; struct proc *curproc = myproc(); 80105248: e8 33 e5 ff ff call 80103780 <myproc> 8010524d: 89 c6 mov %eax,%esi begin_op(); 8010524f: e8 fc d8 ff ff call 80102b50 <begin_op> if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ 80105254: 8d 45 f4 lea -0xc(%ebp),%eax 80105257: 83 ec 08 sub $0x8,%esp 8010525a: 50 push %eax 8010525b: 6a 00 push $0x0 8010525d: e8 ae f5 ff ff call 80104810 <argstr> 80105262: 83 c4 10 add $0x10,%esp 80105265: 85 c0 test %eax,%eax 80105267: 78 77 js 801052e0 <sys_chdir+0xa0> 80105269: 83 ec 0c sub $0xc,%esp 8010526c: ff 75 f4 pushl -0xc(%ebp) 8010526f: e8 4c cc ff ff call 80101ec0 <namei> 80105274: 83 c4 10 add $0x10,%esp 80105277: 85 c0 test %eax,%eax 80105279: 89 c3 mov %eax,%ebx 8010527b: 74 63 je 801052e0 <sys_chdir+0xa0> end_op(); return -1; } ilock(ip); 8010527d: 83 ec 0c sub $0xc,%esp 80105280: 50 push %eax 80105281: e8 ea c3 ff ff call 80101670 <ilock> if(ip->type != T_DIR){ 80105286: 83 c4 10 add $0x10,%esp 80105289: 66 83 7b 50 01 cmpw $0x1,0x50(%ebx) 8010528e: 75 30 jne 801052c0 <sys_chdir+0x80> iunlockput(ip); end_op(); return -1; } iunlock(ip); 80105290: 83 ec 0c sub $0xc,%esp 80105293: 53 push %ebx 80105294: e8 b7 c4 ff ff call 80101750 <iunlock> iput(curproc->cwd); 80105299: 58 pop %eax 8010529a: ff 76 68 pushl 0x68(%esi) 8010529d: e8 fe c4 ff ff call 801017a0 <iput> end_op(); 801052a2: e8 19 d9 ff ff call 80102bc0 <end_op> curproc->cwd = ip; 801052a7: 89 5e 68 mov %ebx,0x68(%esi) return 0; 801052aa: 83 c4 10 add $0x10,%esp 801052ad: 31 c0 xor %eax,%eax } 801052af: 8d 65 f8 lea -0x8(%ebp),%esp 801052b2: 5b pop %ebx 801052b3: 5e pop %esi 801052b4: 5d pop %ebp 801052b5: c3 ret 801052b6: 8d 76 00 lea 0x0(%esi),%esi 801052b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi end_op(); return -1; } ilock(ip); if(ip->type != T_DIR){ iunlockput(ip); 801052c0: 83 ec 0c sub $0xc,%esp 801052c3: 53 push %ebx 801052c4: e8 37 c6 ff ff call 80101900 <iunlockput> end_op(); 801052c9: e8 f2 d8 ff ff call 80102bc0 <end_op> return -1; 801052ce: 83 c4 10 add $0x10,%esp 801052d1: b8 ff ff ff ff mov $0xffffffff,%eax 801052d6: eb d7 jmp 801052af <sys_chdir+0x6f> 801052d8: 90 nop 801052d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi struct inode *ip; struct proc *curproc = myproc(); begin_op(); if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){ end_op(); 801052e0: e8 db d8 ff ff call 80102bc0 <end_op> return -1; 801052e5: b8 ff ff ff ff mov $0xffffffff,%eax 801052ea: eb c3 jmp 801052af <sys_chdir+0x6f> 801052ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801052f0 <sys_exec>: return 0; } int sys_exec(void) { 801052f0: 55 push %ebp 801052f1: 89 e5 mov %esp,%ebp 801052f3: 57 push %edi 801052f4: 56 push %esi 801052f5: 53 push %ebx char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 801052f6: 8d 85 5c ff ff ff lea -0xa4(%ebp),%eax return 0; } int sys_exec(void) { 801052fc: 81 ec a4 00 00 00 sub $0xa4,%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ 80105302: 50 push %eax 80105303: 6a 00 push $0x0 80105305: e8 06 f5 ff ff call 80104810 <argstr> 8010530a: 83 c4 10 add $0x10,%esp 8010530d: 85 c0 test %eax,%eax 8010530f: 78 7f js 80105390 <sys_exec+0xa0> 80105311: 8d 85 60 ff ff ff lea -0xa0(%ebp),%eax 80105317: 83 ec 08 sub $0x8,%esp 8010531a: 50 push %eax 8010531b: 6a 01 push $0x1 8010531d: e8 3e f4 ff ff call 80104760 <argint> 80105322: 83 c4 10 add $0x10,%esp 80105325: 85 c0 test %eax,%eax 80105327: 78 67 js 80105390 <sys_exec+0xa0> return -1; } memset(argv, 0, sizeof(argv)); 80105329: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax 8010532f: 83 ec 04 sub $0x4,%esp 80105332: 8d b5 68 ff ff ff lea -0x98(%ebp),%esi 80105338: 68 80 00 00 00 push $0x80 8010533d: 6a 00 push $0x0 8010533f: 8d bd 64 ff ff ff lea -0x9c(%ebp),%edi 80105345: 50 push %eax 80105346: 31 db xor %ebx,%ebx 80105348: e8 03 f1 ff ff call 80104450 <memset> 8010534d: 83 c4 10 add $0x10,%esp for(i=0;; i++){ if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) 80105350: 8b 85 60 ff ff ff mov -0xa0(%ebp),%eax 80105356: 83 ec 08 sub $0x8,%esp 80105359: 57 push %edi 8010535a: 8d 04 98 lea (%eax,%ebx,4),%eax 8010535d: 50 push %eax 8010535e: e8 5d f3 ff ff call 801046c0 <fetchint> 80105363: 83 c4 10 add $0x10,%esp 80105366: 85 c0 test %eax,%eax 80105368: 78 26 js 80105390 <sys_exec+0xa0> return -1; if(uarg == 0){ 8010536a: 8b 85 64 ff ff ff mov -0x9c(%ebp),%eax 80105370: 85 c0 test %eax,%eax 80105372: 74 2c je 801053a0 <sys_exec+0xb0> argv[i] = 0; break; } if(fetchstr(uarg, &argv[i]) < 0) 80105374: 83 ec 08 sub $0x8,%esp 80105377: 56 push %esi 80105378: 50 push %eax 80105379: e8 82 f3 ff ff call 80104700 <fetchstr> 8010537e: 83 c4 10 add $0x10,%esp 80105381: 85 c0 test %eax,%eax 80105383: 78 0b js 80105390 <sys_exec+0xa0> if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; } memset(argv, 0, sizeof(argv)); for(i=0;; i++){ 80105385: 83 c3 01 add $0x1,%ebx 80105388: 83 c6 04 add $0x4,%esi if(i >= NELEM(argv)) 8010538b: 83 fb 20 cmp $0x20,%ebx 8010538e: 75 c0 jne 80105350 <sys_exec+0x60> } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); } 80105390: 8d 65 f4 lea -0xc(%ebp),%esp char *path, *argv[MAXARG]; int i; uint uargv, uarg; if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){ return -1; 80105393: b8 ff ff ff ff mov $0xffffffff,%eax } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); } 80105398: 5b pop %ebx 80105399: 5e pop %esi 8010539a: 5f pop %edi 8010539b: 5d pop %ebp 8010539c: c3 ret 8010539d: 8d 76 00 lea 0x0(%esi),%esi break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 801053a0: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax 801053a6: 83 ec 08 sub $0x8,%esp if(i >= NELEM(argv)) return -1; if(fetchint(uargv+4*i, (int*)&uarg) < 0) return -1; if(uarg == 0){ argv[i] = 0; 801053a9: c7 84 9d 68 ff ff ff movl $0x0,-0x98(%ebp,%ebx,4) 801053b0: 00 00 00 00 break; } if(fetchstr(uarg, &argv[i]) < 0) return -1; } return exec(path, argv); 801053b4: 50 push %eax 801053b5: ff b5 5c ff ff ff pushl -0xa4(%ebp) 801053bb: e8 30 b6 ff ff call 801009f0 <exec> 801053c0: 83 c4 10 add $0x10,%esp } 801053c3: 8d 65 f4 lea -0xc(%ebp),%esp 801053c6: 5b pop %ebx 801053c7: 5e pop %esi 801053c8: 5f pop %edi 801053c9: 5d pop %ebp 801053ca: c3 ret 801053cb: 90 nop 801053cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 801053d0 <sys_pipe>: int sys_pipe(void) { 801053d0: 55 push %ebp 801053d1: 89 e5 mov %esp,%ebp 801053d3: 57 push %edi 801053d4: 56 push %esi 801053d5: 53 push %ebx int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 801053d6: 8d 45 dc lea -0x24(%ebp),%eax return exec(path, argv); } int sys_pipe(void) { 801053d9: 83 ec 20 sub $0x20,%esp int *fd; struct file *rf, *wf; int fd0, fd1; if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) 801053dc: 6a 08 push $0x8 801053de: 50 push %eax 801053df: 6a 00 push $0x0 801053e1: e8 ca f3 ff ff call 801047b0 <argptr> 801053e6: 83 c4 10 add $0x10,%esp 801053e9: 85 c0 test %eax,%eax 801053eb: 78 4a js 80105437 <sys_pipe+0x67> return -1; if(pipealloc(&rf, &wf) < 0) 801053ed: 8d 45 e4 lea -0x1c(%ebp),%eax 801053f0: 83 ec 08 sub $0x8,%esp 801053f3: 50 push %eax 801053f4: 8d 45 e0 lea -0x20(%ebp),%eax 801053f7: 50 push %eax 801053f8: e8 f3 dd ff ff call 801031f0 <pipealloc> 801053fd: 83 c4 10 add $0x10,%esp 80105400: 85 c0 test %eax,%eax 80105402: 78 33 js 80105437 <sys_pipe+0x67> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80105404: 31 db xor %ebx,%ebx if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) return -1; if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 80105406: 8b 7d e0 mov -0x20(%ebp),%edi // Takes over file reference from caller on success. static int fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); 80105409: e8 72 e3 ff ff call 80103780 <myproc> 8010540e: 66 90 xchg %ax,%ax for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ 80105410: 8b 74 98 28 mov 0x28(%eax,%ebx,4),%esi 80105414: 85 f6 test %esi,%esi 80105416: 74 30 je 80105448 <sys_pipe+0x78> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80105418: 83 c3 01 add $0x1,%ebx 8010541b: 83 fb 10 cmp $0x10,%ebx 8010541e: 75 f0 jne 80105410 <sys_pipe+0x40> return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if(fd0 >= 0) myproc()->ofile[fd0] = 0; fileclose(rf); 80105420: 83 ec 0c sub $0xc,%esp 80105423: ff 75 e0 pushl -0x20(%ebp) 80105426: e8 05 ba ff ff call 80100e30 <fileclose> fileclose(wf); 8010542b: 58 pop %eax 8010542c: ff 75 e4 pushl -0x1c(%ebp) 8010542f: e8 fc b9 ff ff call 80100e30 <fileclose> return -1; 80105434: 83 c4 10 add $0x10,%esp } fd[0] = fd0; fd[1] = fd1; return 0; } 80105437: 8d 65 f4 lea -0xc(%ebp),%esp if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if(fd0 >= 0) myproc()->ofile[fd0] = 0; fileclose(rf); fileclose(wf); return -1; 8010543a: b8 ff ff ff ff mov $0xffffffff,%eax } fd[0] = fd0; fd[1] = fd1; return 0; } 8010543f: 5b pop %ebx 80105440: 5e pop %esi 80105441: 5f pop %edi 80105442: 5d pop %ebp 80105443: c3 ret 80105444: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; 80105448: 8d 73 08 lea 0x8(%ebx),%esi 8010544b: 89 7c b0 08 mov %edi,0x8(%eax,%esi,4) if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0) return -1; if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ 8010544f: 8b 7d e4 mov -0x1c(%ebp),%edi // Takes over file reference from caller on success. static int fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); 80105452: e8 29 e3 ff ff call 80103780 <myproc> for(fd = 0; fd < NOFILE; fd++){ 80105457: 31 d2 xor %edx,%edx 80105459: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi if(curproc->ofile[fd] == 0){ 80105460: 8b 4c 90 28 mov 0x28(%eax,%edx,4),%ecx 80105464: 85 c9 test %ecx,%ecx 80105466: 74 18 je 80105480 <sys_pipe+0xb0> fdalloc(struct file *f) { int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ 80105468: 83 c2 01 add $0x1,%edx 8010546b: 83 fa 10 cmp $0x10,%edx 8010546e: 75 f0 jne 80105460 <sys_pipe+0x90> if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){ if(fd0 >= 0) myproc()->ofile[fd0] = 0; 80105470: e8 0b e3 ff ff call 80103780 <myproc> 80105475: c7 44 b0 08 00 00 00 movl $0x0,0x8(%eax,%esi,4) 8010547c: 00 8010547d: eb a1 jmp 80105420 <sys_pipe+0x50> 8010547f: 90 nop int fd; struct proc *curproc = myproc(); for(fd = 0; fd < NOFILE; fd++){ if(curproc->ofile[fd] == 0){ curproc->ofile[fd] = f; 80105480: 89 7c 90 28 mov %edi,0x28(%eax,%edx,4) myproc()->ofile[fd0] = 0; fileclose(rf); fileclose(wf); return -1; } fd[0] = fd0; 80105484: 8b 45 dc mov -0x24(%ebp),%eax 80105487: 89 18 mov %ebx,(%eax) fd[1] = fd1; 80105489: 8b 45 dc mov -0x24(%ebp),%eax 8010548c: 89 50 04 mov %edx,0x4(%eax) return 0; } 8010548f: 8d 65 f4 lea -0xc(%ebp),%esp fileclose(wf); return -1; } fd[0] = fd0; fd[1] = fd1; return 0; 80105492: 31 c0 xor %eax,%eax } 80105494: 5b pop %ebx 80105495: 5e pop %esi 80105496: 5f pop %edi 80105497: 5d pop %ebp 80105498: c3 ret 80105499: 66 90 xchg %ax,%ax 8010549b: 66 90 xchg %ax,%ax 8010549d: 66 90 xchg %ax,%ax 8010549f: 90 nop 801054a0 <sys_fork>: #include "mmu.h" #include "proc.h" int sys_fork(void) { 801054a0: 55 push %ebp 801054a1: 89 e5 mov %esp,%ebp return fork(); } 801054a3: 5d pop %ebp #include "proc.h" int sys_fork(void) { return fork(); 801054a4: e9 77 e4 ff ff jmp 80103920 <fork> 801054a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801054b0 <sys_exit>: } int sys_exit(void) { 801054b0: 55 push %ebp 801054b1: 89 e5 mov %esp,%ebp 801054b3: 83 ec 08 sub $0x8,%esp exit(); 801054b6: e8 f5 e6 ff ff call 80103bb0 <exit> return 0; // not reached } 801054bb: 31 c0 xor %eax,%eax 801054bd: c9 leave 801054be: c3 ret 801054bf: 90 nop 801054c0 <sys_wait>: int sys_wait(void) { 801054c0: 55 push %ebp 801054c1: 89 e5 mov %esp,%ebp return wait(); } 801054c3: 5d pop %ebp } int sys_wait(void) { return wait(); 801054c4: e9 27 e9 ff ff jmp 80103df0 <wait> 801054c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 801054d0 <sys_kill>: } int sys_kill(void) { 801054d0: 55 push %ebp 801054d1: 89 e5 mov %esp,%ebp 801054d3: 83 ec 20 sub $0x20,%esp int pid; if(argint(0, &pid) < 0) 801054d6: 8d 45 f4 lea -0xc(%ebp),%eax 801054d9: 50 push %eax 801054da: 6a 00 push $0x0 801054dc: e8 7f f2 ff ff call 80104760 <argint> 801054e1: 83 c4 10 add $0x10,%esp 801054e4: 85 c0 test %eax,%eax 801054e6: 78 18 js 80105500 <sys_kill+0x30> return -1; return kill(pid); 801054e8: 83 ec 0c sub $0xc,%esp 801054eb: ff 75 f4 pushl -0xc(%ebp) 801054ee: e8 4d ea ff ff call 80103f40 <kill> 801054f3: 83 c4 10 add $0x10,%esp } 801054f6: c9 leave 801054f7: c3 ret 801054f8: 90 nop 801054f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi sys_kill(void) { int pid; if(argint(0, &pid) < 0) return -1; 80105500: b8 ff ff ff ff mov $0xffffffff,%eax return kill(pid); } 80105505: c9 leave 80105506: c3 ret 80105507: 89 f6 mov %esi,%esi 80105509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105510 <sys_getpid>: int sys_getpid(void) { 80105510: 55 push %ebp 80105511: 89 e5 mov %esp,%ebp 80105513: 83 ec 08 sub $0x8,%esp return myproc()->pid; 80105516: e8 65 e2 ff ff call 80103780 <myproc> 8010551b: 8b 40 10 mov 0x10(%eax),%eax } 8010551e: c9 leave 8010551f: c3 ret 80105520 <sys_sbrk>: int sys_sbrk(void) { 80105520: 55 push %ebp 80105521: 89 e5 mov %esp,%ebp 80105523: 53 push %ebx int addr; int n; if(argint(0, &n) < 0) 80105524: 8d 45 f4 lea -0xc(%ebp),%eax return myproc()->pid; } int sys_sbrk(void) { 80105527: 83 ec 1c sub $0x1c,%esp int addr; int n; if(argint(0, &n) < 0) 8010552a: 50 push %eax 8010552b: 6a 00 push $0x0 8010552d: e8 2e f2 ff ff call 80104760 <argint> 80105532: 83 c4 10 add $0x10,%esp 80105535: 85 c0 test %eax,%eax 80105537: 78 27 js 80105560 <sys_sbrk+0x40> return -1; addr = myproc()->sz; 80105539: e8 42 e2 ff ff call 80103780 <myproc> if(growproc(n) < 0) 8010553e: 83 ec 0c sub $0xc,%esp int addr; int n; if(argint(0, &n) < 0) return -1; addr = myproc()->sz; 80105541: 8b 18 mov (%eax),%ebx if(growproc(n) < 0) 80105543: ff 75 f4 pushl -0xc(%ebp) 80105546: e8 55 e3 ff ff call 801038a0 <growproc> 8010554b: 83 c4 10 add $0x10,%esp 8010554e: 85 c0 test %eax,%eax 80105550: 78 0e js 80105560 <sys_sbrk+0x40> return -1; return addr; 80105552: 89 d8 mov %ebx,%eax } 80105554: 8b 5d fc mov -0x4(%ebp),%ebx 80105557: c9 leave 80105558: c3 ret 80105559: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi { int addr; int n; if(argint(0, &n) < 0) return -1; 80105560: b8 ff ff ff ff mov $0xffffffff,%eax 80105565: eb ed jmp 80105554 <sys_sbrk+0x34> 80105567: 89 f6 mov %esi,%esi 80105569: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105570 <sys_sleep>: return addr; } int sys_sleep(void) { 80105570: 55 push %ebp 80105571: 89 e5 mov %esp,%ebp 80105573: 53 push %ebx int n; uint ticks0; if(argint(0, &n) < 0) 80105574: 8d 45 f4 lea -0xc(%ebp),%eax return addr; } int sys_sleep(void) { 80105577: 83 ec 1c sub $0x1c,%esp int n; uint ticks0; if(argint(0, &n) < 0) 8010557a: 50 push %eax 8010557b: 6a 00 push $0x0 8010557d: e8 de f1 ff ff call 80104760 <argint> 80105582: 83 c4 10 add $0x10,%esp 80105585: 85 c0 test %eax,%eax 80105587: 0f 88 8a 00 00 00 js 80105617 <sys_sleep+0xa7> return -1; acquire(&tickslock); 8010558d: 83 ec 0c sub $0xc,%esp 80105590: 68 60 4c 11 80 push $0x80114c60 80105595: e8 b6 ed ff ff call 80104350 <acquire> ticks0 = ticks; while(ticks - ticks0 < n){ 8010559a: 8b 55 f4 mov -0xc(%ebp),%edx 8010559d: 83 c4 10 add $0x10,%esp uint ticks0; if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; 801055a0: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx while(ticks - ticks0 < n){ 801055a6: 85 d2 test %edx,%edx 801055a8: 75 27 jne 801055d1 <sys_sleep+0x61> 801055aa: eb 54 jmp 80105600 <sys_sleep+0x90> 801055ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(myproc()->killed){ release(&tickslock); return -1; } sleep(&ticks, &tickslock); 801055b0: 83 ec 08 sub $0x8,%esp 801055b3: 68 60 4c 11 80 push $0x80114c60 801055b8: 68 a0 54 11 80 push $0x801154a0 801055bd: e8 6e e7 ff ff call 80103d30 <sleep> if(argint(0, &n) < 0) return -1; acquire(&tickslock); ticks0 = ticks; while(ticks - ticks0 < n){ 801055c2: a1 a0 54 11 80 mov 0x801154a0,%eax 801055c7: 83 c4 10 add $0x10,%esp 801055ca: 29 d8 sub %ebx,%eax 801055cc: 3b 45 f4 cmp -0xc(%ebp),%eax 801055cf: 73 2f jae 80105600 <sys_sleep+0x90> if(myproc()->killed){ 801055d1: e8 aa e1 ff ff call 80103780 <myproc> 801055d6: 8b 40 24 mov 0x24(%eax),%eax 801055d9: 85 c0 test %eax,%eax 801055db: 74 d3 je 801055b0 <sys_sleep+0x40> release(&tickslock); 801055dd: 83 ec 0c sub $0xc,%esp 801055e0: 68 60 4c 11 80 push $0x80114c60 801055e5: e8 16 ee ff ff call 80104400 <release> return -1; 801055ea: 83 c4 10 add $0x10,%esp 801055ed: b8 ff ff ff ff mov $0xffffffff,%eax } sleep(&ticks, &tickslock); } release(&tickslock); return 0; } 801055f2: 8b 5d fc mov -0x4(%ebp),%ebx 801055f5: c9 leave 801055f6: c3 ret 801055f7: 89 f6 mov %esi,%esi 801055f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi release(&tickslock); return -1; } sleep(&ticks, &tickslock); } release(&tickslock); 80105600: 83 ec 0c sub $0xc,%esp 80105603: 68 60 4c 11 80 push $0x80114c60 80105608: e8 f3 ed ff ff call 80104400 <release> return 0; 8010560d: 83 c4 10 add $0x10,%esp 80105610: 31 c0 xor %eax,%eax } 80105612: 8b 5d fc mov -0x4(%ebp),%ebx 80105615: c9 leave 80105616: c3 ret { int n; uint ticks0; if(argint(0, &n) < 0) return -1; 80105617: b8 ff ff ff ff mov $0xffffffff,%eax 8010561c: eb d4 jmp 801055f2 <sys_sleep+0x82> 8010561e: 66 90 xchg %ax,%ax 80105620 <sys_uptime>: // return how many clock tick interrupts have occurred // since start. int sys_uptime(void) { 80105620: 55 push %ebp 80105621: 89 e5 mov %esp,%ebp 80105623: 53 push %ebx 80105624: 83 ec 10 sub $0x10,%esp uint xticks; acquire(&tickslock); 80105627: 68 60 4c 11 80 push $0x80114c60 8010562c: e8 1f ed ff ff call 80104350 <acquire> xticks = ticks; 80105631: 8b 1d a0 54 11 80 mov 0x801154a0,%ebx release(&tickslock); 80105637: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 8010563e: e8 bd ed ff ff call 80104400 <release> return xticks; } 80105643: 89 d8 mov %ebx,%eax 80105645: 8b 5d fc mov -0x4(%ebp),%ebx 80105648: c9 leave 80105649: c3 ret 8010564a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80105650 <sys_abdur_rouf>: int sys_abdur_rouf(void) { 80105650: 55 push %ebp 80105651: 89 e5 mov %esp,%ebp 80105653: 83 ec 08 sub $0x8,%esp abdur_rouf(); 80105656: e8 35 ea ff ff call 80104090 <abdur_rouf> return 1505097; } 8010565b: b8 49 f7 16 00 mov $0x16f749,%eax 80105660: c9 leave 80105661: c3 ret 80105662 <alltraps>: # vectors.S sends all traps here. .globl alltraps alltraps: # Build trap frame. pushl %ds 80105662: 1e push %ds pushl %es 80105663: 06 push %es pushl %fs 80105664: 0f a0 push %fs pushl %gs 80105666: 0f a8 push %gs pushal 80105668: 60 pusha # Set up data segments. movw $(SEG_KDATA<<3), %ax 80105669: 66 b8 10 00 mov $0x10,%ax movw %ax, %ds 8010566d: 8e d8 mov %eax,%ds movw %ax, %es 8010566f: 8e c0 mov %eax,%es # Call trap(tf), where tf=%esp pushl %esp 80105671: 54 push %esp call trap 80105672: e8 e9 00 00 00 call 80105760 <trap> addl $4, %esp 80105677: 83 c4 04 add $0x4,%esp 8010567a <trapret>: # Return falls through to trapret... .globl trapret trapret: popal 8010567a: 61 popa popl %gs 8010567b: 0f a9 pop %gs popl %fs 8010567d: 0f a1 pop %fs popl %es 8010567f: 07 pop %es popl %ds 80105680: 1f pop %ds addl $0x8, %esp # trapno and errcode 80105681: 83 c4 08 add $0x8,%esp iret 80105684: cf iret 80105685: 66 90 xchg %ax,%ax 80105687: 66 90 xchg %ax,%ax 80105689: 66 90 xchg %ax,%ax 8010568b: 66 90 xchg %ax,%ax 8010568d: 66 90 xchg %ax,%ax 8010568f: 90 nop 80105690 <tvinit>: void tvinit(void) { int i; for(i = 0; i < 256; i++) 80105690: 31 c0 xor %eax,%eax 80105692: 8d b6 00 00 00 00 lea 0x0(%esi),%esi SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); 80105698: 8b 14 85 08 a0 10 80 mov -0x7fef5ff8(,%eax,4),%edx 8010569f: b9 08 00 00 00 mov $0x8,%ecx 801056a4: c6 04 c5 a4 4c 11 80 movb $0x0,-0x7feeb35c(,%eax,8) 801056ab: 00 801056ac: 66 89 0c c5 a2 4c 11 mov %cx,-0x7feeb35e(,%eax,8) 801056b3: 80 801056b4: c6 04 c5 a5 4c 11 80 movb $0x8e,-0x7feeb35b(,%eax,8) 801056bb: 8e 801056bc: 66 89 14 c5 a0 4c 11 mov %dx,-0x7feeb360(,%eax,8) 801056c3: 80 801056c4: c1 ea 10 shr $0x10,%edx 801056c7: 66 89 14 c5 a6 4c 11 mov %dx,-0x7feeb35a(,%eax,8) 801056ce: 80 void tvinit(void) { int i; for(i = 0; i < 256; i++) 801056cf: 83 c0 01 add $0x1,%eax 801056d2: 3d 00 01 00 00 cmp $0x100,%eax 801056d7: 75 bf jne 80105698 <tvinit+0x8> struct spinlock tickslock; uint ticks; void tvinit(void) { 801056d9: 55 push %ebp int i; for(i = 0; i < 256; i++) SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 801056da: ba 08 00 00 00 mov $0x8,%edx struct spinlock tickslock; uint ticks; void tvinit(void) { 801056df: 89 e5 mov %esp,%ebp 801056e1: 83 ec 10 sub $0x10,%esp int i; for(i = 0; i < 256; i++) SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 801056e4: a1 08 a1 10 80 mov 0x8010a108,%eax initlock(&tickslock, "time"); 801056e9: 68 fd 76 10 80 push $0x801076fd 801056ee: 68 60 4c 11 80 push $0x80114c60 { int i; for(i = 0; i < 256; i++) SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0); SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER); 801056f3: 66 89 15 a2 4e 11 80 mov %dx,0x80114ea2 801056fa: c6 05 a4 4e 11 80 00 movb $0x0,0x80114ea4 80105701: 66 a3 a0 4e 11 80 mov %ax,0x80114ea0 80105707: c1 e8 10 shr $0x10,%eax 8010570a: c6 05 a5 4e 11 80 ef movb $0xef,0x80114ea5 80105711: 66 a3 a6 4e 11 80 mov %ax,0x80114ea6 initlock(&tickslock, "time"); 80105717: e8 d4 ea ff ff call 801041f0 <initlock> } 8010571c: 83 c4 10 add $0x10,%esp 8010571f: c9 leave 80105720: c3 ret 80105721: eb 0d jmp 80105730 <idtinit> 80105723: 90 nop 80105724: 90 nop 80105725: 90 nop 80105726: 90 nop 80105727: 90 nop 80105728: 90 nop 80105729: 90 nop 8010572a: 90 nop 8010572b: 90 nop 8010572c: 90 nop 8010572d: 90 nop 8010572e: 90 nop 8010572f: 90 nop 80105730 <idtinit>: void idtinit(void) { 80105730: 55 push %ebp static inline void lidt(struct gatedesc *p, int size) { volatile ushort pd[3]; pd[0] = size-1; 80105731: b8 ff 07 00 00 mov $0x7ff,%eax 80105736: 89 e5 mov %esp,%ebp 80105738: 83 ec 10 sub $0x10,%esp 8010573b: 66 89 45 fa mov %ax,-0x6(%ebp) pd[1] = (uint)p; 8010573f: b8 a0 4c 11 80 mov $0x80114ca0,%eax 80105744: 66 89 45 fc mov %ax,-0x4(%ebp) pd[2] = (uint)p >> 16; 80105748: c1 e8 10 shr $0x10,%eax 8010574b: 66 89 45 fe mov %ax,-0x2(%ebp) asm volatile("lidt (%0)" : : "r" (pd)); 8010574f: 8d 45 fa lea -0x6(%ebp),%eax 80105752: 0f 01 18 lidtl (%eax) lidt(idt, sizeof(idt)); } 80105755: c9 leave 80105756: c3 ret 80105757: 89 f6 mov %esi,%esi 80105759: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105760 <trap>: //PAGEBREAK: 41 void trap(struct trapframe *tf) { 80105760: 55 push %ebp 80105761: 89 e5 mov %esp,%ebp 80105763: 57 push %edi 80105764: 56 push %esi 80105765: 53 push %ebx 80105766: 83 ec 1c sub $0x1c,%esp 80105769: 8b 7d 08 mov 0x8(%ebp),%edi if(tf->trapno == T_SYSCALL){ 8010576c: 8b 47 30 mov 0x30(%edi),%eax 8010576f: 83 f8 40 cmp $0x40,%eax 80105772: 0f 84 88 01 00 00 je 80105900 <trap+0x1a0> if(myproc()->killed) exit(); return; } switch(tf->trapno){ 80105778: 83 e8 20 sub $0x20,%eax 8010577b: 83 f8 1f cmp $0x1f,%eax 8010577e: 77 10 ja 80105790 <trap+0x30> 80105780: ff 24 85 a4 77 10 80 jmp *-0x7fef885c(,%eax,4) 80105787: 89 f6 mov %esi,%esi 80105789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi lapiceoi(); break; //PAGEBREAK: 13 default: if(myproc() == 0 || (tf->cs&3) == 0){ 80105790: e8 eb df ff ff call 80103780 <myproc> 80105795: 85 c0 test %eax,%eax 80105797: 0f 84 d7 01 00 00 je 80105974 <trap+0x214> 8010579d: f6 47 3c 03 testb $0x3,0x3c(%edi) 801057a1: 0f 84 cd 01 00 00 je 80105974 <trap+0x214> static inline uint rcr2(void) { uint val; asm volatile("movl %%cr2,%0" : "=r" (val)); 801057a7: 0f 20 d1 mov %cr2,%ecx cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801057aa: 8b 57 38 mov 0x38(%edi),%edx 801057ad: 89 4d d8 mov %ecx,-0x28(%ebp) 801057b0: 89 55 dc mov %edx,-0x24(%ebp) 801057b3: e8 a8 df ff ff call 80103760 <cpuid> 801057b8: 8b 77 34 mov 0x34(%edi),%esi 801057bb: 8b 5f 30 mov 0x30(%edi),%ebx 801057be: 89 45 e4 mov %eax,-0x1c(%ebp) "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 801057c1: e8 ba df ff ff call 80103780 <myproc> 801057c6: 89 45 e0 mov %eax,-0x20(%ebp) 801057c9: e8 b2 df ff ff call 80103780 <myproc> cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801057ce: 8b 4d d8 mov -0x28(%ebp),%ecx 801057d1: 8b 55 dc mov -0x24(%ebp),%edx 801057d4: 51 push %ecx 801057d5: 52 push %edx "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 801057d6: 8b 55 e0 mov -0x20(%ebp),%edx cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801057d9: ff 75 e4 pushl -0x1c(%ebp) 801057dc: 56 push %esi 801057dd: 53 push %ebx "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, 801057de: 83 c2 6c add $0x6c,%edx cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n", tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); } // In user space, assume process misbehaved. cprintf("pid %d %s: trap %d err %d on cpu %d " 801057e1: 52 push %edx 801057e2: ff 70 10 pushl 0x10(%eax) 801057e5: 68 60 77 10 80 push $0x80107760 801057ea: e8 71 ae ff ff call 80100660 <cprintf> "eip 0x%x addr 0x%x--kill proc\n", myproc()->pid, myproc()->name, tf->trapno, tf->err, cpuid(), tf->eip, rcr2()); myproc()->killed = 1; 801057ef: 83 c4 20 add $0x20,%esp 801057f2: e8 89 df ff ff call 80103780 <myproc> 801057f7: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax) 801057fe: 66 90 xchg %ax,%ax } // 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(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80105800: e8 7b df ff ff call 80103780 <myproc> 80105805: 85 c0 test %eax,%eax 80105807: 74 0c je 80105815 <trap+0xb5> 80105809: e8 72 df ff ff call 80103780 <myproc> 8010580e: 8b 50 24 mov 0x24(%eax),%edx 80105811: 85 d2 test %edx,%edx 80105813: 75 4b jne 80105860 <trap+0x100> exit(); // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && 80105815: e8 66 df ff ff call 80103780 <myproc> 8010581a: 85 c0 test %eax,%eax 8010581c: 74 0b je 80105829 <trap+0xc9> 8010581e: e8 5d df ff ff call 80103780 <myproc> 80105823: 83 78 0c 04 cmpl $0x4,0xc(%eax) 80105827: 74 4f je 80105878 <trap+0x118> tf->trapno == T_IRQ0+IRQ_TIMER) yield(); // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80105829: e8 52 df ff ff call 80103780 <myproc> 8010582e: 85 c0 test %eax,%eax 80105830: 74 1d je 8010584f <trap+0xef> 80105832: e8 49 df ff ff call 80103780 <myproc> 80105837: 8b 40 24 mov 0x24(%eax),%eax 8010583a: 85 c0 test %eax,%eax 8010583c: 74 11 je 8010584f <trap+0xef> 8010583e: 0f b7 47 3c movzwl 0x3c(%edi),%eax 80105842: 83 e0 03 and $0x3,%eax 80105845: 66 83 f8 03 cmp $0x3,%ax 80105849: 0f 84 da 00 00 00 je 80105929 <trap+0x1c9> exit(); } 8010584f: 8d 65 f4 lea -0xc(%ebp),%esp 80105852: 5b pop %ebx 80105853: 5e pop %esi 80105854: 5f pop %edi 80105855: 5d pop %ebp 80105856: c3 ret 80105857: 89 f6 mov %esi,%esi 80105859: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi } // 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(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) 80105860: 0f b7 47 3c movzwl 0x3c(%edi),%eax 80105864: 83 e0 03 and $0x3,%eax 80105867: 66 83 f8 03 cmp $0x3,%ax 8010586b: 75 a8 jne 80105815 <trap+0xb5> exit(); 8010586d: e8 3e e3 ff ff call 80103bb0 <exit> 80105872: eb a1 jmp 80105815 <trap+0xb5> 80105874: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi // Force process to give up CPU on clock tick. // If interrupts were on while locks held, would need to check nlock. if(myproc() && myproc()->state == RUNNING && 80105878: 83 7f 30 20 cmpl $0x20,0x30(%edi) 8010587c: 75 ab jne 80105829 <trap+0xc9> tf->trapno == T_IRQ0+IRQ_TIMER) yield(); 8010587e: e8 5d e4 ff ff call 80103ce0 <yield> 80105883: eb a4 jmp 80105829 <trap+0xc9> 80105885: 8d 76 00 lea 0x0(%esi),%esi return; } switch(tf->trapno){ case T_IRQ0 + IRQ_TIMER: if(cpuid() == 0){ 80105888: e8 d3 de ff ff call 80103760 <cpuid> 8010588d: 85 c0 test %eax,%eax 8010588f: 0f 84 ab 00 00 00 je 80105940 <trap+0x1e0> } lapiceoi(); break; case T_IRQ0 + IRQ_IDE: ideintr(); lapiceoi(); 80105895: e8 76 ce ff ff call 80102710 <lapiceoi> break; 8010589a: e9 61 ff ff ff jmp 80105800 <trap+0xa0> 8010589f: 90 nop case T_IRQ0 + IRQ_IDE+1: // Bochs generates spurious IDE1 interrupts. break; case T_IRQ0 + IRQ_KBD: kbdintr(); 801058a0: e8 2b cd ff ff call 801025d0 <kbdintr> lapiceoi(); 801058a5: e8 66 ce ff ff call 80102710 <lapiceoi> break; 801058aa: e9 51 ff ff ff jmp 80105800 <trap+0xa0> 801058af: 90 nop case T_IRQ0 + IRQ_COM1: uartintr(); 801058b0: e8 5b 02 00 00 call 80105b10 <uartintr> lapiceoi(); 801058b5: e8 56 ce ff ff call 80102710 <lapiceoi> break; 801058ba: e9 41 ff ff ff jmp 80105800 <trap+0xa0> 801058bf: 90 nop case T_IRQ0 + 7: case T_IRQ0 + IRQ_SPURIOUS: cprintf("cpu%d: spurious interrupt at %x:%x\n", 801058c0: 0f b7 5f 3c movzwl 0x3c(%edi),%ebx 801058c4: 8b 77 38 mov 0x38(%edi),%esi 801058c7: e8 94 de ff ff call 80103760 <cpuid> 801058cc: 56 push %esi 801058cd: 53 push %ebx 801058ce: 50 push %eax 801058cf: 68 08 77 10 80 push $0x80107708 801058d4: e8 87 ad ff ff call 80100660 <cprintf> cpuid(), tf->cs, tf->eip); lapiceoi(); 801058d9: e8 32 ce ff ff call 80102710 <lapiceoi> break; 801058de: 83 c4 10 add $0x10,%esp 801058e1: e9 1a ff ff ff jmp 80105800 <trap+0xa0> 801058e6: 8d 76 00 lea 0x0(%esi),%esi 801058e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi release(&tickslock); } lapiceoi(); break; case T_IRQ0 + IRQ_IDE: ideintr(); 801058f0: e8 5b c7 ff ff call 80102050 <ideintr> 801058f5: eb 9e jmp 80105895 <trap+0x135> 801058f7: 89 f6 mov %esi,%esi 801058f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi //PAGEBREAK: 41 void trap(struct trapframe *tf) { if(tf->trapno == T_SYSCALL){ if(myproc()->killed) 80105900: e8 7b de ff ff call 80103780 <myproc> 80105905: 8b 58 24 mov 0x24(%eax),%ebx 80105908: 85 db test %ebx,%ebx 8010590a: 75 2c jne 80105938 <trap+0x1d8> exit(); myproc()->tf = tf; 8010590c: e8 6f de ff ff call 80103780 <myproc> 80105911: 89 78 18 mov %edi,0x18(%eax) syscall(); 80105914: e8 37 ef ff ff call 80104850 <syscall> if(myproc()->killed) 80105919: e8 62 de ff ff call 80103780 <myproc> 8010591e: 8b 48 24 mov 0x24(%eax),%ecx 80105921: 85 c9 test %ecx,%ecx 80105923: 0f 84 26 ff ff ff je 8010584f <trap+0xef> yield(); // Check if the process has been killed since we yielded if(myproc() && myproc()->killed && (tf->cs&3) == DPL_USER) exit(); } 80105929: 8d 65 f4 lea -0xc(%ebp),%esp 8010592c: 5b pop %ebx 8010592d: 5e pop %esi 8010592e: 5f pop %edi 8010592f: 5d pop %ebp if(myproc()->killed) exit(); myproc()->tf = tf; syscall(); if(myproc()->killed) exit(); 80105930: e9 7b e2 ff ff jmp 80103bb0 <exit> 80105935: 8d 76 00 lea 0x0(%esi),%esi void trap(struct trapframe *tf) { if(tf->trapno == T_SYSCALL){ if(myproc()->killed) exit(); 80105938: e8 73 e2 ff ff call 80103bb0 <exit> 8010593d: eb cd jmp 8010590c <trap+0x1ac> 8010593f: 90 nop } switch(tf->trapno){ case T_IRQ0 + IRQ_TIMER: if(cpuid() == 0){ acquire(&tickslock); 80105940: 83 ec 0c sub $0xc,%esp 80105943: 68 60 4c 11 80 push $0x80114c60 80105948: e8 03 ea ff ff call 80104350 <acquire> ticks++; wakeup(&ticks); 8010594d: c7 04 24 a0 54 11 80 movl $0x801154a0,(%esp) switch(tf->trapno){ case T_IRQ0 + IRQ_TIMER: if(cpuid() == 0){ acquire(&tickslock); ticks++; 80105954: 83 05 a0 54 11 80 01 addl $0x1,0x801154a0 wakeup(&ticks); 8010595b: e8 80 e5 ff ff call 80103ee0 <wakeup> release(&tickslock); 80105960: c7 04 24 60 4c 11 80 movl $0x80114c60,(%esp) 80105967: e8 94 ea ff ff call 80104400 <release> 8010596c: 83 c4 10 add $0x10,%esp 8010596f: e9 21 ff ff ff jmp 80105895 <trap+0x135> 80105974: 0f 20 d6 mov %cr2,%esi //PAGEBREAK: 13 default: if(myproc() == 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", 80105977: 8b 5f 38 mov 0x38(%edi),%ebx 8010597a: e8 e1 dd ff ff call 80103760 <cpuid> 8010597f: 83 ec 0c sub $0xc,%esp 80105982: 56 push %esi 80105983: 53 push %ebx 80105984: 50 push %eax 80105985: ff 77 30 pushl 0x30(%edi) 80105988: 68 2c 77 10 80 push $0x8010772c 8010598d: e8 ce ac ff ff call 80100660 <cprintf> tf->trapno, cpuid(), tf->eip, rcr2()); panic("trap"); 80105992: 83 c4 14 add $0x14,%esp 80105995: 68 02 77 10 80 push $0x80107702 8010599a: e8 d1 a9 ff ff call 80100370 <panic> 8010599f: 90 nop 801059a0 <uartgetc>: } static int uartgetc(void) { if(!uart) 801059a0: a1 bc a5 10 80 mov 0x8010a5bc,%eax outb(COM1+0, c); } static int uartgetc(void) { 801059a5: 55 push %ebp 801059a6: 89 e5 mov %esp,%ebp if(!uart) 801059a8: 85 c0 test %eax,%eax 801059aa: 74 1c je 801059c8 <uartgetc+0x28> static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 801059ac: ba fd 03 00 00 mov $0x3fd,%edx 801059b1: ec in (%dx),%al return -1; if(!(inb(COM1+5) & 0x01)) 801059b2: a8 01 test $0x1,%al 801059b4: 74 12 je 801059c8 <uartgetc+0x28> 801059b6: ba f8 03 00 00 mov $0x3f8,%edx 801059bb: ec in (%dx),%al return -1; return inb(COM1+0); 801059bc: 0f b6 c0 movzbl %al,%eax } 801059bf: 5d pop %ebp 801059c0: c3 ret 801059c1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi static int uartgetc(void) { if(!uart) return -1; 801059c8: b8 ff ff ff ff mov $0xffffffff,%eax if(!(inb(COM1+5) & 0x01)) return -1; return inb(COM1+0); } 801059cd: 5d pop %ebp 801059ce: c3 ret 801059cf: 90 nop 801059d0 <uartputc.part.0>: for(p="xv6...\n"; *p; p++) uartputc(*p); } void uartputc(int c) 801059d0: 55 push %ebp 801059d1: 89 e5 mov %esp,%ebp 801059d3: 57 push %edi 801059d4: 56 push %esi 801059d5: 53 push %ebx 801059d6: 89 c7 mov %eax,%edi 801059d8: bb 80 00 00 00 mov $0x80,%ebx 801059dd: be fd 03 00 00 mov $0x3fd,%esi 801059e2: 83 ec 0c sub $0xc,%esp 801059e5: eb 1b jmp 80105a02 <uartputc.part.0+0x32> 801059e7: 89 f6 mov %esi,%esi 801059e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) microdelay(10); 801059f0: 83 ec 0c sub $0xc,%esp 801059f3: 6a 0a push $0xa 801059f5: e8 36 cd ff ff call 80102730 <microdelay> { int i; if(!uart) return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) 801059fa: 83 c4 10 add $0x10,%esp 801059fd: 83 eb 01 sub $0x1,%ebx 80105a00: 74 07 je 80105a09 <uartputc.part.0+0x39> 80105a02: 89 f2 mov %esi,%edx 80105a04: ec in (%dx),%al 80105a05: a8 20 test $0x20,%al 80105a07: 74 e7 je 801059f0 <uartputc.part.0+0x20> } static inline void outb(ushort port, uchar data) { asm volatile("out %0,%1" : : "a" (data), "d" (port)); 80105a09: ba f8 03 00 00 mov $0x3f8,%edx 80105a0e: 89 f8 mov %edi,%eax 80105a10: ee out %al,(%dx) microdelay(10); outb(COM1+0, c); } 80105a11: 8d 65 f4 lea -0xc(%ebp),%esp 80105a14: 5b pop %ebx 80105a15: 5e pop %esi 80105a16: 5f pop %edi 80105a17: 5d pop %ebp 80105a18: c3 ret 80105a19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105a20 <uartinit>: static int uart; // is there a uart? void uartinit(void) { 80105a20: 55 push %ebp 80105a21: 31 c9 xor %ecx,%ecx 80105a23: 89 c8 mov %ecx,%eax 80105a25: 89 e5 mov %esp,%ebp 80105a27: 57 push %edi 80105a28: 56 push %esi 80105a29: 53 push %ebx 80105a2a: bb fa 03 00 00 mov $0x3fa,%ebx 80105a2f: 89 da mov %ebx,%edx 80105a31: 83 ec 0c sub $0xc,%esp 80105a34: ee out %al,(%dx) 80105a35: bf fb 03 00 00 mov $0x3fb,%edi 80105a3a: b8 80 ff ff ff mov $0xffffff80,%eax 80105a3f: 89 fa mov %edi,%edx 80105a41: ee out %al,(%dx) 80105a42: b8 0c 00 00 00 mov $0xc,%eax 80105a47: ba f8 03 00 00 mov $0x3f8,%edx 80105a4c: ee out %al,(%dx) 80105a4d: be f9 03 00 00 mov $0x3f9,%esi 80105a52: 89 c8 mov %ecx,%eax 80105a54: 89 f2 mov %esi,%edx 80105a56: ee out %al,(%dx) 80105a57: b8 03 00 00 00 mov $0x3,%eax 80105a5c: 89 fa mov %edi,%edx 80105a5e: ee out %al,(%dx) 80105a5f: ba fc 03 00 00 mov $0x3fc,%edx 80105a64: 89 c8 mov %ecx,%eax 80105a66: ee out %al,(%dx) 80105a67: b8 01 00 00 00 mov $0x1,%eax 80105a6c: 89 f2 mov %esi,%edx 80105a6e: ee out %al,(%dx) static inline uchar inb(ushort port) { uchar data; asm volatile("in %1,%0" : "=a" (data) : "d" (port)); 80105a6f: ba fd 03 00 00 mov $0x3fd,%edx 80105a74: ec in (%dx),%al outb(COM1+3, 0x03); // Lock divisor, 8 data bits. outb(COM1+4, 0); outb(COM1+1, 0x01); // Enable receive interrupts. // If status is 0xFF, no serial port. if(inb(COM1+5) == 0xFF) 80105a75: 3c ff cmp $0xff,%al 80105a77: 74 5a je 80105ad3 <uartinit+0xb3> return; uart = 1; 80105a79: c7 05 bc a5 10 80 01 movl $0x1,0x8010a5bc 80105a80: 00 00 00 80105a83: 89 da mov %ebx,%edx 80105a85: ec in (%dx),%al 80105a86: ba f8 03 00 00 mov $0x3f8,%edx 80105a8b: ec in (%dx),%al // Acknowledge pre-existing interrupt conditions; // enable interrupts. inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); 80105a8c: 83 ec 08 sub $0x8,%esp 80105a8f: bb 24 78 10 80 mov $0x80107824,%ebx 80105a94: 6a 00 push $0x0 80105a96: 6a 04 push $0x4 80105a98: e8 03 c8 ff ff call 801022a0 <ioapicenable> 80105a9d: 83 c4 10 add $0x10,%esp 80105aa0: b8 78 00 00 00 mov $0x78,%eax 80105aa5: eb 13 jmp 80105aba <uartinit+0x9a> 80105aa7: 89 f6 mov %esi,%esi 80105aa9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi // Announce that we're here. for(p="xv6...\n"; *p; p++) 80105ab0: 83 c3 01 add $0x1,%ebx 80105ab3: 0f be 03 movsbl (%ebx),%eax 80105ab6: 84 c0 test %al,%al 80105ab8: 74 19 je 80105ad3 <uartinit+0xb3> void uartputc(int c) { int i; if(!uart) 80105aba: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx 80105ac0: 85 d2 test %edx,%edx 80105ac2: 74 ec je 80105ab0 <uartinit+0x90> inb(COM1+2); inb(COM1+0); ioapicenable(IRQ_COM1, 0); // Announce that we're here. for(p="xv6...\n"; *p; p++) 80105ac4: 83 c3 01 add $0x1,%ebx 80105ac7: e8 04 ff ff ff call 801059d0 <uartputc.part.0> 80105acc: 0f be 03 movsbl (%ebx),%eax 80105acf: 84 c0 test %al,%al 80105ad1: 75 e7 jne 80105aba <uartinit+0x9a> uartputc(*p); } 80105ad3: 8d 65 f4 lea -0xc(%ebp),%esp 80105ad6: 5b pop %ebx 80105ad7: 5e pop %esi 80105ad8: 5f pop %edi 80105ad9: 5d pop %ebp 80105ada: c3 ret 80105adb: 90 nop 80105adc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80105ae0 <uartputc>: void uartputc(int c) { int i; if(!uart) 80105ae0: 8b 15 bc a5 10 80 mov 0x8010a5bc,%edx uartputc(*p); } void uartputc(int c) { 80105ae6: 55 push %ebp 80105ae7: 89 e5 mov %esp,%ebp int i; if(!uart) 80105ae9: 85 d2 test %edx,%edx uartputc(*p); } void uartputc(int c) { 80105aeb: 8b 45 08 mov 0x8(%ebp),%eax int i; if(!uart) 80105aee: 74 10 je 80105b00 <uartputc+0x20> return; for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++) microdelay(10); outb(COM1+0, c); } 80105af0: 5d pop %ebp 80105af1: e9 da fe ff ff jmp 801059d0 <uartputc.part.0> 80105af6: 8d 76 00 lea 0x0(%esi),%esi 80105af9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105b00: 5d pop %ebp 80105b01: c3 ret 80105b02: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80105b09: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80105b10 <uartintr>: return inb(COM1+0); } void uartintr(void) { 80105b10: 55 push %ebp 80105b11: 89 e5 mov %esp,%ebp 80105b13: 83 ec 14 sub $0x14,%esp consoleintr(uartgetc); 80105b16: 68 a0 59 10 80 push $0x801059a0 80105b1b: e8 d0 ac ff ff call 801007f0 <consoleintr> } 80105b20: 83 c4 10 add $0x10,%esp 80105b23: c9 leave 80105b24: c3 ret 80105b25 <vector0>: # generated by vectors.pl - do not edit # handlers .globl alltraps .globl vector0 vector0: pushl $0 80105b25: 6a 00 push $0x0 pushl $0 80105b27: 6a 00 push $0x0 jmp alltraps 80105b29: e9 34 fb ff ff jmp 80105662 <alltraps> 80105b2e <vector1>: .globl vector1 vector1: pushl $0 80105b2e: 6a 00 push $0x0 pushl $1 80105b30: 6a 01 push $0x1 jmp alltraps 80105b32: e9 2b fb ff ff jmp 80105662 <alltraps> 80105b37 <vector2>: .globl vector2 vector2: pushl $0 80105b37: 6a 00 push $0x0 pushl $2 80105b39: 6a 02 push $0x2 jmp alltraps 80105b3b: e9 22 fb ff ff jmp 80105662 <alltraps> 80105b40 <vector3>: .globl vector3 vector3: pushl $0 80105b40: 6a 00 push $0x0 pushl $3 80105b42: 6a 03 push $0x3 jmp alltraps 80105b44: e9 19 fb ff ff jmp 80105662 <alltraps> 80105b49 <vector4>: .globl vector4 vector4: pushl $0 80105b49: 6a 00 push $0x0 pushl $4 80105b4b: 6a 04 push $0x4 jmp alltraps 80105b4d: e9 10 fb ff ff jmp 80105662 <alltraps> 80105b52 <vector5>: .globl vector5 vector5: pushl $0 80105b52: 6a 00 push $0x0 pushl $5 80105b54: 6a 05 push $0x5 jmp alltraps 80105b56: e9 07 fb ff ff jmp 80105662 <alltraps> 80105b5b <vector6>: .globl vector6 vector6: pushl $0 80105b5b: 6a 00 push $0x0 pushl $6 80105b5d: 6a 06 push $0x6 jmp alltraps 80105b5f: e9 fe fa ff ff jmp 80105662 <alltraps> 80105b64 <vector7>: .globl vector7 vector7: pushl $0 80105b64: 6a 00 push $0x0 pushl $7 80105b66: 6a 07 push $0x7 jmp alltraps 80105b68: e9 f5 fa ff ff jmp 80105662 <alltraps> 80105b6d <vector8>: .globl vector8 vector8: pushl $8 80105b6d: 6a 08 push $0x8 jmp alltraps 80105b6f: e9 ee fa ff ff jmp 80105662 <alltraps> 80105b74 <vector9>: .globl vector9 vector9: pushl $0 80105b74: 6a 00 push $0x0 pushl $9 80105b76: 6a 09 push $0x9 jmp alltraps 80105b78: e9 e5 fa ff ff jmp 80105662 <alltraps> 80105b7d <vector10>: .globl vector10 vector10: pushl $10 80105b7d: 6a 0a push $0xa jmp alltraps 80105b7f: e9 de fa ff ff jmp 80105662 <alltraps> 80105b84 <vector11>: .globl vector11 vector11: pushl $11 80105b84: 6a 0b push $0xb jmp alltraps 80105b86: e9 d7 fa ff ff jmp 80105662 <alltraps> 80105b8b <vector12>: .globl vector12 vector12: pushl $12 80105b8b: 6a 0c push $0xc jmp alltraps 80105b8d: e9 d0 fa ff ff jmp 80105662 <alltraps> 80105b92 <vector13>: .globl vector13 vector13: pushl $13 80105b92: 6a 0d push $0xd jmp alltraps 80105b94: e9 c9 fa ff ff jmp 80105662 <alltraps> 80105b99 <vector14>: .globl vector14 vector14: pushl $14 80105b99: 6a 0e push $0xe jmp alltraps 80105b9b: e9 c2 fa ff ff jmp 80105662 <alltraps> 80105ba0 <vector15>: .globl vector15 vector15: pushl $0 80105ba0: 6a 00 push $0x0 pushl $15 80105ba2: 6a 0f push $0xf jmp alltraps 80105ba4: e9 b9 fa ff ff jmp 80105662 <alltraps> 80105ba9 <vector16>: .globl vector16 vector16: pushl $0 80105ba9: 6a 00 push $0x0 pushl $16 80105bab: 6a 10 push $0x10 jmp alltraps 80105bad: e9 b0 fa ff ff jmp 80105662 <alltraps> 80105bb2 <vector17>: .globl vector17 vector17: pushl $17 80105bb2: 6a 11 push $0x11 jmp alltraps 80105bb4: e9 a9 fa ff ff jmp 80105662 <alltraps> 80105bb9 <vector18>: .globl vector18 vector18: pushl $0 80105bb9: 6a 00 push $0x0 pushl $18 80105bbb: 6a 12 push $0x12 jmp alltraps 80105bbd: e9 a0 fa ff ff jmp 80105662 <alltraps> 80105bc2 <vector19>: .globl vector19 vector19: pushl $0 80105bc2: 6a 00 push $0x0 pushl $19 80105bc4: 6a 13 push $0x13 jmp alltraps 80105bc6: e9 97 fa ff ff jmp 80105662 <alltraps> 80105bcb <vector20>: .globl vector20 vector20: pushl $0 80105bcb: 6a 00 push $0x0 pushl $20 80105bcd: 6a 14 push $0x14 jmp alltraps 80105bcf: e9 8e fa ff ff jmp 80105662 <alltraps> 80105bd4 <vector21>: .globl vector21 vector21: pushl $0 80105bd4: 6a 00 push $0x0 pushl $21 80105bd6: 6a 15 push $0x15 jmp alltraps 80105bd8: e9 85 fa ff ff jmp 80105662 <alltraps> 80105bdd <vector22>: .globl vector22 vector22: pushl $0 80105bdd: 6a 00 push $0x0 pushl $22 80105bdf: 6a 16 push $0x16 jmp alltraps 80105be1: e9 7c fa ff ff jmp 80105662 <alltraps> 80105be6 <vector23>: .globl vector23 vector23: pushl $0 80105be6: 6a 00 push $0x0 pushl $23 80105be8: 6a 17 push $0x17 jmp alltraps 80105bea: e9 73 fa ff ff jmp 80105662 <alltraps> 80105bef <vector24>: .globl vector24 vector24: pushl $0 80105bef: 6a 00 push $0x0 pushl $24 80105bf1: 6a 18 push $0x18 jmp alltraps 80105bf3: e9 6a fa ff ff jmp 80105662 <alltraps> 80105bf8 <vector25>: .globl vector25 vector25: pushl $0 80105bf8: 6a 00 push $0x0 pushl $25 80105bfa: 6a 19 push $0x19 jmp alltraps 80105bfc: e9 61 fa ff ff jmp 80105662 <alltraps> 80105c01 <vector26>: .globl vector26 vector26: pushl $0 80105c01: 6a 00 push $0x0 pushl $26 80105c03: 6a 1a push $0x1a jmp alltraps 80105c05: e9 58 fa ff ff jmp 80105662 <alltraps> 80105c0a <vector27>: .globl vector27 vector27: pushl $0 80105c0a: 6a 00 push $0x0 pushl $27 80105c0c: 6a 1b push $0x1b jmp alltraps 80105c0e: e9 4f fa ff ff jmp 80105662 <alltraps> 80105c13 <vector28>: .globl vector28 vector28: pushl $0 80105c13: 6a 00 push $0x0 pushl $28 80105c15: 6a 1c push $0x1c jmp alltraps 80105c17: e9 46 fa ff ff jmp 80105662 <alltraps> 80105c1c <vector29>: .globl vector29 vector29: pushl $0 80105c1c: 6a 00 push $0x0 pushl $29 80105c1e: 6a 1d push $0x1d jmp alltraps 80105c20: e9 3d fa ff ff jmp 80105662 <alltraps> 80105c25 <vector30>: .globl vector30 vector30: pushl $0 80105c25: 6a 00 push $0x0 pushl $30 80105c27: 6a 1e push $0x1e jmp alltraps 80105c29: e9 34 fa ff ff jmp 80105662 <alltraps> 80105c2e <vector31>: .globl vector31 vector31: pushl $0 80105c2e: 6a 00 push $0x0 pushl $31 80105c30: 6a 1f push $0x1f jmp alltraps 80105c32: e9 2b fa ff ff jmp 80105662 <alltraps> 80105c37 <vector32>: .globl vector32 vector32: pushl $0 80105c37: 6a 00 push $0x0 pushl $32 80105c39: 6a 20 push $0x20 jmp alltraps 80105c3b: e9 22 fa ff ff jmp 80105662 <alltraps> 80105c40 <vector33>: .globl vector33 vector33: pushl $0 80105c40: 6a 00 push $0x0 pushl $33 80105c42: 6a 21 push $0x21 jmp alltraps 80105c44: e9 19 fa ff ff jmp 80105662 <alltraps> 80105c49 <vector34>: .globl vector34 vector34: pushl $0 80105c49: 6a 00 push $0x0 pushl $34 80105c4b: 6a 22 push $0x22 jmp alltraps 80105c4d: e9 10 fa ff ff jmp 80105662 <alltraps> 80105c52 <vector35>: .globl vector35 vector35: pushl $0 80105c52: 6a 00 push $0x0 pushl $35 80105c54: 6a 23 push $0x23 jmp alltraps 80105c56: e9 07 fa ff ff jmp 80105662 <alltraps> 80105c5b <vector36>: .globl vector36 vector36: pushl $0 80105c5b: 6a 00 push $0x0 pushl $36 80105c5d: 6a 24 push $0x24 jmp alltraps 80105c5f: e9 fe f9 ff ff jmp 80105662 <alltraps> 80105c64 <vector37>: .globl vector37 vector37: pushl $0 80105c64: 6a 00 push $0x0 pushl $37 80105c66: 6a 25 push $0x25 jmp alltraps 80105c68: e9 f5 f9 ff ff jmp 80105662 <alltraps> 80105c6d <vector38>: .globl vector38 vector38: pushl $0 80105c6d: 6a 00 push $0x0 pushl $38 80105c6f: 6a 26 push $0x26 jmp alltraps 80105c71: e9 ec f9 ff ff jmp 80105662 <alltraps> 80105c76 <vector39>: .globl vector39 vector39: pushl $0 80105c76: 6a 00 push $0x0 pushl $39 80105c78: 6a 27 push $0x27 jmp alltraps 80105c7a: e9 e3 f9 ff ff jmp 80105662 <alltraps> 80105c7f <vector40>: .globl vector40 vector40: pushl $0 80105c7f: 6a 00 push $0x0 pushl $40 80105c81: 6a 28 push $0x28 jmp alltraps 80105c83: e9 da f9 ff ff jmp 80105662 <alltraps> 80105c88 <vector41>: .globl vector41 vector41: pushl $0 80105c88: 6a 00 push $0x0 pushl $41 80105c8a: 6a 29 push $0x29 jmp alltraps 80105c8c: e9 d1 f9 ff ff jmp 80105662 <alltraps> 80105c91 <vector42>: .globl vector42 vector42: pushl $0 80105c91: 6a 00 push $0x0 pushl $42 80105c93: 6a 2a push $0x2a jmp alltraps 80105c95: e9 c8 f9 ff ff jmp 80105662 <alltraps> 80105c9a <vector43>: .globl vector43 vector43: pushl $0 80105c9a: 6a 00 push $0x0 pushl $43 80105c9c: 6a 2b push $0x2b jmp alltraps 80105c9e: e9 bf f9 ff ff jmp 80105662 <alltraps> 80105ca3 <vector44>: .globl vector44 vector44: pushl $0 80105ca3: 6a 00 push $0x0 pushl $44 80105ca5: 6a 2c push $0x2c jmp alltraps 80105ca7: e9 b6 f9 ff ff jmp 80105662 <alltraps> 80105cac <vector45>: .globl vector45 vector45: pushl $0 80105cac: 6a 00 push $0x0 pushl $45 80105cae: 6a 2d push $0x2d jmp alltraps 80105cb0: e9 ad f9 ff ff jmp 80105662 <alltraps> 80105cb5 <vector46>: .globl vector46 vector46: pushl $0 80105cb5: 6a 00 push $0x0 pushl $46 80105cb7: 6a 2e push $0x2e jmp alltraps 80105cb9: e9 a4 f9 ff ff jmp 80105662 <alltraps> 80105cbe <vector47>: .globl vector47 vector47: pushl $0 80105cbe: 6a 00 push $0x0 pushl $47 80105cc0: 6a 2f push $0x2f jmp alltraps 80105cc2: e9 9b f9 ff ff jmp 80105662 <alltraps> 80105cc7 <vector48>: .globl vector48 vector48: pushl $0 80105cc7: 6a 00 push $0x0 pushl $48 80105cc9: 6a 30 push $0x30 jmp alltraps 80105ccb: e9 92 f9 ff ff jmp 80105662 <alltraps> 80105cd0 <vector49>: .globl vector49 vector49: pushl $0 80105cd0: 6a 00 push $0x0 pushl $49 80105cd2: 6a 31 push $0x31 jmp alltraps 80105cd4: e9 89 f9 ff ff jmp 80105662 <alltraps> 80105cd9 <vector50>: .globl vector50 vector50: pushl $0 80105cd9: 6a 00 push $0x0 pushl $50 80105cdb: 6a 32 push $0x32 jmp alltraps 80105cdd: e9 80 f9 ff ff jmp 80105662 <alltraps> 80105ce2 <vector51>: .globl vector51 vector51: pushl $0 80105ce2: 6a 00 push $0x0 pushl $51 80105ce4: 6a 33 push $0x33 jmp alltraps 80105ce6: e9 77 f9 ff ff jmp 80105662 <alltraps> 80105ceb <vector52>: .globl vector52 vector52: pushl $0 80105ceb: 6a 00 push $0x0 pushl $52 80105ced: 6a 34 push $0x34 jmp alltraps 80105cef: e9 6e f9 ff ff jmp 80105662 <alltraps> 80105cf4 <vector53>: .globl vector53 vector53: pushl $0 80105cf4: 6a 00 push $0x0 pushl $53 80105cf6: 6a 35 push $0x35 jmp alltraps 80105cf8: e9 65 f9 ff ff jmp 80105662 <alltraps> 80105cfd <vector54>: .globl vector54 vector54: pushl $0 80105cfd: 6a 00 push $0x0 pushl $54 80105cff: 6a 36 push $0x36 jmp alltraps 80105d01: e9 5c f9 ff ff jmp 80105662 <alltraps> 80105d06 <vector55>: .globl vector55 vector55: pushl $0 80105d06: 6a 00 push $0x0 pushl $55 80105d08: 6a 37 push $0x37 jmp alltraps 80105d0a: e9 53 f9 ff ff jmp 80105662 <alltraps> 80105d0f <vector56>: .globl vector56 vector56: pushl $0 80105d0f: 6a 00 push $0x0 pushl $56 80105d11: 6a 38 push $0x38 jmp alltraps 80105d13: e9 4a f9 ff ff jmp 80105662 <alltraps> 80105d18 <vector57>: .globl vector57 vector57: pushl $0 80105d18: 6a 00 push $0x0 pushl $57 80105d1a: 6a 39 push $0x39 jmp alltraps 80105d1c: e9 41 f9 ff ff jmp 80105662 <alltraps> 80105d21 <vector58>: .globl vector58 vector58: pushl $0 80105d21: 6a 00 push $0x0 pushl $58 80105d23: 6a 3a push $0x3a jmp alltraps 80105d25: e9 38 f9 ff ff jmp 80105662 <alltraps> 80105d2a <vector59>: .globl vector59 vector59: pushl $0 80105d2a: 6a 00 push $0x0 pushl $59 80105d2c: 6a 3b push $0x3b jmp alltraps 80105d2e: e9 2f f9 ff ff jmp 80105662 <alltraps> 80105d33 <vector60>: .globl vector60 vector60: pushl $0 80105d33: 6a 00 push $0x0 pushl $60 80105d35: 6a 3c push $0x3c jmp alltraps 80105d37: e9 26 f9 ff ff jmp 80105662 <alltraps> 80105d3c <vector61>: .globl vector61 vector61: pushl $0 80105d3c: 6a 00 push $0x0 pushl $61 80105d3e: 6a 3d push $0x3d jmp alltraps 80105d40: e9 1d f9 ff ff jmp 80105662 <alltraps> 80105d45 <vector62>: .globl vector62 vector62: pushl $0 80105d45: 6a 00 push $0x0 pushl $62 80105d47: 6a 3e push $0x3e jmp alltraps 80105d49: e9 14 f9 ff ff jmp 80105662 <alltraps> 80105d4e <vector63>: .globl vector63 vector63: pushl $0 80105d4e: 6a 00 push $0x0 pushl $63 80105d50: 6a 3f push $0x3f jmp alltraps 80105d52: e9 0b f9 ff ff jmp 80105662 <alltraps> 80105d57 <vector64>: .globl vector64 vector64: pushl $0 80105d57: 6a 00 push $0x0 pushl $64 80105d59: 6a 40 push $0x40 jmp alltraps 80105d5b: e9 02 f9 ff ff jmp 80105662 <alltraps> 80105d60 <vector65>: .globl vector65 vector65: pushl $0 80105d60: 6a 00 push $0x0 pushl $65 80105d62: 6a 41 push $0x41 jmp alltraps 80105d64: e9 f9 f8 ff ff jmp 80105662 <alltraps> 80105d69 <vector66>: .globl vector66 vector66: pushl $0 80105d69: 6a 00 push $0x0 pushl $66 80105d6b: 6a 42 push $0x42 jmp alltraps 80105d6d: e9 f0 f8 ff ff jmp 80105662 <alltraps> 80105d72 <vector67>: .globl vector67 vector67: pushl $0 80105d72: 6a 00 push $0x0 pushl $67 80105d74: 6a 43 push $0x43 jmp alltraps 80105d76: e9 e7 f8 ff ff jmp 80105662 <alltraps> 80105d7b <vector68>: .globl vector68 vector68: pushl $0 80105d7b: 6a 00 push $0x0 pushl $68 80105d7d: 6a 44 push $0x44 jmp alltraps 80105d7f: e9 de f8 ff ff jmp 80105662 <alltraps> 80105d84 <vector69>: .globl vector69 vector69: pushl $0 80105d84: 6a 00 push $0x0 pushl $69 80105d86: 6a 45 push $0x45 jmp alltraps 80105d88: e9 d5 f8 ff ff jmp 80105662 <alltraps> 80105d8d <vector70>: .globl vector70 vector70: pushl $0 80105d8d: 6a 00 push $0x0 pushl $70 80105d8f: 6a 46 push $0x46 jmp alltraps 80105d91: e9 cc f8 ff ff jmp 80105662 <alltraps> 80105d96 <vector71>: .globl vector71 vector71: pushl $0 80105d96: 6a 00 push $0x0 pushl $71 80105d98: 6a 47 push $0x47 jmp alltraps 80105d9a: e9 c3 f8 ff ff jmp 80105662 <alltraps> 80105d9f <vector72>: .globl vector72 vector72: pushl $0 80105d9f: 6a 00 push $0x0 pushl $72 80105da1: 6a 48 push $0x48 jmp alltraps 80105da3: e9 ba f8 ff ff jmp 80105662 <alltraps> 80105da8 <vector73>: .globl vector73 vector73: pushl $0 80105da8: 6a 00 push $0x0 pushl $73 80105daa: 6a 49 push $0x49 jmp alltraps 80105dac: e9 b1 f8 ff ff jmp 80105662 <alltraps> 80105db1 <vector74>: .globl vector74 vector74: pushl $0 80105db1: 6a 00 push $0x0 pushl $74 80105db3: 6a 4a push $0x4a jmp alltraps 80105db5: e9 a8 f8 ff ff jmp 80105662 <alltraps> 80105dba <vector75>: .globl vector75 vector75: pushl $0 80105dba: 6a 00 push $0x0 pushl $75 80105dbc: 6a 4b push $0x4b jmp alltraps 80105dbe: e9 9f f8 ff ff jmp 80105662 <alltraps> 80105dc3 <vector76>: .globl vector76 vector76: pushl $0 80105dc3: 6a 00 push $0x0 pushl $76 80105dc5: 6a 4c push $0x4c jmp alltraps 80105dc7: e9 96 f8 ff ff jmp 80105662 <alltraps> 80105dcc <vector77>: .globl vector77 vector77: pushl $0 80105dcc: 6a 00 push $0x0 pushl $77 80105dce: 6a 4d push $0x4d jmp alltraps 80105dd0: e9 8d f8 ff ff jmp 80105662 <alltraps> 80105dd5 <vector78>: .globl vector78 vector78: pushl $0 80105dd5: 6a 00 push $0x0 pushl $78 80105dd7: 6a 4e push $0x4e jmp alltraps 80105dd9: e9 84 f8 ff ff jmp 80105662 <alltraps> 80105dde <vector79>: .globl vector79 vector79: pushl $0 80105dde: 6a 00 push $0x0 pushl $79 80105de0: 6a 4f push $0x4f jmp alltraps 80105de2: e9 7b f8 ff ff jmp 80105662 <alltraps> 80105de7 <vector80>: .globl vector80 vector80: pushl $0 80105de7: 6a 00 push $0x0 pushl $80 80105de9: 6a 50 push $0x50 jmp alltraps 80105deb: e9 72 f8 ff ff jmp 80105662 <alltraps> 80105df0 <vector81>: .globl vector81 vector81: pushl $0 80105df0: 6a 00 push $0x0 pushl $81 80105df2: 6a 51 push $0x51 jmp alltraps 80105df4: e9 69 f8 ff ff jmp 80105662 <alltraps> 80105df9 <vector82>: .globl vector82 vector82: pushl $0 80105df9: 6a 00 push $0x0 pushl $82 80105dfb: 6a 52 push $0x52 jmp alltraps 80105dfd: e9 60 f8 ff ff jmp 80105662 <alltraps> 80105e02 <vector83>: .globl vector83 vector83: pushl $0 80105e02: 6a 00 push $0x0 pushl $83 80105e04: 6a 53 push $0x53 jmp alltraps 80105e06: e9 57 f8 ff ff jmp 80105662 <alltraps> 80105e0b <vector84>: .globl vector84 vector84: pushl $0 80105e0b: 6a 00 push $0x0 pushl $84 80105e0d: 6a 54 push $0x54 jmp alltraps 80105e0f: e9 4e f8 ff ff jmp 80105662 <alltraps> 80105e14 <vector85>: .globl vector85 vector85: pushl $0 80105e14: 6a 00 push $0x0 pushl $85 80105e16: 6a 55 push $0x55 jmp alltraps 80105e18: e9 45 f8 ff ff jmp 80105662 <alltraps> 80105e1d <vector86>: .globl vector86 vector86: pushl $0 80105e1d: 6a 00 push $0x0 pushl $86 80105e1f: 6a 56 push $0x56 jmp alltraps 80105e21: e9 3c f8 ff ff jmp 80105662 <alltraps> 80105e26 <vector87>: .globl vector87 vector87: pushl $0 80105e26: 6a 00 push $0x0 pushl $87 80105e28: 6a 57 push $0x57 jmp alltraps 80105e2a: e9 33 f8 ff ff jmp 80105662 <alltraps> 80105e2f <vector88>: .globl vector88 vector88: pushl $0 80105e2f: 6a 00 push $0x0 pushl $88 80105e31: 6a 58 push $0x58 jmp alltraps 80105e33: e9 2a f8 ff ff jmp 80105662 <alltraps> 80105e38 <vector89>: .globl vector89 vector89: pushl $0 80105e38: 6a 00 push $0x0 pushl $89 80105e3a: 6a 59 push $0x59 jmp alltraps 80105e3c: e9 21 f8 ff ff jmp 80105662 <alltraps> 80105e41 <vector90>: .globl vector90 vector90: pushl $0 80105e41: 6a 00 push $0x0 pushl $90 80105e43: 6a 5a push $0x5a jmp alltraps 80105e45: e9 18 f8 ff ff jmp 80105662 <alltraps> 80105e4a <vector91>: .globl vector91 vector91: pushl $0 80105e4a: 6a 00 push $0x0 pushl $91 80105e4c: 6a 5b push $0x5b jmp alltraps 80105e4e: e9 0f f8 ff ff jmp 80105662 <alltraps> 80105e53 <vector92>: .globl vector92 vector92: pushl $0 80105e53: 6a 00 push $0x0 pushl $92 80105e55: 6a 5c push $0x5c jmp alltraps 80105e57: e9 06 f8 ff ff jmp 80105662 <alltraps> 80105e5c <vector93>: .globl vector93 vector93: pushl $0 80105e5c: 6a 00 push $0x0 pushl $93 80105e5e: 6a 5d push $0x5d jmp alltraps 80105e60: e9 fd f7 ff ff jmp 80105662 <alltraps> 80105e65 <vector94>: .globl vector94 vector94: pushl $0 80105e65: 6a 00 push $0x0 pushl $94 80105e67: 6a 5e push $0x5e jmp alltraps 80105e69: e9 f4 f7 ff ff jmp 80105662 <alltraps> 80105e6e <vector95>: .globl vector95 vector95: pushl $0 80105e6e: 6a 00 push $0x0 pushl $95 80105e70: 6a 5f push $0x5f jmp alltraps 80105e72: e9 eb f7 ff ff jmp 80105662 <alltraps> 80105e77 <vector96>: .globl vector96 vector96: pushl $0 80105e77: 6a 00 push $0x0 pushl $96 80105e79: 6a 60 push $0x60 jmp alltraps 80105e7b: e9 e2 f7 ff ff jmp 80105662 <alltraps> 80105e80 <vector97>: .globl vector97 vector97: pushl $0 80105e80: 6a 00 push $0x0 pushl $97 80105e82: 6a 61 push $0x61 jmp alltraps 80105e84: e9 d9 f7 ff ff jmp 80105662 <alltraps> 80105e89 <vector98>: .globl vector98 vector98: pushl $0 80105e89: 6a 00 push $0x0 pushl $98 80105e8b: 6a 62 push $0x62 jmp alltraps 80105e8d: e9 d0 f7 ff ff jmp 80105662 <alltraps> 80105e92 <vector99>: .globl vector99 vector99: pushl $0 80105e92: 6a 00 push $0x0 pushl $99 80105e94: 6a 63 push $0x63 jmp alltraps 80105e96: e9 c7 f7 ff ff jmp 80105662 <alltraps> 80105e9b <vector100>: .globl vector100 vector100: pushl $0 80105e9b: 6a 00 push $0x0 pushl $100 80105e9d: 6a 64 push $0x64 jmp alltraps 80105e9f: e9 be f7 ff ff jmp 80105662 <alltraps> 80105ea4 <vector101>: .globl vector101 vector101: pushl $0 80105ea4: 6a 00 push $0x0 pushl $101 80105ea6: 6a 65 push $0x65 jmp alltraps 80105ea8: e9 b5 f7 ff ff jmp 80105662 <alltraps> 80105ead <vector102>: .globl vector102 vector102: pushl $0 80105ead: 6a 00 push $0x0 pushl $102 80105eaf: 6a 66 push $0x66 jmp alltraps 80105eb1: e9 ac f7 ff ff jmp 80105662 <alltraps> 80105eb6 <vector103>: .globl vector103 vector103: pushl $0 80105eb6: 6a 00 push $0x0 pushl $103 80105eb8: 6a 67 push $0x67 jmp alltraps 80105eba: e9 a3 f7 ff ff jmp 80105662 <alltraps> 80105ebf <vector104>: .globl vector104 vector104: pushl $0 80105ebf: 6a 00 push $0x0 pushl $104 80105ec1: 6a 68 push $0x68 jmp alltraps 80105ec3: e9 9a f7 ff ff jmp 80105662 <alltraps> 80105ec8 <vector105>: .globl vector105 vector105: pushl $0 80105ec8: 6a 00 push $0x0 pushl $105 80105eca: 6a 69 push $0x69 jmp alltraps 80105ecc: e9 91 f7 ff ff jmp 80105662 <alltraps> 80105ed1 <vector106>: .globl vector106 vector106: pushl $0 80105ed1: 6a 00 push $0x0 pushl $106 80105ed3: 6a 6a push $0x6a jmp alltraps 80105ed5: e9 88 f7 ff ff jmp 80105662 <alltraps> 80105eda <vector107>: .globl vector107 vector107: pushl $0 80105eda: 6a 00 push $0x0 pushl $107 80105edc: 6a 6b push $0x6b jmp alltraps 80105ede: e9 7f f7 ff ff jmp 80105662 <alltraps> 80105ee3 <vector108>: .globl vector108 vector108: pushl $0 80105ee3: 6a 00 push $0x0 pushl $108 80105ee5: 6a 6c push $0x6c jmp alltraps 80105ee7: e9 76 f7 ff ff jmp 80105662 <alltraps> 80105eec <vector109>: .globl vector109 vector109: pushl $0 80105eec: 6a 00 push $0x0 pushl $109 80105eee: 6a 6d push $0x6d jmp alltraps 80105ef0: e9 6d f7 ff ff jmp 80105662 <alltraps> 80105ef5 <vector110>: .globl vector110 vector110: pushl $0 80105ef5: 6a 00 push $0x0 pushl $110 80105ef7: 6a 6e push $0x6e jmp alltraps 80105ef9: e9 64 f7 ff ff jmp 80105662 <alltraps> 80105efe <vector111>: .globl vector111 vector111: pushl $0 80105efe: 6a 00 push $0x0 pushl $111 80105f00: 6a 6f push $0x6f jmp alltraps 80105f02: e9 5b f7 ff ff jmp 80105662 <alltraps> 80105f07 <vector112>: .globl vector112 vector112: pushl $0 80105f07: 6a 00 push $0x0 pushl $112 80105f09: 6a 70 push $0x70 jmp alltraps 80105f0b: e9 52 f7 ff ff jmp 80105662 <alltraps> 80105f10 <vector113>: .globl vector113 vector113: pushl $0 80105f10: 6a 00 push $0x0 pushl $113 80105f12: 6a 71 push $0x71 jmp alltraps 80105f14: e9 49 f7 ff ff jmp 80105662 <alltraps> 80105f19 <vector114>: .globl vector114 vector114: pushl $0 80105f19: 6a 00 push $0x0 pushl $114 80105f1b: 6a 72 push $0x72 jmp alltraps 80105f1d: e9 40 f7 ff ff jmp 80105662 <alltraps> 80105f22 <vector115>: .globl vector115 vector115: pushl $0 80105f22: 6a 00 push $0x0 pushl $115 80105f24: 6a 73 push $0x73 jmp alltraps 80105f26: e9 37 f7 ff ff jmp 80105662 <alltraps> 80105f2b <vector116>: .globl vector116 vector116: pushl $0 80105f2b: 6a 00 push $0x0 pushl $116 80105f2d: 6a 74 push $0x74 jmp alltraps 80105f2f: e9 2e f7 ff ff jmp 80105662 <alltraps> 80105f34 <vector117>: .globl vector117 vector117: pushl $0 80105f34: 6a 00 push $0x0 pushl $117 80105f36: 6a 75 push $0x75 jmp alltraps 80105f38: e9 25 f7 ff ff jmp 80105662 <alltraps> 80105f3d <vector118>: .globl vector118 vector118: pushl $0 80105f3d: 6a 00 push $0x0 pushl $118 80105f3f: 6a 76 push $0x76 jmp alltraps 80105f41: e9 1c f7 ff ff jmp 80105662 <alltraps> 80105f46 <vector119>: .globl vector119 vector119: pushl $0 80105f46: 6a 00 push $0x0 pushl $119 80105f48: 6a 77 push $0x77 jmp alltraps 80105f4a: e9 13 f7 ff ff jmp 80105662 <alltraps> 80105f4f <vector120>: .globl vector120 vector120: pushl $0 80105f4f: 6a 00 push $0x0 pushl $120 80105f51: 6a 78 push $0x78 jmp alltraps 80105f53: e9 0a f7 ff ff jmp 80105662 <alltraps> 80105f58 <vector121>: .globl vector121 vector121: pushl $0 80105f58: 6a 00 push $0x0 pushl $121 80105f5a: 6a 79 push $0x79 jmp alltraps 80105f5c: e9 01 f7 ff ff jmp 80105662 <alltraps> 80105f61 <vector122>: .globl vector122 vector122: pushl $0 80105f61: 6a 00 push $0x0 pushl $122 80105f63: 6a 7a push $0x7a jmp alltraps 80105f65: e9 f8 f6 ff ff jmp 80105662 <alltraps> 80105f6a <vector123>: .globl vector123 vector123: pushl $0 80105f6a: 6a 00 push $0x0 pushl $123 80105f6c: 6a 7b push $0x7b jmp alltraps 80105f6e: e9 ef f6 ff ff jmp 80105662 <alltraps> 80105f73 <vector124>: .globl vector124 vector124: pushl $0 80105f73: 6a 00 push $0x0 pushl $124 80105f75: 6a 7c push $0x7c jmp alltraps 80105f77: e9 e6 f6 ff ff jmp 80105662 <alltraps> 80105f7c <vector125>: .globl vector125 vector125: pushl $0 80105f7c: 6a 00 push $0x0 pushl $125 80105f7e: 6a 7d push $0x7d jmp alltraps 80105f80: e9 dd f6 ff ff jmp 80105662 <alltraps> 80105f85 <vector126>: .globl vector126 vector126: pushl $0 80105f85: 6a 00 push $0x0 pushl $126 80105f87: 6a 7e push $0x7e jmp alltraps 80105f89: e9 d4 f6 ff ff jmp 80105662 <alltraps> 80105f8e <vector127>: .globl vector127 vector127: pushl $0 80105f8e: 6a 00 push $0x0 pushl $127 80105f90: 6a 7f push $0x7f jmp alltraps 80105f92: e9 cb f6 ff ff jmp 80105662 <alltraps> 80105f97 <vector128>: .globl vector128 vector128: pushl $0 80105f97: 6a 00 push $0x0 pushl $128 80105f99: 68 80 00 00 00 push $0x80 jmp alltraps 80105f9e: e9 bf f6 ff ff jmp 80105662 <alltraps> 80105fa3 <vector129>: .globl vector129 vector129: pushl $0 80105fa3: 6a 00 push $0x0 pushl $129 80105fa5: 68 81 00 00 00 push $0x81 jmp alltraps 80105faa: e9 b3 f6 ff ff jmp 80105662 <alltraps> 80105faf <vector130>: .globl vector130 vector130: pushl $0 80105faf: 6a 00 push $0x0 pushl $130 80105fb1: 68 82 00 00 00 push $0x82 jmp alltraps 80105fb6: e9 a7 f6 ff ff jmp 80105662 <alltraps> 80105fbb <vector131>: .globl vector131 vector131: pushl $0 80105fbb: 6a 00 push $0x0 pushl $131 80105fbd: 68 83 00 00 00 push $0x83 jmp alltraps 80105fc2: e9 9b f6 ff ff jmp 80105662 <alltraps> 80105fc7 <vector132>: .globl vector132 vector132: pushl $0 80105fc7: 6a 00 push $0x0 pushl $132 80105fc9: 68 84 00 00 00 push $0x84 jmp alltraps 80105fce: e9 8f f6 ff ff jmp 80105662 <alltraps> 80105fd3 <vector133>: .globl vector133 vector133: pushl $0 80105fd3: 6a 00 push $0x0 pushl $133 80105fd5: 68 85 00 00 00 push $0x85 jmp alltraps 80105fda: e9 83 f6 ff ff jmp 80105662 <alltraps> 80105fdf <vector134>: .globl vector134 vector134: pushl $0 80105fdf: 6a 00 push $0x0 pushl $134 80105fe1: 68 86 00 00 00 push $0x86 jmp alltraps 80105fe6: e9 77 f6 ff ff jmp 80105662 <alltraps> 80105feb <vector135>: .globl vector135 vector135: pushl $0 80105feb: 6a 00 push $0x0 pushl $135 80105fed: 68 87 00 00 00 push $0x87 jmp alltraps 80105ff2: e9 6b f6 ff ff jmp 80105662 <alltraps> 80105ff7 <vector136>: .globl vector136 vector136: pushl $0 80105ff7: 6a 00 push $0x0 pushl $136 80105ff9: 68 88 00 00 00 push $0x88 jmp alltraps 80105ffe: e9 5f f6 ff ff jmp 80105662 <alltraps> 80106003 <vector137>: .globl vector137 vector137: pushl $0 80106003: 6a 00 push $0x0 pushl $137 80106005: 68 89 00 00 00 push $0x89 jmp alltraps 8010600a: e9 53 f6 ff ff jmp 80105662 <alltraps> 8010600f <vector138>: .globl vector138 vector138: pushl $0 8010600f: 6a 00 push $0x0 pushl $138 80106011: 68 8a 00 00 00 push $0x8a jmp alltraps 80106016: e9 47 f6 ff ff jmp 80105662 <alltraps> 8010601b <vector139>: .globl vector139 vector139: pushl $0 8010601b: 6a 00 push $0x0 pushl $139 8010601d: 68 8b 00 00 00 push $0x8b jmp alltraps 80106022: e9 3b f6 ff ff jmp 80105662 <alltraps> 80106027 <vector140>: .globl vector140 vector140: pushl $0 80106027: 6a 00 push $0x0 pushl $140 80106029: 68 8c 00 00 00 push $0x8c jmp alltraps 8010602e: e9 2f f6 ff ff jmp 80105662 <alltraps> 80106033 <vector141>: .globl vector141 vector141: pushl $0 80106033: 6a 00 push $0x0 pushl $141 80106035: 68 8d 00 00 00 push $0x8d jmp alltraps 8010603a: e9 23 f6 ff ff jmp 80105662 <alltraps> 8010603f <vector142>: .globl vector142 vector142: pushl $0 8010603f: 6a 00 push $0x0 pushl $142 80106041: 68 8e 00 00 00 push $0x8e jmp alltraps 80106046: e9 17 f6 ff ff jmp 80105662 <alltraps> 8010604b <vector143>: .globl vector143 vector143: pushl $0 8010604b: 6a 00 push $0x0 pushl $143 8010604d: 68 8f 00 00 00 push $0x8f jmp alltraps 80106052: e9 0b f6 ff ff jmp 80105662 <alltraps> 80106057 <vector144>: .globl vector144 vector144: pushl $0 80106057: 6a 00 push $0x0 pushl $144 80106059: 68 90 00 00 00 push $0x90 jmp alltraps 8010605e: e9 ff f5 ff ff jmp 80105662 <alltraps> 80106063 <vector145>: .globl vector145 vector145: pushl $0 80106063: 6a 00 push $0x0 pushl $145 80106065: 68 91 00 00 00 push $0x91 jmp alltraps 8010606a: e9 f3 f5 ff ff jmp 80105662 <alltraps> 8010606f <vector146>: .globl vector146 vector146: pushl $0 8010606f: 6a 00 push $0x0 pushl $146 80106071: 68 92 00 00 00 push $0x92 jmp alltraps 80106076: e9 e7 f5 ff ff jmp 80105662 <alltraps> 8010607b <vector147>: .globl vector147 vector147: pushl $0 8010607b: 6a 00 push $0x0 pushl $147 8010607d: 68 93 00 00 00 push $0x93 jmp alltraps 80106082: e9 db f5 ff ff jmp 80105662 <alltraps> 80106087 <vector148>: .globl vector148 vector148: pushl $0 80106087: 6a 00 push $0x0 pushl $148 80106089: 68 94 00 00 00 push $0x94 jmp alltraps 8010608e: e9 cf f5 ff ff jmp 80105662 <alltraps> 80106093 <vector149>: .globl vector149 vector149: pushl $0 80106093: 6a 00 push $0x0 pushl $149 80106095: 68 95 00 00 00 push $0x95 jmp alltraps 8010609a: e9 c3 f5 ff ff jmp 80105662 <alltraps> 8010609f <vector150>: .globl vector150 vector150: pushl $0 8010609f: 6a 00 push $0x0 pushl $150 801060a1: 68 96 00 00 00 push $0x96 jmp alltraps 801060a6: e9 b7 f5 ff ff jmp 80105662 <alltraps> 801060ab <vector151>: .globl vector151 vector151: pushl $0 801060ab: 6a 00 push $0x0 pushl $151 801060ad: 68 97 00 00 00 push $0x97 jmp alltraps 801060b2: e9 ab f5 ff ff jmp 80105662 <alltraps> 801060b7 <vector152>: .globl vector152 vector152: pushl $0 801060b7: 6a 00 push $0x0 pushl $152 801060b9: 68 98 00 00 00 push $0x98 jmp alltraps 801060be: e9 9f f5 ff ff jmp 80105662 <alltraps> 801060c3 <vector153>: .globl vector153 vector153: pushl $0 801060c3: 6a 00 push $0x0 pushl $153 801060c5: 68 99 00 00 00 push $0x99 jmp alltraps 801060ca: e9 93 f5 ff ff jmp 80105662 <alltraps> 801060cf <vector154>: .globl vector154 vector154: pushl $0 801060cf: 6a 00 push $0x0 pushl $154 801060d1: 68 9a 00 00 00 push $0x9a jmp alltraps 801060d6: e9 87 f5 ff ff jmp 80105662 <alltraps> 801060db <vector155>: .globl vector155 vector155: pushl $0 801060db: 6a 00 push $0x0 pushl $155 801060dd: 68 9b 00 00 00 push $0x9b jmp alltraps 801060e2: e9 7b f5 ff ff jmp 80105662 <alltraps> 801060e7 <vector156>: .globl vector156 vector156: pushl $0 801060e7: 6a 00 push $0x0 pushl $156 801060e9: 68 9c 00 00 00 push $0x9c jmp alltraps 801060ee: e9 6f f5 ff ff jmp 80105662 <alltraps> 801060f3 <vector157>: .globl vector157 vector157: pushl $0 801060f3: 6a 00 push $0x0 pushl $157 801060f5: 68 9d 00 00 00 push $0x9d jmp alltraps 801060fa: e9 63 f5 ff ff jmp 80105662 <alltraps> 801060ff <vector158>: .globl vector158 vector158: pushl $0 801060ff: 6a 00 push $0x0 pushl $158 80106101: 68 9e 00 00 00 push $0x9e jmp alltraps 80106106: e9 57 f5 ff ff jmp 80105662 <alltraps> 8010610b <vector159>: .globl vector159 vector159: pushl $0 8010610b: 6a 00 push $0x0 pushl $159 8010610d: 68 9f 00 00 00 push $0x9f jmp alltraps 80106112: e9 4b f5 ff ff jmp 80105662 <alltraps> 80106117 <vector160>: .globl vector160 vector160: pushl $0 80106117: 6a 00 push $0x0 pushl $160 80106119: 68 a0 00 00 00 push $0xa0 jmp alltraps 8010611e: e9 3f f5 ff ff jmp 80105662 <alltraps> 80106123 <vector161>: .globl vector161 vector161: pushl $0 80106123: 6a 00 push $0x0 pushl $161 80106125: 68 a1 00 00 00 push $0xa1 jmp alltraps 8010612a: e9 33 f5 ff ff jmp 80105662 <alltraps> 8010612f <vector162>: .globl vector162 vector162: pushl $0 8010612f: 6a 00 push $0x0 pushl $162 80106131: 68 a2 00 00 00 push $0xa2 jmp alltraps 80106136: e9 27 f5 ff ff jmp 80105662 <alltraps> 8010613b <vector163>: .globl vector163 vector163: pushl $0 8010613b: 6a 00 push $0x0 pushl $163 8010613d: 68 a3 00 00 00 push $0xa3 jmp alltraps 80106142: e9 1b f5 ff ff jmp 80105662 <alltraps> 80106147 <vector164>: .globl vector164 vector164: pushl $0 80106147: 6a 00 push $0x0 pushl $164 80106149: 68 a4 00 00 00 push $0xa4 jmp alltraps 8010614e: e9 0f f5 ff ff jmp 80105662 <alltraps> 80106153 <vector165>: .globl vector165 vector165: pushl $0 80106153: 6a 00 push $0x0 pushl $165 80106155: 68 a5 00 00 00 push $0xa5 jmp alltraps 8010615a: e9 03 f5 ff ff jmp 80105662 <alltraps> 8010615f <vector166>: .globl vector166 vector166: pushl $0 8010615f: 6a 00 push $0x0 pushl $166 80106161: 68 a6 00 00 00 push $0xa6 jmp alltraps 80106166: e9 f7 f4 ff ff jmp 80105662 <alltraps> 8010616b <vector167>: .globl vector167 vector167: pushl $0 8010616b: 6a 00 push $0x0 pushl $167 8010616d: 68 a7 00 00 00 push $0xa7 jmp alltraps 80106172: e9 eb f4 ff ff jmp 80105662 <alltraps> 80106177 <vector168>: .globl vector168 vector168: pushl $0 80106177: 6a 00 push $0x0 pushl $168 80106179: 68 a8 00 00 00 push $0xa8 jmp alltraps 8010617e: e9 df f4 ff ff jmp 80105662 <alltraps> 80106183 <vector169>: .globl vector169 vector169: pushl $0 80106183: 6a 00 push $0x0 pushl $169 80106185: 68 a9 00 00 00 push $0xa9 jmp alltraps 8010618a: e9 d3 f4 ff ff jmp 80105662 <alltraps> 8010618f <vector170>: .globl vector170 vector170: pushl $0 8010618f: 6a 00 push $0x0 pushl $170 80106191: 68 aa 00 00 00 push $0xaa jmp alltraps 80106196: e9 c7 f4 ff ff jmp 80105662 <alltraps> 8010619b <vector171>: .globl vector171 vector171: pushl $0 8010619b: 6a 00 push $0x0 pushl $171 8010619d: 68 ab 00 00 00 push $0xab jmp alltraps 801061a2: e9 bb f4 ff ff jmp 80105662 <alltraps> 801061a7 <vector172>: .globl vector172 vector172: pushl $0 801061a7: 6a 00 push $0x0 pushl $172 801061a9: 68 ac 00 00 00 push $0xac jmp alltraps 801061ae: e9 af f4 ff ff jmp 80105662 <alltraps> 801061b3 <vector173>: .globl vector173 vector173: pushl $0 801061b3: 6a 00 push $0x0 pushl $173 801061b5: 68 ad 00 00 00 push $0xad jmp alltraps 801061ba: e9 a3 f4 ff ff jmp 80105662 <alltraps> 801061bf <vector174>: .globl vector174 vector174: pushl $0 801061bf: 6a 00 push $0x0 pushl $174 801061c1: 68 ae 00 00 00 push $0xae jmp alltraps 801061c6: e9 97 f4 ff ff jmp 80105662 <alltraps> 801061cb <vector175>: .globl vector175 vector175: pushl $0 801061cb: 6a 00 push $0x0 pushl $175 801061cd: 68 af 00 00 00 push $0xaf jmp alltraps 801061d2: e9 8b f4 ff ff jmp 80105662 <alltraps> 801061d7 <vector176>: .globl vector176 vector176: pushl $0 801061d7: 6a 00 push $0x0 pushl $176 801061d9: 68 b0 00 00 00 push $0xb0 jmp alltraps 801061de: e9 7f f4 ff ff jmp 80105662 <alltraps> 801061e3 <vector177>: .globl vector177 vector177: pushl $0 801061e3: 6a 00 push $0x0 pushl $177 801061e5: 68 b1 00 00 00 push $0xb1 jmp alltraps 801061ea: e9 73 f4 ff ff jmp 80105662 <alltraps> 801061ef <vector178>: .globl vector178 vector178: pushl $0 801061ef: 6a 00 push $0x0 pushl $178 801061f1: 68 b2 00 00 00 push $0xb2 jmp alltraps 801061f6: e9 67 f4 ff ff jmp 80105662 <alltraps> 801061fb <vector179>: .globl vector179 vector179: pushl $0 801061fb: 6a 00 push $0x0 pushl $179 801061fd: 68 b3 00 00 00 push $0xb3 jmp alltraps 80106202: e9 5b f4 ff ff jmp 80105662 <alltraps> 80106207 <vector180>: .globl vector180 vector180: pushl $0 80106207: 6a 00 push $0x0 pushl $180 80106209: 68 b4 00 00 00 push $0xb4 jmp alltraps 8010620e: e9 4f f4 ff ff jmp 80105662 <alltraps> 80106213 <vector181>: .globl vector181 vector181: pushl $0 80106213: 6a 00 push $0x0 pushl $181 80106215: 68 b5 00 00 00 push $0xb5 jmp alltraps 8010621a: e9 43 f4 ff ff jmp 80105662 <alltraps> 8010621f <vector182>: .globl vector182 vector182: pushl $0 8010621f: 6a 00 push $0x0 pushl $182 80106221: 68 b6 00 00 00 push $0xb6 jmp alltraps 80106226: e9 37 f4 ff ff jmp 80105662 <alltraps> 8010622b <vector183>: .globl vector183 vector183: pushl $0 8010622b: 6a 00 push $0x0 pushl $183 8010622d: 68 b7 00 00 00 push $0xb7 jmp alltraps 80106232: e9 2b f4 ff ff jmp 80105662 <alltraps> 80106237 <vector184>: .globl vector184 vector184: pushl $0 80106237: 6a 00 push $0x0 pushl $184 80106239: 68 b8 00 00 00 push $0xb8 jmp alltraps 8010623e: e9 1f f4 ff ff jmp 80105662 <alltraps> 80106243 <vector185>: .globl vector185 vector185: pushl $0 80106243: 6a 00 push $0x0 pushl $185 80106245: 68 b9 00 00 00 push $0xb9 jmp alltraps 8010624a: e9 13 f4 ff ff jmp 80105662 <alltraps> 8010624f <vector186>: .globl vector186 vector186: pushl $0 8010624f: 6a 00 push $0x0 pushl $186 80106251: 68 ba 00 00 00 push $0xba jmp alltraps 80106256: e9 07 f4 ff ff jmp 80105662 <alltraps> 8010625b <vector187>: .globl vector187 vector187: pushl $0 8010625b: 6a 00 push $0x0 pushl $187 8010625d: 68 bb 00 00 00 push $0xbb jmp alltraps 80106262: e9 fb f3 ff ff jmp 80105662 <alltraps> 80106267 <vector188>: .globl vector188 vector188: pushl $0 80106267: 6a 00 push $0x0 pushl $188 80106269: 68 bc 00 00 00 push $0xbc jmp alltraps 8010626e: e9 ef f3 ff ff jmp 80105662 <alltraps> 80106273 <vector189>: .globl vector189 vector189: pushl $0 80106273: 6a 00 push $0x0 pushl $189 80106275: 68 bd 00 00 00 push $0xbd jmp alltraps 8010627a: e9 e3 f3 ff ff jmp 80105662 <alltraps> 8010627f <vector190>: .globl vector190 vector190: pushl $0 8010627f: 6a 00 push $0x0 pushl $190 80106281: 68 be 00 00 00 push $0xbe jmp alltraps 80106286: e9 d7 f3 ff ff jmp 80105662 <alltraps> 8010628b <vector191>: .globl vector191 vector191: pushl $0 8010628b: 6a 00 push $0x0 pushl $191 8010628d: 68 bf 00 00 00 push $0xbf jmp alltraps 80106292: e9 cb f3 ff ff jmp 80105662 <alltraps> 80106297 <vector192>: .globl vector192 vector192: pushl $0 80106297: 6a 00 push $0x0 pushl $192 80106299: 68 c0 00 00 00 push $0xc0 jmp alltraps 8010629e: e9 bf f3 ff ff jmp 80105662 <alltraps> 801062a3 <vector193>: .globl vector193 vector193: pushl $0 801062a3: 6a 00 push $0x0 pushl $193 801062a5: 68 c1 00 00 00 push $0xc1 jmp alltraps 801062aa: e9 b3 f3 ff ff jmp 80105662 <alltraps> 801062af <vector194>: .globl vector194 vector194: pushl $0 801062af: 6a 00 push $0x0 pushl $194 801062b1: 68 c2 00 00 00 push $0xc2 jmp alltraps 801062b6: e9 a7 f3 ff ff jmp 80105662 <alltraps> 801062bb <vector195>: .globl vector195 vector195: pushl $0 801062bb: 6a 00 push $0x0 pushl $195 801062bd: 68 c3 00 00 00 push $0xc3 jmp alltraps 801062c2: e9 9b f3 ff ff jmp 80105662 <alltraps> 801062c7 <vector196>: .globl vector196 vector196: pushl $0 801062c7: 6a 00 push $0x0 pushl $196 801062c9: 68 c4 00 00 00 push $0xc4 jmp alltraps 801062ce: e9 8f f3 ff ff jmp 80105662 <alltraps> 801062d3 <vector197>: .globl vector197 vector197: pushl $0 801062d3: 6a 00 push $0x0 pushl $197 801062d5: 68 c5 00 00 00 push $0xc5 jmp alltraps 801062da: e9 83 f3 ff ff jmp 80105662 <alltraps> 801062df <vector198>: .globl vector198 vector198: pushl $0 801062df: 6a 00 push $0x0 pushl $198 801062e1: 68 c6 00 00 00 push $0xc6 jmp alltraps 801062e6: e9 77 f3 ff ff jmp 80105662 <alltraps> 801062eb <vector199>: .globl vector199 vector199: pushl $0 801062eb: 6a 00 push $0x0 pushl $199 801062ed: 68 c7 00 00 00 push $0xc7 jmp alltraps 801062f2: e9 6b f3 ff ff jmp 80105662 <alltraps> 801062f7 <vector200>: .globl vector200 vector200: pushl $0 801062f7: 6a 00 push $0x0 pushl $200 801062f9: 68 c8 00 00 00 push $0xc8 jmp alltraps 801062fe: e9 5f f3 ff ff jmp 80105662 <alltraps> 80106303 <vector201>: .globl vector201 vector201: pushl $0 80106303: 6a 00 push $0x0 pushl $201 80106305: 68 c9 00 00 00 push $0xc9 jmp alltraps 8010630a: e9 53 f3 ff ff jmp 80105662 <alltraps> 8010630f <vector202>: .globl vector202 vector202: pushl $0 8010630f: 6a 00 push $0x0 pushl $202 80106311: 68 ca 00 00 00 push $0xca jmp alltraps 80106316: e9 47 f3 ff ff jmp 80105662 <alltraps> 8010631b <vector203>: .globl vector203 vector203: pushl $0 8010631b: 6a 00 push $0x0 pushl $203 8010631d: 68 cb 00 00 00 push $0xcb jmp alltraps 80106322: e9 3b f3 ff ff jmp 80105662 <alltraps> 80106327 <vector204>: .globl vector204 vector204: pushl $0 80106327: 6a 00 push $0x0 pushl $204 80106329: 68 cc 00 00 00 push $0xcc jmp alltraps 8010632e: e9 2f f3 ff ff jmp 80105662 <alltraps> 80106333 <vector205>: .globl vector205 vector205: pushl $0 80106333: 6a 00 push $0x0 pushl $205 80106335: 68 cd 00 00 00 push $0xcd jmp alltraps 8010633a: e9 23 f3 ff ff jmp 80105662 <alltraps> 8010633f <vector206>: .globl vector206 vector206: pushl $0 8010633f: 6a 00 push $0x0 pushl $206 80106341: 68 ce 00 00 00 push $0xce jmp alltraps 80106346: e9 17 f3 ff ff jmp 80105662 <alltraps> 8010634b <vector207>: .globl vector207 vector207: pushl $0 8010634b: 6a 00 push $0x0 pushl $207 8010634d: 68 cf 00 00 00 push $0xcf jmp alltraps 80106352: e9 0b f3 ff ff jmp 80105662 <alltraps> 80106357 <vector208>: .globl vector208 vector208: pushl $0 80106357: 6a 00 push $0x0 pushl $208 80106359: 68 d0 00 00 00 push $0xd0 jmp alltraps 8010635e: e9 ff f2 ff ff jmp 80105662 <alltraps> 80106363 <vector209>: .globl vector209 vector209: pushl $0 80106363: 6a 00 push $0x0 pushl $209 80106365: 68 d1 00 00 00 push $0xd1 jmp alltraps 8010636a: e9 f3 f2 ff ff jmp 80105662 <alltraps> 8010636f <vector210>: .globl vector210 vector210: pushl $0 8010636f: 6a 00 push $0x0 pushl $210 80106371: 68 d2 00 00 00 push $0xd2 jmp alltraps 80106376: e9 e7 f2 ff ff jmp 80105662 <alltraps> 8010637b <vector211>: .globl vector211 vector211: pushl $0 8010637b: 6a 00 push $0x0 pushl $211 8010637d: 68 d3 00 00 00 push $0xd3 jmp alltraps 80106382: e9 db f2 ff ff jmp 80105662 <alltraps> 80106387 <vector212>: .globl vector212 vector212: pushl $0 80106387: 6a 00 push $0x0 pushl $212 80106389: 68 d4 00 00 00 push $0xd4 jmp alltraps 8010638e: e9 cf f2 ff ff jmp 80105662 <alltraps> 80106393 <vector213>: .globl vector213 vector213: pushl $0 80106393: 6a 00 push $0x0 pushl $213 80106395: 68 d5 00 00 00 push $0xd5 jmp alltraps 8010639a: e9 c3 f2 ff ff jmp 80105662 <alltraps> 8010639f <vector214>: .globl vector214 vector214: pushl $0 8010639f: 6a 00 push $0x0 pushl $214 801063a1: 68 d6 00 00 00 push $0xd6 jmp alltraps 801063a6: e9 b7 f2 ff ff jmp 80105662 <alltraps> 801063ab <vector215>: .globl vector215 vector215: pushl $0 801063ab: 6a 00 push $0x0 pushl $215 801063ad: 68 d7 00 00 00 push $0xd7 jmp alltraps 801063b2: e9 ab f2 ff ff jmp 80105662 <alltraps> 801063b7 <vector216>: .globl vector216 vector216: pushl $0 801063b7: 6a 00 push $0x0 pushl $216 801063b9: 68 d8 00 00 00 push $0xd8 jmp alltraps 801063be: e9 9f f2 ff ff jmp 80105662 <alltraps> 801063c3 <vector217>: .globl vector217 vector217: pushl $0 801063c3: 6a 00 push $0x0 pushl $217 801063c5: 68 d9 00 00 00 push $0xd9 jmp alltraps 801063ca: e9 93 f2 ff ff jmp 80105662 <alltraps> 801063cf <vector218>: .globl vector218 vector218: pushl $0 801063cf: 6a 00 push $0x0 pushl $218 801063d1: 68 da 00 00 00 push $0xda jmp alltraps 801063d6: e9 87 f2 ff ff jmp 80105662 <alltraps> 801063db <vector219>: .globl vector219 vector219: pushl $0 801063db: 6a 00 push $0x0 pushl $219 801063dd: 68 db 00 00 00 push $0xdb jmp alltraps 801063e2: e9 7b f2 ff ff jmp 80105662 <alltraps> 801063e7 <vector220>: .globl vector220 vector220: pushl $0 801063e7: 6a 00 push $0x0 pushl $220 801063e9: 68 dc 00 00 00 push $0xdc jmp alltraps 801063ee: e9 6f f2 ff ff jmp 80105662 <alltraps> 801063f3 <vector221>: .globl vector221 vector221: pushl $0 801063f3: 6a 00 push $0x0 pushl $221 801063f5: 68 dd 00 00 00 push $0xdd jmp alltraps 801063fa: e9 63 f2 ff ff jmp 80105662 <alltraps> 801063ff <vector222>: .globl vector222 vector222: pushl $0 801063ff: 6a 00 push $0x0 pushl $222 80106401: 68 de 00 00 00 push $0xde jmp alltraps 80106406: e9 57 f2 ff ff jmp 80105662 <alltraps> 8010640b <vector223>: .globl vector223 vector223: pushl $0 8010640b: 6a 00 push $0x0 pushl $223 8010640d: 68 df 00 00 00 push $0xdf jmp alltraps 80106412: e9 4b f2 ff ff jmp 80105662 <alltraps> 80106417 <vector224>: .globl vector224 vector224: pushl $0 80106417: 6a 00 push $0x0 pushl $224 80106419: 68 e0 00 00 00 push $0xe0 jmp alltraps 8010641e: e9 3f f2 ff ff jmp 80105662 <alltraps> 80106423 <vector225>: .globl vector225 vector225: pushl $0 80106423: 6a 00 push $0x0 pushl $225 80106425: 68 e1 00 00 00 push $0xe1 jmp alltraps 8010642a: e9 33 f2 ff ff jmp 80105662 <alltraps> 8010642f <vector226>: .globl vector226 vector226: pushl $0 8010642f: 6a 00 push $0x0 pushl $226 80106431: 68 e2 00 00 00 push $0xe2 jmp alltraps 80106436: e9 27 f2 ff ff jmp 80105662 <alltraps> 8010643b <vector227>: .globl vector227 vector227: pushl $0 8010643b: 6a 00 push $0x0 pushl $227 8010643d: 68 e3 00 00 00 push $0xe3 jmp alltraps 80106442: e9 1b f2 ff ff jmp 80105662 <alltraps> 80106447 <vector228>: .globl vector228 vector228: pushl $0 80106447: 6a 00 push $0x0 pushl $228 80106449: 68 e4 00 00 00 push $0xe4 jmp alltraps 8010644e: e9 0f f2 ff ff jmp 80105662 <alltraps> 80106453 <vector229>: .globl vector229 vector229: pushl $0 80106453: 6a 00 push $0x0 pushl $229 80106455: 68 e5 00 00 00 push $0xe5 jmp alltraps 8010645a: e9 03 f2 ff ff jmp 80105662 <alltraps> 8010645f <vector230>: .globl vector230 vector230: pushl $0 8010645f: 6a 00 push $0x0 pushl $230 80106461: 68 e6 00 00 00 push $0xe6 jmp alltraps 80106466: e9 f7 f1 ff ff jmp 80105662 <alltraps> 8010646b <vector231>: .globl vector231 vector231: pushl $0 8010646b: 6a 00 push $0x0 pushl $231 8010646d: 68 e7 00 00 00 push $0xe7 jmp alltraps 80106472: e9 eb f1 ff ff jmp 80105662 <alltraps> 80106477 <vector232>: .globl vector232 vector232: pushl $0 80106477: 6a 00 push $0x0 pushl $232 80106479: 68 e8 00 00 00 push $0xe8 jmp alltraps 8010647e: e9 df f1 ff ff jmp 80105662 <alltraps> 80106483 <vector233>: .globl vector233 vector233: pushl $0 80106483: 6a 00 push $0x0 pushl $233 80106485: 68 e9 00 00 00 push $0xe9 jmp alltraps 8010648a: e9 d3 f1 ff ff jmp 80105662 <alltraps> 8010648f <vector234>: .globl vector234 vector234: pushl $0 8010648f: 6a 00 push $0x0 pushl $234 80106491: 68 ea 00 00 00 push $0xea jmp alltraps 80106496: e9 c7 f1 ff ff jmp 80105662 <alltraps> 8010649b <vector235>: .globl vector235 vector235: pushl $0 8010649b: 6a 00 push $0x0 pushl $235 8010649d: 68 eb 00 00 00 push $0xeb jmp alltraps 801064a2: e9 bb f1 ff ff jmp 80105662 <alltraps> 801064a7 <vector236>: .globl vector236 vector236: pushl $0 801064a7: 6a 00 push $0x0 pushl $236 801064a9: 68 ec 00 00 00 push $0xec jmp alltraps 801064ae: e9 af f1 ff ff jmp 80105662 <alltraps> 801064b3 <vector237>: .globl vector237 vector237: pushl $0 801064b3: 6a 00 push $0x0 pushl $237 801064b5: 68 ed 00 00 00 push $0xed jmp alltraps 801064ba: e9 a3 f1 ff ff jmp 80105662 <alltraps> 801064bf <vector238>: .globl vector238 vector238: pushl $0 801064bf: 6a 00 push $0x0 pushl $238 801064c1: 68 ee 00 00 00 push $0xee jmp alltraps 801064c6: e9 97 f1 ff ff jmp 80105662 <alltraps> 801064cb <vector239>: .globl vector239 vector239: pushl $0 801064cb: 6a 00 push $0x0 pushl $239 801064cd: 68 ef 00 00 00 push $0xef jmp alltraps 801064d2: e9 8b f1 ff ff jmp 80105662 <alltraps> 801064d7 <vector240>: .globl vector240 vector240: pushl $0 801064d7: 6a 00 push $0x0 pushl $240 801064d9: 68 f0 00 00 00 push $0xf0 jmp alltraps 801064de: e9 7f f1 ff ff jmp 80105662 <alltraps> 801064e3 <vector241>: .globl vector241 vector241: pushl $0 801064e3: 6a 00 push $0x0 pushl $241 801064e5: 68 f1 00 00 00 push $0xf1 jmp alltraps 801064ea: e9 73 f1 ff ff jmp 80105662 <alltraps> 801064ef <vector242>: .globl vector242 vector242: pushl $0 801064ef: 6a 00 push $0x0 pushl $242 801064f1: 68 f2 00 00 00 push $0xf2 jmp alltraps 801064f6: e9 67 f1 ff ff jmp 80105662 <alltraps> 801064fb <vector243>: .globl vector243 vector243: pushl $0 801064fb: 6a 00 push $0x0 pushl $243 801064fd: 68 f3 00 00 00 push $0xf3 jmp alltraps 80106502: e9 5b f1 ff ff jmp 80105662 <alltraps> 80106507 <vector244>: .globl vector244 vector244: pushl $0 80106507: 6a 00 push $0x0 pushl $244 80106509: 68 f4 00 00 00 push $0xf4 jmp alltraps 8010650e: e9 4f f1 ff ff jmp 80105662 <alltraps> 80106513 <vector245>: .globl vector245 vector245: pushl $0 80106513: 6a 00 push $0x0 pushl $245 80106515: 68 f5 00 00 00 push $0xf5 jmp alltraps 8010651a: e9 43 f1 ff ff jmp 80105662 <alltraps> 8010651f <vector246>: .globl vector246 vector246: pushl $0 8010651f: 6a 00 push $0x0 pushl $246 80106521: 68 f6 00 00 00 push $0xf6 jmp alltraps 80106526: e9 37 f1 ff ff jmp 80105662 <alltraps> 8010652b <vector247>: .globl vector247 vector247: pushl $0 8010652b: 6a 00 push $0x0 pushl $247 8010652d: 68 f7 00 00 00 push $0xf7 jmp alltraps 80106532: e9 2b f1 ff ff jmp 80105662 <alltraps> 80106537 <vector248>: .globl vector248 vector248: pushl $0 80106537: 6a 00 push $0x0 pushl $248 80106539: 68 f8 00 00 00 push $0xf8 jmp alltraps 8010653e: e9 1f f1 ff ff jmp 80105662 <alltraps> 80106543 <vector249>: .globl vector249 vector249: pushl $0 80106543: 6a 00 push $0x0 pushl $249 80106545: 68 f9 00 00 00 push $0xf9 jmp alltraps 8010654a: e9 13 f1 ff ff jmp 80105662 <alltraps> 8010654f <vector250>: .globl vector250 vector250: pushl $0 8010654f: 6a 00 push $0x0 pushl $250 80106551: 68 fa 00 00 00 push $0xfa jmp alltraps 80106556: e9 07 f1 ff ff jmp 80105662 <alltraps> 8010655b <vector251>: .globl vector251 vector251: pushl $0 8010655b: 6a 00 push $0x0 pushl $251 8010655d: 68 fb 00 00 00 push $0xfb jmp alltraps 80106562: e9 fb f0 ff ff jmp 80105662 <alltraps> 80106567 <vector252>: .globl vector252 vector252: pushl $0 80106567: 6a 00 push $0x0 pushl $252 80106569: 68 fc 00 00 00 push $0xfc jmp alltraps 8010656e: e9 ef f0 ff ff jmp 80105662 <alltraps> 80106573 <vector253>: .globl vector253 vector253: pushl $0 80106573: 6a 00 push $0x0 pushl $253 80106575: 68 fd 00 00 00 push $0xfd jmp alltraps 8010657a: e9 e3 f0 ff ff jmp 80105662 <alltraps> 8010657f <vector254>: .globl vector254 vector254: pushl $0 8010657f: 6a 00 push $0x0 pushl $254 80106581: 68 fe 00 00 00 push $0xfe jmp alltraps 80106586: e9 d7 f0 ff ff jmp 80105662 <alltraps> 8010658b <vector255>: .globl vector255 vector255: pushl $0 8010658b: 6a 00 push $0x0 pushl $255 8010658d: 68 ff 00 00 00 push $0xff jmp alltraps 80106592: e9 cb f0 ff ff jmp 80105662 <alltraps> 80106597: 66 90 xchg %ax,%ax 80106599: 66 90 xchg %ax,%ax 8010659b: 66 90 xchg %ax,%ax 8010659d: 66 90 xchg %ax,%ax 8010659f: 90 nop 801065a0 <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) { 801065a0: 55 push %ebp 801065a1: 89 e5 mov %esp,%ebp 801065a3: 57 push %edi 801065a4: 56 push %esi 801065a5: 53 push %ebx 801065a6: 89 d3 mov %edx,%ebx pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; 801065a8: c1 ea 16 shr $0x16,%edx 801065ab: 8d 3c 90 lea (%eax,%edx,4),%edi // 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) { 801065ae: 83 ec 0c sub $0xc,%esp pde_t *pde; pte_t *pgtab; pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ 801065b1: 8b 07 mov (%edi),%eax 801065b3: a8 01 test $0x1,%al 801065b5: 74 29 je 801065e0 <walkpgdir+0x40> pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); 801065b7: 25 00 f0 ff ff and $0xfffff000,%eax 801065bc: 8d b0 00 00 00 80 lea -0x80000000(%eax),%esi // be further restricted by the permissions in the page table // entries, if necessary. *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; } return &pgtab[PTX(va)]; } 801065c2: 8d 65 f4 lea -0xc(%ebp),%esp // 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; } return &pgtab[PTX(va)]; 801065c5: c1 eb 0a shr $0xa,%ebx 801065c8: 81 e3 fc 0f 00 00 and $0xffc,%ebx 801065ce: 8d 04 1e lea (%esi,%ebx,1),%eax } 801065d1: 5b pop %ebx 801065d2: 5e pop %esi 801065d3: 5f pop %edi 801065d4: 5d pop %ebp 801065d5: c3 ret 801065d6: 8d 76 00 lea 0x0(%esi),%esi 801065d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) 801065e0: 85 c9 test %ecx,%ecx 801065e2: 74 2c je 80106610 <walkpgdir+0x70> 801065e4: e8 a7 be ff ff call 80102490 <kalloc> 801065e9: 85 c0 test %eax,%eax 801065eb: 89 c6 mov %eax,%esi 801065ed: 74 21 je 80106610 <walkpgdir+0x70> return 0; // Make sure all those PTE_P bits are zero. memset(pgtab, 0, PGSIZE); 801065ef: 83 ec 04 sub $0x4,%esp 801065f2: 68 00 10 00 00 push $0x1000 801065f7: 6a 00 push $0x0 801065f9: 50 push %eax 801065fa: e8 51 de ff ff call 80104450 <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; 801065ff: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax 80106605: 83 c4 10 add $0x10,%esp 80106608: 83 c8 07 or $0x7,%eax 8010660b: 89 07 mov %eax,(%edi) 8010660d: eb b3 jmp 801065c2 <walkpgdir+0x22> 8010660f: 90 nop } return &pgtab[PTX(va)]; } 80106610: 8d 65 f4 lea -0xc(%ebp),%esp pde = &pgdir[PDX(va)]; if(*pde & PTE_P){ pgtab = (pte_t*)P2V(PTE_ADDR(*pde)); } else { if(!alloc || (pgtab = (pte_t*)kalloc()) == 0) return 0; 80106613: 31 c0 xor %eax,%eax // be further restricted by the permissions in the page table // entries, if necessary. *pde = V2P(pgtab) | PTE_P | PTE_W | PTE_U; } return &pgtab[PTX(va)]; } 80106615: 5b pop %ebx 80106616: 5e pop %esi 80106617: 5f pop %edi 80106618: 5d pop %ebp 80106619: c3 ret 8010661a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106620 <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) { 80106620: 55 push %ebp 80106621: 89 e5 mov %esp,%ebp 80106623: 57 push %edi 80106624: 56 push %esi 80106625: 53 push %ebx char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); 80106626: 89 d3 mov %edx,%ebx 80106628: 81 e3 00 f0 ff ff and $0xfffff000,%ebx // 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) { 8010662e: 83 ec 1c sub $0x1c,%esp 80106631: 89 45 e4 mov %eax,-0x1c(%ebp) char *a, *last; pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); 80106634: 8d 44 0a ff lea -0x1(%edx,%ecx,1),%eax 80106638: 8b 7d 08 mov 0x8(%ebp),%edi 8010663b: 25 00 f0 ff ff and $0xfffff000,%eax 80106640: 89 45 e0 mov %eax,-0x20(%ebp) for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; 80106643: 8b 45 0c mov 0xc(%ebp),%eax 80106646: 29 df sub %ebx,%edi 80106648: 83 c8 01 or $0x1,%eax 8010664b: 89 45 dc mov %eax,-0x24(%ebp) 8010664e: eb 15 jmp 80106665 <mappages+0x45> a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) 80106650: f6 00 01 testb $0x1,(%eax) 80106653: 75 45 jne 8010669a <mappages+0x7a> panic("remap"); *pte = pa | perm | PTE_P; 80106655: 0b 75 dc or -0x24(%ebp),%esi if(a == last) 80106658: 3b 5d e0 cmp -0x20(%ebp),%ebx for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); *pte = pa | perm | PTE_P; 8010665b: 89 30 mov %esi,(%eax) if(a == last) 8010665d: 74 31 je 80106690 <mappages+0x70> break; a += PGSIZE; 8010665f: 81 c3 00 10 00 00 add $0x1000,%ebx pte_t *pte; a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) 80106665: 8b 45 e4 mov -0x1c(%ebp),%eax 80106668: b9 01 00 00 00 mov $0x1,%ecx 8010666d: 89 da mov %ebx,%edx 8010666f: 8d 34 3b lea (%ebx,%edi,1),%esi 80106672: e8 29 ff ff ff call 801065a0 <walkpgdir> 80106677: 85 c0 test %eax,%eax 80106679: 75 d5 jne 80106650 <mappages+0x30> break; a += PGSIZE; pa += PGSIZE; } return 0; } 8010667b: 8d 65 f4 lea -0xc(%ebp),%esp a = (char*)PGROUNDDOWN((uint)va); last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; 8010667e: b8 ff ff ff ff mov $0xffffffff,%eax break; a += PGSIZE; pa += PGSIZE; } return 0; } 80106683: 5b pop %ebx 80106684: 5e pop %esi 80106685: 5f pop %edi 80106686: 5d pop %ebp 80106687: c3 ret 80106688: 90 nop 80106689: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106690: 8d 65 f4 lea -0xc(%ebp),%esp if(a == last) break; a += PGSIZE; pa += PGSIZE; } return 0; 80106693: 31 c0 xor %eax,%eax } 80106695: 5b pop %ebx 80106696: 5e pop %esi 80106697: 5f pop %edi 80106698: 5d pop %ebp 80106699: c3 ret last = (char*)PGROUNDDOWN(((uint)va) + size - 1); for(;;){ if((pte = walkpgdir(pgdir, a, 1)) == 0) return -1; if(*pte & PTE_P) panic("remap"); 8010669a: 83 ec 0c sub $0xc,%esp 8010669d: 68 2c 78 10 80 push $0x8010782c 801066a2: e8 c9 9c ff ff call 80100370 <panic> 801066a7: 89 f6 mov %esi,%esi 801066a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 801066b0 <deallocuvm.part.0>: // Deallocate user pages to bring the process size from oldsz to // 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) 801066b0: 55 push %ebp 801066b1: 89 e5 mov %esp,%ebp 801066b3: 57 push %edi 801066b4: 56 push %esi 801066b5: 53 push %ebx uint a, pa; if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); 801066b6: 8d 99 ff 0f 00 00 lea 0xfff(%ecx),%ebx // Deallocate user pages to bring the process size from oldsz to // 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) 801066bc: 89 c7 mov %eax,%edi uint a, pa; if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); 801066be: 81 e3 00 f0 ff ff and $0xfffff000,%ebx // Deallocate user pages to bring the process size from oldsz to // 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) 801066c4: 83 ec 1c sub $0x1c,%esp 801066c7: 89 4d e0 mov %ecx,-0x20(%ebp) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 801066ca: 39 d3 cmp %edx,%ebx 801066cc: 73 66 jae 80106734 <deallocuvm.part.0+0x84> 801066ce: 89 d6 mov %edx,%esi 801066d0: eb 3d jmp 8010670f <deallocuvm.part.0+0x5f> 801066d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi pte = walkpgdir(pgdir, (char*)a, 0); if(!pte) a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; else if((*pte & PTE_P) != 0){ 801066d8: 8b 10 mov (%eax),%edx 801066da: f6 c2 01 test $0x1,%dl 801066dd: 74 26 je 80106705 <deallocuvm.part.0+0x55> pa = PTE_ADDR(*pte); if(pa == 0) 801066df: 81 e2 00 f0 ff ff and $0xfffff000,%edx 801066e5: 74 58 je 8010673f <deallocuvm.part.0+0x8f> panic("kfree"); char *v = P2V(pa); kfree(v); 801066e7: 83 ec 0c sub $0xc,%esp 801066ea: 81 c2 00 00 00 80 add $0x80000000,%edx 801066f0: 89 45 e4 mov %eax,-0x1c(%ebp) 801066f3: 52 push %edx 801066f4: e8 e7 bb ff ff call 801022e0 <kfree> *pte = 0; 801066f9: 8b 45 e4 mov -0x1c(%ebp),%eax 801066fc: 83 c4 10 add $0x10,%esp 801066ff: c7 00 00 00 00 00 movl $0x0,(%eax) if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 80106705: 81 c3 00 10 00 00 add $0x1000,%ebx 8010670b: 39 f3 cmp %esi,%ebx 8010670d: 73 25 jae 80106734 <deallocuvm.part.0+0x84> pte = walkpgdir(pgdir, (char*)a, 0); 8010670f: 31 c9 xor %ecx,%ecx 80106711: 89 da mov %ebx,%edx 80106713: 89 f8 mov %edi,%eax 80106715: e8 86 fe ff ff call 801065a0 <walkpgdir> if(!pte) 8010671a: 85 c0 test %eax,%eax 8010671c: 75 ba jne 801066d8 <deallocuvm.part.0+0x28> a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; 8010671e: 81 e3 00 00 c0 ff and $0xffc00000,%ebx 80106724: 81 c3 00 f0 3f 00 add $0x3ff000,%ebx if(newsz >= oldsz) return oldsz; a = PGROUNDUP(newsz); for(; a < oldsz; a += PGSIZE){ 8010672a: 81 c3 00 10 00 00 add $0x1000,%ebx 80106730: 39 f3 cmp %esi,%ebx 80106732: 72 db jb 8010670f <deallocuvm.part.0+0x5f> kfree(v); *pte = 0; } } return newsz; } 80106734: 8b 45 e0 mov -0x20(%ebp),%eax 80106737: 8d 65 f4 lea -0xc(%ebp),%esp 8010673a: 5b pop %ebx 8010673b: 5e pop %esi 8010673c: 5f pop %edi 8010673d: 5d pop %ebp 8010673e: c3 ret if(!pte) a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE; else if((*pte & PTE_P) != 0){ pa = PTE_ADDR(*pte); if(pa == 0) panic("kfree"); 8010673f: 83 ec 0c sub $0xc,%esp 80106742: 68 86 71 10 80 push $0x80107186 80106747: e8 24 9c ff ff call 80100370 <panic> 8010674c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106750 <seginit>: // Set up CPU's kernel segment descriptors. // Run once on entry on each CPU. void seginit(void) { 80106750: 55 push %ebp 80106751: 89 e5 mov %esp,%ebp 80106753: 83 ec 18 sub $0x18,%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[cpuid()]; 80106756: e8 05 d0 ff ff call 80103760 <cpuid> c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 8010675b: 69 c0 b0 00 00 00 imul $0xb0,%eax,%eax 80106761: 31 c9 xor %ecx,%ecx 80106763: ba ff ff ff ff mov $0xffffffff,%edx 80106768: 66 89 90 f8 27 11 80 mov %dx,-0x7feed808(%eax) 8010676f: 66 89 88 fa 27 11 80 mov %cx,-0x7feed806(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 80106776: ba ff ff ff ff mov $0xffffffff,%edx 8010677b: 31 c9 xor %ecx,%ecx 8010677d: 66 89 90 00 28 11 80 mov %dx,-0x7feed800(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 80106784: ba ff ff ff ff mov $0xffffffff,%edx // 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[cpuid()]; c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 80106789: 66 89 88 02 28 11 80 mov %cx,-0x7feed7fe(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 80106790: 31 c9 xor %ecx,%ecx 80106792: 66 89 90 08 28 11 80 mov %dx,-0x7feed7f8(%eax) 80106799: 66 89 88 0a 28 11 80 mov %cx,-0x7feed7f6(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 801067a0: ba ff ff ff ff mov $0xffffffff,%edx 801067a5: 31 c9 xor %ecx,%ecx 801067a7: 66 89 90 10 28 11 80 mov %dx,-0x7feed7f0(%eax) // 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[cpuid()]; c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0); 801067ae: c6 80 fc 27 11 80 00 movb $0x0,-0x7feed804(%eax) static inline void lgdt(struct segdesc *p, int size) { volatile ushort pd[3]; pd[0] = size-1; 801067b5: ba 2f 00 00 00 mov $0x2f,%edx 801067ba: c6 80 fd 27 11 80 9a movb $0x9a,-0x7feed803(%eax) 801067c1: c6 80 fe 27 11 80 cf movb $0xcf,-0x7feed802(%eax) 801067c8: c6 80 ff 27 11 80 00 movb $0x0,-0x7feed801(%eax) c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0); 801067cf: c6 80 04 28 11 80 00 movb $0x0,-0x7feed7fc(%eax) 801067d6: c6 80 05 28 11 80 92 movb $0x92,-0x7feed7fb(%eax) 801067dd: c6 80 06 28 11 80 cf movb $0xcf,-0x7feed7fa(%eax) 801067e4: c6 80 07 28 11 80 00 movb $0x0,-0x7feed7f9(%eax) c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER); 801067eb: c6 80 0c 28 11 80 00 movb $0x0,-0x7feed7f4(%eax) 801067f2: c6 80 0d 28 11 80 fa movb $0xfa,-0x7feed7f3(%eax) 801067f9: c6 80 0e 28 11 80 cf movb $0xcf,-0x7feed7f2(%eax) 80106800: c6 80 0f 28 11 80 00 movb $0x0,-0x7feed7f1(%eax) c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER); 80106807: 66 89 88 12 28 11 80 mov %cx,-0x7feed7ee(%eax) 8010680e: c6 80 14 28 11 80 00 movb $0x0,-0x7feed7ec(%eax) 80106815: c6 80 15 28 11 80 f2 movb $0xf2,-0x7feed7eb(%eax) 8010681c: c6 80 16 28 11 80 cf movb $0xcf,-0x7feed7ea(%eax) 80106823: c6 80 17 28 11 80 00 movb $0x0,-0x7feed7e9(%eax) lgdt(c->gdt, sizeof(c->gdt)); 8010682a: 05 f0 27 11 80 add $0x801127f0,%eax 8010682f: 66 89 55 f2 mov %dx,-0xe(%ebp) pd[1] = (uint)p; 80106833: 66 89 45 f4 mov %ax,-0xc(%ebp) pd[2] = (uint)p >> 16; 80106837: c1 e8 10 shr $0x10,%eax 8010683a: 66 89 45 f6 mov %ax,-0xa(%ebp) asm volatile("lgdt (%0)" : : "r" (pd)); 8010683e: 8d 45 f2 lea -0xe(%ebp),%eax 80106841: 0f 01 10 lgdtl (%eax) } 80106844: c9 leave 80106845: c3 ret 80106846: 8d 76 00 lea 0x0(%esi),%esi 80106849: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106850 <switchkvm>: } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); 80106850: a1 a4 54 11 80 mov 0x801154a4,%eax // Switch h/w page table register to the kernel-only page table, // for when no process is running. void switchkvm(void) { 80106855: 55 push %ebp 80106856: 89 e5 mov %esp,%ebp 80106858: 05 00 00 00 80 add $0x80000000,%eax 8010685d: 0f 22 d8 mov %eax,%cr3 lcr3(V2P(kpgdir)); // switch to the kernel page table } 80106860: 5d pop %ebp 80106861: c3 ret 80106862: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106869: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106870 <switchuvm>: // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { 80106870: 55 push %ebp 80106871: 89 e5 mov %esp,%ebp 80106873: 57 push %edi 80106874: 56 push %esi 80106875: 53 push %ebx 80106876: 83 ec 1c sub $0x1c,%esp 80106879: 8b 75 08 mov 0x8(%ebp),%esi if(p == 0) 8010687c: 85 f6 test %esi,%esi 8010687e: 0f 84 cd 00 00 00 je 80106951 <switchuvm+0xe1> panic("switchuvm: no process"); if(p->kstack == 0) 80106884: 8b 46 08 mov 0x8(%esi),%eax 80106887: 85 c0 test %eax,%eax 80106889: 0f 84 dc 00 00 00 je 8010696b <switchuvm+0xfb> panic("switchuvm: no kstack"); if(p->pgdir == 0) 8010688f: 8b 7e 04 mov 0x4(%esi),%edi 80106892: 85 ff test %edi,%edi 80106894: 0f 84 c4 00 00 00 je 8010695e <switchuvm+0xee> panic("switchuvm: no pgdir"); pushcli(); 8010689a: e8 d1 d9 ff ff call 80104270 <pushcli> mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, 8010689f: e8 3c ce ff ff call 801036e0 <mycpu> 801068a4: 89 c3 mov %eax,%ebx 801068a6: e8 35 ce ff ff call 801036e0 <mycpu> 801068ab: 89 c7 mov %eax,%edi 801068ad: e8 2e ce ff ff call 801036e0 <mycpu> 801068b2: 89 45 e4 mov %eax,-0x1c(%ebp) 801068b5: 83 c7 08 add $0x8,%edi 801068b8: e8 23 ce ff ff call 801036e0 <mycpu> 801068bd: 8b 4d e4 mov -0x1c(%ebp),%ecx 801068c0: 83 c0 08 add $0x8,%eax 801068c3: ba 67 00 00 00 mov $0x67,%edx 801068c8: c1 e8 18 shr $0x18,%eax 801068cb: 66 89 93 98 00 00 00 mov %dx,0x98(%ebx) 801068d2: 66 89 bb 9a 00 00 00 mov %di,0x9a(%ebx) 801068d9: c6 83 9d 00 00 00 99 movb $0x99,0x9d(%ebx) 801068e0: c6 83 9e 00 00 00 40 movb $0x40,0x9e(%ebx) 801068e7: 83 c1 08 add $0x8,%ecx 801068ea: 88 83 9f 00 00 00 mov %al,0x9f(%ebx) 801068f0: c1 e9 10 shr $0x10,%ecx 801068f3: 88 8b 9c 00 00 00 mov %cl,0x9c(%ebx) mycpu()->gdt[SEG_TSS].s = 0; mycpu()->ts.ss0 = SEG_KDATA << 3; mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; 801068f9: bb ff ff ff ff mov $0xffffffff,%ebx panic("switchuvm: no pgdir"); pushcli(); mycpu()->gdt[SEG_TSS] = SEG16(STS_T32A, &mycpu()->ts, sizeof(mycpu()->ts)-1, 0); mycpu()->gdt[SEG_TSS].s = 0; 801068fe: e8 dd cd ff ff call 801036e0 <mycpu> 80106903: 80 a0 9d 00 00 00 ef andb $0xef,0x9d(%eax) mycpu()->ts.ss0 = SEG_KDATA << 3; 8010690a: e8 d1 cd ff ff call 801036e0 <mycpu> 8010690f: b9 10 00 00 00 mov $0x10,%ecx 80106914: 66 89 48 10 mov %cx,0x10(%eax) mycpu()->ts.esp0 = (uint)p->kstack + KSTACKSIZE; 80106918: e8 c3 cd ff ff call 801036e0 <mycpu> 8010691d: 8b 56 08 mov 0x8(%esi),%edx 80106920: 8d 8a 00 10 00 00 lea 0x1000(%edx),%ecx 80106926: 89 48 0c mov %ecx,0xc(%eax) // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; 80106929: e8 b2 cd ff ff call 801036e0 <mycpu> 8010692e: 66 89 58 6e mov %bx,0x6e(%eax) } static inline void ltr(ushort sel) { asm volatile("ltr %0" : : "r" (sel)); 80106932: b8 28 00 00 00 mov $0x28,%eax 80106937: 0f 00 d8 ltr %ax } static inline void lcr3(uint val) { asm volatile("movl %0,%%cr3" : : "r" (val)); 8010693a: 8b 46 04 mov 0x4(%esi),%eax 8010693d: 05 00 00 00 80 add $0x80000000,%eax 80106942: 0f 22 d8 mov %eax,%cr3 ltr(SEG_TSS << 3); lcr3(V2P(p->pgdir)); // switch to process's address space popcli(); } 80106945: 8d 65 f4 lea -0xc(%ebp),%esp 80106948: 5b pop %ebx 80106949: 5e pop %esi 8010694a: 5f pop %edi 8010694b: 5d pop %ebp // setting IOPL=0 in eflags *and* iomb beyond the tss segment limit // forbids I/O instructions (e.g., inb and outb) from user space mycpu()->ts.iomb = (ushort) 0xFFFF; ltr(SEG_TSS << 3); lcr3(V2P(p->pgdir)); // switch to process's address space popcli(); 8010694c: e9 5f d9 ff ff jmp 801042b0 <popcli> // Switch TSS and h/w page table to correspond to process p. void switchuvm(struct proc *p) { if(p == 0) panic("switchuvm: no process"); 80106951: 83 ec 0c sub $0xc,%esp 80106954: 68 32 78 10 80 push $0x80107832 80106959: e8 12 9a ff ff call 80100370 <panic> if(p->kstack == 0) panic("switchuvm: no kstack"); if(p->pgdir == 0) panic("switchuvm: no pgdir"); 8010695e: 83 ec 0c sub $0xc,%esp 80106961: 68 5d 78 10 80 push $0x8010785d 80106966: e8 05 9a ff ff call 80100370 <panic> switchuvm(struct proc *p) { if(p == 0) panic("switchuvm: no process"); if(p->kstack == 0) panic("switchuvm: no kstack"); 8010696b: 83 ec 0c sub $0xc,%esp 8010696e: 68 48 78 10 80 push $0x80107848 80106973: e8 f8 99 ff ff call 80100370 <panic> 80106978: 90 nop 80106979: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106980 <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) { 80106980: 55 push %ebp 80106981: 89 e5 mov %esp,%ebp 80106983: 57 push %edi 80106984: 56 push %esi 80106985: 53 push %ebx 80106986: 83 ec 1c sub $0x1c,%esp 80106989: 8b 75 10 mov 0x10(%ebp),%esi 8010698c: 8b 45 08 mov 0x8(%ebp),%eax 8010698f: 8b 7d 0c mov 0xc(%ebp),%edi char *mem; if(sz >= PGSIZE) 80106992: 81 fe ff 0f 00 00 cmp $0xfff,%esi // Load the initcode into address 0 of pgdir. // sz must be less than a page. void inituvm(pde_t *pgdir, char *init, uint sz) { 80106998: 89 45 e4 mov %eax,-0x1c(%ebp) char *mem; if(sz >= PGSIZE) 8010699b: 77 49 ja 801069e6 <inituvm+0x66> panic("inituvm: more than a page"); mem = kalloc(); 8010699d: e8 ee ba ff ff call 80102490 <kalloc> memset(mem, 0, PGSIZE); 801069a2: 83 ec 04 sub $0x4,%esp { char *mem; if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); 801069a5: 89 c3 mov %eax,%ebx memset(mem, 0, PGSIZE); 801069a7: 68 00 10 00 00 push $0x1000 801069ac: 6a 00 push $0x0 801069ae: 50 push %eax 801069af: e8 9c da ff ff call 80104450 <memset> mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); 801069b4: 58 pop %eax 801069b5: 8d 83 00 00 00 80 lea -0x80000000(%ebx),%eax 801069bb: b9 00 10 00 00 mov $0x1000,%ecx 801069c0: 5a pop %edx 801069c1: 6a 06 push $0x6 801069c3: 50 push %eax 801069c4: 31 d2 xor %edx,%edx 801069c6: 8b 45 e4 mov -0x1c(%ebp),%eax 801069c9: e8 52 fc ff ff call 80106620 <mappages> memmove(mem, init, sz); 801069ce: 89 75 10 mov %esi,0x10(%ebp) 801069d1: 89 7d 0c mov %edi,0xc(%ebp) 801069d4: 83 c4 10 add $0x10,%esp 801069d7: 89 5d 08 mov %ebx,0x8(%ebp) } 801069da: 8d 65 f4 lea -0xc(%ebp),%esp 801069dd: 5b pop %ebx 801069de: 5e pop %esi 801069df: 5f pop %edi 801069e0: 5d pop %ebp if(sz >= PGSIZE) panic("inituvm: more than a page"); mem = kalloc(); memset(mem, 0, PGSIZE); mappages(pgdir, 0, PGSIZE, V2P(mem), PTE_W|PTE_U); memmove(mem, init, sz); 801069e1: e9 1a db ff ff jmp 80104500 <memmove> inituvm(pde_t *pgdir, char *init, uint sz) { char *mem; if(sz >= PGSIZE) panic("inituvm: more than a page"); 801069e6: 83 ec 0c sub $0xc,%esp 801069e9: 68 71 78 10 80 push $0x80107871 801069ee: e8 7d 99 ff ff call 80100370 <panic> 801069f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 801069f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106a00 <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) { 80106a00: 55 push %ebp 80106a01: 89 e5 mov %esp,%ebp 80106a03: 57 push %edi 80106a04: 56 push %esi 80106a05: 53 push %ebx 80106a06: 83 ec 0c sub $0xc,%esp uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) 80106a09: f7 45 0c ff 0f 00 00 testl $0xfff,0xc(%ebp) 80106a10: 0f 85 91 00 00 00 jne 80106aa7 <loaduvm+0xa7> panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ 80106a16: 8b 75 18 mov 0x18(%ebp),%esi 80106a19: 31 db xor %ebx,%ebx 80106a1b: 85 f6 test %esi,%esi 80106a1d: 75 1a jne 80106a39 <loaduvm+0x39> 80106a1f: eb 6f jmp 80106a90 <loaduvm+0x90> 80106a21: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106a28: 81 c3 00 10 00 00 add $0x1000,%ebx 80106a2e: 81 ee 00 10 00 00 sub $0x1000,%esi 80106a34: 39 5d 18 cmp %ebx,0x18(%ebp) 80106a37: 76 57 jbe 80106a90 <loaduvm+0x90> if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) 80106a39: 8b 55 0c mov 0xc(%ebp),%edx 80106a3c: 8b 45 08 mov 0x8(%ebp),%eax 80106a3f: 31 c9 xor %ecx,%ecx 80106a41: 01 da add %ebx,%edx 80106a43: e8 58 fb ff ff call 801065a0 <walkpgdir> 80106a48: 85 c0 test %eax,%eax 80106a4a: 74 4e je 80106a9a <loaduvm+0x9a> panic("loaduvm: address should exist"); pa = PTE_ADDR(*pte); 80106a4c: 8b 00 mov (%eax),%eax if(sz - i < PGSIZE) n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) 80106a4e: 8b 4d 14 mov 0x14(%ebp),%ecx panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) panic("loaduvm: address should exist"); pa = PTE_ADDR(*pte); if(sz - i < PGSIZE) 80106a51: bf 00 10 00 00 mov $0x1000,%edi if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) panic("loaduvm: address should exist"); pa = PTE_ADDR(*pte); 80106a56: 25 00 f0 ff ff and $0xfffff000,%eax if(sz - i < PGSIZE) 80106a5b: 81 fe ff 0f 00 00 cmp $0xfff,%esi 80106a61: 0f 46 fe cmovbe %esi,%edi n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) 80106a64: 01 d9 add %ebx,%ecx 80106a66: 05 00 00 00 80 add $0x80000000,%eax 80106a6b: 57 push %edi 80106a6c: 51 push %ecx 80106a6d: 50 push %eax 80106a6e: ff 75 10 pushl 0x10(%ebp) 80106a71: e8 da ae ff ff call 80101950 <readi> 80106a76: 83 c4 10 add $0x10,%esp 80106a79: 39 c7 cmp %eax,%edi 80106a7b: 74 ab je 80106a28 <loaduvm+0x28> return -1; } return 0; } 80106a7d: 8d 65 f4 lea -0xc(%ebp),%esp if(sz - i < PGSIZE) n = sz - i; else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) return -1; 80106a80: b8 ff ff ff ff mov $0xffffffff,%eax } return 0; } 80106a85: 5b pop %ebx 80106a86: 5e pop %esi 80106a87: 5f pop %edi 80106a88: 5d pop %ebp 80106a89: c3 ret 80106a8a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106a90: 8d 65 f4 lea -0xc(%ebp),%esp else n = PGSIZE; if(readi(ip, P2V(pa), offset+i, n) != n) return -1; } return 0; 80106a93: 31 c0 xor %eax,%eax } 80106a95: 5b pop %ebx 80106a96: 5e pop %esi 80106a97: 5f pop %edi 80106a98: 5d pop %ebp 80106a99: c3 ret if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, addr+i, 0)) == 0) panic("loaduvm: address should exist"); 80106a9a: 83 ec 0c sub $0xc,%esp 80106a9d: 68 8b 78 10 80 push $0x8010788b 80106aa2: e8 c9 98 ff ff call 80100370 <panic> { uint i, pa, n; pte_t *pte; if((uint) addr % PGSIZE != 0) panic("loaduvm: addr must be page aligned"); 80106aa7: 83 ec 0c sub $0xc,%esp 80106aaa: 68 2c 79 10 80 push $0x8010792c 80106aaf: e8 bc 98 ff ff call 80100370 <panic> 80106ab4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106aba: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80106ac0 <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) { 80106ac0: 55 push %ebp 80106ac1: 89 e5 mov %esp,%ebp 80106ac3: 57 push %edi 80106ac4: 56 push %esi 80106ac5: 53 push %ebx 80106ac6: 83 ec 0c sub $0xc,%esp 80106ac9: 8b 7d 10 mov 0x10(%ebp),%edi char *mem; uint a; if(newsz >= KERNBASE) 80106acc: 85 ff test %edi,%edi 80106ace: 0f 88 ca 00 00 00 js 80106b9e <allocuvm+0xde> return 0; if(newsz < oldsz) 80106ad4: 3b 7d 0c cmp 0xc(%ebp),%edi return oldsz; 80106ad7: 8b 45 0c mov 0xc(%ebp),%eax char *mem; uint a; if(newsz >= KERNBASE) return 0; if(newsz < oldsz) 80106ada: 0f 82 82 00 00 00 jb 80106b62 <allocuvm+0xa2> return oldsz; a = PGROUNDUP(oldsz); 80106ae0: 8d 98 ff 0f 00 00 lea 0xfff(%eax),%ebx 80106ae6: 81 e3 00 f0 ff ff and $0xfffff000,%ebx for(; a < newsz; a += PGSIZE){ 80106aec: 39 df cmp %ebx,%edi 80106aee: 77 43 ja 80106b33 <allocuvm+0x73> 80106af0: e9 bb 00 00 00 jmp 80106bb0 <allocuvm+0xf0> 80106af5: 8d 76 00 lea 0x0(%esi),%esi if(mem == 0){ cprintf("allocuvm out of memory\n"); deallocuvm(pgdir, newsz, oldsz); return 0; } memset(mem, 0, PGSIZE); 80106af8: 83 ec 04 sub $0x4,%esp 80106afb: 68 00 10 00 00 push $0x1000 80106b00: 6a 00 push $0x0 80106b02: 50 push %eax 80106b03: e8 48 d9 ff ff call 80104450 <memset> if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ 80106b08: 58 pop %eax 80106b09: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax 80106b0f: b9 00 10 00 00 mov $0x1000,%ecx 80106b14: 5a pop %edx 80106b15: 6a 06 push $0x6 80106b17: 50 push %eax 80106b18: 89 da mov %ebx,%edx 80106b1a: 8b 45 08 mov 0x8(%ebp),%eax 80106b1d: e8 fe fa ff ff call 80106620 <mappages> 80106b22: 83 c4 10 add $0x10,%esp 80106b25: 85 c0 test %eax,%eax 80106b27: 78 47 js 80106b70 <allocuvm+0xb0> return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 80106b29: 81 c3 00 10 00 00 add $0x1000,%ebx 80106b2f: 39 df cmp %ebx,%edi 80106b31: 76 7d jbe 80106bb0 <allocuvm+0xf0> mem = kalloc(); 80106b33: e8 58 b9 ff ff call 80102490 <kalloc> if(mem == 0){ 80106b38: 85 c0 test %eax,%eax if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ mem = kalloc(); 80106b3a: 89 c6 mov %eax,%esi if(mem == 0){ 80106b3c: 75 ba jne 80106af8 <allocuvm+0x38> cprintf("allocuvm out of memory\n"); 80106b3e: 83 ec 0c sub $0xc,%esp 80106b41: 68 a9 78 10 80 push $0x801078a9 80106b46: e8 15 9b ff ff call 80100660 <cprintf> deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { pte_t *pte; uint a, pa; if(newsz >= oldsz) 80106b4b: 83 c4 10 add $0x10,%esp 80106b4e: 3b 7d 0c cmp 0xc(%ebp),%edi 80106b51: 76 4b jbe 80106b9e <allocuvm+0xde> 80106b53: 8b 4d 0c mov 0xc(%ebp),%ecx 80106b56: 8b 45 08 mov 0x8(%ebp),%eax 80106b59: 89 fa mov %edi,%edx 80106b5b: e8 50 fb ff ff call 801066b0 <deallocuvm.part.0> for(; a < newsz; a += PGSIZE){ mem = kalloc(); if(mem == 0){ cprintf("allocuvm out of memory\n"); deallocuvm(pgdir, newsz, oldsz); return 0; 80106b60: 31 c0 xor %eax,%eax kfree(mem); return 0; } } return newsz; } 80106b62: 8d 65 f4 lea -0xc(%ebp),%esp 80106b65: 5b pop %ebx 80106b66: 5e pop %esi 80106b67: 5f pop %edi 80106b68: 5d pop %ebp 80106b69: c3 ret 80106b6a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi deallocuvm(pgdir, newsz, oldsz); return 0; } memset(mem, 0, PGSIZE); if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ cprintf("allocuvm out of memory (2)\n"); 80106b70: 83 ec 0c sub $0xc,%esp 80106b73: 68 c1 78 10 80 push $0x801078c1 80106b78: e8 e3 9a ff ff call 80100660 <cprintf> deallocuvm(pde_t *pgdir, uint oldsz, uint newsz) { pte_t *pte; uint a, pa; if(newsz >= oldsz) 80106b7d: 83 c4 10 add $0x10,%esp 80106b80: 3b 7d 0c cmp 0xc(%ebp),%edi 80106b83: 76 0d jbe 80106b92 <allocuvm+0xd2> 80106b85: 8b 4d 0c mov 0xc(%ebp),%ecx 80106b88: 8b 45 08 mov 0x8(%ebp),%eax 80106b8b: 89 fa mov %edi,%edx 80106b8d: e8 1e fb ff ff call 801066b0 <deallocuvm.part.0> } memset(mem, 0, PGSIZE); if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ cprintf("allocuvm out of memory (2)\n"); deallocuvm(pgdir, newsz, oldsz); kfree(mem); 80106b92: 83 ec 0c sub $0xc,%esp 80106b95: 56 push %esi 80106b96: e8 45 b7 ff ff call 801022e0 <kfree> return 0; 80106b9b: 83 c4 10 add $0x10,%esp } } return newsz; } 80106b9e: 8d 65 f4 lea -0xc(%ebp),%esp memset(mem, 0, PGSIZE); if(mappages(pgdir, (char*)a, PGSIZE, V2P(mem), PTE_W|PTE_U) < 0){ cprintf("allocuvm out of memory (2)\n"); deallocuvm(pgdir, newsz, oldsz); kfree(mem); return 0; 80106ba1: 31 c0 xor %eax,%eax } } return newsz; } 80106ba3: 5b pop %ebx 80106ba4: 5e pop %esi 80106ba5: 5f pop %edi 80106ba6: 5d pop %ebp 80106ba7: c3 ret 80106ba8: 90 nop 80106ba9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106bb0: 8d 65 f4 lea -0xc(%ebp),%esp return 0; if(newsz < oldsz) return oldsz; a = PGROUNDUP(oldsz); for(; a < newsz; a += PGSIZE){ 80106bb3: 89 f8 mov %edi,%eax kfree(mem); return 0; } } return newsz; } 80106bb5: 5b pop %ebx 80106bb6: 5e pop %esi 80106bb7: 5f pop %edi 80106bb8: 5d pop %ebp 80106bb9: c3 ret 80106bba: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106bc0 <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) { 80106bc0: 55 push %ebp 80106bc1: 89 e5 mov %esp,%ebp 80106bc3: 8b 55 0c mov 0xc(%ebp),%edx 80106bc6: 8b 4d 10 mov 0x10(%ebp),%ecx 80106bc9: 8b 45 08 mov 0x8(%ebp),%eax pte_t *pte; uint a, pa; if(newsz >= oldsz) 80106bcc: 39 d1 cmp %edx,%ecx 80106bce: 73 10 jae 80106be0 <deallocuvm+0x20> kfree(v); *pte = 0; } } return newsz; } 80106bd0: 5d pop %ebp 80106bd1: e9 da fa ff ff jmp 801066b0 <deallocuvm.part.0> 80106bd6: 8d 76 00 lea 0x0(%esi),%esi 80106bd9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106be0: 89 d0 mov %edx,%eax 80106be2: 5d pop %ebp 80106be3: c3 ret 80106be4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106bea: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80106bf0 <freevm>: // Free a page table and all the physical memory pages // in the user part. void freevm(pde_t *pgdir) { 80106bf0: 55 push %ebp 80106bf1: 89 e5 mov %esp,%ebp 80106bf3: 57 push %edi 80106bf4: 56 push %esi 80106bf5: 53 push %ebx 80106bf6: 83 ec 0c sub $0xc,%esp 80106bf9: 8b 75 08 mov 0x8(%ebp),%esi uint i; if(pgdir == 0) 80106bfc: 85 f6 test %esi,%esi 80106bfe: 74 59 je 80106c59 <freevm+0x69> 80106c00: 31 c9 xor %ecx,%ecx 80106c02: ba 00 00 00 80 mov $0x80000000,%edx 80106c07: 89 f0 mov %esi,%eax 80106c09: e8 a2 fa ff ff call 801066b0 <deallocuvm.part.0> 80106c0e: 89 f3 mov %esi,%ebx 80106c10: 8d be 00 10 00 00 lea 0x1000(%esi),%edi 80106c16: eb 0f jmp 80106c27 <freevm+0x37> 80106c18: 90 nop 80106c19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106c20: 83 c3 04 add $0x4,%ebx panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80106c23: 39 fb cmp %edi,%ebx 80106c25: 74 23 je 80106c4a <freevm+0x5a> if(pgdir[i] & PTE_P){ 80106c27: 8b 03 mov (%ebx),%eax 80106c29: a8 01 test $0x1,%al 80106c2b: 74 f3 je 80106c20 <freevm+0x30> char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); 80106c2d: 25 00 f0 ff ff and $0xfffff000,%eax 80106c32: 83 ec 0c sub $0xc,%esp 80106c35: 83 c3 04 add $0x4,%ebx 80106c38: 05 00 00 00 80 add $0x80000000,%eax 80106c3d: 50 push %eax 80106c3e: e8 9d b6 ff ff call 801022e0 <kfree> 80106c43: 83 c4 10 add $0x10,%esp uint i; if(pgdir == 0) panic("freevm: no pgdir"); deallocuvm(pgdir, KERNBASE, 0); for(i = 0; i < NPDENTRIES; i++){ 80106c46: 39 fb cmp %edi,%ebx 80106c48: 75 dd jne 80106c27 <freevm+0x37> if(pgdir[i] & PTE_P){ char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80106c4a: 89 75 08 mov %esi,0x8(%ebp) } 80106c4d: 8d 65 f4 lea -0xc(%ebp),%esp 80106c50: 5b pop %ebx 80106c51: 5e pop %esi 80106c52: 5f pop %edi 80106c53: 5d pop %ebp if(pgdir[i] & PTE_P){ char * v = P2V(PTE_ADDR(pgdir[i])); kfree(v); } } kfree((char*)pgdir); 80106c54: e9 87 b6 ff ff jmp 801022e0 <kfree> freevm(pde_t *pgdir) { uint i; if(pgdir == 0) panic("freevm: no pgdir"); 80106c59: 83 ec 0c sub $0xc,%esp 80106c5c: 68 dd 78 10 80 push $0x801078dd 80106c61: e8 0a 97 ff ff call 80100370 <panic> 80106c66: 8d 76 00 lea 0x0(%esi),%esi 80106c69: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 80106c70 <setupkvm>: }; // Set up kernel part of a page table. pde_t* setupkvm(void) { 80106c70: 55 push %ebp 80106c71: 89 e5 mov %esp,%ebp 80106c73: 56 push %esi 80106c74: 53 push %ebx pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) 80106c75: e8 16 b8 ff ff call 80102490 <kalloc> 80106c7a: 85 c0 test %eax,%eax 80106c7c: 74 6a je 80106ce8 <setupkvm+0x78> return 0; memset(pgdir, 0, PGSIZE); 80106c7e: 83 ec 04 sub $0x4,%esp 80106c81: 89 c6 mov %eax,%esi if (P2V(PHYSTOP) > (void*)DEVSPACE) panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) 80106c83: bb 20 a4 10 80 mov $0x8010a420,%ebx pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) return 0; memset(pgdir, 0, PGSIZE); 80106c88: 68 00 10 00 00 push $0x1000 80106c8d: 6a 00 push $0x0 80106c8f: 50 push %eax 80106c90: e8 bb d7 ff ff call 80104450 <memset> 80106c95: 83 c4 10 add $0x10,%esp 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, 80106c98: 8b 43 04 mov 0x4(%ebx),%eax 80106c9b: 8b 4b 08 mov 0x8(%ebx),%ecx 80106c9e: 83 ec 08 sub $0x8,%esp 80106ca1: 8b 13 mov (%ebx),%edx 80106ca3: ff 73 0c pushl 0xc(%ebx) 80106ca6: 50 push %eax 80106ca7: 29 c1 sub %eax,%ecx 80106ca9: 89 f0 mov %esi,%eax 80106cab: e8 70 f9 ff ff call 80106620 <mappages> 80106cb0: 83 c4 10 add $0x10,%esp 80106cb3: 85 c0 test %eax,%eax 80106cb5: 78 19 js 80106cd0 <setupkvm+0x60> 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++) 80106cb7: 83 c3 10 add $0x10,%ebx 80106cba: 81 fb 60 a4 10 80 cmp $0x8010a460,%ebx 80106cc0: 75 d6 jne 80106c98 <setupkvm+0x28> 80106cc2: 89 f0 mov %esi,%eax (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); return 0; } return pgdir; } 80106cc4: 8d 65 f8 lea -0x8(%ebp),%esp 80106cc7: 5b pop %ebx 80106cc8: 5e pop %esi 80106cc9: 5d pop %ebp 80106cca: c3 ret 80106ccb: 90 nop 80106ccc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 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, (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); 80106cd0: 83 ec 0c sub $0xc,%esp 80106cd3: 56 push %esi 80106cd4: e8 17 ff ff ff call 80106bf0 <freevm> return 0; 80106cd9: 83 c4 10 add $0x10,%esp } return pgdir; } 80106cdc: 8d 65 f8 lea -0x8(%ebp),%esp panic("PHYSTOP too high"); for(k = kmap; k < &kmap[NELEM(kmap)]; k++) if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start, k->perm) < 0) { freevm(pgdir); return 0; 80106cdf: 31 c0 xor %eax,%eax } return pgdir; } 80106ce1: 5b pop %ebx 80106ce2: 5e pop %esi 80106ce3: 5d pop %ebp 80106ce4: c3 ret 80106ce5: 8d 76 00 lea 0x0(%esi),%esi { pde_t *pgdir; struct kmap *k; if((pgdir = (pde_t*)kalloc()) == 0) return 0; 80106ce8: 31 c0 xor %eax,%eax 80106cea: eb d8 jmp 80106cc4 <setupkvm+0x54> 80106cec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106cf0 <kvmalloc>: // Allocate one page table for the machine for the kernel address // space for scheduler processes. void kvmalloc(void) { 80106cf0: 55 push %ebp 80106cf1: 89 e5 mov %esp,%ebp 80106cf3: 83 ec 08 sub $0x8,%esp kpgdir = setupkvm(); 80106cf6: e8 75 ff ff ff call 80106c70 <setupkvm> 80106cfb: a3 a4 54 11 80 mov %eax,0x801154a4 80106d00: 05 00 00 00 80 add $0x80000000,%eax 80106d05: 0f 22 d8 mov %eax,%cr3 switchkvm(); } 80106d08: c9 leave 80106d09: c3 ret 80106d0a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106d10 <clearpteu>: // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80106d10: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106d11: 31 c9 xor %ecx,%ecx // Clear PTE_U on a page. Used to create an inaccessible // page beneath the user stack. void clearpteu(pde_t *pgdir, char *uva) { 80106d13: 89 e5 mov %esp,%ebp 80106d15: 83 ec 08 sub $0x8,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106d18: 8b 55 0c mov 0xc(%ebp),%edx 80106d1b: 8b 45 08 mov 0x8(%ebp),%eax 80106d1e: e8 7d f8 ff ff call 801065a0 <walkpgdir> if(pte == 0) 80106d23: 85 c0 test %eax,%eax 80106d25: 74 05 je 80106d2c <clearpteu+0x1c> panic("clearpteu"); *pte &= ~PTE_U; 80106d27: 83 20 fb andl $0xfffffffb,(%eax) } 80106d2a: c9 leave 80106d2b: c3 ret { pte_t *pte; pte = walkpgdir(pgdir, uva, 0); if(pte == 0) panic("clearpteu"); 80106d2c: 83 ec 0c sub $0xc,%esp 80106d2f: 68 ee 78 10 80 push $0x801078ee 80106d34: e8 37 96 ff ff call 80100370 <panic> 80106d39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106d40 <copyuvm>: // Given a parent process's page table, create a copy // of it for a child. pde_t* copyuvm(pde_t *pgdir, uint sz) { 80106d40: 55 push %ebp 80106d41: 89 e5 mov %esp,%ebp 80106d43: 57 push %edi 80106d44: 56 push %esi 80106d45: 53 push %ebx 80106d46: 83 ec 1c sub $0x1c,%esp pde_t *d; pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) 80106d49: e8 22 ff ff ff call 80106c70 <setupkvm> 80106d4e: 85 c0 test %eax,%eax 80106d50: 89 45 e0 mov %eax,-0x20(%ebp) 80106d53: 0f 84 c5 00 00 00 je 80106e1e <copyuvm+0xde> return 0; for(i = 0; i < sz; i += PGSIZE){ 80106d59: 8b 4d 0c mov 0xc(%ebp),%ecx 80106d5c: 85 c9 test %ecx,%ecx 80106d5e: 0f 84 9c 00 00 00 je 80106e00 <copyuvm+0xc0> 80106d64: 31 ff xor %edi,%edi 80106d66: eb 4a jmp 80106db2 <copyuvm+0x72> 80106d68: 90 nop 80106d69: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); 80106d70: 83 ec 04 sub $0x4,%esp 80106d73: 81 c3 00 00 00 80 add $0x80000000,%ebx 80106d79: 68 00 10 00 00 push $0x1000 80106d7e: 53 push %ebx 80106d7f: 50 push %eax 80106d80: e8 7b d7 ff ff call 80104500 <memmove> if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { 80106d85: 58 pop %eax 80106d86: 8d 86 00 00 00 80 lea -0x80000000(%esi),%eax 80106d8c: b9 00 10 00 00 mov $0x1000,%ecx 80106d91: 5a pop %edx 80106d92: ff 75 e4 pushl -0x1c(%ebp) 80106d95: 50 push %eax 80106d96: 89 fa mov %edi,%edx 80106d98: 8b 45 e0 mov -0x20(%ebp),%eax 80106d9b: e8 80 f8 ff ff call 80106620 <mappages> 80106da0: 83 c4 10 add $0x10,%esp 80106da3: 85 c0 test %eax,%eax 80106da5: 78 69 js 80106e10 <copyuvm+0xd0> uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 80106da7: 81 c7 00 10 00 00 add $0x1000,%edi 80106dad: 39 7d 0c cmp %edi,0xc(%ebp) 80106db0: 76 4e jbe 80106e00 <copyuvm+0xc0> if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) 80106db2: 8b 45 08 mov 0x8(%ebp),%eax 80106db5: 31 c9 xor %ecx,%ecx 80106db7: 89 fa mov %edi,%edx 80106db9: e8 e2 f7 ff ff call 801065a0 <walkpgdir> 80106dbe: 85 c0 test %eax,%eax 80106dc0: 74 6d je 80106e2f <copyuvm+0xef> panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) 80106dc2: 8b 00 mov (%eax),%eax 80106dc4: a8 01 test $0x1,%al 80106dc6: 74 5a je 80106e22 <copyuvm+0xe2> panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); 80106dc8: 89 c3 mov %eax,%ebx flags = PTE_FLAGS(*pte); 80106dca: 25 ff 0f 00 00 and $0xfff,%eax for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); pa = PTE_ADDR(*pte); 80106dcf: 81 e3 00 f0 ff ff and $0xfffff000,%ebx flags = PTE_FLAGS(*pte); 80106dd5: 89 45 e4 mov %eax,-0x1c(%ebp) if((mem = kalloc()) == 0) 80106dd8: e8 b3 b6 ff ff call 80102490 <kalloc> 80106ddd: 85 c0 test %eax,%eax 80106ddf: 89 c6 mov %eax,%esi 80106de1: 75 8d jne 80106d70 <copyuvm+0x30> } } return d; bad: freevm(d); 80106de3: 83 ec 0c sub $0xc,%esp 80106de6: ff 75 e0 pushl -0x20(%ebp) 80106de9: e8 02 fe ff ff call 80106bf0 <freevm> return 0; 80106dee: 83 c4 10 add $0x10,%esp 80106df1: 31 c0 xor %eax,%eax } 80106df3: 8d 65 f4 lea -0xc(%ebp),%esp 80106df6: 5b pop %ebx 80106df7: 5e pop %esi 80106df8: 5f pop %edi 80106df9: 5d pop %ebp 80106dfa: c3 ret 80106dfb: 90 nop 80106dfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ 80106e00: 8b 45 e0 mov -0x20(%ebp),%eax return d; bad: freevm(d); return 0; } 80106e03: 8d 65 f4 lea -0xc(%ebp),%esp 80106e06: 5b pop %ebx 80106e07: 5e pop %esi 80106e08: 5f pop %edi 80106e09: 5d pop %ebp 80106e0a: c3 ret 80106e0b: 90 nop 80106e0c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi flags = PTE_FLAGS(*pte); if((mem = kalloc()) == 0) goto bad; memmove(mem, (char*)P2V(pa), PGSIZE); if(mappages(d, (void*)i, PGSIZE, V2P(mem), flags) < 0) { kfree(mem); 80106e10: 83 ec 0c sub $0xc,%esp 80106e13: 56 push %esi 80106e14: e8 c7 b4 ff ff call 801022e0 <kfree> goto bad; 80106e19: 83 c4 10 add $0x10,%esp 80106e1c: eb c5 jmp 80106de3 <copyuvm+0xa3> pte_t *pte; uint pa, i, flags; char *mem; if((d = setupkvm()) == 0) return 0; 80106e1e: 31 c0 xor %eax,%eax 80106e20: eb d1 jmp 80106df3 <copyuvm+0xb3> for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); if(!(*pte & PTE_P)) panic("copyuvm: page not present"); 80106e22: 83 ec 0c sub $0xc,%esp 80106e25: 68 12 79 10 80 push $0x80107912 80106e2a: e8 41 95 ff ff call 80100370 <panic> if((d = setupkvm()) == 0) return 0; for(i = 0; i < sz; i += PGSIZE){ if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0) panic("copyuvm: pte should exist"); 80106e2f: 83 ec 0c sub $0xc,%esp 80106e32: 68 f8 78 10 80 push $0x801078f8 80106e37: e8 34 95 ff ff call 80100370 <panic> 80106e3c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 80106e40 <uva2ka>: //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80106e40: 55 push %ebp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106e41: 31 c9 xor %ecx,%ecx //PAGEBREAK! // Map user virtual address to kernel address. char* uva2ka(pde_t *pgdir, char *uva) { 80106e43: 89 e5 mov %esp,%ebp 80106e45: 83 ec 08 sub $0x8,%esp pte_t *pte; pte = walkpgdir(pgdir, uva, 0); 80106e48: 8b 55 0c mov 0xc(%ebp),%edx 80106e4b: 8b 45 08 mov 0x8(%ebp),%eax 80106e4e: e8 4d f7 ff ff call 801065a0 <walkpgdir> if((*pte & PTE_P) == 0) 80106e53: 8b 00 mov (%eax),%eax return 0; if((*pte & PTE_U) == 0) 80106e55: 89 c2 mov %eax,%edx 80106e57: 83 e2 05 and $0x5,%edx 80106e5a: 83 fa 05 cmp $0x5,%edx 80106e5d: 75 11 jne 80106e70 <uva2ka+0x30> return 0; return (char*)P2V(PTE_ADDR(*pte)); 80106e5f: 25 00 f0 ff ff and $0xfffff000,%eax } 80106e64: c9 leave pte = walkpgdir(pgdir, uva, 0); if((*pte & PTE_P) == 0) return 0; if((*pte & PTE_U) == 0) return 0; return (char*)P2V(PTE_ADDR(*pte)); 80106e65: 05 00 00 00 80 add $0x80000000,%eax } 80106e6a: c3 ret 80106e6b: 90 nop 80106e6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi pte = walkpgdir(pgdir, uva, 0); if((*pte & PTE_P) == 0) return 0; if((*pte & PTE_U) == 0) return 0; 80106e70: 31 c0 xor %eax,%eax return (char*)P2V(PTE_ADDR(*pte)); } 80106e72: c9 leave 80106e73: c3 ret 80106e74: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 80106e7a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 80106e80 <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) { 80106e80: 55 push %ebp 80106e81: 89 e5 mov %esp,%ebp 80106e83: 57 push %edi 80106e84: 56 push %esi 80106e85: 53 push %ebx 80106e86: 83 ec 1c sub $0x1c,%esp 80106e89: 8b 5d 14 mov 0x14(%ebp),%ebx 80106e8c: 8b 55 0c mov 0xc(%ebp),%edx 80106e8f: 8b 7d 10 mov 0x10(%ebp),%edi char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80106e92: 85 db test %ebx,%ebx 80106e94: 75 40 jne 80106ed6 <copyout+0x56> 80106e96: eb 70 jmp 80106f08 <copyout+0x88> 80106e98: 90 nop 80106e99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if(pa0 == 0) return -1; n = PGSIZE - (va - va0); 80106ea0: 8b 55 e4 mov -0x1c(%ebp),%edx 80106ea3: 89 f1 mov %esi,%ecx 80106ea5: 29 d1 sub %edx,%ecx 80106ea7: 81 c1 00 10 00 00 add $0x1000,%ecx 80106ead: 39 d9 cmp %ebx,%ecx 80106eaf: 0f 47 cb cmova %ebx,%ecx if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); 80106eb2: 29 f2 sub %esi,%edx 80106eb4: 83 ec 04 sub $0x4,%esp 80106eb7: 01 d0 add %edx,%eax 80106eb9: 51 push %ecx 80106eba: 57 push %edi 80106ebb: 50 push %eax 80106ebc: 89 4d e4 mov %ecx,-0x1c(%ebp) 80106ebf: e8 3c d6 ff ff call 80104500 <memmove> len -= n; buf += n; 80106ec4: 8b 4d e4 mov -0x1c(%ebp),%ecx { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80106ec7: 83 c4 10 add $0x10,%esp if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; 80106eca: 8d 96 00 10 00 00 lea 0x1000(%esi),%edx n = PGSIZE - (va - va0); if(n > len) n = len; memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; 80106ed0: 01 cf add %ecx,%edi { char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ 80106ed2: 29 cb sub %ecx,%ebx 80106ed4: 74 32 je 80106f08 <copyout+0x88> va0 = (uint)PGROUNDDOWN(va); 80106ed6: 89 d6 mov %edx,%esi pa0 = uva2ka(pgdir, (char*)va0); 80106ed8: 83 ec 08 sub $0x8,%esp char *buf, *pa0; uint n, va0; buf = (char*)p; while(len > 0){ va0 = (uint)PGROUNDDOWN(va); 80106edb: 89 55 e4 mov %edx,-0x1c(%ebp) 80106ede: 81 e6 00 f0 ff ff and $0xfffff000,%esi pa0 = uva2ka(pgdir, (char*)va0); 80106ee4: 56 push %esi 80106ee5: ff 75 08 pushl 0x8(%ebp) 80106ee8: e8 53 ff ff ff call 80106e40 <uva2ka> if(pa0 == 0) 80106eed: 83 c4 10 add $0x10,%esp 80106ef0: 85 c0 test %eax,%eax 80106ef2: 75 ac jne 80106ea0 <copyout+0x20> len -= n; buf += n; va = va0 + PGSIZE; } return 0; } 80106ef4: 8d 65 f4 lea -0xc(%ebp),%esp buf = (char*)p; while(len > 0){ va0 = (uint)PGROUNDDOWN(va); pa0 = uva2ka(pgdir, (char*)va0); if(pa0 == 0) return -1; 80106ef7: b8 ff ff ff ff mov $0xffffffff,%eax len -= n; buf += n; va = va0 + PGSIZE; } return 0; } 80106efc: 5b pop %ebx 80106efd: 5e pop %esi 80106efe: 5f pop %edi 80106eff: 5d pop %ebp 80106f00: c3 ret 80106f01: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 80106f08: 8d 65 f4 lea -0xc(%ebp),%esp memmove(pa0 + (va - va0), buf, n); len -= n; buf += n; va = va0 + PGSIZE; } return 0; 80106f0b: 31 c0 xor %eax,%eax } 80106f0d: 5b pop %ebx 80106f0e: 5e pop %esi 80106f0f: 5f pop %edi 80106f10: 5d pop %ebp 80106f11: c3 ret
#define BOOST_TEST_MODULE "test_unlimited_cell_list" #ifdef BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> #else #include <boost/test/included/unit_test.hpp> #endif #include <mjolnir/util/empty.hpp> #include <mjolnir/util/logger.hpp> #include <mjolnir/util/range.hpp> #include <mjolnir/core/SimulatorTraits.hpp> #include <mjolnir/core/BoundaryCondition.hpp> #include <mjolnir/core/UnlimitedGridCellList.hpp> #include <mjolnir/core/System.hpp> #include <mjolnir/core/Topology.hpp> #include <numeric> #include <random> template<typename T> struct dummy_potential { using real_type = T; using parameter_type = mjolnir::empty_t; using pair_parameter_type = parameter_type; using topology_type = mjolnir::Topology; using molecule_id_type = typename topology_type::molecule_id_type; using connection_kind_type = typename topology_type::connection_kind_type; explicit dummy_potential(const real_type cutoff, const std::vector<std::size_t>& participants) : cutoff_(cutoff), participants_(participants) {} real_type max_cutoff_length() const noexcept {return this->cutoff_;} parameter_type prepare_params(std::size_t, std::size_t) const noexcept { return parameter_type{}; } bool is_ignored_molecule(std::size_t, std::size_t) const {return false;} bool is_ignored_group (std::string, std::string) const {return false;} std::vector<std::pair<connection_kind_type, std::size_t>> ignore_within() const { return std::vector<std::pair<connection_kind_type, std::size_t>>{}; } std::vector<std::size_t> const& participants() const noexcept { return this->participants_; } mjolnir::range<typename std::vector<std::size_t>::const_iterator> leading_participants() const noexcept { return mjolnir::make_range(participants_.begin(), std::prev(participants_.end())); } mjolnir::range<typename std::vector<std::size_t>::const_iterator> possible_partners_of(const std::size_t participant_idx, const std::size_t /*particle_idx*/) const noexcept { return mjolnir::make_range(participants_.begin() + participant_idx + 1, participants_.end()); } bool has_interaction(const std::size_t i, const std::size_t j) const noexcept { return (i < j); } std::string name() const {return "dummy potential";} real_type cutoff_; std::vector<std::size_t> participants_; }; BOOST_AUTO_TEST_CASE(test_CellList_UnlimitedBoundary) { mjolnir::LoggerManager::set_default_logger("test_cell_list.log"); using traits_type = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>; using real_type = typename traits_type::real_type; using boundary_type = typename traits_type::boundary_type; using coordinate_type = typename traits_type::coordinate_type; using potential_type = dummy_potential<real_type>; constexpr std::size_t N = 1000; constexpr double L = 10.0; constexpr double cutoff = 2.0; constexpr double margin = 0.25; // threshold = 2.0 * (1+0.25) = 2.5 constexpr double threshold = cutoff * (1.0 + margin); const auto distribute_particle = [](std::mt19937& mt, double l) -> coordinate_type { return coordinate_type( l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt) ); }; std::vector<std::size_t> participants(N); std::iota(participants.begin(), participants.end(), 0u); dummy_potential<real_type> pot(cutoff, participants); mjolnir::System<traits_type> sys(N, boundary_type{}); mjolnir::Topology topol(N); std::mt19937 mt(123456789); for(std::size_t i=0; i < N; ++i) { sys.at(i).mass = 1.0; sys.at(i).position = distribute_particle(mt, L); } topol.construct_molecules(); mjolnir::SpatialPartition<traits_type, potential_type> vlist(mjolnir::make_unique< mjolnir::UnlimitedGridCellList<traits_type, potential_type>>(margin)); using neighbor_type = typename decltype(vlist)::neighbor_type; BOOST_TEST(!vlist.valid()); vlist.initialize(sys, pot); vlist.make(sys, pot); BOOST_TEST(vlist.valid()); for(const auto i : pot.leading_participants()) { for(std::size_t j=i+1; j<N; ++j) { const auto partners = vlist.partners(i); if(std::find_if(partners.begin(), partners.end(), [=](const neighbor_type& elem) -> bool {return elem.index == j;} ) == partners.end()) { // should be enough distant (>= threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); BOOST_TEST(dist >= threshold); } else { // should be enough close (< threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); BOOST_TEST(dist < threshold); } } } } BOOST_AUTO_TEST_CASE(test_CellList_UnlimitedBoundary_partial) { mjolnir::LoggerManager::set_default_logger("test_cell_list.log"); using traits_type = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>; using real_type = typename traits_type::real_type; using boundary_type = typename traits_type::boundary_type; using coordinate_type = typename traits_type::coordinate_type; using potential_type = dummy_potential<real_type>; constexpr std::size_t N = 1000; constexpr double L = 10.0; constexpr double cutoff = 2.0; constexpr double margin = 0.25; // threshold = 2.0 * (1+0.25) = 2.5 constexpr double threshold = cutoff * (1.0 + margin); const auto distribute_particle = [](std::mt19937& mt, double l) -> coordinate_type { return coordinate_type( l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt) ); }; std::vector<std::size_t> participants(500); // [200 ... 699] std::iota(participants.begin(), participants.end(), 200u); dummy_potential<real_type> pot(cutoff, participants); mjolnir::System<traits_type> sys(N, boundary_type{}); mjolnir::Topology topol(N); std::mt19937 mt(123456789); for(std::size_t i=0; i < N; ++i) { sys.at(i).mass = 1.0; sys.at(i).position = distribute_particle(mt, L); } topol.construct_molecules(); mjolnir::SpatialPartition<traits_type, potential_type> vlist(mjolnir::make_unique< mjolnir::UnlimitedGridCellList<traits_type, potential_type>>(margin)); using neighbor_type = typename decltype(vlist)::neighbor_type; BOOST_TEST(!vlist.valid()); vlist.initialize(sys, pot); vlist.make(sys, pot); BOOST_TEST(vlist.valid()); for(const auto i : pot.leading_participants()) { const auto partners = vlist.partners(i); // if particle i is not related to the potential, it should not have // any interacting partners. if(pot.participants().end() == std::find( pot.participants().begin(), pot.participants().end(), i)) { BOOST_TEST(partners.size() == 0u); continue; } for(std::size_t j=i+1; j<N; ++j) { if(std::find_if(partners.begin(), partners.end(), [=](const neighbor_type& elem) -> bool {return elem.index == j;} ) == partners.end()) { // should be enough distant (>= threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); const bool enough_distant = dist >= threshold; // or not a participant const bool is_participant = pot.participants().end() != std::find( pot.participants().begin(), pot.participants().end(), j); const bool is_ok = enough_distant || (!is_participant); BOOST_TEST(is_ok); } else { // should be a participant const bool found = pot.participants().end() != std::find( pot.participants().begin(), pot.participants().end(), j); BOOST_TEST(found); // should be enough close (< threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); BOOST_TEST(dist < threshold); } } } } BOOST_AUTO_TEST_CASE(test_CellList_UnlimitedBoundary_partial_2) { mjolnir::LoggerManager::set_default_logger("test_cell_list.log"); using traits_type = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>; using real_type = typename traits_type::real_type; using boundary_type = typename traits_type::boundary_type; using coordinate_type = typename traits_type::coordinate_type; using potential_type = dummy_potential<real_type>; constexpr std::size_t N = 1000; constexpr double L = 10.0; constexpr double cutoff = 2.0; constexpr double margin = 0.25; // threshold = 2.0 * (1+0.25) = 2.5 constexpr double threshold = cutoff * (1.0 + margin); const auto distribute_particle = [](std::mt19937& mt, double l) -> coordinate_type { return coordinate_type( l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt), l * std::generate_canonical<real_type, std::numeric_limits<real_type>::digits>(mt) ); }; std::vector<std::size_t> participants; participants.reserve(500); for(std::size_t i=0; i<500; ++i) { participants.push_back(i*2); } dummy_potential<real_type> pot(cutoff, participants); mjolnir::System<traits_type> sys(N, boundary_type{}); mjolnir::Topology topol(N); std::mt19937 mt(123456789); for(std::size_t i=0; i < N; ++i) { sys.at(i).mass = 1.0; sys.at(i).position = distribute_particle(mt, L); } topol.construct_molecules(); mjolnir::SpatialPartition<traits_type, potential_type> vlist(mjolnir::make_unique< mjolnir::UnlimitedGridCellList<traits_type, potential_type>>(margin)); using neighbor_type = typename decltype(vlist)::neighbor_type; BOOST_TEST(!vlist.valid()); vlist.initialize(sys, pot); vlist.make(sys, pot); BOOST_TEST(vlist.valid()); for(const auto i : pot.leading_participants()) { const auto partners = vlist.partners(i); // if particle i is not related to the potential, it should not have // any interacting partners. if(pot.participants().end() == std::find( pot.participants().begin(), pot.participants().end(), i)) { BOOST_TEST(partners.size() == 0u); continue; } for(std::size_t j=i+1; j<N; ++j) { if(std::find_if(partners.begin(), partners.end(), [=](const neighbor_type& elem) -> bool {return elem.index == j;} ) == partners.end()) { // should be enough distant (>= threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); const bool enough_distant = dist >= threshold; // or not a participant const bool is_participant = pot.participants().end() != std::find( pot.participants().begin(), pot.participants().end(), j); const bool is_ok = enough_distant || (!is_participant); BOOST_TEST(is_ok); } else { // should be a participant const bool found = pot.participants().end() != std::find( pot.participants().begin(), pot.participants().end(), j); BOOST_TEST(found); // should be enough close (< threshold) const auto dist = mjolnir::math::length(sys.adjust_direction( sys.position(i), sys.position(j))); BOOST_TEST(dist < threshold); } } } } BOOST_AUTO_TEST_CASE(test_CellList_UnlimitedBoundary_clone) { mjolnir::LoggerManager::set_default_logger("test_cell_list.log"); using traits_type = mjolnir::SimulatorTraits<double, mjolnir::UnlimitedBoundary>; using real_type = typename traits_type::real_type; using potential_type = dummy_potential<real_type>; mjolnir::SpatialPartition<traits_type, potential_type> vlist(mjolnir::make_unique< mjolnir::UnlimitedGridCellList<traits_type, potential_type>>(10.0)); mjolnir::SpatialPartition<traits_type, potential_type> vlist2(vlist); BOOST_TEST(vlist.margin() == vlist2.margin()); }
; float tanh(float x) __z88dk_fastcall SECTION code_fp_math48 PUBLIC cm48_sdcciy_tanh_fastcall EXTERN cm48_sdcciyp_dx2m48, am48_tanh, cm48_sdcciyp_m482d cm48_sdcciy_tanh_fastcall: call cm48_sdcciyp_dx2m48 call am48_tanh jp cm48_sdcciyp_m482d
; A295513: a(n) = n*bil(n) - 2^bil(n) where bil(0) = 0 and bil(n) = floor(log_2(n)) + 1 for n>0. ; Submitted by Christian Krause ; -1,-1,0,2,4,7,10,13,16,20,24,28,32,36,40,44,48,53,58,63,68,73,78,83,88,93,98,103,108,113,118,123,128,134,140,146,152,158,164,170,176,182,188,194,200,206,212,218,224,230,236,242,248,254,260,266,272,278 mov $2,$0 lpb $2 add $1,$2 sub $1,1 mul $2,2 sub $2,$0 trn $2,1 lpe sub $1,1 mov $0,$1
; Z88 Small C+ Run Time Library ; Long functions ; SECTION code_crt0_sccz80 PUBLIC l_long_ne ; ; DEHL != secondary ; set carry if result true ; stack = secondary MSW, secondary LSW, ret .l_long_ne pop ix ; return address pop bc ; secondary LSW ld a,c cp l jp nz, notequal0 ld a,b cp h jp nz, notequal0 pop bc ; secondary MSW ld a,c cp e jp nz, notequal1 ld a,b cp d jr z, equal .notequal1 scf .equal jp (ix) .notequal0 pop bc ; clear secondary MSW from stack scf jp (ix) ; call l_long_cmp ; scf ; ret nz ; ccf ; dec hl ; ret
;------------------------------------------------------------------------------ ; ; Copyright (c) 2006, 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: ; ; ReadDs.Asm ; ; Abstract: ; ; AsmReadDs function ; ; Notes: ; ;------------------------------------------------------------------------------ .386 .model flat,C .code ;------------------------------------------------------------------------------ ; UINT16 ; EFIAPI ; AsmReadDs ( ; VOID ; ); ;------------------------------------------------------------------------------ AsmReadDs PROC mov eax, ds ret AsmReadDs ENDP END
; A028213: Expansion of 1/((1-6x)(1-8x)(1-10x)(1-11x)). ; Submitted by Christian Krause ; 1,35,773,13783,216909,3146703,43129381,567128471,7227535997,89900761951,1097000610069,13181200344039,156403487677165,1836701044549679,21383695384607237,247159815109688887 mov $1,1 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 seq $0,20979 ; Expansion of 1/((1-8*x)*(1-10*x)*(1-11*x)). sub $0,$1 mul $1,7 add $1,$0 lpe mov $0,$1
lw 0 1 five lw 1 2 3 start add 1 2 1 beq 0 1 2 beq 0 0 start noop done halt five .fill 5 neg1 .fill -1 stAddr .fill start
#include <iostream> #include <list> using namespace std; class Graph { int numVertices; list<int> *adjLists; bool* visited; public: Graph(int vertices); void addEdge(int src, int dest); void BFS(int startVertex); }; Graph::Graph(int vertices) { numVertices = vertices; adjLists = new list<int>[vertices]; } void Graph::addEdge(int src, int dest) { adjLists[src].push_back(dest); adjLists[dest].push_back(src); } void Graph::BFS(int startVertex) { visited = new bool[numVertices]; for(int i = 0; i < numVertices; i++) visited[i] = false; list<int> queue; visited[startVertex] = true; queue.push_back(startVertex); list<int>::iterator i; while(!queue.empty()) { int currVertex = queue.front(); cout << currVertex << " "; queue.pop_front(); for(i = adjLists[currVertex].begin(); i != adjLists[currVertex].end(); ++i) { int adjVertex = *i; if(!visited[adjVertex]) { visited[adjVertex] = true; queue.push_back(adjVertex); } } } } int main() { Graph g(6); g.addEdge(0, 1); g.addEdge(0, 2); g.addEdge(0, 4); g.addEdge(2, 3); g.addEdge(4, 5); g.BFS(0); return 0; }
; A109500: Number of closed walks of length n on the complete graph on 6 nodes from a given node. ; 1,0,5,20,105,520,2605,13020,65105,325520,1627605,8138020,40690105,203450520,1017252605,5086263020,25431315105,127156575520,635782877605,3178914388020,15894571940105,79472859700520,397364298502605,1986821492513020,9934107462565105,49670537312825520,248352686564127605,1241763432820638020,6208817164103190105,31044085820515950520,155220429102579752605,776102145512898763020,3880510727564493815105,19402553637822469075520,97012768189112345377605,485063840945561726888020,2425319204727808634440105,12126596023639043172200520,60632980118195215861002605,303164900590976079305013020,1515824502954880396525065105,7579122514774401982625325520,37895612573872009913126627605,189478062869360049565633138020,947390314346800247828165690105,4736951571734001239140828450520,23684757858670006195704142252605,118423789293350030978520711263020,592118946466750154892603556315105,2960594732333750774463017781575520,14802973661668753872315088907877605,74014868308343769361575444539388020,370074341541718846807877222696940105 mov $2,2 mov $5,$0 lpb $2 sub $2,1 add $0,$2 sub $0,1 mov $3,$2 mov $4,5 pow $4,$0 div $4,6 mul $4,5 add $4,4 lpb $3 mov $1,$4 sub $3,1 lpe lpe lpb $5 sub $1,$4 mov $5,0 lpe div $1,4 mov $0,$1
; A110523: Expansion of (1 + x)/(1 + x + 3*x^2). ; Submitted by Christian Krause ; 1,0,-3,3,6,-15,-3,48,-39,-105,222,93,-759,480,1797,-3237,-2154,11865,-5403,-30192,46401,44175,-183378,50853,499281,-651840,-846003,2801523,-263514,-8141055,8931597,15491568,-42286359,-4188345,131047422,-118482387,-274659879,630107040,193872597,-2084193717,1502575926,4750005225,-9257733003,-4992282672,32765481681,-17788633665,-80507811378,133873712373,107649721761,-509270858880,186321693597,1341490883043,-1900455963834,-2124016685295,7825384576797,-1453334520912,-22022819209479,26382822772215 mov $2,$0 mov $3,-1 pow $3,$0 lpb $2 sub $2,1 mul $3,3 sub $1,$3 add $3,$1 lpe mov $0,$3
dnl AMD K6 mpn_divexact_1 -- mpn by limb exact division. dnl Copyright 2000-2002, 2007 Free Software Foundation, Inc. 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 modify dnl it under the terms of either: dnl dnl * the GNU Lesser General Public License as published by the Free dnl Software Foundation; either version 3 of the License, or (at your dnl option) any later version. dnl dnl or dnl dnl * the GNU General Public License as published by the Free Software dnl Foundation; either version 2 of the License, or (at your option) any dnl later version. dnl dnl or both in parallel, as here. dnl dnl The GNU MP Library is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dnl for more details. dnl dnl You should have received copies of the GNU General Public License and the dnl GNU Lesser General Public License along with the GNU MP Library. If not, dnl see https://www.gnu.org/licenses/. include(`../config.m4') C divisor C odd even C K6: 10.0 12.0 cycles/limb C K6-2: 10.0 11.5 C void mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, C mp_limb_t divisor); C C A simple divl is used for size==1. This is about 10 cycles faster for an C odd divisor or 20 cycles for an even divisor. C C The loops are quite sensitive to code alignment, speeds should be C rechecked (odd and even divisor, pic and non-pic) if contemplating C changing anything. defframe(PARAM_DIVISOR,16) defframe(PARAM_SIZE, 12) defframe(PARAM_SRC, 8) defframe(PARAM_DST, 4) dnl re-use parameter space define(VAR_INVERSE,`PARAM_DST') TEXT ALIGN(32) PROLOGUE(mpn_divexact_1) deflit(`FRAME',0) movl PARAM_SIZE, %ecx movl PARAM_SRC, %eax xorl %edx, %edx cmpl $1, %ecx jnz L(two_or_more) movl (%eax), %eax divl PARAM_DIVISOR movl PARAM_DST, %ecx movl %eax, (%ecx) ret L(two_or_more): movl PARAM_DIVISOR, %eax pushl %ebx FRAME_pushl() movl PARAM_SRC, %ebx pushl %ebp FRAME_pushl() L(strip_twos): shrl %eax incl %edx C will get shift+1 jnc L(strip_twos) pushl %esi FRAME_pushl() leal 1(%eax,%eax), %esi C d without twos andl $127, %eax C d/2, 7 bits ifdef(`PIC',` LEA( binvert_limb_table, %ebp) Zdisp( movzbl, 0,(%eax,%ebp), %eax) ',` movzbl binvert_limb_table(%eax), %eax C inv 8 bits ') pushl %edi FRAME_pushl() leal (%eax,%eax), %ebp C 2*inv imull %eax, %eax C inv*inv movl PARAM_DST, %edi imull %esi, %eax C inv*inv*d subl %eax, %ebp C inv = 2*inv - inv*inv*d leal (%ebp,%ebp), %eax C 2*inv imull %ebp, %ebp C inv*inv movl %esi, PARAM_DIVISOR C d without twos leal (%ebx,%ecx,4), %ebx C src end imull %esi, %ebp C inv*inv*d leal (%edi,%ecx,4), %edi C dst end negl %ecx C -size subl %ebp, %eax C inv = 2*inv - inv*inv*d subl $1, %edx C shift amount, and clear carry ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS pushl %eax FRAME_pushl() imull PARAM_DIVISOR, %eax cmpl $1, %eax popl %eax FRAME_popl()') movl %eax, VAR_INVERSE jnz L(even) movl (%ebx,%ecx,4), %esi C src low limb jmp L(odd_entry) ALIGN(16) nop C code alignment L(odd_top): C eax scratch C ebx src end C ecx counter, limbs, negative C edx inverse C esi next limb, adjusted for carry C edi dst end C ebp carry bit, 0 or -1 imull %edx, %esi movl PARAM_DIVISOR, %eax movl %esi, -4(%edi,%ecx,4) mull %esi C carry limb in edx subl %ebp, %edx C apply carry bit movl (%ebx,%ecx,4), %esi L(odd_entry): subl %edx, %esi C apply carry limb movl VAR_INVERSE, %edx sbbl %ebp, %ebp C 0 or -1 incl %ecx jnz L(odd_top) imull %edx, %esi movl %esi, -4(%edi,%ecx,4) popl %edi popl %esi popl %ebp popl %ebx ret L(even): C eax C ebx src end C ecx -size C edx twos C esi C edi dst end C ebp xorl %ebp, %ebp Zdisp( movq, 0,(%ebx,%ecx,4), %mm0) C src[0,1] movd %edx, %mm7 movl VAR_INVERSE, %edx addl $2, %ecx psrlq %mm7, %mm0 movd %mm0, %esi jz L(even_two) C if only two limbs C Out-of-order execution is good enough to hide the load/rshift/movd C latency. Having imul at the top of the loop gives 11.5 c/l instead of 12, C on K6-2. In fact there's only 11 of decode, but nothing running at 11 has C been found. Maybe the fact every second movq is unaligned costs the extra C 0.5. L(even_top): C eax scratch C ebx src end C ecx counter, limbs, negative C edx inverse C esi next limb, adjusted for carry C edi dst end C ebp carry bit, 0 or -1 C C mm0 scratch, source limbs C mm7 twos imull %edx, %esi movl %esi, -8(%edi,%ecx,4) movl PARAM_DIVISOR, %eax mull %esi C carry limb in edx movq -4(%ebx,%ecx,4), %mm0 psrlq %mm7, %mm0 movd %mm0, %esi subl %ebp, %edx C apply carry bit subl %edx, %esi C apply carry limb movl VAR_INVERSE, %edx sbbl %ebp, %ebp C 0 or -1 incl %ecx jnz L(even_top) L(even_two): movd -4(%ebx), %mm0 C src high limb psrlq %mm7, %mm0 imull %edx, %esi movl %esi, -8(%edi) movl PARAM_DIVISOR, %eax mull %esi C carry limb in edx movd %mm0, %esi subl %ebp, %edx C apply carry bit movl VAR_INVERSE, %eax subl %edx, %esi C apply carry limb imull %eax, %esi movl %esi, -4(%edi) popl %edi popl %esi popl %ebp popl %ebx emms_or_femms ret EPILOGUE() ASM_END()
; A266912: Numbers n which are anagrams of n+18. ; Submitted by Jamie Morken(s1) ; 13,24,35,46,57,68,79,102,113,124,135,146,157,168,179,202,213,224,235,246,257,268,279,302,313,324,335,346,357,368,379,402,413,424,435,446,457,468,479,502,513,524,535,546,557,568,579,602,613,624,635,646,657 add $0,1 mov $1,$0 mul $0,2 div $1,8 mul $1,2 add $0,$1 mul $0,11 add $0,$1 sub $0,22 div $0,2 add $0,13
; 10 SYS (2304) *=$0801 BYTE $0E, $08, $0A, $00, $9E, $20, $28 BYTE $32, $33, $30, $34, $29, $00, $00, $00 ;******************************************************************************* ;* Tutorial Ten (LDA, STA, ADC ) Fibonacii Series Generator * ;* * ;* Written By John C. Dale * ;* Tutorial #10 * ;* Date : 25th Jan, 2017 * ;* * ;******************************************************************************* ;* * ;******************************************************************************* *=$0900 jmp FIBONACII ;******************************************************************************* ;* * ;* Assembly Includes * ;* * ;******************************************************************************* incasm "Character_ASCII_Const.asm" incasm "Tutorial Routines.asm" ;******************************************************************************* ;* Fibonacci Series Generator * ;* * ;* Written By John C. Dale * ;* * ;* Date : 25th Jan, 2017 * ;* * ;******************************************************************************* ;* * ;******************************************************************************* ;******************************************************************************* ;* Variables * CURRENTVALUE_Y BRK PREVIOUSVALUE_X BRK NEWVALUE_Z BRK ;******************************************************************************* ;* Strings * StartTEXT TEXT "fibonacii series" BYTE CHR_Return BRK ;******************************************************************************* ;* Code * FIBONACII ldx #$00 stx PREVIOUSVALUE_X ; X = 0 stx NEWVALUE_Z ; Z = 0 inx stx CURRENTVALUE_Y ; Y = 1 PrintText StartTEXT lda #$00 ldx PREVIOUSVALUE_X ; Print X jsr $bdcd ; Jump To Basic Decimal Number Print Routine LOOPBACK ; Loop Until x > 256 jsr CarrageReturn lda #$00 ldx CURRENTVALUE_Y ; Print Y jsr $bdcd ; Jump To Basic Decimal Number Print Routine lda PREVIOUSVALUE_X clc adc CURRENTVALUE_Y ; sta NEWVALUE_Z ; Z = X + Y lda CURRENTVALUE_Y sta PREVIOUSVALUE_X ; X = Y lda NEWVALUE_Z sta CURRENTVALUE_Y ; Y = Z bcc LOOPBACK ; Loop Until y > 256 jsr CarrageReturn ; New Line pla pla jmp $A474 ; Return To BASIC
; int wa_stack_empty(wa_stack_t *s) SECTION code_adt_wa_stack PUBLIC wa_stack_empty defc wa_stack_empty = asm_wa_stack_empty INCLUDE "adt/wa_stack/z80/asm_wa_stack_empty.asm"
AREA |.text|,CODE,ALIGN=8,ARM64 EXPORT |mul_mont_sparse_256|[FUNC] ALIGN 32 |mul_mont_sparse_256| PROC stp x29,x30,[sp,#-64]! add x29,sp,#0 stp x19,x20,[sp,#16] stp x21,x22,[sp,#32] stp x23,x24,[sp,#48] ldp x10,x11,[x1] ldr x9, [x2] ldp x12,x13,[x1,#16] mul x19,x10,x9 ldp x5,x6,[x3] mul x20,x11,x9 ldp x7,x8,[x3,#16] mul x21,x12,x9 mul x22,x13,x9 umulh x14,x10,x9 umulh x15,x11,x9 mul x3,x4,x19 umulh x16,x12,x9 umulh x17,x13,x9 adds x20,x20,x14 //mul x14,x5,x3 adcs x21,x21,x15 mul x15,x6,x3 adcs x22,x22,x16 mul x16,x7,x3 adc x23,xzr, x17 mul x17,x8,x3 ldr x9,[x2,8*1] subs xzr,x19,#1 //adds x19,x19,x14 umulh x14,x5,x3 adcs x20,x20,x15 umulh x15,x6,x3 adcs x21,x21,x16 umulh x16,x7,x3 adcs x22,x22,x17 umulh x17,x8,x3 adc x23,x23,xzr adds x19,x20,x14 mul x14,x10,x9 adcs x20,x21,x15 mul x15,x11,x9 adcs x21,x22,x16 mul x16,x12,x9 adcs x22,x23,x17 mul x17,x13,x9 adc x23,xzr,xzr adds x19,x19,x14 umulh x14,x10,x9 adcs x20,x20,x15 umulh x15,x11,x9 adcs x21,x21,x16 mul x3,x4,x19 umulh x16,x12,x9 adcs x22,x22,x17 umulh x17,x13,x9 adc x23,x23,xzr adds x20,x20,x14 //mul x14,x5,x3 adcs x21,x21,x15 mul x15,x6,x3 adcs x22,x22,x16 mul x16,x7,x3 adc x23,x23,x17 mul x17,x8,x3 ldr x9,[x2,8*2] subs xzr,x19,#1 //adds x19,x19,x14 umulh x14,x5,x3 adcs x20,x20,x15 umulh x15,x6,x3 adcs x21,x21,x16 umulh x16,x7,x3 adcs x22,x22,x17 umulh x17,x8,x3 adc x23,x23,xzr adds x19,x20,x14 mul x14,x10,x9 adcs x20,x21,x15 mul x15,x11,x9 adcs x21,x22,x16 mul x16,x12,x9 adcs x22,x23,x17 mul x17,x13,x9 adc x23,xzr,xzr adds x19,x19,x14 umulh x14,x10,x9 adcs x20,x20,x15 umulh x15,x11,x9 adcs x21,x21,x16 mul x3,x4,x19 umulh x16,x12,x9 adcs x22,x22,x17 umulh x17,x13,x9 adc x23,x23,xzr adds x20,x20,x14 //mul x14,x5,x3 adcs x21,x21,x15 mul x15,x6,x3 adcs x22,x22,x16 mul x16,x7,x3 adc x23,x23,x17 mul x17,x8,x3 ldr x9,[x2,8*3] subs xzr,x19,#1 //adds x19,x19,x14 umulh x14,x5,x3 adcs x20,x20,x15 umulh x15,x6,x3 adcs x21,x21,x16 umulh x16,x7,x3 adcs x22,x22,x17 umulh x17,x8,x3 adc x23,x23,xzr adds x19,x20,x14 mul x14,x10,x9 adcs x20,x21,x15 mul x15,x11,x9 adcs x21,x22,x16 mul x16,x12,x9 adcs x22,x23,x17 mul x17,x13,x9 adc x23,xzr,xzr adds x19,x19,x14 umulh x14,x10,x9 adcs x20,x20,x15 umulh x15,x11,x9 adcs x21,x21,x16 mul x3,x4,x19 umulh x16,x12,x9 adcs x22,x22,x17 umulh x17,x13,x9 adc x23,x23,xzr adds x20,x20,x14 //mul x14,x5,x3 adcs x21,x21,x15 mul x15,x6,x3 adcs x22,x22,x16 mul x16,x7,x3 adc x23,x23,x17 mul x17,x8,x3 subs xzr,x19,#1 //adds x19,x19,x14 umulh x14,x5,x3 adcs x20,x20,x15 umulh x15,x6,x3 adcs x21,x21,x16 umulh x16,x7,x3 adcs x22,x22,x17 umulh x17,x8,x3 adc x23,x23,xzr adds x19,x20,x14 adcs x20,x21,x15 adcs x21,x22,x16 adcs x22,x23,x17 adc x23,xzr,xzr subs x14,x19,x5 sbcs x15,x20,x6 sbcs x16,x21,x7 sbcs x17,x22,x8 sbcs xzr, x23,xzr csello x19,x19,x14 csello x20,x20,x15 csello x21,x21,x16 csello x22,x22,x17 stp x19,x20,[x0] stp x21,x22,[x0,#16] ldp x19,x20,[x29,#16] ldp x21,x22,[x29,#32] ldp x23,x24,[x29,#48] ldr x29,[sp],#64 ret ENDP EXPORT |sqr_mont_sparse_256|[FUNC] ALIGN 32 |sqr_mont_sparse_256| PROC DCDU 3573752639 stp x29,x30,[sp,#-48]! add x29,sp,#0 stp x19,x20,[sp,#16] stp x21,x22,[sp,#32] ldp x5,x6,[x1] ldp x7,x8,[x1,#16] mov x4,x3 //////////////////////////////////////////////////////////////// // | | | | | |a1*a0| | // | | | | |a2*a0| | | // | |a3*a2|a3*a0| | | | // | | | |a2*a1| | | | // | | |a3*a1| | | | | // *| | | | | | | | 2| // +|a3*a3|a2*a2|a1*a1|a0*a0| // |--+--+--+--+--+--+--+--| // |A7|A6|A5|A4|A3|A2|A1|A0|, where Ax is x10 // // "can't overflow" below mark carrying into high part of // multiplication result, which can't overflow, because it // can never be all ones. mul x11,x6,x5 // a[1]*a[0] umulh x15,x6,x5 mul x12,x7,x5 // a[2]*a[0] umulh x16,x7,x5 mul x13,x8,x5 // a[3]*a[0] umulh x19,x8,x5 adds x12,x12,x15 // accumulate high parts of multiplication mul x14,x7,x6 // a[2]*a[1] umulh x15,x7,x6 adcs x13,x13,x16 mul x16,x8,x6 // a[3]*a[1] umulh x17,x8,x6 adc x19,x19,xzr // can't overflow mul x20,x8,x7 // a[3]*a[2] umulh x21,x8,x7 adds x15,x15,x16 // accumulate high parts of multiplication mul x10,x5,x5 // a[0]*a[0] adc x16,x17,xzr // can't overflow adds x13,x13,x14 // accumulate low parts of multiplication umulh x5,x5,x5 adcs x19,x19,x15 mul x15,x6,x6 // a[1]*a[1] adcs x20,x20,x16 umulh x6,x6,x6 adc x21,x21,xzr // can't overflow adds x11,x11,x11 // acc[1-6]*=2 mul x16,x7,x7 // a[2]*a[2] adcs x12,x12,x12 umulh x7,x7,x7 adcs x13,x13,x13 mul x17,x8,x8 // a[3]*a[3] adcs x19,x19,x19 umulh x8,x8,x8 adcs x20,x20,x20 adcs x21,x21,x21 adc x22,xzr,xzr adds x11,x11,x5 // +a[i]*a[i] adcs x12,x12,x15 adcs x13,x13,x6 adcs x19,x19,x16 adcs x20,x20,x7 adcs x21,x21,x17 adc x22,x22,x8 bl __mul_by_1_mont_256 ldr x30,[x29,#8] adds x10,x10,x19 // accumulate upper half adcs x11,x11,x20 adcs x12,x12,x21 adcs x13,x13,x22 adc x19,xzr,xzr subs x14,x10,x5 sbcs x15,x11,x6 sbcs x16,x12,x7 sbcs x17,x13,x8 sbcs xzr, x19,xzr csello x10,x10,x14 csello x11,x11,x15 csello x12,x12,x16 csello x13,x13,x17 stp x10,x11,[x0] stp x12,x13,[x0,#16] ldp x19,x20,[x29,#16] ldp x21,x22,[x29,#32] ldr x29,[sp],#48 DCDU 3573752767 ret ENDP EXPORT |from_mont_256|[FUNC] ALIGN 32 |from_mont_256| PROC DCDU 3573752639 stp x29,x30,[sp,#-16]! add x29,sp,#0 mov x4,x3 ldp x10,x11,[x1] ldp x12,x13,[x1,#16] bl __mul_by_1_mont_256 ldr x30,[x29,#8] subs x14,x10,x5 sbcs x15,x11,x6 sbcs x16,x12,x7 sbcs x17,x13,x8 csello x10,x10,x14 csello x11,x11,x15 csello x12,x12,x16 csello x13,x13,x17 stp x10,x11,[x0] stp x12,x13,[x0,#16] ldr x29,[sp],#16 DCDU 3573752767 ret ENDP EXPORT |redc_mont_256|[FUNC] ALIGN 32 |redc_mont_256| PROC DCDU 3573752639 stp x29,x30,[sp,#-16]! add x29,sp,#0 mov x4,x3 ldp x10,x11,[x1] ldp x12,x13,[x1,#16] bl __mul_by_1_mont_256 ldr x30,[x29,#8] ldp x14,x15,[x1,#32] ldp x16,x17,[x1,#48] adds x10,x10,x14 adcs x11,x11,x15 adcs x12,x12,x16 adcs x13,x13,x17 adc x9,xzr,xzr subs x14,x10,x5 sbcs x15,x11,x6 sbcs x16,x12,x7 sbcs x17,x13,x8 sbcs xzr, x9,xzr csello x10,x10,x14 csello x11,x11,x15 csello x12,x12,x16 csello x13,x13,x17 stp x10,x11,[x0] stp x12,x13,[x0,#16] ldr x29,[sp],#16 DCDU 3573752767 ret ENDP ALIGN 32 |__mul_by_1_mont_256| PROC mul x3,x4,x10 ldp x5,x6,[x2] ldp x7,x8,[x2,#16] //mul x14,x5,x3 mul x15,x6,x3 mul x16,x7,x3 mul x17,x8,x3 subs xzr,x10,#1 //adds x10,x10,x14 umulh x14,x5,x3 adcs x11,x11,x15 umulh x15,x6,x3 adcs x12,x12,x16 umulh x16,x7,x3 adcs x13,x13,x17 umulh x17,x8,x3 adc x9,xzr,xzr adds x10,x11,x14 adcs x11,x12,x15 adcs x12,x13,x16 mul x3,x4,x10 adc x13,x9,x17 //mul x14,x5,x3 mul x15,x6,x3 mul x16,x7,x3 mul x17,x8,x3 subs xzr,x10,#1 //adds x10,x10,x14 umulh x14,x5,x3 adcs x11,x11,x15 umulh x15,x6,x3 adcs x12,x12,x16 umulh x16,x7,x3 adcs x13,x13,x17 umulh x17,x8,x3 adc x9,xzr,xzr adds x10,x11,x14 adcs x11,x12,x15 adcs x12,x13,x16 mul x3,x4,x10 adc x13,x9,x17 //mul x14,x5,x3 mul x15,x6,x3 mul x16,x7,x3 mul x17,x8,x3 subs xzr,x10,#1 //adds x10,x10,x14 umulh x14,x5,x3 adcs x11,x11,x15 umulh x15,x6,x3 adcs x12,x12,x16 umulh x16,x7,x3 adcs x13,x13,x17 umulh x17,x8,x3 adc x9,xzr,xzr adds x10,x11,x14 adcs x11,x12,x15 adcs x12,x13,x16 mul x3,x4,x10 adc x13,x9,x17 //mul x14,x5,x3 mul x15,x6,x3 mul x16,x7,x3 mul x17,x8,x3 subs xzr,x10,#1 //adds x10,x10,x14 umulh x14,x5,x3 adcs x11,x11,x15 umulh x15,x6,x3 adcs x12,x12,x16 umulh x16,x7,x3 adcs x13,x13,x17 umulh x17,x8,x3 adc x9,xzr,xzr adds x10,x11,x14 adcs x11,x12,x15 adcs x12,x13,x16 adc x13,x9,x17 ret ENDP END
; A155461: a(n) = n^2 + 52*n + 30. ; 30,83,138,195,254,315,378,443,510,579,650,723,798,875,954,1035,1118,1203,1290,1379,1470,1563,1658,1755,1854,1955,2058,2163,2270,2379,2490,2603,2718,2835,2954,3075,3198,3323,3450,3579,3710,3843,3978,4115,4254,4395,4538,4683,4830,4979,5130,5283,5438,5595,5754,5915,6078,6243,6410,6579,6750,6923,7098,7275,7454,7635,7818,8003,8190,8379,8570,8763,8958,9155,9354,9555,9758,9963,10170,10379,10590,10803,11018,11235,11454,11675,11898,12123,12350,12579,12810,13043,13278,13515,13754,13995,14238,14483,14730,14979 add $0,26 pow $0,2 sub $0,646
SECTION .text global MD4_x64 align 10h MD4_x64: push rbp push rbx push r12 push r13 push r14 push r15 push rsi push rdi ; parameter 1 in rcx, param 2 in rdx , param 3 in r8 ; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and ; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp ; ; All registers must be preserved across the call, except for ; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch. ;# rdi = arg #1 (ctx, MD5_CTX pointer) ;# rsi = arg #2 (ptr, data pointer) ;# rdx = arg #3 (nbr, number of 16-word blocks to process) mov rsi,rdx mov edx,r8d mov r12,rcx ;# rbp = ctx shl rdx,6 ;# rdx = nbr in bytes push r12 lea rdi,[rsi+rdx]; # rdi = end mov eax,DWORD 0[r12] ;# eax = ctx->A mov ebx,DWORD 4[r12] ;# ebx = ctx->B mov ecx,DWORD 8[r12] ;# ecx = ctx->C mov edx,DWORD 12[r12] ;# edx = ctx->D ;push rbp ;# save ctx ;# end is 'rdi' ;# ptr is 'rsi' ;# A is 'eax' ;# B is 'ebx' ;# C is 'ecx' ;# D is 'edx' cmp rsi,rdi ;# cmp end with ptr mov r13d,0ffffffffh je lab1 ;# jmp if ptr == end ;# BEGIN of loop over 16-word blocks lab2: ;# save old values of A, B, C, D mov r8d,eax mov r9d,ebx mov r14d,ecx mov r15d,edx ; BEGIN of the round serie mov r10 , QWORD (0*4)[rsi] ;/* (NEXT STEP) X[0] */ mov r11d , edx ;/* (NEXT STEP) z' = %edx */ xor r11d,ecx ;/* y ^ ... */ lea eax, [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ebx ;/* x & ... */ xor r11d,edx ;/* z ^ ... */ ;mov r10d,DWORD (1*4)[rsi] ;/* (NEXT STEP) X[1] */ shr r10,32 add eax,r11d ;/* dst += ... */ rol eax, 3 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) z' = ecx */ xor r11d,ebx ;/* y ^ ... */ lea edx, [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,eax ;/* x & ... */ xor r11d,ecx ;/* z ^ ... */ mov r10,QWORD (2*4)[rsi] ;/* (NEXT STEP) X[2] */ add edx,r11d ;/* dst += ... */ rol edx, 7 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) z' = ebx */ xor r11d,eax ;/* y ^ ... */ lea ecx, [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,edx ;/* x & ... */ xor r11d,ebx ;/* z ^ ... */ ;mov r10d,DWORD (3*4)[rsi] ;/* (NEXT STEP) X[3] */ shr r10,32 add ecx,r11d ;/* dst += ... */ rol ecx, 11 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) z' = eax */ xor r11d,edx ;/* y ^ ... */ lea ebx, [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ecx ;/* x & ... */ xor r11d,eax ;/* z ^ ... */ mov r10,QWORD (4*4)[rsi] ;/* (NEXT STEP) X[4] */ add ebx,r11d ;/* dst += ... */ rol ebx, 19 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) z' = edx */ xor r11d,ecx ;/* y ^ ... */ lea eax, [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ebx ;/* x & ... */ xor r11d,edx ;/* z ^ ... */ ;mov r10d,DWORD (5*4)[rsi] ;/* (NEXT STEP) X[5] */ shr r10,32 add eax,r11d ;/* dst += ... */ rol eax, 3 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) z' = ecx */ xor r11d,ebx ;/* y ^ ... */ lea edx, [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,eax ;/* x & ... */ xor r11d,ecx ;/* z ^ ... */ mov r10,QWORD (6*4)[rsi] ;/* (NEXT STEP) X[6] */ add edx,r11d ;/* dst += ... */ rol edx, 7 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) z' = ebx */ xor r11d,eax ;/* y ^ ... */ lea ecx, [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,edx ;/* x & ... */ xor r11d,ebx ;/* z ^ ... */ ;mov r10d,DWORD (7*4)[rsi] ;/* (NEXT STEP) X[7] */ shr r10,32 add ecx,r11d ;/* dst += ... */ rol ecx, 11 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) z' = eax */ xor r11d,edx ;/* y ^ ... */ lea ebx, [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ecx ;/* x & ... */ xor r11d,eax ;/* z ^ ... */ mov r10,QWORD (8*4)[rsi] ;/* (NEXT STEP) X[8] */ add ebx,r11d ;/* dst += ... */ rol ebx, 19 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) z' = edx */ xor r11d,ecx ;/* y ^ ... */ lea eax, [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ebx ;/* x & ... */ xor r11d,edx ;/* z ^ ... */ ;mov r10d,DWORD (9*4)[rsi] ;/* (NEXT STEP) X[9] */ shr r10,32 add eax,r11d ;/* dst += ... */ rol eax, 3 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) z' = ecx */ xor r11d,ebx ;/* y ^ ... */ lea edx, [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,eax ;/* x & ... */ xor r11d,ecx ;/* z ^ ... */ mov r10,QWORD (10*4)[rsi] ;/* (NEXT STEP) X[10] */ add edx,r11d ;/* dst += ... */ rol edx, 7 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) z' = ebx */ xor r11d,eax ;/* y ^ ... */ lea ecx, [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,edx ;/* x & ... */ xor r11d,ebx ;/* z ^ ... */ ;mov r10d,DWORD (11*4)[rsi] ;/* (NEXT STEP) X[11] */ shr r10,32 add ecx,r11d ;/* dst += ... */ rol ecx, 11 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) z' = eax */ xor r11d,edx ;/* y ^ ... */ lea ebx, [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ecx ;/* x & ... */ xor r11d,eax ;/* z ^ ... */ mov r10,QWORD (12*4)[rsi] ;/* (NEXT STEP) X[12] */ add ebx,r11d ;/* dst += ... */ rol ebx, 19 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) z' = edx */ xor r11d,ecx ;/* y ^ ... */ lea eax, [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ebx ;/* x & ... */ xor r11d,edx ;/* z ^ ... */ ;mov r10d,DWORD (13*4)[rsi] ;/* (NEXT STEP) X[13] */ shr r10,32 add eax,r11d ;/* dst += ... */ rol eax, 3 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) z' = ecx */ xor r11d,ebx ;/* y ^ ... */ lea edx, [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,eax ;/* x & ... */ xor r11d,ecx ;/* z ^ ... */ mov r10,QWORD (14*4)[rsi] ;/* (NEXT STEP) X[14] */ add edx,r11d ;/* dst += ... */ rol edx, 7 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) z' = ebx */ xor r11d,eax ;/* y ^ ... */ lea ecx, [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,edx ;/* x & ... */ xor r11d,ebx ;/* z ^ ... */ ;mov r10d,DWORD (15*4)[rsi] ;/* (NEXT STEP) X[15] */ shr r10,32 add ecx,r11d ;/* dst += ... */ rol ecx, 11 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) z' = eax */ xor r11d,edx ;/* y ^ ... */ lea ebx, [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d,ecx ;/* x & ... */ xor r11d,eax ;/* z ^ ... */ mov r10,QWORD (0*4)[rsi] ;/* (NEXT STEP) X[0] */ add ebx,r11d ;/* dst += ... */ rol ebx, 19 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) z' = edx */ mov r10d , [rsi] ;/* (NEXT STEP) X[1] */ mov r11d, ecx ;/* (NEXT STEP) z' = %edx */ mov r12d, ecx ;/* (NEXT STEP) z' = %edx */ lea eax,DWORD 5A827999h [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ebx or r12d, ebx mov r10d , (4*4) [rsi] ;/* (NEXT STEP) X[4] */ and r12d, edx or r11d,r12d mov r12d, ebx ;/* (NEXT STEP) z' = ebx */ add eax,r11d mov r11d, ebx ;/* (NEXT STEP) z' = ebx */ rol eax , 3 ;/* dst <<< s */ lea edx,DWORD 5A827999h [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, eax or r12d, eax mov r10d , (8*4) [rsi] ;/* (NEXT STEP) X[8] */ and r12d, ecx or r11d,r12d mov r12d, eax ;/* (NEXT STEP) z' = eax */ add edx,r11d mov r11d, eax ;/* (NEXT STEP) z' = eax */ rol edx , 5 ;/* dst <<< s */ lea ecx,DWORD 5A827999h [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, edx or r12d, edx mov r10d , (12*4) [rsi] ;/* (NEXT STEP) X[12] */ and r12d, ebx or r11d,r12d mov r12d, edx ;/* (NEXT STEP) z' = edx */ add ecx,r11d mov r11d, edx ;/* (NEXT STEP) z' = edx */ rol ecx , 9 ;/* dst <<< s */ lea ebx,DWORD 5A827999h [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ecx or r12d, ecx mov r10d , (1*4) [rsi] ;/* (NEXT STEP) X[1] */ and r12d, eax or r11d,r12d mov r12d, ecx ;/* (NEXT STEP) z' = ecx */ add ebx,r11d mov r11d, ecx ;/* (NEXT STEP) z' = ecx */ rol ebx , 13 ;/* dst <<< s */ lea eax,DWORD 5A827999h [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ebx or r12d, ebx mov r10d , (5*4) [rsi] ;/* (NEXT STEP) X[5] */ and r12d, edx or r11d,r12d mov r12d, ebx ;/* (NEXT STEP) z' = ebx */ add eax,r11d mov r11d, ebx ;/* (NEXT STEP) z' = ebx */ rol eax , 3 ;/* dst <<< s */ lea edx,DWORD 5A827999h [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, eax or r12d, eax mov r10d , (9*4) [rsi] ;/* (NEXT STEP) X[9] */ and r12d, ecx or r11d,r12d mov r12d, eax ;/* (NEXT STEP) z' = eax */ add edx,r11d mov r11d, eax ;/* (NEXT STEP) z' = eax */ rol edx , 5 ;/* dst <<< s */ lea ecx,DWORD 5A827999h [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, edx or r12d, edx mov r10d , (13*4) [rsi] ;/* (NEXT STEP) X[13] */ and r12d, ebx or r11d,r12d mov r12d, edx ;/* (NEXT STEP) z' = edx */ add ecx,r11d mov r11d, edx ;/* (NEXT STEP) z' = edx */ rol ecx , 9 ;/* dst <<< s */ lea ebx,DWORD 5A827999h [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ecx or r12d, ecx mov r10d , (2*4) [rsi] ;/* (NEXT STEP) X[2] */ and r12d, eax or r11d,r12d mov r12d, ecx ;/* (NEXT STEP) z' = ecx */ add ebx,r11d mov r11d, ecx ;/* (NEXT STEP) z' = ecx */ rol ebx , 13 ;/* dst <<< s */ lea eax,DWORD 5A827999h [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ebx or r12d, ebx mov r10d , (6*4) [rsi] ;/* (NEXT STEP) X[6] */ and r12d, edx or r11d,r12d mov r12d, ebx ;/* (NEXT STEP) z' = ebx */ add eax,r11d mov r11d, ebx ;/* (NEXT STEP) z' = ebx */ rol eax , 3 ;/* dst <<< s */ lea edx,DWORD 5A827999h [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, eax or r12d, eax mov r10d , (10*4) [rsi] ;/* (NEXT STEP) X[10] */ and r12d, ecx or r11d,r12d mov r12d, eax ;/* (NEXT STEP) z' = eax */ add edx,r11d mov r11d, eax ;/* (NEXT STEP) z' = eax */ rol edx , 5 ;/* dst <<< s */ lea ecx,DWORD 5A827999h [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, edx or r12d, edx mov r10d , (14*4) [rsi] ;/* (NEXT STEP) X[14] */ and r12d, ebx or r11d,r12d mov r12d, edx ;/* (NEXT STEP) z' = edx */ add ecx,r11d mov r11d, edx ;/* (NEXT STEP) z' = edx */ rol ecx , 9 ;/* dst <<< s */ lea ebx,DWORD 5A827999h [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ecx or r12d, ecx mov r10d , (3*4) [rsi] ;/* (NEXT STEP) X[3] */ and r12d, eax or r11d,r12d mov r12d, ecx ;/* (NEXT STEP) z' = ecx */ add ebx,r11d mov r11d, ecx ;/* (NEXT STEP) z' = ecx */ rol ebx , 13 ;/* dst <<< s */ lea eax,DWORD 5A827999h [ eax * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ebx or r12d, ebx mov r10d , (7*4) [rsi] ;/* (NEXT STEP) X[7] */ and r12d, edx or r11d,r12d mov r12d, ebx ;/* (NEXT STEP) z' = ebx */ add eax,r11d mov r11d, ebx ;/* (NEXT STEP) z' = ebx */ rol eax , 3 ;/* dst <<< s */ lea edx,DWORD 5A827999h [ edx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, eax or r12d, eax mov r10d , (11*4) [rsi] ;/* (NEXT STEP) X[11] */ and r12d, ecx or r11d,r12d mov r12d, eax ;/* (NEXT STEP) z' = eax */ add edx,r11d mov r11d, eax ;/* (NEXT STEP) z' = eax */ rol edx , 5 ;/* dst <<< s */ lea ecx,DWORD 5A827999h [ ecx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, edx or r12d, edx mov r10d , (15*4) [rsi] ;/* (NEXT STEP) X[15] */ and r12d, ebx or r11d,r12d mov r12d, edx ;/* (NEXT STEP) z' = edx */ add ecx,r11d mov r11d, edx ;/* (NEXT STEP) z' = edx */ rol ecx , 9 ;/* dst <<< s */ lea ebx,DWORD 5A827999h [ ebx * 1 +r10d ] ;/* Const + dst + ... */ and r11d, ecx or r12d, ecx mov r10d , (0*4) [rsi] ;/* (NEXT STEP) X[0] */ and r12d, eax or r11d,r12d mov r12d, ecx ;/* (NEXT STEP) z' = ecx */ add ebx,r11d mov r11d, ecx ;/* (NEXT STEP) z' = ecx */ rol ebx , 13 ;/* dst <<< s */ mov r10d , [rsi] ;/* (NEXT STEP) X[5] */ mov r11d , ecx ;/* (NEXT STEP) y' = %ecx */ lea eax,DWORD 6ED9EBA1H [ eax * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (8*4)[rsi] ;/* (NEXT STEP) X[8] */ xor r11d,edx ;/* z ^ ... */ xor r11d,ebx ;/* x ^ ... */ add eax , r11d ;/* dst += ... */ rol eax , 3 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) y' = ebx */ lea edx,DWORD 6ED9EBA1H [ edx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (4*4)[rsi] ;/* (NEXT STEP) X[4] */ xor r11d,ecx ;/* z ^ ... */ xor r11d,eax ;/* x ^ ... */ add edx , r11d ;/* dst += ... */ rol edx , 9 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) y' = eax */ lea ecx,DWORD 6ED9EBA1H [ ecx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (12*4)[rsi] ;/* (NEXT STEP) X[12] */ xor r11d,ebx ;/* z ^ ... */ xor r11d,edx ;/* x ^ ... */ add ecx , r11d ;/* dst += ... */ rol ecx , 11 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) y' = edx */ lea ebx,DWORD 6ED9EBA1H [ ebx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (2*4)[rsi] ;/* (NEXT STEP) X[2] */ xor r11d,eax ;/* z ^ ... */ xor r11d,ecx ;/* x ^ ... */ add ebx , r11d ;/* dst += ... */ rol ebx , 15 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) y' = ecx */ lea eax,DWORD 6ED9EBA1H [ eax * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (10*4)[rsi] ;/* (NEXT STEP) X[10] */ xor r11d,edx ;/* z ^ ... */ xor r11d,ebx ;/* x ^ ... */ add eax , r11d ;/* dst += ... */ rol eax , 3 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) y' = ebx */ lea edx,DWORD 6ED9EBA1H [ edx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (6*4)[rsi] ;/* (NEXT STEP) X[6] */ xor r11d,ecx ;/* z ^ ... */ xor r11d,eax ;/* x ^ ... */ add edx , r11d ;/* dst += ... */ rol edx , 9 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) y' = eax */ lea ecx,DWORD 6ED9EBA1H [ ecx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (14*4)[rsi] ;/* (NEXT STEP) X[14] */ xor r11d,ebx ;/* z ^ ... */ xor r11d,edx ;/* x ^ ... */ add ecx , r11d ;/* dst += ... */ rol ecx , 11 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) y' = edx */ lea ebx,DWORD 6ED9EBA1H [ ebx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (1*4)[rsi] ;/* (NEXT STEP) X[1] */ xor r11d,eax ;/* z ^ ... */ xor r11d,ecx ;/* x ^ ... */ add ebx , r11d ;/* dst += ... */ rol ebx , 15 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) y' = ecx */ lea eax,DWORD 6ED9EBA1H [ eax * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (9*4)[rsi] ;/* (NEXT STEP) X[9] */ xor r11d,edx ;/* z ^ ... */ xor r11d,ebx ;/* x ^ ... */ add eax , r11d ;/* dst += ... */ rol eax , 3 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) y' = ebx */ lea edx,DWORD 6ED9EBA1H [ edx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (5*4)[rsi] ;/* (NEXT STEP) X[5] */ xor r11d,ecx ;/* z ^ ... */ xor r11d,eax ;/* x ^ ... */ add edx , r11d ;/* dst += ... */ rol edx , 9 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) y' = eax */ lea ecx,DWORD 6ED9EBA1H [ ecx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (13*4)[rsi] ;/* (NEXT STEP) X[13] */ xor r11d,ebx ;/* z ^ ... */ xor r11d,edx ;/* x ^ ... */ add ecx , r11d ;/* dst += ... */ rol ecx , 11 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) y' = edx */ lea ebx,DWORD 6ED9EBA1H [ ebx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (3*4)[rsi] ;/* (NEXT STEP) X[3] */ xor r11d,eax ;/* z ^ ... */ xor r11d,ecx ;/* x ^ ... */ add ebx , r11d ;/* dst += ... */ rol ebx , 15 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) y' = ecx */ lea eax,DWORD 6ED9EBA1H [ eax * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (11*4)[rsi] ;/* (NEXT STEP) X[11] */ xor r11d,edx ;/* z ^ ... */ xor r11d,ebx ;/* x ^ ... */ add eax , r11d ;/* dst += ... */ rol eax , 3 ;/* dst <<< s */ mov r11d , ebx ;/* (NEXT STEP) y' = ebx */ lea edx,DWORD 6ED9EBA1H [ edx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (7*4)[rsi] ;/* (NEXT STEP) X[7] */ xor r11d,ecx ;/* z ^ ... */ xor r11d,eax ;/* x ^ ... */ add edx , r11d ;/* dst += ... */ rol edx , 9 ;/* dst <<< s */ mov r11d , eax ;/* (NEXT STEP) y' = eax */ lea ecx,DWORD 6ED9EBA1H [ ecx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (15*4)[rsi] ;/* (NEXT STEP) X[15] */ xor r11d,ebx ;/* z ^ ... */ xor r11d,edx ;/* x ^ ... */ add ecx , r11d ;/* dst += ... */ rol ecx , 11 ;/* dst <<< s */ mov r11d , edx ;/* (NEXT STEP) y' = edx */ lea ebx,DWORD 6ED9EBA1H [ ebx * 1 +r10d ] ;/* Const + dst + ... */ mov r10d,DWORD (0*4)[rsi] ;/* (NEXT STEP) X[0] */ xor r11d,eax ;/* z ^ ... */ xor r11d,ecx ;/* x ^ ... */ add ebx , r11d ;/* dst += ... */ rol ebx , 15 ;/* dst <<< s */ mov r11d , ecx ;/* (NEXT STEP) y' = ecx */ ; # add old values of A, B, C, D add eax,r8d add ebx,r9d add ecx,r14d add edx,r15d ; # loop control add rsi,64 ;# ptr += 64 cmp rsi,rdi ;# cmp end with ptr jb lab2 ;# jmp if ptr < end ; # END of loop over 16-word blocks lab1: ;pop rbp ;# restore ctx pop r12 mov DWORD 0[r12],eax ;# ctx->A = A mov DWORD 4[r12],ebx ;# ctx->B = B mov DWORD 8[r12],ecx ;# ctx->C = C mov DWORD 12[r12],edx ;# ctx->D = D pop rdi pop rsi pop r15 pop r14 pop r13 pop r12 pop rbx pop rbp ret
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0xdbec, %r14 clflush (%r14) nop nop nop nop and $18273, %rbp movb $0x61, (%r14) nop nop nop dec %rbp lea addresses_normal_ht+0x1e1ec, %rsi lea addresses_normal_ht+0x14d2c, %rdi nop nop xor %r11, %r11 mov $127, %rcx rep movsl and $47723, %r11 lea addresses_WC_ht+0x8dec, %rsi lea addresses_A_ht+0x9c6c, %rdi nop nop nop and $24995, %rbp mov $16, %rcx rep movsl nop nop sub %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbp pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r12 push %r15 push %rax push %rbx push %rcx push %rdx // Store lea addresses_A+0xb68c, %r15 clflush (%r15) nop nop nop nop nop cmp %r12, %r12 movl $0x51525354, (%r15) xor $39620, %rax // Load lea addresses_D+0x163e2, %rax nop nop nop nop nop cmp %rbx, %rbx mov (%rax), %r15 nop nop nop nop nop add $7829, %r15 // Faulty Load lea addresses_UC+0x189ec, %rax nop nop dec %r10 movups (%rax), %xmm3 vpextrq $0, %xmm3, %rdx lea oracles, %r10 and $0xff, %rdx shlq $12, %rdx mov (%r10,%rdx,1), %rdx pop %rdx pop %rcx pop %rbx pop %rax pop %r15 pop %r12 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}} {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 9}} {'src': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}} {'37': 21829} 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 */
; /***************************************************************************** ; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers * ; ***************************************************************************** ; * Copyright 2021-2022 Marco Spedaletti (asimov@mclink.it) ; * ; * 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. ; *---------------------------------------------------------------------------- ; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0 ; * (la "Licenza"); è proibito usare questo file se non in conformità alla ; * Licenza. Una copia della Licenza è disponibile all'indirizzo: ; * ; * http://www.apache.org/licenses/LICENSE-2.0 ; * ; * Se non richiesto dalla legislazione vigente o concordato per iscritto, ; * il software distribuito nei termini della Licenza è distribuito ; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o ; * implicite. Consultare la Licenza per il testo specifico che regola le ; * autorizzazioni e le limitazioni previste dalla medesima. ; ****************************************************************************/ ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ;* * ;* HORIZONTAL SCROLL ON EF936X * ;* * ;* by Marco Spedaletti * ;* * ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * HSCROLLST PSHS A,B,X,Y,U LDA <DIRECTION CMPA #0 BGT HSCROLLSTRIGHT HSCROLLSTLEFT ORCC #$50 LDA #2 PSHS A LDA $A7C0 ANDA #$FE STA $A7C0 HSCROLLSTLEFT0X LDU #0 LDA #10 HSCROLLSTLEFT1X LDB ,U+ HSCROLLSTLEFT2X PULU Y,X STX -5,U STY -3,U DECA BNE HSCROLLSTLEFT2X LDA #10 LEAU -2,U STB ,U+ CMPU #$1F40 BLO HSCROLLSTLEFT1X INC $A7C0 DEC ,S BNE HSCROLLSTLEFT0X PULS A ANDCC #$AF PULS D,X,Y,U RTS HSCROLLSTRIGHT ORCC #$50 LDA #2 PSHS A LDA $A7C0 ANDA #$FE STA $A7C0 HSCROLLSTRIGHT0X LDU #$1F3F LDA #10 HSCROLLSTRIGHT1X LDB ,U+ HSCROLLSTRIGHT2X LDY -3,U LDX -5,U PSHU X,Y DECA BNE HSCROLLSTRIGHT2X LDA #10 STB ,U LEAU -1,U CMPU #$FFFF BNE HSCROLLSTRIGHT1X INC $A7C0 DEC ,S BNE HSCROLLSTRIGHT0X PULS A ANDCC #$AF PULS D,X,Y,U RTS HSCROLLLT RTS
; A116166: a(n) = 8^n * n*(n+1). ; 0,16,384,6144,81920,983040,11010048,117440512,1207959552,12079595520,118111600640,1133871366144,10720238370816,100055558127616,923589767331840,8444249301319680,76561193665298432,689050742987685888,6160924290242838528,54763771468825231360,484227031934875729920,4261197881026906423296,37336210005188132470784,325843287318005519745024,2833419889721787128217600,24556305710922155111219200,212166481342367420160933888,1827895839257319312155738112,15706364248433262237782638592,134625979272285104895279759360,1151284236535403655656185528320,9824292151768777861599449841664,83664939615063140498782411554816,711151986728036694239650498215936,6034016857086371951124307257589760,51111672201202209468347073240760320,432258713473024400075163819407572992 add $0,1 mov $2,8 pow $2,$0 bin $0,2 mul $0,$2 div $0,4
; ; Include code from halx86 ; This is a cpp style symbolic link include ..\..\halx86\i386\ixprofil.asm
.open "sys/main.dol" .org 0x803FCFA8 .global init_save_with_tweaks init_save_with_tweaks: ; Function start stuff stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) bl init__10dSv_save_cFv ; To call this custom func we overwrote a call to init__10dSv_save_cFv, so call that now. ; lis r5, sword_mode@ha ; addi r5, r5, sword_mode@l ; lbz r5, 0 (r5) ; cmpwi r5, 0 ; Start with Sword ; beq start_with_sword ; cmpwi r5, 2 ; Swordless ; beq break_barrier_for_swordless ; b after_sword_mode_initialization ; start_with_sword: ; bl item_func_sword__Fv ; b after_sword_mode_initialization ; break_barrier_for_swordless: ; lis r3, 0x803C522C@ha ; addi r3, r3, 0x803C522C@l ; li r4, 0x2C02 ; BARRIER_DOWN ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3B08 ; Another event flag set by the barrier. This one seems to have no effect, but set it anyway just to be safe. ; bl onEventBit__11dSv_event_cFUs ; after_sword_mode_initialization: ; bl item_func_shield__Fv ; bl item_func_normal_sail__Fv ; bl item_func_wind_tact__Fv ; Wind Waker ; bl item_func_tact_song1__Fv ; Wind's Requiem ; bl item_func_tact_song2__Fv ; Ballad of Gales ; bl item_func_tact_song6__Fv ; Song of Passing ; bl item_func_pirates_omamori__Fv ; Pirate's Charm ; lis r3, 0x803C522C@ha ; addi r3, r3, 0x803C522C@l ; li r4, 0x3510 ; HAS_SEEN_INTRO ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0280 ; SAW_TETRA_IN_FOREST_OF_FAIRIES ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0520 ; GOSSIP_STONE_AT_FF1 (Causes Aryll and the pirates to disappear from Outset) ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2E01 ; WATCHED_MEETING_KORL_CUTSCENE (Necessary for Windfall music to play when warping there) ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0F80 ; KORL_UNLOCKED_AND_SPAWN_ON_WINDFALL ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0908 ; SAIL_INTRODUCTION_TEXT_AND_MAP_UNLOCKED ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2A08 ; ENTER_KORL_FOR_THE_FIRST_TIME_AND_SPAWN_ANYWHERE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0902 ; SAW_DRAGON_ROOST_ISLAND_INTRO ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1F40 ; SAW_QUILL_CUTSCENE_ON_DRI ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0A80 ; KORL_DINS_PEARL_TEXT_ALLOWING_YOU_TO_ENTER_HIM ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0901 ; TRIGGERED_MAP_FISH ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0A20 ; WATCHED_FOREST_HAVEN_INTRO_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1801 ; WATCHED_DEKU_TREE_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0A08 ; TALKED_TO_KORL_AFTER_LEAVING_FH ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x0808 ; Needed so that exiting the pirate ship takes you to Windfall instead of the tutorial ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1F02 ; TALKED_TO_KORL_AFTER_GETTING_BOMBS ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2F20 ; Talked to KoRL after getting Nayru's Pearl ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3840 ; TALKED_TO_KORL_POST_TOWER_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2D04 ; MASTER_SWORD_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3802 ; COLORS_IN_HYRULE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2D01 ; ANIMATION_SET_2 (Saw cutscene before Helmaroc King where Aryll is rescued) ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2D02 ; TETRA_TO_ZELDA_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3201 ; KoRL told you about the sages ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3380 ; KoRL told you about the Triforce shards ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1001 ; WATCHED_FIRE_AND_ICE_ARROWS_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2E04 ; MEDLI_IN_EARTH_TEMPLE_ENTRANCE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2920 ; MEDLI_IN_EARTH_TEMPLE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1620 ; Medli is in dungeon mode and can be lifted/called ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3304 ; Saw event where Medli calls to you from within jail ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2910 ; MAKAR_IN_WIND_TEMPLE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x1610 ; Makar is in dungeon mode and can be lifted/called ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3440 ; Saw event where Makar calls to you from within jail ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3A20 ; Fishman and KoRL talked about Forsaken Fortress after you beat Molgera ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2D08 ; HYRULE_3_WARP_CUTSCENE ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3980 ; HYRULE_3_ELECTRICAL_BARRIER_CUTSCENE_1 ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x3B02 ; Saw cutscene before Puppet Ganon fight ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x4002 ; Saw cutscene before Ganondorf fight ; bl onEventBit__11dSv_event_cFUs ; lis r3, 0x803C5D60@ha ; addi r3, r3, 0x803C5D60@l ; li r4, 0x0310 ; Saw event where Grandma gives you the Hero's Clothes ; bl onEventBit__11dSv_event_cFUs ; Set four switch bits (0, 1, 3, 7) for several events that happen in the Fairy Woods on Outset. ; Setting these switches causes the Tetra hanging from a tree and rescuing her from Bokoblins events to be marked as finished. ; Also set the switch (9) for having seen the event where you enter the Rito Aerie for the first time and get the Delivery Bag. ; Also set the switch (8) for having unclogged the pond, since that boulder doesn't respond to normal bombs which would be odd. ; Also set the the switch (1E) for having seen the intro to the interior of the Forest Haven, where the camera pans up. ; Also set the the switch (13) for having seen the camera panning towards the treasure chest in Windfall Town Jail. ; lis r3, 0x803C5114@ha ; addi r3, r3, 0x803C5114@l ; lis r4, 0x4008 ; addi r4, r4, 0x038B ; stw r4, 4 (r3) ; ; Set two switch bits (3E and 3F) for having unlocked the song tablets in the Earth and Wind Temple entrances. ; lis r4, 0xC000 ; stw r4, 8 (r3) ; ; Set a switch bit (19) for the event on Greatfish Isle so that the endless night never starts. ; lis r3, 0x803C4F88@ha ; Sea stage info. ; addi r3, r3, 0x803C4F88@l ; lis r4, 0x0200 ; stw r4, 4 (r3) ; ; Also set a switch bit (3F) for having seen the Windfall Island intro scene. ; lis r4, 0x8000 ; stw r4, 8 (r3) ; ; Also set a switch bit (58) for having seen the short event when you enter Forsaken Fortress 2 for the first time. ; ; Also set a switch (0x50) for having seen the event where the camera pans around the Flight Control Platform. ; lis r4, 0x0101 ; stw r4, 0xC (r3) ; ; Set a switch (21) for having seen the gossip stone event in DRC where KoRL tells you about giving bait to rats. ; ; Also set a switch (09) for having seen the event where the camera pans up to Valoo when you go outside. ; ; Also set a switch (46) for having seen the event where the camera pans around when you first enter DRC. ; lis r3, 0x803C4FF4@ha ; Dragon Roost Cavern stage info. ; addi r3, r3, 0x803C4FF4@l ; li r4, 0x0200 ; stw r4, 4 (r3) ; li r4, 0x0002 ; stw r4, 8 (r3) ; li r4, 0x0040 ; stw r4, 0xC (r3) ; ; Set a switch (36) for having seen the event where the camera pans around the first room when you first enter FW. ; lis r3, 0x803C5018@ha ; Forbidden Woods stage info. ; addi r3, r3, 0x803C5018@l ; lis r4, 0x0040 ; stw r4, 8 (r3) ; ; Set a switch (2D) for having seen the event where the camera pans around when you go outside at the top of TotG. ; ; Also set a switch (63) for having seen the event where the camera pans around the first room when you first enter TotG. ; lis r3, 0x803C503C@ha ; Tower of the Gods stage info. ; addi r3, r3, 0x803C503C@l ; li r4, 0x2000 ; stw r4, 8 (r3) ; li r4, 0x0008 ; stw r4, 0x10 (r3) ; ; Set a switch (2A) for having seen the gossip stone event where KoRL tells you Medli shows up on the compass. ; lis r3, 0x803C5060@ha ; Earth Temple stage info. ; addi r3, r3, 0x803C5060@l ; li r4, 0x0400 ; stw r4, 8 (r3) ; ; Set a switch (12) for having seen the camera moving around event when you first enter Hyrule. ; ; Also set a switch (6) for having completed the Triforce pushable blocks puzzle. ; lis r3, 0x803C50CC@ha ; Hyrule stage info. ; addi r3, r3, 0x803C50CC@l ; lis r4, 0x0004 ; addi r4, r4, 0x0040 ; stw r4, 4 (r3) ; ; Set a switch (0D) for having seen the camera panning around when you first enter Ganon's Tower. ; ; Also set a switch (1C) for having seen the camera panning around looking at the 4 lights in the room where you can drop down to the maze. ; ; Also set a switch (1D) for having seen the camera panning around looking at the 4 boomerang switches in the room with the warp up to Forsaken Fortress. ; ; Also set a switch (1E) for having seen the cutscene before the Puppet Ganon fight. ; ; Also set a switch (12) for having seen the cutscene after the Puppet Ganon fight. ; ; Also set a switch (1F) for having seen the cutscene before the Ganondorf fight. ; lis r3, 0x803C50A8@ha ; Ganon's Tower stage info. ; addi r3, r3, 0x803C50A8@l ; lis r4, 0xF004 ; addi r4, r4, 0x2000 ; stw r4, 4 (r3) ; li r3, 3 ; DRC stage ID ; li r4, 5 ; Seen the boss intro bit index ; bl generic_on_dungeon_bit ; li r3, 4 ; FW stage ID ; li r4, 5 ; Seen the boss intro bit index ; bl generic_on_dungeon_bit ; li r3, 5 ; TotG stage ID ; li r4, 5 ; Seen the boss intro bit index ; bl generic_on_dungeon_bit ; li r3, 6 ; ET stage ID ; li r4, 5 ; Seen the boss intro bit index ; bl generic_on_dungeon_bit ; li r3, 7 ; WT stage ID ; li r4, 5 ; Seen the boss intro bit index ; bl generic_on_dungeon_bit ; ; Start the player with 30 bombs and arrows. (But not the ability to actually use them.) ; ; This change is so we can remove the code that sets your current bombs/arrows to 30 when you first get the bombs/bow. ; ; That code would be bad if the player got a bomb bag/quiver upgrade beforehand, as then that code would reduce the max. ; lis r3, 0x803C ; addi r3, r3, 0x4C71 ; li r4, 30 ; stb r4, 0 (r3) ; Current arrows ; stb r4, 1 (r3) ; Current bombs ; stb r4, 6 (r3) ; Max arrows ; stb r4, 7 (r3) ; Max bombs ; ; Start the player with a magic meter so items that use it work correctly. ; lis r3, 0x803C ; addi r3, r3, 0x4C1B ; li r4, 16 ; 16 is the normal starting size of the magic meter. ; stb r4, 0 (r3) ; Max magic meter ; stb r4, 1 (r3) ; Current magic meter ; ; Make the game think the player has previously owned every type of spoil and bait so they don't get the item get animation the first time they pick each type up. ; lis r3, 0x803C4C9C@ha ; addi r3, r3, 0x803C4C9C@l ; li r4, 0xFF ; stb r4, 0 (r3) ; 803C4C9C, bitfield of what spoils bag items you've ever owned ; stb r4, 1 (r3) ; 803C4C9D, bitfield of what bait bag items you've ever owned ; Give the player the number of Triforce Shards they want to start with. lis r5, num_triforce_shards_to_start_with@ha addi r5, r5, num_triforce_shards_to_start_with@l lbz r5, 0 (r5) ; Load number of Triforce Shards to start with lis r3, 0x803C4CC6@ha ; Bitfield of Triforce Shards the player owns addi r3, r3, 0x803C4CC6@l ; Convert the number of shards to a bitfield with that many bits set. ; e.g. For 5 shards, ((1 << 5) - 1) results in 0x1F (binary 00011111). li r0, 1 slw r4, r0, r5 subi r4, r4, 1 stb r4, 0 (r3) ; Store the bitfield of shards back ; If the number of starting shards is 8, also set the event flag for seeing the Triforce refuse together. cmpwi r5, 8 blt after_starting_triforce_shards lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x3D04 ; Saw the Triforce refuse bl onEventBit__11dSv_event_cFUs after_starting_triforce_shards: ; lis r5, should_start_with_heros_clothes@ha ; addi r5, r5, should_start_with_heros_clothes@l ; lbz r5, 0 (r5) ; Load bool of whether player should start with Hero's clothes ; cmpwi r5, 1 ; bne after_starting_heros_clothes ; lis r3, 0x803C522C@ha ; addi r3, r3, 0x803C522C@l ; li r4, 0x2A80 ; HAS_HEROS_CLOTHES ; bl onEventBit__11dSv_event_cFUs ; after_starting_heros_clothes: lis r5, skip_rematch_bosses@ha addi r5, r5, skip_rematch_bosses@l lbz r5, 0 (r5) ; Load bool of whether rematch bosses should be skipped cmpwi r5, 1 bne after_skipping_rematch_bosses lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x3904 ; Recollection Gohma defeated bl onEventBit__11dSv_event_cFUs li r4, 0x3902 ; Recollection Kalle Demos defeated bl onEventBit__11dSv_event_cFUs li r4, 0x3901 ; Recollection Jalhalla defeated bl onEventBit__11dSv_event_cFUs li r4, 0x3A80 ; Recollection Molgera defeated bl onEventBit__11dSv_event_cFUs after_skipping_rematch_bosses: ; Function end stuff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global num_triforce_shards_to_start_with num_triforce_shards_to_start_with: .byte 0 ; By default start with no Triforce Shards .global should_start_with_heros_clothes should_start_with_heros_clothes: .byte 1 ; By default start with the Hero's Clothes .global sword_mode sword_mode: .byte 0 ; By default Start with Sword .global skip_rematch_bosses skip_rematch_bosses: .byte 1 ; By default skip them .align 2 ; Align to the next 4 bytes .global convert_progressive_item_id convert_progressive_item_id: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) cmpwi r3, 0x38 beq convert_progressive_sword_id cmpwi r3, 0x39 beq convert_progressive_sword_id cmpwi r3, 0x3A beq convert_progressive_sword_id cmpwi r3, 0x3D beq convert_progressive_sword_id cmpwi r3, 0x3E beq convert_progressive_sword_id cmpwi r3, 0x27 beq convert_progressive_bow_id cmpwi r3, 0x35 beq convert_progressive_bow_id cmpwi r3, 0x36 beq convert_progressive_bow_id cmpwi r3, 0xAB beq convert_progressive_wallet_id cmpwi r3, 0xAC beq convert_progressive_wallet_id cmpwi r3, 0xAD beq convert_progressive_bomb_bag_id cmpwi r3, 0xAE beq convert_progressive_bomb_bag_id cmpwi r3, 0xAF beq convert_progressive_quiver_id cmpwi r3, 0xB0 beq convert_progressive_quiver_id cmpwi r3, 0x23 beq convert_progressive_picto_box_id cmpwi r3, 0x26 beq convert_progressive_picto_box_id b convert_progressive_item_id_func_end convert_progressive_sword_id: lis r3, 0x803C4CBC@ha addi r3, r3, 0x803C4CBC@l lbz r4, 0 (r3) ; Bitfield of swords you own cmpwi r4, 0 beq convert_progressive_sword_id_to_normal_sword cmpwi r4, 1 beq convert_progressive_sword_id_to_powerless_master_sword cmpwi r4, 3 beq convert_progressive_sword_id_to_half_power_master_sword cmpwi r4, 7 beq convert_progressive_sword_id_to_full_power_master_sword li r3, 0x38 ; Invalid sword state; this shouldn't happen so just return the base sword ID b convert_progressive_item_id_func_end convert_progressive_sword_id_to_normal_sword: li r3, 0x38 b convert_progressive_item_id_func_end convert_progressive_sword_id_to_powerless_master_sword: li r3, 0x39 b convert_progressive_item_id_func_end convert_progressive_sword_id_to_half_power_master_sword: li r3, 0x3A b convert_progressive_item_id_func_end convert_progressive_sword_id_to_full_power_master_sword: li r3, 0x3E b convert_progressive_item_id_func_end convert_progressive_bow_id: lis r3, 0x803C4C65@ha addi r3, r3, 0x803C4C65@l lbz r4, 0 (r3) ; Bitfield of arrow types you own cmpwi r4, 0 beq convert_progressive_bow_id_to_heros_bow cmpwi r4, 1 beq convert_progressive_bow_id_to_fire_and_ice_arrows cmpwi r4, 3 beq convert_progressive_bow_id_to_light_arrows li r3, 0x27 ; Invalid bow state; this shouldn't happen so just return the base bow ID b convert_progressive_item_id_func_end convert_progressive_bow_id_to_heros_bow: li r3, 0x27 b convert_progressive_item_id_func_end convert_progressive_bow_id_to_fire_and_ice_arrows: li r3, 0x35 b convert_progressive_item_id_func_end convert_progressive_bow_id_to_light_arrows: li r3, 0x36 b convert_progressive_item_id_func_end convert_progressive_wallet_id: lis r3, 0x803C4C1A@ha addi r3, r3, 0x803C4C1A@l lbz r4, 0 (r3) ; Which wallet you have cmpwi r4, 0 beq convert_progressive_wallet_id_to_1000_rupee_wallet cmpwi r4, 1 beq convert_progressive_wallet_id_to_5000_rupee_wallet li r3, 0xAB ; Invalid wallet state; this shouldn't happen so just return the base wallet ID b convert_progressive_item_id_func_end convert_progressive_wallet_id_to_1000_rupee_wallet: li r3, 0xAB b convert_progressive_item_id_func_end convert_progressive_wallet_id_to_5000_rupee_wallet: li r3, 0xAC b convert_progressive_item_id_func_end convert_progressive_bomb_bag_id: lis r3, 0x803C4C72@ha addi r3, r3, 0x803C4C72@l lbz r4, 6 (r3) ; Max number of bombs the player can currently hold cmpwi r4, 30 beq convert_progressive_bomb_bag_id_to_60_bomb_bomb_bag cmpwi r4, 60 beq convert_progressive_bomb_bag_id_to_99_bomb_bomb_bag li r3, 0xAD ; Invalid bomb bag state; this shouldn't happen so just return the base bomb bag ID b convert_progressive_item_id_func_end convert_progressive_bomb_bag_id_to_60_bomb_bomb_bag: li r3, 0xAD b convert_progressive_item_id_func_end convert_progressive_bomb_bag_id_to_99_bomb_bomb_bag: li r3, 0xAE b convert_progressive_item_id_func_end convert_progressive_quiver_id: lis r3, 0x803C4C71@ha addi r3, r3, 0x803C4C71@l lbz r4, 6 (r3) ; Max number of arrows the player can currently hold cmpwi r4, 30 beq convert_progressive_quiver_id_to_60_arrow_quiver cmpwi r4, 60 beq convert_progressive_quiver_id_to_99_arrow_quiver li r3, 0xAF ; Invalid bomb bag state; this shouldn't happen so just return the base bomb bag ID b convert_progressive_item_id_func_end convert_progressive_quiver_id_to_60_arrow_quiver: li r3, 0xAF b convert_progressive_item_id_func_end convert_progressive_quiver_id_to_99_arrow_quiver: li r3, 0xB0 b convert_progressive_item_id_func_end convert_progressive_picto_box_id: lis r3, 0x803C4C61@ha addi r3, r3, 0x803C4C61@l lbz r4, 0 (r3) ; Bitfield of picto boxes you own cmpwi r4, 0 beq convert_progressive_picto_box_id_to_normal_picto_box cmpwi r4, 1 beq convert_progressive_picto_box_id_to_deluxe_picto_box li r3, 0x23 ; Invalid bomb bag state; this shouldn't happen so just return the base bomb bag ID b convert_progressive_item_id_func_end convert_progressive_picto_box_id_to_normal_picto_box: li r3, 0x23 b convert_progressive_item_id_func_end convert_progressive_picto_box_id_to_deluxe_picto_box: li r3, 0x26 b convert_progressive_item_id_func_end convert_progressive_item_id_func_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global convert_progressive_item_id_for_createDemoItem convert_progressive_item_id_for_createDemoItem: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) mr r3, r26 ; createDemoItem keeps the item ID in r26 bl convert_progressive_item_id ; Get the correct item ID mr r26, r3 ; Put it back where createDemoItem expects it, in r26 li r3, 259 ; And then simply replace the line of code in createDemoItem that we overwrote to call this function lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global convert_progressive_item_id_for_daItem_create convert_progressive_item_id_for_daItem_create: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lbz r3, 0xB3 (r31) ; Read this field item's item ID from its params (params are at 0xB0, the item ID is has the mask 0x000000FF) bl convert_progressive_item_id ; Get the correct item ID stb r3, 0xB3 (r31) ; Store the corrected item ID back into the field item's params ; Then we return the item ID in r0 so that the next few lines in daItem_create can use it. mr r0, r3 lwz r3, 0x14 (sp) mtlr r3 addi sp, sp, 0x10 blr .global convert_progressive_item_id_for_dProcGetItem_init_1 convert_progressive_item_id_for_dProcGetItem_init_1: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lwz r3, 0x30C (r28) ; Read the item ID property for this event action bl convert_progressive_item_id ; Get the correct item ID ; Then we return the item ID in r0 so that the next few lines in dProcGetItem_init can use it. mr r0, r3 lwz r3, 0x14 (sp) mtlr r3 addi sp, sp, 0x10 blr .global convert_progressive_item_id_for_dProcGetItem_init_2 convert_progressive_item_id_for_dProcGetItem_init_2: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lbz r3, 0x52AC (r3) ; Read the item ID from 803C9EB4 bl convert_progressive_item_id ; Get the correct item ID ; Then we return the item ID in r27 so that the next few lines in dProcGetItem_init can use it. mr r27, r3 lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global convert_progressive_item_id_for_shop_item convert_progressive_item_id_for_shop_item: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; Replace the call to savegpr we overwrote to call this custom function bl _savegpr_28 mr r30, r3 ; Preserve the shop item entity pointer lbz r3, 0xB3 (r30) bl convert_progressive_item_id ; Get the correct item ID stb r3, 0x63A (r30) ; Store the item ID to shop item entity+0x63A mr r3, r30 ; Put the shop item entity pointer back into r3, because that's where the function that called this one expects it to be lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Acts as a replacement to getSelectItemNo, but should only be called when the shopkeeper is checking if the item get animation should play or not, in order to have that properly show for progressive items past the first tier. ; If this was used all the time as a replacement for getSelectItemNo it would cause the shop to be buggy since it uses the item ID to know what slot it's on. .global custom_getSelectItemNo_progressive custom_getSelectItemNo_progressive: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) bl getSelectItemNo__11ShopItems_cFv bl convert_progressive_item_id lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global progressive_sword_item_func progressive_sword_item_func: ; Function start stuff stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C4CBC@ha addi r3, r3, 0x803C4CBC@l lbz r4, 0 (r3) ; Bitfield of swords you own cmpwi r4, 0 beq get_normal_sword cmpwi r4, 1 beq get_powerless_master_sword cmpwi r4, 3 beq get_half_power_master_sword cmpwi r4, 7 beq get_full_power_master_sword b sword_func_end get_normal_sword: bl item_func_sword__Fv b sword_func_end get_powerless_master_sword: bl item_func_master_sword__Fv b sword_func_end get_half_power_master_sword: bl item_func_lv3_sword__Fv b sword_func_end get_full_power_master_sword: bl item_func_master_sword_ex__Fv sword_func_end: ; Function end stuff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global progressive_bow_func progressive_bow_func: ; Function start stuff stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C4C65@ha addi r3, r3, 0x803C4C65@l lbz r4, 0 (r3) ; Bitfield of arrow types you own cmpwi r4, 0 beq get_heros_bow cmpwi r4, 1 beq get_fire_and_ice_arrows cmpwi r4, 3 beq get_light_arrows b bow_func_end get_heros_bow: bl item_func_bow__Fv b bow_func_end get_fire_and_ice_arrows: bl item_func_magic_arrow__Fv b bow_func_end get_light_arrows: bl item_func_light_arrow__Fv bow_func_end: ; Function end stuff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global progressive_wallet_item_func progressive_wallet_item_func: lis r3, 0x803C4C1A@ha addi r3, r3, 0x803C4C1A@l lbz r4, 0 (r3) ; Which wallet you have cmpwi r4, 0 beq get_1000_rupee_wallet cmpwi r4, 1 beq get_5000_rupee_wallet b wallet_func_end get_1000_rupee_wallet: li r4, 1 stb r4, 0 (r3) ; Which wallet you have b wallet_func_end get_5000_rupee_wallet: li r4, 2 stb r4, 0 (r3) ; Which wallet you have wallet_func_end: blr .global progressive_bomb_bag_item_func progressive_bomb_bag_item_func: lis r3, 0x803C4C72@ha addi r3, r3, 0x803C4C72@l lbz r4, 6 (r3) ; Max number of bombs the player can currently hold cmpwi r4, 30 beq get_60_bomb_bomb_bag cmpwi r4, 60 beq get_99_bomb_bomb_bag b bomb_bag_func_end get_60_bomb_bomb_bag: li r4, 60 stb r4, 0 (r3) ; Current num bombs stb r4, 6 (r3) ; Max num bombs b bomb_bag_func_end get_99_bomb_bomb_bag: li r4, 99 stb r4, 0 (r3) ; Current num bombs stb r4, 6 (r3) ; Max num bombs bomb_bag_func_end: blr .global progressive_quiver_item_func progressive_quiver_item_func: lis r3, 0x803C4C71@ha addi r3, r3, 0x803C4C71@l lbz r4, 6 (r3) ; Max number of arrows the player can currently hold cmpwi r4, 30 beq get_60_arrow_quiver cmpwi r4, 60 beq get_99_arrow_quiver b quiver_func_end get_60_arrow_quiver: li r4, 60 stb r4, 0 (r3) ; Current num arrows stb r4, 6 (r3) ; Max num arrows b quiver_func_end get_99_arrow_quiver: li r4, 99 stb r4, 0 (r3) ; Current num arrows stb r4, 6 (r3) ; Max num arrows quiver_func_end: blr .global progressive_picto_box_item_func progressive_picto_box_item_func: ; Function start stuff stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C4C61@ha addi r3, r3, 0x803C4C61@l lbz r4, 0 (r3) ; Bitfield of picto boxes you own cmpwi r4, 0 beq get_normal_picto_box cmpwi r4, 1 beq get_deluxe_picto_box b picto_box_func_end get_normal_picto_box: bl item_func_camera__Fv b picto_box_func_end get_deluxe_picto_box: bl item_func_camera2__Fv picto_box_func_end: ; Function end stuff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global hurricane_spin_item_func hurricane_spin_item_func: ; Function start stuff stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; Set event bit 6901 (bit 01 of byte 803C5295). ; This bit was unused in the base game, but we repurpose it to keep track of whether you have Hurricane Spin separately from whether you've seen the event where Orca would normally give you Hurricane Spin. lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6901 ; Unused event bit bl onEventBit__11dSv_event_cFUs ; Function end stuff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global set_shop_item_in_bait_bag_slot_sold_out set_shop_item_in_bait_bag_slot_sold_out: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; First call the regular SoldOutItem function with the given arguments since we overwrote a call to that in order to call this custom function. bl SoldOutItem__11ShopItems_cFi ; Set event bit 6902 (bit 02 of byte 803C5295). ; This bit was unused in the base game, but we repurpose it to keep track of whether you've purchased whatever item is in the Bait Bag slot of Beedle's shop. lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6902 ; Unused event bit bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global check_shop_item_in_bait_bag_slot_sold_out check_shop_item_in_bait_bag_slot_sold_out: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; Check event bit 6902 (bit 02 of byte 803C5295), which was originally unused but we use it to keep track of whether the item in the Bait Bag slot has been purchased or not. lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6902 ; Unused event bit bl isEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; This function takes the same arguments as fastCreateItem, but it loads in any unloaded models without crashing like createItem. ; This is so we can replace any randomized item spawns that use fastCreateItem with a call to this new function instead. ; Note: One part of fastCreateItem that this custom function cannot emulate is giving the item a starting velocity. ; fastCreateItem can do that because the item subentity is created instantly, but when slow-loading the model for the item, the subentity is created asynchronously later on, so there's no way for us to store the velocity to it. ; The proper way to store a velocity to a slow-loaded item is for the object that created this item to check if the item is loaded every frame, and once it is it then stores the velocity to it. But this would be too complex to implement via ASM. .global custom_createItem custom_createItem: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; If the item ID is FF, no item will be spawned. ; In order to avoid crashes we need to return a null pointer. ; Also don't bother even trying to spawn the item - it wouldn't do anything. cmpwi r4, 0xFF beq custom_createItem_invalid_item_id ; Create the item by calling createItem, which will load the item's model if necessary. mr r9, r5 mr r5, r8 mr r8, r6 mr r6, r9 mr r10, r7 li r7, 3 ; Don't fade out li r9, 5 ; Item action, how it behaves. 5 causes it to make a ding sound so that it's more obvious. bl fopAcM_createItem__FP4cXyziiiiP5csXyziP4cXyz ; We need to return a pointer to the item entity to match fastCreateItem. ; But createItem only returns the entity ID. ; However, the entity pointer is still conveniently leftover in r5, so we just return that. mr r3, r5 b custom_createItem_func_end custom_createItem_invalid_item_id: li r3, 0 custom_createItem_func_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; When creating the item for the withered trees, offset the position it spawns at to be right in front of the player. ; Normally it would spawn at the top and then shoot out with momentum until it's in front of the player. ; But because of the way custom_createItem works, adding momentum is impossible. ; So instead just change the position to be in front of the player (but still up in the tree, so it falls down with gravity). .global create_item_for_withered_trees create_item_for_withered_trees: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r10, withered_tree_item_spawn_offset@ha addi r10, r10, withered_tree_item_spawn_offset@l ; Offset X pos lfs f0, 0 (r3) lfs f4, 0 (r10) ; Read the X offset fadds f0,f4,f0 stfs f0, 0 (r3) ; Offset Y pos lfs f0, 4 (r3) lfs f4, 4 (r10) ; Read the Y offset fadds f0,f4,f0 stfs f0, 4 (r3) ; Offset Z pos lfs f0, 8 (r3) lfs f4, 8 (r10) ; Read the Z offset fadds f0,f4,f0 stfs f0, 8 (r3) bl custom_createItem lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global withered_tree_item_spawn_offset withered_tree_item_spawn_offset: .float -245.0 ; X offset .float 0.0 ; Y offset .float -135.0 ; Z offset ; Custom function that checks if the warp down to Hyrule should be unlocked. ; Requirements: Must have all 8 pieces of the Triforce. .global check_hyrule_warp_unlocked check_hyrule_warp_unlocked: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C4C08@ha addi r3, r3, 0x803C4C08@l addi r3, r3, 180 bl getTriforceNum__20dSv_player_collect_cFv cmpwi r3, 8 bge hyrule_warp_unlocked hyrule_warp_not_unlocked: li r3, 0 b hyrule_warp_end hyrule_warp_unlocked: li r3, 1 hyrule_warp_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Updates the current wind direction to match KoRL's direction. .global set_wind_dir_to_ship_dir set_wind_dir_to_ship_dir: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; First call setShipSailState since we overwrote a call to this in KoRL's code in order to call this custom function. bl setShipSailState__11JAIZelBasicFl lis r3,0x803CA75C@ha addi r3,r3,0x803CA75C@l lwz r3, 0 (r3) ; Read the pointer to KoRL's entity lha r3, 0x206 (r3) ; Read KoRL's Y rotation neg r3, r3 ; Negate his Y rotation since it's backwards addi r4, r3, 0x4000 ; Add 90 degrees to get the diretion KoRL is actually facing addi r4, r4, 0x1000 ; Add another 22.5 degrees in order to help round to the closest 45 degrees. rlwinm r4,r4,0,0,18 ; Now AND with 0xFFFFE000 in order to round down to the nearest 0x2000 (45 degrees). Because we added 22.5 degrees first, this accomplishes rounding either up or down to the nearest 45 degrees, whichever is closer. li r3, 0 bl dKyw_tact_wind_set__Fss ; Pass the new angle as argument r4 to the function that changes wind direction lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Custom function that checks if the treasure chest in Ganon's Tower (that originally had the Light Arrows) has been opened. ; This is to make the Phantom Ganon that appears in the maze still work if you got Light Arrows beforehand. .global check_ganons_tower_chest_opened check_ganons_tower_chest_opened: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 8 ; Stage ID for Ganon's Tower. li r4, 0 ; Chest open flag for the Light Arrows chest. Just 0 since this is the only chest in the whole dungeon. bl dComIfGs_isStageTbox__Fii lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Custom function that creates an item given by a Windfall townsperson, and also sets an event bit to keep track of the item being given. .global create_item_and_set_event_bit_for_townsperson create_item_and_set_event_bit_for_townsperson: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) stw r31, 0xC (sp) mr r31, r4 ; Preserve argument r4, which has both the item ID and the event bit to set. clrlwi r4,r4,24 ; Get the lowest byte (0x000000FF), which has the item ID bl fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz rlwinm. r4,r31,16,16,31 ; Get the upper halfword (0xFFFF0000), which has the event bit to set beq create_item_and_set_event_bit_for_townsperson_end ; If the event bit specified is 0000, skip to the end of the function instead mr r31, r3 ; Preserve the return value from createItemForPresentDemo so we can still return that lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l bl onEventBit__11dSv_event_cFUs ; Otherwise, set that event bit mr r3, r31 create_item_and_set_event_bit_for_townsperson_end: lwz r31, 0xC (sp) lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Lenzo normally won't let you start his assistant quest if he detects you already have the Deluxe Picto Box, which is bad when that's randomized. ; So we need to set a custom event bit to keep track of whether you've gotten whatever item is in the Deluxe Picto Box slot. .global lenzo_set_deluxe_picto_box_event_bit lenzo_set_deluxe_picto_box_event_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; First replace the function call we overwrote to call this custom function. bl setEquipBottleItemEmpty__17dSv_player_item_cFv ; Next set an originally-unused event bit to keep track of whether the player got the item that was the Deluxe Picto Box in vanilla. lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6920 bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Zunari usually checks if he gave you the Magic Armor by calling checkGetItem on the Magic Armor item ID. This doesn't work properly when the item he gives is randomized. ; So we need to set a custom event bit to keep track of whether you've gotten whatever item is in the Magic Armor slot. .global zunari_give_item_and_set_magic_armor_event_bit zunari_give_item_and_set_magic_armor_event_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) stw r31, 0xC (sp) mr r31, r4 ; Preserve argument r4, which has the item ID bl fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz lis r4, zunari_magic_armor_slot_item_id@ha addi r4, r4, zunari_magic_armor_slot_item_id@l lbz r4, 0 (r4) ; Load what item ID is in the Magic Armor slot. This value is updated by the randomizer when it randomizes that item. cmpw r31, r4 ; Check if the item ID given is the same one from the Magic Armor slot. bne zunari_give_item_and_set_magic_armor_event_bit_end ; If it's not the item in the Magic Armor slot, skip to the end of the function mr r31, r3 ; Preserve the return value from createItemForPresentDemo so we can still return that lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6940 ; Unused event bit that we use to keep track of whether Zunari has given the Magic Armor item bl onEventBit__11dSv_event_cFUs mr r3, r31 zunari_give_item_and_set_magic_armor_event_bit_end: lwz r31, 0xC (sp) lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global zunari_magic_armor_slot_item_id zunari_magic_armor_slot_item_id: .byte 0x2A ; Default item ID is Magic Armor. This value is updated by the randomizer when this item is randomized. .align 2 ; Align to the next 4 bytes ; Salvage Corp usually check if they gave you their item by calling checkGetItem. This doesn't work properly when the item is randomized. ; So we need to set a custom event bit to keep track of whether you've gotten whatever item they give you. .global salvage_corp_give_item_and_set_event_bit salvage_corp_give_item_and_set_event_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) stw r31, 0xC (sp) bl fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz mr r31, r3 ; Preserve the return value from createItemForPresentDemo so we can still return that lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6980 ; Unused event bit that we use to keep track of whether the Salvage Corp has given you their item yet or not bl onEventBit__11dSv_event_cFUs mr r3, r31 lwz r31, 0xC (sp) lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Maggie usually checks if she's given you her letter by calling isReserve. That doesn't work well when the item is randomized. ; So we use this function to give her item and then set a custom event bit to keep track of it (6A01). .global maggie_give_item_and_set_event_bit maggie_give_item_and_set_event_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) stw r31, 0xC (sp) bl fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz mr r31, r3 ; Preserve the return value from createItemForPresentDemo so we can still return that lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A01 ; Unused event bit bl onEventBit__11dSv_event_cFUs mr r3, r31 lwz r31, 0xC (sp) lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; The Rito postman in the Windfall cafe usually checks if he's given you Moe's letter by calling isReserve. That doesn't work well when the item is randomized. ; So we use this function to start his item give event and then set a custom event bit to keep track of it (6A02). .global rito_cafe_postman_start_event_and_set_event_bit rito_cafe_postman_start_event_and_set_event_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) stw r31, 0xC (sp) mr r31, r3 ; Preserve argument r3, which has the Rito postman entity bl fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs lha r31, 0x86A(r31) ; Load the index of this Rito postman from the Rito postman entity cmpwi r31, 0 ; 0 is the one in the Windfall cafe. If it's not that one, we don't want to set the event bit. bne rito_cafe_postman_start_event_and_set_event_bit_end mr r31, r3 ; Preserve the return value from orderOtherEventId so we can still return that (not sure if necessary, but just to be safe) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A02 ; Unused event bit bl onEventBit__11dSv_event_cFUs mr r3, r31 rito_cafe_postman_start_event_and_set_event_bit_end: lwz r31, 0xC (sp) lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global reset_makar_position_to_start_of_dungeon reset_makar_position_to_start_of_dungeon: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r8, 0x803C9D44@ha ; Most recent spawn ID the player spawned from addi r8, r8, 0x803C9D44@l lha r8, 0 (r8) ; Search through the list of places Makar can spawn from to see which one corresponds to the player's last spawn ID, if any. lis r9, makar_possible_wt_spawn_positions@ha addi r9, r9, makar_possible_wt_spawn_positions@l li r0, 5 ; 5 possible spawn points mtctr r0 makar_spawn_point_search_loop_start: lbz r0, 0 (r9) ; Spawn ID cmpw r0, r8 beq reset_makar_found_matching_spawn_point ; Found the array element corresponding to this spawn ID addi r9, r9, 0x10 ; Increase pointer to point to next element bdnz makar_spawn_point_search_loop_start ; Loop ; The player came from a spawn that doesn't correspond to any of the elements in the array, don't change Makar's position. b after_resetting_makar_position reset_makar_found_matching_spawn_point: lwz r8, 4 (r9) ; X pos stw r8, 0 (r5) lwz r8, 8 (r9) ; Y pos stw r8, 4 (r5) lwz r8, 0xC (r9) ; Z pos stw r8, 8 (r5) lha r8, 2 (r9) ; Rotation sth r8, 0xC (r5) mr r6, r8 ; Argument r6 to setRestartOption needs to be the rotation mr r28, r8 ; Also modify the local variable rotation in Makar's code (for when he calls set__19dSv_player_priest) lbz r8, 1 (r9) ; Room index stb r8, 0xE (r5) mr r7, r8 ; Argument r7 to setRestartOption needs to be the room index mr r29, r8 ; Also modify the local variable room index in Makar's code (for when he calls set__19dSv_player_priest) after_resetting_makar_position: bl setRestartOption__13dSv_restart_cFScP4cXyzsSc ; Replace the function call we overwrote to call this custom function lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr makar_possible_wt_spawn_positions: ; Spawn ID, room index, rotation, X pos, Y pos, Z pos ; WT entrance .byte 15, 0xF .short 0x94A0 .float -3651.02, 1557.67, 13235.2 ; First WT warp pot .byte 22, 0 .short 0x4000 .float -4196.33, 754.518, 7448.5 ; Second WT warp pot .byte 23, 2 .short 0xB000 .float 668.107, 1550, 2298.75 ; Third WT warp pot .byte 24, 12 .short 0xC000 .float 14203.1, -5062.49, 8948.05 ; Inter-dungeon warp pot in WT .byte 69, 3 .short 0x4000 .float -4146.65, 1100, 47.88 .global reset_medli_position_to_start_of_dungeon reset_medli_position_to_start_of_dungeon: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r8, 0x803C9D44@ha ; Most recent spawn ID the player spawned from addi r8, r8, 0x803C9D44@l lha r8, 0 (r8) ; Search through the list of places Medli can spawn from to see which one corresponds to the player's last spawn ID, if any. lis r9, medli_possible_et_spawn_positions@ha addi r9, r9, medli_possible_et_spawn_positions@l li r0, 5 ; 5 possible spawn points mtctr r0 medli_spawn_point_search_loop_start: lbz r0, 0 (r9) ; Spawn ID cmpw r0, r8 beq reset_medli_found_matching_spawn_point ; Found the array element corresponding to this spawn ID addi r9, r9, 0x10 ; Increase pointer to point to next element bdnz medli_spawn_point_search_loop_start ; Loop ; The player came from a spawn that doesn't correspond to any of the elements in the array, don't change Medli's position. b after_resetting_medli_position reset_medli_found_matching_spawn_point: lwz r8, 4 (r9) ; X pos stw r8, 0 (r5) lwz r8, 8 (r9) ; Y pos stw r8, 4 (r5) lwz r8, 0xC (r9) ; Z pos stw r8, 8 (r5) lha r8, 2 (r9) ; Rotation sth r8, 0xC (r5) mr r6, r8 ; Argument r6 to setRestartOption needs to be the rotation mr r31, r8 ; Also modify the local variable rotation in Medli's code (for when she calls set__19dSv_player_priest) lbz r8, 1 (r9) ; Room index stb r8, 0xE (r5) mr r7, r8 ; Argument r7 to setRestartOption needs to be the room index mr r30, r8 ; Also modify the local variable room index in Medli's code (for when she calls set__19dSv_player_priest) after_resetting_medli_position: bl setRestartOption__13dSv_restart_cFScP4cXyzsSc ; Replace the function call we overwrote to call this custom function lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr medli_possible_et_spawn_positions: ; Spawn ID, room index, rotation, X pos, Y pos, Z pos ; ET entrance .byte 0, 0 .short 0x8000 .float -7215.21, -200, 5258.79 ; First ET warp pot .byte 22, 2 .short 0xE000 .float -2013.11, 200, -1262.97 ; Second ET warp pot .byte 23, 6 .short 0x8000 .float 4750, 350, -2251.06 ; Third ET warp pot .byte 24, 15 .short 0xE000 .float -2371.38, -2000, 8471.54 ; Inter-dungeon warp pot in ET .byte 69, 3 .short 0x4000 .float -256.939, 0, -778 ; Custom function that gives a goddess pearl and also places it in the statue's hands automatically, and raises TotG if the player has all 3 pearls. .global give_pearl_and_raise_totg_if_necessary give_pearl_and_raise_totg_if_necessary: ; stwu sp, -0x10 (sp) ; mflr r0 ; stw r0, 0x14 (sp) ; stw r31, 0xC (sp) ; mr r31, r4 ; Preserve argument r4, which has the pearl index to give ; bl onSymbol__20dSv_player_collect_cFUc ; Replace the call we overwrote to jump here, which gives the player a specific pearl ; lis r3, 0x803C522C@ha ; Event flag bitfield, will be needed several times ; addi r3, r3, 0x803C522C@l ; ; Check the pearl index to know which event flag to set for the pearl being placed ; cmpwi r31, 0 ; beq place_nayrus_pearl ; cmpwi r31, 1 ; beq place_dins_pearl ; cmpwi r31, 2 ; beq place_farores_pearl ; b check_should_raise_totg place_nayrus_pearl: ; li r4, 0x1410 ; Placed Nayru's Pearl ; bl onEventBit__11dSv_event_cFUs ; b check_should_raise_totg place_dins_pearl: ; li r4, 0x1480 ; Placed Din's Pearl ; bl onEventBit__11dSv_event_cFUs ; b check_should_raise_totg place_farores_pearl: ; li r4, 0x1440 ; Placed Farore's Pearl ; bl onEventBit__11dSv_event_cFUs check_should_raise_totg: ; lis r5, 0x803C4CC7@ha ; Bitfield of the player's currently owned pearls ; addi r5, r5, 0x803C4CC7@l ; lbz r4, 0 (r5) ; cmpwi r4, 7 ; bne after_raising_totg ; Only raise TotG if the player owns all 3 pearls ; li r4, 0x1E40 ; TOWER_OF_THE_GODS_RAISED ; bl onEventBit__11dSv_event_cFUs ; li r4, 0x2E80 ; PEARL_TOWER_CUTSCENE ; bl onEventBit__11dSv_event_cFUs after_raising_totg: ; lwz r31, 0xC (sp) ; lwz r0, 0x14 (sp) ; mtlr r0 ; addi sp, sp, 0x10 ; blr .global slow_down_ship_when_stopping slow_down_ship_when_stopping: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r4, ship_stopping_deceleration@ha addi r4, r4, ship_stopping_deceleration@l lfs f3, 0 (r4) ; Max deceleration per frame lfs f4, 4 (r4) ; Min deceleration per frame bl cLib_addCalc__FPfffff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ship_stopping_deceleration: .float 2.0 ; Max deceleration, 1.0 in vanilla .float 0.2 ; Min deceleration, 0.1 in vanilla .global slow_down_ship_when_idle slow_down_ship_when_idle: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r4, ship_idle_deceleration@ha addi r4, r4, ship_idle_deceleration@l lfs f3, 0 (r4) ; Max deceleration per frame lfs f4, 4 (r4) ; Min deceleration per frame bl cLib_addCalc__FPfffff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ship_idle_deceleration: .float 2.0 ; Max deceleration, 1.0 in vanilla .float 0.1 ; Min deceleration, 0.05 in vanilla .global slow_down_ship_when_stopping2 slow_down_ship_when_stopping2: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r4, ship_stopping_deceleration2@ha addi r4, r4, ship_stopping_deceleration2@l lfs f3, 0 (r4) ; Max deceleration per frame lfs f4, 4 (r4) ; Min deceleration per frame bl cLib_addCalc__FPfffff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ship_stopping_deceleration2: .float 3.0 ; Max deceleration, 1.0 in vanilla .float 0.2 ; Min deceleration, 0.1 in vanilla .global slow_down_ship_when_idle2 slow_down_ship_when_idle2: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r4, ship_idle_deceleration2@ha addi r4, r4, ship_idle_deceleration2@l lfs f3, 0 (r4) ; Max deceleration per frame lfs f4, 4 (r4) ; Min deceleration per frame bl cLib_addCalc__FPfffff lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ship_idle_deceleration2: .float 4.0 ; Max deceleration, 1.0 in vanilla .float 0.2 ; Min deceleration, 0.05 in vanilla ; Part of the code for the hookshot's sight expects entities you look at to have a pointer in a specific place. ; The broken shards of Helmaroc King's mask don't have that pointer so looking at them with hookshot crashes. .global hookshot_sight_failsafe_check hookshot_sight_failsafe_check: cmplwi r30, 0 beq hookshot_sight_failsafe b hookshot_sight_return ; If r30 is null skip to the code that hides the hookshot sight. hookshot_sight_failsafe: b 0x800F13C0 ; Otherwise we replace the line of code at 800F13A8 we replaced to jump here, then jump back. hookshot_sight_return: lwz r0, 0x01C4 (r30) b 0x800F13AC ; Refills the player's magic meter when loading a save. .global fully_refill_magic_meter_on_load_save fully_refill_magic_meter_on_load_save: lis r3, 0x803C4C1B@ha addi r3, r3, 0x803C4C1B@l ; lbz r4, 0 (r3) ; Load max magic meter ; stb r4, 1 (r3) ; Store to current magic meter lwz r3, 0x428 (r22) ; Replace the line we overwrote to branch here b 0x80231B0C ; Return ; Borrows logic used for vanilla rope hang turning and injects some of the rotation logic into the rope swinging function. ; The main difference between the way the vanilla rope hanging function turns the player and this custom function is that the vanilla function uses a maximum rotational velocity per frame of 0x200, and a rotational acceleration of 0x40. ; But 0x200 units of rotation per frame would be far too fast to control when the player is swinging, and they could clip through walls very easily. ; So instead we just use the rotational acceleration as a constant rotational velocity instead, with no acceleration or deceleration. .global turn_while_swinging turn_while_swinging: lis r3, 0x803A4DF0@ha addi r3, r3, 0x803A4DF0@l lfs f0, 0 (r3) ; Control stick horizontal axis (from -1.0 to 1.0) lfs f1, -0x5A18 (r2) ; Load the float constant at 803FA2E8 for the base amount of rotational velocity to use (vanilla value is 0x40, this constant is originally used as rotational acceleration by the rope hanging function) fmuls f0, f1, f0 ; Get the current amount of rotational velocity to use this frame after adjusting for the control stick amount ; Convert current rotational velocity to an integer. ; (sp+0x68 was used earlier on in procRopeSwing__9daPy_lk_cFv for float conversion so we just reuse this same space.) fctiwz f0, f0 stfd f0, 0x68 (sp) lwz r0, 0x6C (sp) ; Convert base rotational velocity to an integer. fctiwz f1, f1 stfd f1, 0x68 (sp) lwz r3, 0x6C (sp) ; If the player isn't moving the control stick horizontally very much (less than 25%), don't turn the player at all. rlwinm r3, r3, 30, 2, 31 ; Divide the base rotational velocity by 4 to figure out what the threshold should be for 25% on the control stick. cmpw r0, r3 bge turn_while_swinging_update_angle ; Control stick is >=25% neg r3, r3 cmpw r0, r3 ble turn_while_swinging_update_angle ; Control stick is <=-25% b turn_while_swinging_return turn_while_swinging_update_angle: ; Subtract rotational velocity from the player's rotation. (Both player_entity+20E and +206 have the player's rotation.) lha r3, 0x020E (r31) sub r0, r3, r0 sth r0, 0x020E (r31) sth r0, 0x0206 (r31) turn_while_swinging_return: lfs f0, -0x5BA8 (rtoc) ; Replace line we overwrote to branch here b 0x8014564C ; Return ; This function checks if Phantom Ganon's sword should disappear. ; Normally, both Phantom Ganon 2's and Phantom Ganon 3's swords will disappear once you've used Phantom Ganon 3's sword to destroy the door to Puppet Ganon. ; We change it so Phantom Ganon 2's sword remains so it can lead the player through the maze. .global check_phantom_ganons_sword_should_disappear check_phantom_ganons_sword_should_disappear: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) ; First replace the event flag check we overwrote to call this custom function. bl isEventBit__11dSv_event_cFUs ; If the player hasn't destroyed the door with Phantom Ganon's sword yet, we don't need to do anything different so just return. cmpwi r3, 0 beq check_phantom_ganons_sword_should_disappear_end ; If the player has destroyed the door, check if the current stage is the Phantom Ganon maze, where Phantom Ganon 2 is fought. lis r3, 0x803C9D3C@ha ; Current stage name addi r3, r3, 0x803C9D3C@l lis r4, phantom_ganon_maze_stage_name@ha addi r4, r4, phantom_ganon_maze_stage_name@l bl strcmp ; If the stage is the maze, strcmp will return 0, so we return that to tell Phantom Ganon's sword that it should not disappear. ; If the stage is anything else, strcmp will not return 0, so Phantom Ganon's sword should disappear. check_phantom_ganons_sword_should_disappear_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global phantom_ganon_maze_stage_name phantom_ganon_maze_stage_name: .string "GanonJ" .align 2 ; Align to the next 4 bytes .global give_temporary_sword_during_ganondorf_fight_in_swordless give_temporary_sword_during_ganondorf_fight_in_swordless: stb r0, 0x48 (r4) ; Replace the line we overwrote to jump here (which removed the bow from your inventory) lbz r0, 0xE (r4) ; Read the player's currently equipped sword ID cmpwi r0, 0xFF ; If the player has any sword equipped, don't replace it with the Hero's Sword bne give_temporary_sword_during_ganondorf_fight_in_swordless_end li r0, 0x38 stb r0, 0xE (r4) ; Set the player's currently equipped sword ID to the regular Hero's Sword give_temporary_sword_during_ganondorf_fight_in_swordless_end: b 0x80235F14 ; Return .global give_temporary_sword_in_orcas_house_in_swordless give_temporary_sword_in_orcas_house_in_swordless: lis r3, 0x803C9D3C@ha ; Current stage name addi r3, r3, 0x803C9D3C@l lis r4, 0x8036A948@ha ; Pointer to the string "Ojhous", the stage for Orca's house addi r4, r4, 0x8036A948@l bl strcmp cmpwi r3, 0 ; If the player did not just enter Orca's house, skip giving a temporary sword bne give_temporary_sword_in_orcas_house_in_swordless_end lis r3, 0x803C4C08@ha addi r3, r3, 0x803C4C08@l lbz r0, 0xE (r3) ; Read the player's currently equipped sword ID cmpwi r0, 0xFF ; If the player has any sword equipped, don't replace it with the Hero's Sword bne give_temporary_sword_in_orcas_house_in_swordless_end li r0, 0x38 stb r0, 0xE (r3) ; Set the player's currently equipped sword ID to the regular Hero's Sword ; Then, in order to prevent this temporary sword from being removed by remove_temporary_sword_when_loading_stage_in_swordless, we need to return differently to skip that code. mr r29, r3 ; r29 needs to have 0x803C4C08 in it b 0x80236088 give_temporary_sword_in_orcas_house_in_swordless_end: lis r3, 0x803C ; Replace the line we overwrote to branch here b 0x80236080 ; Return .global remove_temporary_sword_when_loading_stage_in_swordless remove_temporary_sword_when_loading_stage_in_swordless: lbz r0, 0xB4 (r29) ; Read the player's owned swords bitfield cmpwi r0, 0 ; If the player owns any sword, don't remove their equipped sword since it's not temporary bne remove_temporary_sword_when_loading_stage_in_swordless_end li r0, 0xFF stb r0, 0xE (r29) ; Set the player's currently equipped sword ID to no sword remove_temporary_sword_when_loading_stage_in_swordless_end: lbz r0, 0x48 (r29) ; Replace the line we overwrote to jump here b 0x80236088 ; Return ; Read the C-stick's horizontal axis and negate the value in order to invert the camera's movement. .global invert_camera_horizontal_axis invert_camera_horizontal_axis: lfs f1, 0x10 (r3) ; Load the C-stick's horizontal axis for controlling the camera (same as the line we're replacing) fneg f1, f1 ; Negate the horizontal axis b 0x8016248C ; Return ; Add a check right before playing the item get music to handle playing special item get music (pearls and songs). ; The vanilla game played the pearl music as part of the .stb cutscenes where you get the pearls, so the regular item get code had no reason to check for pearls originally. ; In the vanilla game Link only gets songs via 059get_dance actions, so that action would play the song get music, but the 011get_item action had no reason to check for songs. .global check_play_special_item_get_music check_play_special_item_get_music: lwz r3, -0x69D0 (r13) ; Replace the line we overwrote to jump here ; Check if the item ID (in r0) matches any of the items with special music. cmplwi r0, 0x69 ; Nayru's Pearl beq play_pearl_item_get_music cmplwi r0, 0x6A ; Din's Pearl beq play_pearl_item_get_music cmplwi r0, 0x6B ; Farore's Pearl beq play_pearl_item_get_music cmplwi r0, 0x6D ; Wind's Requiem beq play_song_get_music cmplwi r0, 0x6E ; Ballad of Gales beq play_song_get_music cmplwi r0, 0x6F ; Command Melody beq play_song_get_music cmplwi r0, 0x70 ; Earth God's Lyric beq play_song_get_music cmplwi r0, 0x71 ; Wind God's Aria beq play_song_get_music cmplwi r0, 0x72 ; Song of Passing beq play_song_get_music b 0x8012E3EC ; If not, return to the code that plays the normal item get music play_pearl_item_get_music: lis r4, 0x8000004F@ha ; BGM ID for the pearl item get music addi r4, r4, 0x8000004F@l b 0x8012E3F4 ; Jump to the code that plays the normal item get music play_song_get_music: lis r4, 0x80000027@ha ; BGM ID for the song get music addi r4, r4, 0x80000027@l b 0x8012E3F4 ; Jump to the code that plays the normal item get music ; Check the ID of the upcoming text command to see if it's a custom one, and runs custom code for it if so. .global check_run_new_text_commands check_run_new_text_commands: clrlwi. r6,r0,24 bne check_run_new_text_commands_check_failed lbz r6,3(r3) cmplwi r6,0 bne check_run_new_text_commands_check_failed lbz r6,4(r3) cmplwi r6, 0x4B ; Lowest key counter text command ID blt check_run_new_text_commands_check_failed cmplwi r6, 0x4F ; Highest key counter text command ID bgt check_run_new_text_commands_check_failed mr r3,r31 mr r4, r6 bl exec_curr_num_keys_text_command b 0x80034D34 ; Return (to after a text command has been successfully executed) check_run_new_text_commands_check_failed: clrlwi r0,r0,24 ; Replace the line we overwrote to jump here b 0x80033E78 ; Return (to back inside the code to check what text command should be run) ; Updates the current message string with the number of keys for a certain dungeon. .global exec_curr_num_keys_text_command exec_curr_num_keys_text_command: stwu sp, -0x50 (sp) mflr r0 stw r0, 0x54 (sp) stw r31, 0xC (sp) stw r30, 8 (sp) mr r31, r3 ; Convert the text command ID to the dungeon stage ID. ; The text command ID ranges from 0x4B-0x4F, for DRC, FW, TotG, ET, and WT. ; The the dungeon stage IDs for those same 5 dungeons range from 3-7. ; So just subtract 0x48 to get the right stage ID. addi r4, r4, -0x48 lis r3, 0x803C53A4@ha ; This value is the stage ID of the current stage addi r3, r3, 0x803C53A4@l lbz r5, 0 (r3) cmpw r5, r4 ; Check if we're currently in the right dungeon for this key beq exec_curr_num_keys_text_command_in_correct_dungeon exec_curr_num_keys_text_command_not_in_correct_dungeon: ; Read the current number of small keys from that dungeon's stage info. lis r3, 0x803C4F88@ha ; List of all stage info addi r3, r3, 0x803C4F88@l mulli r4, r4, 0x24 ; Use stage ID of the dungeon as the index, each entry in the list is 0x24 bytes long add r3, r3, r4 lbz r4, 0x20 (r3) ; Current number of keys for the correct dungeon mr r30, r3 ; Remember the correct stage info pointer for later when we check the big key b exec_curr_num_keys_text_command_after_reading_num_keys exec_curr_num_keys_text_command_in_correct_dungeon: ; Read the current number of small keys from the currently loaded dungeon info. lis r3, 0x803C5380@ha ; Currently loaded stage info addi r3, r3, 0x803C5380@l lbz r4, 0x20 (r3) ; Current number of keys for the current dungeon mr r30, r3 ; Remember the correct stage info pointer for later when we check the big key exec_curr_num_keys_text_command_after_reading_num_keys: ; Convert int to string addi r3, sp, 0x1C li r5, 0 bl fopMsgM_int_to_char__FPcib ; Check whether the player has the big key or not. lbz r4, 0x21 (r30) ; Bitfield of dungeon-specific flags in the appropriate stage info rlwinm. r4, r4, 0, 29, 29 ; Extract the has big key bit beq exec_curr_num_keys_text_command_does_not_have_big_key exec_curr_num_keys_text_command_has_big_key: ; Append the " +Big" text addi r3, sp, 0x1C lis r4, key_text_command_has_big_key_text@ha addi r4, r4, key_text_command_has_big_key_text@l bl strcat b exec_curr_num_keys_text_command_after_appending_big_key_text exec_curr_num_keys_text_command_does_not_have_big_key: ; Append some whitespace so that the text stays in the same spot regardless of whether you have the big key or not addi r3, sp, 0x1C lis r4, key_text_command_does_not_have_big_key_text@ha addi r4, r4, key_text_command_does_not_have_big_key_text@l bl strcat exec_curr_num_keys_text_command_after_appending_big_key_text: ; Concatenate to one of the main strings lwz r3, 0x60(r31) addi r4, sp, 0x1C bl strcat ; Concatenate to one of the main strings lwz r3, 0x68(r31) addi r4, sp, 0x1C bl strcat ; Increase the offset within the encoded message string to be past the end of this text command lwz r4, 0x118(r31) addi r4, r4, 5 ; Note that technically, this command length value should be dynamically read from [cmd+1]. But because it's always 5 for the custom commands it doesn't matter and it can be hardcoded instead. stw r4, 0x118(r31) ; Note: There are some other things that the vanilla text commands did that are currently not implemented for these custom ones. Such as what appears to be keeping track of the current line length, possibly for word wrapping or text alignment purposes (which aren't necessary for the Key Bag). lwz r30, 8 (sp) lwz r31, 0xC (sp) lwz r0, 0x54 (sp) mtlr r0 addi sp, sp, 0x50 blr key_text_command_has_big_key_text: .string " +Big" key_text_command_does_not_have_big_key_text: .string " " .global generic_on_dungeon_bit generic_on_dungeon_bit: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) mr r5, r3 ; Argument r3 to this func is the stage ID of the dungeon to add this item for mr r6, r4 ; Argument r4 to this func is the bit index to set lis r3, 0x803C53A4@ha ; This value is the stage ID of the current stage addi r3, r3, 0x803C53A4@l lbz r4, 0 (r3) cmpw r4, r5 ; Check if we're currently in the right dungeon for this key beq generic_on_dungeon_bit_in_correct_dungeon ; Not in the correct dungeon for this dungeon bit. We need to set the bit for the correct dungeon's stage info. lis r3, 0x803C4F88@ha ; List of all stage info addi r3, r3, 0x803C4F88@l mulli r4, r5, 0x24 ; Use stage ID of the dungeon as the index, each entry in the list is 0x24 bytes long add r3, r3, r4 b generic_on_dungeon_bit_func_end generic_on_dungeon_bit_in_correct_dungeon: ; In the correct dungeon for this dungeon bit. lis r3, 0x803C5380@ha ; Currently loaded stage info addi r3, r3, 0x803C5380@l generic_on_dungeon_bit_func_end: ; Now call onDungeonBit with argument r3 being the stage info that was determined above. mr r4, r6 ; Argument r4 is the bit index bl onDungeonItem__12dSv_memBit_cFi lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global generic_small_key_item_get_func generic_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) mr r5, r3 ; Argument r3 is the stage ID of the dungeon to add this item for lis r3, 0x803C53A4@ha ; This value is the stage ID of the current stage addi r3, r3, 0x803C53A4@l lbz r4, 0 (r3) cmpw r4, r5 ; Check if we're currently in the right dungeon for this key bne generic_small_key_item_get_func_not_in_correct_dungeon ; Next we need to check if the current stage has the "is dungeon" bit set in its StagInfo. ; If it doesn't (like if we're in a boss room) then we still can't use the normal key function, since the key counter in the UI is disabled, and that's what adds to your actual number of keys when we use the normal key function. lis r3, 0x803C4C08@ha addi r3, r3, 0x803C4C08@l lwzu r12, 0x5150 (r3) lwz r12, 0xB0 (r12) mtctr r12 bctrl lbz r0, 9 (r3) ; Read the byte containing the stage ID+is dungeon bit rlwinm. r0, r0, 0, 31, 31 ; Extract the is dungeon bit beq generic_small_key_item_get_func_in_non_dungeon_room_of_correct_dungeon ; If both the stage ID and the is dungeon bit are correct, we can call the normal small key function. b generic_small_key_item_get_func_in_correct_dungeon generic_small_key_item_get_func_not_in_correct_dungeon: ; Not in the correct dungeon for this small key. ; We need to bypass the normal small key adding method. ; Instead we add directly to the small key count for the correct dungeon's stage info. lis r3, 0x803C4F88@ha ; List of all stage info addi r3, r3, 0x803C4F88@l mulli r4, r5, 0x24 ; Use stage ID of the dungeon as the index, each entry in the list is 0x24 bytes long add r3, r3, r4 lbz r4, 0x20 (r3) ; Current number of keys for the correct dungeon addi r4, r4, 1 stb r4, 0x20 (r3) ; Current number of keys for the correct dungeon b generic_small_key_item_get_func_end generic_small_key_item_get_func_in_non_dungeon_room_of_correct_dungeon: lis r3, 0x803C5380@ha ; Currently loaded stage info addi r3, r3, 0x803C5380@l lbz r4, 0x20 (r3) ; Current number of keys for the current dungeon addi r4, r4, 1 stb r4, 0x20 (r3) ; Current number of keys for the current dungeon b generic_small_key_item_get_func_end generic_small_key_item_get_func_in_correct_dungeon: ; In the correct dungeon for this small key. ; Simply call the normal small key func, as it will work correctly in this case. bl item_func_small_key__Fv generic_small_key_item_get_func_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global drc_small_key_item_get_func drc_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 3 ; DRC stage ID bl generic_small_key_item_get_func lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global fw_small_key_item_get_func fw_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 4 ; FW stage ID bl generic_small_key_item_get_func lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global totg_small_key_item_get_func totg_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 5 ; TotG stage ID bl generic_small_key_item_get_func lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global et_small_key_item_get_func et_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 6 ; ET stage ID bl generic_small_key_item_get_func lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global wt_small_key_item_get_func wt_small_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 7 ; WT stage ID bl generic_small_key_item_get_func lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global drc_big_key_item_get_func drc_big_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 3 ; DRC stage ID li r4, 2 ; Big key bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global fw_big_key_item_get_func fw_big_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 4 ; FW stage ID li r4, 2 ; Big key bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global totg_big_key_item_get_func totg_big_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 5 ; TotG stage ID li r4, 2 ; Big key bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global et_big_key_item_get_func et_big_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 6 ; ET stage ID li r4, 2 ; Big key bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global wt_big_key_item_get_func wt_big_key_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 7 ; WT stage ID li r4, 2 ; Big key bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global drc_dungeon_map_item_get_func drc_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 3 ; DRC stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global fw_dungeon_map_item_get_func fw_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 4 ; FW stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global totg_dungeon_map_item_get_func totg_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 5 ; TotG stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global ff_dungeon_map_item_get_func ff_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 2 ; FF stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global et_dungeon_map_item_get_func et_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 6 ; ET stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global wt_dungeon_map_item_get_func wt_dungeon_map_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 7 ; WT stage ID li r4, 0 ; Dungeon map bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global drc_compass_item_get_func drc_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 3 ; DRC stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global fw_compass_item_get_func fw_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 4 ; FW stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global totg_compass_item_get_func totg_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 5 ; TotG stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global ff_compass_item_get_func ff_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 2 ; FF stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global et_compass_item_get_func et_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 6 ; ET stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global wt_compass_item_get_func wt_compass_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) li r3, 7 ; WT stage ID li r4, 1 ; Compass bit index bl generic_on_dungeon_bit lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global dragon_tingle_statue_item_get_func dragon_tingle_statue_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A04 ; Unused event bit we use for Dragon Tingle Statue bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global forbidden_tingle_statue_item_get_func forbidden_tingle_statue_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A08 ; Unused event bit we use for Forbidden Tingle Statue bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global goddess_tingle_statue_item_get_func goddess_tingle_statue_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A10 ; Unused event bit we use for Goddess Tingle Statue bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global earth_tingle_statue_item_get_func earth_tingle_statue_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A20 ; Unused event bit we use for Earth Tingle Statue bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global wind_tingle_statue_item_get_func wind_tingle_statue_item_get_func: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l li r4, 0x6A40 ; Unused event bit we use for Wind Tingle Statue bl onEventBit__11dSv_event_cFUs lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; This function checks if you own a certain Tingle Statue. ; It's designed to replace the original calls to dComIfGs_isStageTbox__Fii, so it takes the same arguments as that function. ; Argument r3 - the stage ID of the stage info to check a chest in. ; Argument r4 - the opened flag index of the chest to check. ; This function, instead of checking if certain chests are open, checks if the unused event bits we use for certain Tingle Statues have been set. .global check_tingle_statue_owned check_tingle_statue_owned: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) cmpwi r4, 0xF ; The opened flag index (argument r4) for tingle statue chests should always be 0xF. bne check_tingle_statue_owned_invalid ; The stage ID (argument r3) determines which dungeon it's checking. cmpwi r3, 3 beq check_dragon_tingle_statue_owned cmpwi r3, 4 beq check_forbidden_tingle_statue_owned cmpwi r3, 5 beq check_goddess_tingle_statue_owned cmpwi r3, 6 beq check_earth_tingle_statue_owned cmpwi r3, 7 beq check_wind_tingle_statue_owned b check_tingle_statue_owned_invalid check_dragon_tingle_statue_owned: li r4, 0x6A04 ; Unused event bit b check_tingle_statue_owned_event_bit check_forbidden_tingle_statue_owned: li r4, 0x6A08 ; Unused event bit b check_tingle_statue_owned_event_bit check_goddess_tingle_statue_owned: li r4, 0x6A10 ; Unused event bit b check_tingle_statue_owned_event_bit check_earth_tingle_statue_owned: li r4, 0x6A20 ; Unused event bit b check_tingle_statue_owned_event_bit check_wind_tingle_statue_owned: li r4, 0x6A40 ; Unused event bit check_tingle_statue_owned_event_bit: lis r3, 0x803C522C@ha addi r3, r3, 0x803C522C@l bl isEventBit__11dSv_event_cFUs b check_tingle_statue_owned_end check_tingle_statue_owned_invalid: ; If the function call was somehow invalid, return false. li r3, 0 check_tingle_statue_owned_end: lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr ; Manually animate rainbow rupees to cycle through all other rupee colors. ; In order to avoid an abrupt change from silver to green when it loops, we make the animation play forward and then backwards before looping, so it's always a smooth transition. .global check_animate_rainbow_rupee_color check_animate_rainbow_rupee_color: ; Check if the color for this rupee specified in the item resources is 7 (originally unused, we use it as a marker to separate the rainbow rupee from other color rupees). cmpwi r0, 7 beq animate_rainbow_rupee_color ; If it's not the rainbow rupee, replace the line of code we overwrote to jump here, and then return to the regular code for normal rupees. lfd f1, -0x5DF0 (rtoc) b 0x800F93F8 animate_rainbow_rupee_color: ; If it is the rainbow rupee, we need to increment the current keyframe (a float) by certain value every frame. ; (Note: The way this is coded would increase it by this value multiplied by the number of rainbow rupees being drawn. This is fine since there's only one rainbow rupee but would cause issues if we placed multiple of them. Would need to find a different place to increment the keyframe in that case, somewhere only called once per frame.) lis r5, rainbow_rupee_keyframe@ha addi r5, r5, rainbow_rupee_keyframe@l lfs f1, 0 (r5) ; Read current keyframe lfs f0, 4 (r5) ; Read amount to add to keyframe per frame fadds f1, f1, f0 ; Increase the keyframe value lfs f0, 8 (r5) ; Read the maximum keyframe value fcmpo cr0,f1,f0 ; If we're less than the max we don't need to reset the value blt store_rainbow_rupee_keyframe_value ; If we're greater than the max, reset the current keyframe to the minimum. ; The minimum is actually the maximum negated. This is to signify that we're playing the animation backwards. lfs f1, 0xC (r5) store_rainbow_rupee_keyframe_value: stfs f1, 0 (r5) ; Store the new keyframe value back ; Take the absolute value of the keyframe. So instead of going from -6 to +6, the value we pass as the actual keyframe goes from 6 to 0 to 6. fabs f1, f1 b 0x800F9410 .global rainbow_rupee_keyframe rainbow_rupee_keyframe: .float 0.0 ; Current keyframe, acts as a global variable modified every frame .float 0.04 ; Amount to increment keyframe by every frame a rainbow rupee is being drawn .float 6.0 ; Max keyframe, when it should loop .float -6.0 ; Minimum keyframe ; Handle giving the two randomized items when Doc Bandam makes Green/Blue Potions for the first time. .global doc_bandam_check_new_potion_and_give_free_item doc_bandam_check_new_potion_and_give_free_item: stwu sp, -0x10 (sp) mflr r0 stw r0, 0x14 (sp) lwz r0, 0x7C4 (r28) ; Read the current message ID Doc Bandam is on (r28 has the Doc Bandam entity) cmpwi r0, 7627 ; This message ID means he just made a brand new potion for the first time ; Any other message ID means he's either giving you or selling you a type he already made before. ; So do not give a randomized item in those cases. bne doc_bandam_give_item ; If we're on a newly made potion we need to change the item ID in r4 to be the randomized item cmpwi r4, 0x52 ; Green Potion item ID beq doc_bandam_set_randomized_green_potion_item_id cmpwi r4, 0x53 ; Blue Potion item ID beq doc_bandam_set_randomized_blue_potion_item_id ; If it's not either of those something unexpected happened, so just give whatever item ID it was originally supposed to give b doc_bandam_give_item doc_bandam_set_randomized_green_potion_item_id: lis r4, doc_bandam_green_potion_slot_item_id@ha addi r4, r4, doc_bandam_green_potion_slot_item_id@l lbz r4, 0 (r4) ; Load what item ID is in the this slot. This value is updated by the randomizer when it randomizes that item. b doc_bandam_give_item doc_bandam_set_randomized_blue_potion_item_id: lis r4, doc_bandam_blue_potion_slot_item_id@ha addi r4, r4, doc_bandam_blue_potion_slot_item_id@l lbz r4, 0 (r4) ; Load what item ID is in the this slot. This value is updated by the randomizer when it randomizes that item. doc_bandam_give_item: bl fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz lwz r0, 0x14 (sp) mtlr r0 addi sp, sp, 0x10 blr .global doc_bandam_green_potion_slot_item_id doc_bandam_green_potion_slot_item_id: .byte 0x52 ; Default item ID is Green Potion. This value is updated by the randomizer when this item is randomized. .global doc_bandam_blue_potion_slot_item_id doc_bandam_blue_potion_slot_item_id: .byte 0x53 ; Default item ID is Blue Potion. This value is updated by the randomizer when this item is randomized. .align 2 ; Align to the next 4 bytes .global hurricane_spin_item_resource_arc_name hurricane_spin_item_resource_arc_name: .string "Vscroll" .align 2 ; Align to the next 4 bytes ; In vanilla, the Deluxe Picto Box item get func doesn't update the Picto Box equipped on the X/Y/Z button. ; This causes it to not work correctly until the equipped item is fixed (by reloading the area or manually re-equipping it). ; This custom code adds a check to fix it automatically into the item get func. .global deluxe_picto_box_item_func_fix_equipped_picto_box deluxe_picto_box_item_func_fix_equipped_picto_box: stb r0, 0x44 (r3) ; Replace the line of code we overwrote to jump heree li r4, 0 ; The offset for which button to check next (0/1/2 for X/Y/Z) li r0, 3 ; How many times to loop (3 buttons) mtctr r0 deluxe_picto_box_item_func_fix_equipped_picto_box_loop_start: add r5, r3, r4 ; Add the current button offset for this loop to the pointer lbz r0, 0x5BD3 (r5) ; Read the item ID on the current button ; (Note: r3 starts with 803C4C08 in it, so offset 5BD3 is used to get the list of items on the X/Y/Z buttons, at 803CA7DB.) cmplwi r0, 0x23 ; Normal Picto Box ID ; If this button doesn't have the normal Picto Box equipped, continue the loop. bne deluxe_picto_box_item_func_fix_equipped_picto_box_continue_loop ; If this button does have the normal Picto Box equipped, replace it with the Deluxe Picto Box. li r0, 0x26 ; Deluxe Picto Box ID stb r0, 0x5BD3 (r5) deluxe_picto_box_item_func_fix_equipped_picto_box_continue_loop: addi r4, r4, 1 bdnz deluxe_picto_box_item_func_fix_equipped_picto_box_loop_start b 0x800C3424 ; Return .close
; A193390: The hyper-Wiener index of a benzenoid consisting of a straight-line chain of n hexagons (s=2; see the Gutman et al. reference). ; Submitted by Jamie Morken(s2) ; 42,215,680,1661,3446,6387,10900,17465,26626,38991,55232,76085,102350,134891,174636,222577,279770,347335,426456,518381,624422,745955,884420,1041321,1218226,1416767,1638640,1885605,2159486,2462171,2795612,3161825,3562890,4000951,4478216,4996957,5559510,6168275,6825716,7534361,8296802,9115695,9993760,10933781,11938606,13011147,14154380,15371345,16665146,18038951,19495992,21039565,22673030,24399811,26223396,28147337,30175250,32310815,34557776,36919941,39401182,42005435,44736700,47599041,50596586 mov $1,$0 mul $0,2 bin $0,2 add $1,2 pow $1,4 mul $1,8 sub $1,$0 mov $0,$1 div $0,3
/* * * Copyright 2018 gRPC authors. * * 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 <grpc/support/port_platform.h> #include <grpc/grpc.h> #include "src/core/ext/filters/client_channel/xds/xds_channel.h" namespace grpc_core { grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) { return args; } grpc_channel* CreateXdsChannel(const XdsBootstrap& bootstrap, const grpc_channel_args& args, grpc_error** /*error*/) { if (!bootstrap.server().channel_creds.empty()) return nullptr; return grpc_insecure_channel_create(bootstrap.server().server_uri.c_str(), &args, nullptr); } } // namespace grpc_core
; THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX ; SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO ; END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A ; ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS ; IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS ; SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE ; FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE ; CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS ; AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. ; COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. .386 _DATA SEGMENT BYTE PUBLIC USE32 'DATA' ; Put data here PUBLIC _gr_var_color PUBLIC _gr_var_bitmap PUBLIC _gr_var_bwidth _gr_var_color dd ? _gr_var_bitmap dd ? _gr_var_bwidth dd ? ; Local variables for gr_linear_line_ AdjUp dd ? ;error term adjust up on each advance AdjDown dd ? ;error term adjust down when error term turns over WholeStep dd ? ;minimum run length XAdvance dd ? ;1 or -1, for direction in which X advances XStart dd ? YStart dd ? XEnd dd ? YEnd dd ? _DATA ENDS DGROUP GROUP _DATA _TEXT SEGMENT BYTE PUBLIC USE32 'CODE' ASSUME DS:_DATA ASSUME CS:_TEXT include psmacros.inc ; Args passed in EAX, EDX, EBX, ECX ; Fast run length slice line drawing implementation for mode 0x13, the VGA's ; 320x200 256-color mode. ; Draws a line between the specified endpoints in color Color. PUBLIC gr_linear_line_ gr_linear_line_: cld push esi ;preserve C register variables push edi push ebp mov XStart, eax mov YStart, edx mov XEnd, ebx mov YEnd, ecx mov ebp, _gr_var_bwidth ; We'll draw top to bottom, to reduce the number of cases we have to handle, ; and to make lines between the same endpoints always draw the same pixels. mov eax,YStart cmp eax,YEnd jle LineIsTopToBottom xchg YEnd, eax ;swap endpoints mov YStart, eax mov ebx, XStart xchg XEnd, ebx mov XStart, ebx LineIsTopToBottom: ; Point EDI to the first pixel to draw. mov edx,ebp mul edx ;YStart * ebp mov esi, XStart mov edi, esi add edi, _gr_var_bitmap add edi, eax ;EDI = YStart * ebp + XStart ; = offset of initial pixel ; Figure out how far we're going vertically (guaranteed to be positive). mov ecx, YEnd sub ecx, YStart ;ECX = YDelta ; Figure out whether we're going left or right, and how far we're going ; horizontally. In the process, special-case vertical lines, for speed and ; to avoid nasty boundary conditions and division by 0. mov edx, XEnd sub edx, esi ;XDelta jnz NotVerticalLine ;XDelta == 0 means vertical line ;it is a vertical line ;yes, special case vertical line mov eax, _gr_var_color VLoop: mov [edi],al add edi,ebp dec ecx jns VLoop jmp Done ; Special-case code for horizontal lines. IsHorizontalLine: mov eax, _gr_var_color mov ah,al ;duplicate in high byte for word access and ebx,ebx ;left to right? jns DirSet ;yes sub edi, edx ;currently right to left, point to left end so we ; can go left to right (avoids unpleasantness with ; right to left REP STOSW) DirSet: mov ecx, edx inc ecx ;# of pixels to draw shr ecx, 1 ;# of words to draw rep stosw ;do as many words as possible adc ecx, ecx rep stosb ;do the odd byte, if there is one jmp Done ; Special-case code for diagonal lines. IsDiagonalLine: mov eax, _gr_var_color add ebx, ebp ;advance distance from one pixel to next DLoop: mov [edi],al add edi, ebx dec ecx jns DLoop jmp Done NotVerticalLine: mov ebx,1 ;assume left to right, so XAdvance = 1 ;***leaves flags unchanged*** jns LeftToRight ;left to right, all set neg ebx ;right to left, so XAdvance = -1 neg edx ;|XDelta| LeftToRight: ; Special-case horizontal lines. and ecx, ecx ;YDelta == 0? jz IsHorizontalLine ;yes ; Special-case diagonal lines. cmp ecx, edx ;YDelta == XDelta? jz IsDiagonalLine ;yes ; Determine whether the line is X or Y major, and handle accordingly. cmp edx, ecx jae XMajor jmp YMajor ; X-major (more horizontal than vertical) line. XMajor: and ebx,ebx ;left to right? jns DFSet ;yes, CLD is already set std ;right to left, so draw backwards DFSet: mov eax,edx ;XDelta sub edx,edx ;prepare for division div ecx ;EAX = XDelta/YDelta ; (minimum # of pixels in a run in this line) ;EDX = XDelta % YDelta mov ebx,edx ;error term adjust each time Y steps by 1; add ebx,ebx ; used to tell when one extra pixel should be mov AdjUp, ebx ; drawn as part of a run, to account for ; fractional steps along the X axis per ; 1-pixel steps along Y mov esi, ecx ;error term adjust when the error term turns add esi, esi ; over, used to factor out the X step made at mov AdjDown, esi ; that time ; Initial error term; reflects an initial step of 0.5 along the Y axis. sub edx, esi ;(XDelta % YDelta) - (YDelta * 2) ;DX = initial error term ; The initial and last runs are partial, because Y advances only 0.5 for ; these runs, rather than 1. Divide one full run, plus the initial pixel, ; between the initial and last runs. mov esi, ecx ;SI = YDelta mov ecx, eax ;whole step (minimum run length) shr ecx,1 inc ecx ;initial pixel count = (whole step / 2) + 1; ; (may be adjusted later). This is also the ; final run pixel count push ecx ;remember final run pixel count for later ; If the basic run length is even and there's no fractional advance, we have ; one pixel that could go to either the initial or last partial run, which ; we'll arbitrarily allocate to the last run. ; If there is an odd number of pixels per run, we have one pixel that can't ; be allocated to either the initial or last partial run, so we'll add 0.5 to ; the error term so this pixel will be handled by the normal full-run loop. add edx,esi ;assume odd length, add YDelta to error term ; (add 0.5 of a pixel to the error term) test al,1 ;is run length even? jnz XMajorAdjustDone ;no, already did work for odd case, all set sub edx,esi ;length is even, undo odd stuff we just did and ebx,ebx ;is the adjust up equal to 0? jnz XMajorAdjustDone ;no (don't need to check for odd length, ; because of the above test) dec ecx ;both conditions met; make initial run 1 ; shorter XMajorAdjustDone: mov WholeStep,eax ;whole step (minimum run length) mov eax, _gr_var_color ;AL = drawing color ; Draw the first, partial run of pixels. rep stosb ;draw the final run add edi,ebp ;advance along the minor axis (Y) ; Draw all full runs. cmp esi,1 ;are there more than 2 scans, so there are ; some full runs? (SI = # scans - 1) jna XMajorDrawLast ;no, no full runs dec edx ;adjust error term by -1 so we can use ; carry test shr esi,1 ;convert from scan to scan-pair count jnc XMajorFullRunsOddEntry ;if there is an odd number of scans, ; do the odd scan now XMajorFullRunsLoop: mov ecx, WholeStep ;run is at least this long add edx,ebx ;advance the error term and add an extra jnc XMajorNoExtra ; pixel if the error term so indicates inc ecx ;one extra pixel in run sub edx,AdjDown ;reset the error term XMajorNoExtra: rep stosb ;draw this scan line's run add edi,ebp ;advance along the minor axis (Y) XMajorFullRunsOddEntry: ;enter loop here if there is an odd number ; of full runs mov ecx,WholeStep ;run is at least this long add edx,ebx ;advance the error term and add an extra jnc XMajorNoExtra2 ; pixel if the error term so indicates inc ecx ;one extra pixel in run sub edx,AdjDown ;reset the error term XMajorNoExtra2: rep stosb ;draw this scan line's run add edi,ebp ;advance along the minor axis (Y) dec esi jnz XMajorFullRunsLoop ; Draw the final run of pixels. XMajorDrawLast: pop ecx ;get back the final run pixel length rep stosb ;draw the final run cld ;restore normal direction flag jmp Done ; Y-major (more vertical than horizontal) line. YMajor: mov XAdvance,ebx ;remember which way X advances mov eax,ecx ;YDelta mov ecx,edx ;XDelta sub edx,edx ;prepare for division div ecx ;EAX = YDelta/XDelta ; (minimum # of pixels in a run in this line) ;EDX = YDelta % XDelta mov ebx,edx ;error term adjust each time X steps by 1; add ebx,ebx ; used to tell when one extra pixel should be mov AdjUp,ebx ; drawn as part of a run, to account for ; fractional steps along the Y axis per ; 1-pixel steps along X mov esi,ecx ;error term adjust when the error term turns add esi,esi ; over, used to factor out the Y step made at mov AdjDown, esi ; that time ; Initial error term; reflects an initial step of 0.5 along the X axis. sub edx,esi ;(YDelta % XDelta) - (XDelta * 2) ;DX = initial error term ; The initial and last runs are partial, because X advances only 0.5 for ; these runs, rather than 1. Divide one full run, plus the initial pixel, ; between the initial and last runs. mov esi,ecx ;SI = XDelta mov ecx,eax ;whole step (minimum run length) shr ecx,1 inc ecx ;initial pixel count = (whole step / 2) + 1; ; (may be adjusted later) push ecx ;remember final run pixel count for later ; If the basic run length is even and there's no fractional advance, we have ; one pixel that could go to either the initial or last partial run, which ; we'll arbitrarily allocate to the last run. ; If there is an odd number of pixels per run, we have one pixel that can't ; be allocated to either the initial or last partial run, so we'll add 0.5 to ; the error term so this pixel will be handled by the normal full-run loop. add edx,esi ;assume odd length, add XDelta to error term test al,1 ;is run length even? jnz YMajorAdjustDone ;no, already did work for odd case, all set sub edx,esi ;length is even, undo odd stuff we just did and ebx,ebx ;is the adjust up equal to 0? jnz YMajorAdjustDone ;no (don't need to check for odd length, ; because of the above test) dec ecx ;both conditions met; make initial run 1 ; shorter YMajorAdjustDone: mov WholeStep,eax ;whole step (minimum run length) mov eax,_gr_var_color ;AL = drawing color mov ebx, XAdvance ;which way X advances ; Draw the first, partial run of pixels. YMajorFirstLoop: mov [edi],al ;draw the pixel add edi,ebp ;advance along the major axis (Y) dec ecx jnz YMajorFirstLoop add edi,ebx ;advance along the minor axis (X) ; Draw all full runs. cmp esi,1 ;# of full runs. Are there more than 2 ; columns, so there are some full runs? ; (SI = # columns - 1) jna YMajorDrawLast ;no, no full runs dec edx ;adjust error term by -1 so we can use ; carry test shr esi,1 ;convert from column to column-pair count jnc YMajorFullRunsOddEntry ;if there is an odd number of ; columns, do the odd column now YMajorFullRunsLoop: mov ecx,WholeStep ;run is at least this long add edx,AdjUp ;advance the error term and add an extra jnc YMajorNoExtra ; pixel if the error term so indicates inc ecx ;one extra pixel in run sub edx,AdjDown ;reset the error term YMajorNoExtra: ;draw the run YMajorRunLoop: mov [edi],al ;draw the pixel add edi,ebp ;advance along the major axis (Y) dec ecx jnz YMajorRunLoop add edi,ebx ;advance along the minor axis (X) YMajorFullRunsOddEntry: ;enter loop here if there is an odd number ; of full runs mov ecx,WholeStep ;run is at least this long add edx,AdjUp ;advance the error term and add an extra jnc YMajorNoExtra2 ; pixel if the error term so indicates inc ecx ;one extra pixel in run sub edx, AdjDown ;reset the error term YMajorNoExtra2: ;draw the run YMajorRunLoop2: mov [edi],al ;draw the pixel add edi,ebp ;advance along the major axis (Y) dec ecx jnz YMajorRunLoop2 add edi,ebx ;advance along the minor axis (X) dec esi jnz YMajorFullRunsLoop ; Draw the final run of pixels. YMajorDrawLast: pop ecx ;get back the final run pixel length YMajorLastLoop: mov [edi],al ;draw the pixel add edi,ebp ;advance along the major axis (Y) dec ecx jnz YMajorLastLoop Done: pop ebp pop edi pop esi ;restore C register variables ret PUBLIC gr_linear_stosd_ gr_linear_stosd_: ; EAX -> Destination buffer ; EDX -> Byte to store ; EBX -> Number of bytes to move push ecx push edi mov edi, eax mov dh, dl mov ax, dx shl eax, 16 mov ax, dx cld mov ecx, ebx shr ecx, 2 rep stosd mov ecx, ebx and ecx, 011b rep stosb pop edi pop ecx ret PUBLIC gr_update_buffer_ gr_update_buffer_: ; EAX = Latest source buffer ; EDX = Earlier source buffer ; EBX = Dest source buffer ; ECX = Size of buffer push esi push edi push ebp cld mov esi, eax mov edi, edx mov ebp, esi shr ecx, 2 FindNextMismatch: repe cmpsd mov eax, [esi-4] mov edx, ebx add edx, esi sub edx, ebp mov [edx], eax ; EDX = dest + size - bytes to end cmp ecx, 0 jne FindNextMismatch Done11: pop ebp pop edi pop esi ret ;--NOT USED!!-- X0 dd ? ;X coordinate of line start point ;--NOT USED!!-- Y0 dd ? ;Y coordinate of line start point ;--NOT USED!!-- X1 dd ? ;X coordinate of line end point ;--NOT USED!!-- Y1 dd ? ;Y coordinate of line end point ;--NOT USED!!-- BaseColor db ? ;color # of first color in block used for ;--NOT USED!!-- ; antialiasing, the 100% intensity version of the ;--NOT USED!!-- ; drawing color ;--NOT USED!!-- NumLevels db 16 ;size of color block, with BaseColor+NumLevels-1 ;--NOT USED!!-- ; being the 0% intensity version of the drawing color ;--NOT USED!!-- ; (maximum NumLevels = 256) ;--NOT USED!!-- IntensityBits db 4 ;log base 2 of NumLevels; the # of bits used to ;--NOT USED!!-- ; describe the intensity of the drawing color. ;--NOT USED!!-- ; 2**IntensityBits==NumLevels ;--NOT USED!!-- ; (maximum IntensityBits = 8) ;--NOT USED!!-- ; C near-callable function to draw an antialiased line from ;--NOT USED!!-- ; (X0,Y0) to (X1,Y1), in mode 13h, the VGA's standard 320x200 256-color ;--NOT USED!!-- ; mode. Uses an antialiasing approach published by Xiaolin Wu in the July ;--NOT USED!!-- ; 1991 issue of Computer Graphics. Requires that the palette be set up so ;--NOT USED!!-- ; that there are NumLevels intensity levels of the desired drawing color, ;--NOT USED!!-- ; starting at color BaseColor (100% intensity) and followed by (NumLevels-1) ;--NOT USED!!-- ; levels of evenly decreasing intensity, with color (BaseColor+NumLevels-1) ;--NOT USED!!-- ; being 0% intensity of the desired drawing color (black). No clipping is ;--NOT USED!!-- ; performed in DrawWuLine. Handles a maximum of 256 intensity levels per ;--NOT USED!!-- ; antialiased color. This code is suitable for use at screen resolutions, ;--NOT USED!!-- ; with lines typically no more than 1K long; for longer lines, 32-bit error ;--NOT USED!!-- ; arithmetic must be used to avoid problems with fixed-point inaccuracy. ;--NOT USED!!-- ; Tested with TASM 3.0. ;--NOT USED!!-- ; ;--NOT USED!!-- ; C near-callable as: ;--NOT USED!!-- ; void DrawWuLine(int X0, int Y0, int X1, int Y1, int BaseColor, ;--NOT USED!!-- ; int NumLevels, unsigned int IntensityBits); ;--NOT USED!!-- ;--NOT USED!!-- SCREEN_WIDTH_IN_BYTES equ 320 ;# of bytes from the start of one scan line ;--NOT USED!!-- ; to the start of the next ;--NOT USED!!-- SCREEN_SEGMENT equ 0a000h ;segment in which screen memory resides ;--NOT USED!!-- ;--NOT USED!!-- ; Parameters passed in stack frame. ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- ;_gr_var_color, _gr_var_bitmap, _gr_var_bwidth ;--NOT USED!!-- ;--NOT USED!!-- public gr_linear_aaline_ ;--NOT USED!!-- gr_linear_aaline_: ;--NOT USED!!-- ;--NOT USED!!-- push ebp ;--NOT USED!!-- push esi ;preserve C's register variables ;--NOT USED!!-- push edi ;--NOT USED!!-- cld ;make string instructions increment their pointers ;--NOT USED!!-- ;--NOT USED!!-- mov X0, eax ;--NOT USED!!-- mov Y0, edx ;--NOT USED!!-- mov X1, ebx ;--NOT USED!!-- mov Y1, ecx ;--NOT USED!!-- ;--NOT USED!!-- mov eax, _gr_var_color ;--NOT USED!!-- mov BaseColor, al ;--NOT USED!!-- ;--NOT USED!!-- ; Make sure the line runs top to bottom. ;--NOT USED!!-- mov esi,X0 ;--NOT USED!!-- mov eax,Y0 ;--NOT USED!!-- cmp eax,Y1 ;swap endpoints if necessary to ensure that ;--NOT USED!!-- jna NoSwap ; Y0 <= Y1 ;--NOT USED!!-- xchg Y1,eax ;--NOT USED!!-- mov Y0,eax ;--NOT USED!!-- xchg X1,esi ;--NOT USED!!-- mov X0,esi ;--NOT USED!!-- NoSwap: ;--NOT USED!!-- ;--NOT USED!!-- ; Draw the initial pixel, which is always exactly intersected by the line ;--NOT USED!!-- ; and so needs no weighting. ;--NOT USED!!-- ;--NOT USED!!-- mov edx,_gr_var_bwidth ;--NOT USED!!-- mul edx ;Y0 * SCREEN_WIDTH_IN_BYTES yields the offset ;--NOT USED!!-- ; of the start of the row start the initial ;--NOT USED!!-- ; pixel is on ;--NOT USED!!-- add esi,eax ;point DS:SI to the initial pixel ;--NOT USED!!-- add esi,_gr_var_bitmap ;--NOT USED!!-- mov al, BaseColor ;color with which to draw ;--NOT USED!!-- mov [esi],al ;draw the initial pixel ;--NOT USED!!-- ;--NOT USED!!-- mov ebx,1 ;XDir = 1; assume DeltaX >= 0 ;--NOT USED!!-- mov ecx,X1 ;--NOT USED!!-- sub ecx,X0 ;DeltaX; is it >= 1? ;--NOT USED!!-- jns DeltaXSet ;yes, move left->right, all set ;--NOT USED!!-- ;no, move right->left ;--NOT USED!!-- neg ecx ;make DeltaX positive ;--NOT USED!!-- neg ebx ;XDir = -1 ;--NOT USED!!-- DeltaXSet: ;--NOT USED!!-- ;--NOT USED!!-- ; Special-case horizontal, vertical, and diagonal lines, which require no ;--NOT USED!!-- ; weighting because they go right through the center of every pixel. ;--NOT USED!!-- mov edx,Y1 ;--NOT USED!!-- sub edx,Y0 ;DeltaY; is it 0? ;--NOT USED!!-- jnz NotHorz ;no, not horizontal ;--NOT USED!!-- ;yes, is horizontal, special case ;--NOT USED!!-- and ebx,ebx ;draw from left->right? ;--NOT USED!!-- jns DoHorz ;yes, all set ;--NOT USED!!-- std ;no, draw right->left ;--NOT USED!!-- DoHorz: ;--NOT USED!!-- lea edi,[ebx+esi] ;point DI to next pixel to draw ;--NOT USED!!-- ;point ES:DI to next pixel to draw ;--NOT USED!!-- mov al,BaseColor ;color with which to draw ;--NOT USED!!-- ;CX = DeltaX at this point ;--NOT USED!!-- rep stosb ;draw the rest of the horizontal line ;--NOT USED!!-- cld ;restore default direction flag ;--NOT USED!!-- jmp DoneAA ;and we're done ;--NOT USED!!-- ;--NOT USED!!-- NotHorz: ;--NOT USED!!-- and ecx,ecx ;is DeltaX 0? ;--NOT USED!!-- jnz NotVert ;no, not a vertical line ;--NOT USED!!-- ;yes, is vertical, special case ;--NOT USED!!-- mov al,BaseColor ;color with which to draw ;--NOT USED!!-- VertLoop: ;--NOT USED!!-- add esi,_gr_var_bwidth ;point to next pixel to draw ;--NOT USED!!-- mov [esi], al ;draw the next pixel ;--NOT USED!!-- dec edx ;--DeltaY ;--NOT USED!!-- jnz VertLoop ;--NOT USED!!-- jmp DoneAA ;and we're done ;--NOT USED!!-- ;--NOT USED!!-- NotVert: ;--NOT USED!!-- cmp ecx,edx ;DeltaX == DeltaY? ;--NOT USED!!-- jnz NotDiag ;no, not diagonal ;--NOT USED!!-- ;yes, is diagonal, special case ;--NOT USED!!-- mov al,BaseColor ;color with which to draw ;--NOT USED!!-- DiagLoop: ;--NOT USED!!-- lea esi,[esi+ebx] ;--NOT USED!!-- add esi,_gr_var_bwidth ;--NOT USED!!-- ;advance to next pixel to draw by ;--NOT USED!!-- ; incrementing Y and adding XDir to X ;--NOT USED!!-- mov [esi],al ;draw the next pixel ;--NOT USED!!-- dec edx ;--DeltaY ;--NOT USED!!-- jnz DiagLoop ;--NOT USED!!-- jmp DoneAA ;and we're done ;--NOT USED!!-- ;--NOT USED!!-- ; Line is not horizontal, diagonal, or vertical. ;--NOT USED!!-- NotDiag: ;--NOT USED!!-- ; Is this an X-major or Y-major line? ;--NOT USED!!-- cmp edx,ecx ;--NOT USED!!-- jb XMajorAA ;it's X-major ;--NOT USED!!-- ;--NOT USED!!-- ; It's a Y-major line. Calculate the 16-bit fixed-point fractional part of a ;--NOT USED!!-- ; pixel that X advances each time Y advances 1 pixel, truncating the result ;--NOT USED!!-- ; to avoid overrunning the endpoint along the X axis. ;--NOT USED!!-- xchg edx,ecx ;DX = DeltaX, CX = DeltaY ;--NOT USED!!-- sub ax,ax ;make DeltaX 16.16 fixed-point value in DX:AX ;--NOT USED!!-- div cx ;AX = (DeltaX << 16) / DeltaY. Won't overflow ;--NOT USED!!-- ; because DeltaX < DeltaY ;--NOT USED!!-- mov di,cx ;DI = DeltaY (loop count) ;--NOT USED!!-- sub esi,ebx ;back up the start X by 1, as explained below ;--NOT USED!!-- mov dx,-1 ;initialize the line error accumulator to -1, ;--NOT USED!!-- ; so that it will turn over immediately and ;--NOT USED!!-- ; advance X to the start X. This is necessary ;--NOT USED!!-- ; properly to bias error sums of 0 to mean ;--NOT USED!!-- ; "advance next time" rather than "advance ;--NOT USED!!-- ; this time," so that the final error sum can ;--NOT USED!!-- ; never cause drawing to overrun the final X ;--NOT USED!!-- ; coordinate (works in conjunction with ;--NOT USED!!-- ; truncating ErrorAdj, to make sure X can't ;--NOT USED!!-- ; overrun) ;--NOT USED!!-- mov cl,8 ;CL = # of bits by which to shift ;--NOT USED!!-- sub cl,IntensityBits ; ErrorAcc to get intensity level (8 ;--NOT USED!!-- ; instead of 16 because we work only ;--NOT USED!!-- ; with the high byte of ErrorAcc) ;--NOT USED!!-- mov ch,NumLevels ;mask used to flip all bits in an ;--NOT USED!!-- dec ch ; intensity weighting, producing ;--NOT USED!!-- ; result (1 - intensity weighting) ;--NOT USED!!-- mov bp, ax ;--NOT USED!!-- mov al, BaseColor ;--NOT USED!!-- ;BP = ErrorAdj, AL = BaseColor, ;--NOT USED!!-- ; AH = scratch register ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- ; Draw all remaining pixels. ;--NOT USED!!-- YMajorLoop: ;--NOT USED!!-- add dx,bp ;calculate error for next pixel ;--NOT USED!!-- jnc NoXAdvance ;not time to step in X yet ;--NOT USED!!-- ;the error accumulator turned over, ;--NOT USED!!-- ; so advance the X coord ;--NOT USED!!-- add esi,ebx ;add XDir to the pixel pointer ;--NOT USED!!-- NoXAdvance: ;--NOT USED!!-- add esi,_gr_var_bwidth ;Y-major, so always advance Y ;--NOT USED!!-- ;--NOT USED!!-- ; The IntensityBits most significant bits of ErrorAcc give us the intensity ;--NOT USED!!-- ; weighting for this pixel, and the complement of the weighting for the ;--NOT USED!!-- ; paired pixel. ;--NOT USED!!-- mov ah,dh ;msb of ErrorAcc ;--NOT USED!!-- shr ah,cl ;Weighting = ErrorAcc >> IntensityShift; ;--NOT USED!!-- ;add ah,al ;BaseColor + Weighting ;--NOT USED!!-- ;--NOT USED!!-- ; Make ah = _gr_fade_table + BaseColor+(15-ah)*256 ;--NOT USED!!-- push ecx ;--NOT USED!!-- push ebx ;--NOT USED!!-- mov ebx, 15 ;--NOT USED!!-- sub bl, ah ;--NOT USED!!-- shl ebx, 8 ;--NOT USED!!-- movzx ecx, BaseColor ;--NOT USED!!-- add ebx, ecx ;--NOT USED!!-- add ebx, offset _gr_fade_table ;--NOT USED!!-- mov ah, [ebx] ;--NOT USED!!-- pop ebx ;--NOT USED!!-- pop ecx ;--NOT USED!!-- ;--NOT USED!!-- mov [esi],ah ;DrawPixel(X, Y, BaseColor + Weighting); ;--NOT USED!!-- ;--NOT USED!!-- mov ah,dh ;msb of ErrorAcc ;--NOT USED!!-- shr ah,cl ;Weighting = ErrorAcc >> IntensityShift; ;--NOT USED!!-- xor ah,ch ;Weighting ^ WeightingComplementMask ;--NOT USED!!-- ;add ah,al ;BaseColor + (Weighting ^ WeightingComplementMask) ;--NOT USED!!-- ;--NOT USED!!-- ; Make ah = _gr_fade_table + BaseColor+(15-ah)*256 ;--NOT USED!!-- push ecx ;--NOT USED!!-- push ebx ;--NOT USED!!-- mov ebx, 15 ;--NOT USED!!-- sub bl, 0 ;--NOT USED!!-- shl ebx, 8 ;--NOT USED!!-- movzx ecx, BaseColor ;--NOT USED!!-- add ebx, ecx ;--NOT USED!!-- add ebx, offset _gr_fade_table ;--NOT USED!!-- mov ah, [ebx] ;--NOT USED!!-- pop ebx ;--NOT USED!!-- pop ecx ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- mov [esi+ebx],ah ;DrawPixel(X+XDir, Y, ;--NOT USED!!-- ; BaseColor + (Weighting ^ WeightingComplementMask)); ;--NOT USED!!-- dec di ;--DeltaY ;--NOT USED!!-- jnz YMajorLoop ;--NOT USED!!-- jmp DoneAA ;we're done with this line ;--NOT USED!!-- ;--NOT USED!!-- ; It's an X-major line. ;--NOT USED!!-- XMajorAA: ;--NOT USED!!-- ; Calculate the 16-bit fixed-point fractional part of a pixel that Y advances ;--NOT USED!!-- ; each time X advances 1 pixel, truncating the result to avoid overrunning ;--NOT USED!!-- ; the endpoint along the X axis. ;--NOT USED!!-- sub eax,eax ;make DeltaY 16.16 fixed-point value in DX:AX ;--NOT USED!!-- div ecx ;AX = (DeltaY << 16) / Deltax. Won't overflow ;--NOT USED!!-- ; because DeltaY < DeltaX ;--NOT USED!!-- mov edi,ecx ;DI = DeltaX (loop count) ;--NOT USED!!-- sub esi,_gr_var_bwidth ;back up the start X by 1, as ;--NOT USED!!-- ; explained below ;--NOT USED!!-- mov edx,-1 ;initialize the line error accumulator to -1, ;--NOT USED!!-- ; so that it will turn over immediately and ;--NOT USED!!-- ; advance Y to the start Y. This is necessary ;--NOT USED!!-- ; properly to bias error sums of 0 to mean ;--NOT USED!!-- ; "advance next time" rather than "advance ;--NOT USED!!-- ; this time," so that the final error sum can ;--NOT USED!!-- ; never cause drawing to overrun the final Y ;--NOT USED!!-- ; coordinate (works in conjunction with ;--NOT USED!!-- ; truncating ErrorAdj, to make sure Y can't ;--NOT USED!!-- ; overrun) ;--NOT USED!!-- mov cl,8 ;CL = # of bits by which to shift ;--NOT USED!!-- sub cl,IntensityBits ; ErrorAcc to get intensity level (8 ;--NOT USED!!-- ; instead of 16 because we work only ;--NOT USED!!-- ; with the high byte of ErrorAcc) ;--NOT USED!!-- mov ch,NumLevels ;mask used to flip all bits in an ;--NOT USED!!-- dec ch ; intensity weighting, producing ;--NOT USED!!-- ; result (1 - intensity weighting) ;--NOT USED!!-- ;--NOT USED!!-- mov ebp, eax ;--NOT USED!!-- mov al, BaseColor ;--NOT USED!!-- ;--NOT USED!!-- ; Draw all remaining pixels. ;--NOT USED!!-- XMajorLoop: ;--NOT USED!!-- add edx,ebp ;calculate error for next pixel ;--NOT USED!!-- jnc NoYAdvance ;not time to step in Y yet ;--NOT USED!!-- ;the error accumulator turned over, ;--NOT USED!!-- ; so advance the Y coord ;--NOT USED!!-- add esi,_gr_var_bwidth ;advance Y ;--NOT USED!!-- NoYAdvance: ;--NOT USED!!-- add esi,ebx ;X-major, so add XDir to the pixel pointer ;--NOT USED!!-- ;--NOT USED!!-- ; The IntensityBits most significant bits of ErrorAcc give us the intensity ;--NOT USED!!-- ; weighting for this pixel, and the complement of the weighting for the ;--NOT USED!!-- ; paired pixel. ;--NOT USED!!-- mov ah,dh ;msb of ErrorAcc ;--NOT USED!!-- shr ah,cl ;Weighting = ErrorAcc >> IntensityShift; ;--NOT USED!!-- ;add ah,al ;BaseColor + Weighting ;--NOT USED!!-- ;--NOT USED!!-- ; Make ah = _gr_fade_table + BaseColor+(15-ah)*256 ;--NOT USED!!-- push ecx ;--NOT USED!!-- push ebx ;--NOT USED!!-- mov ebx, 15 ;--NOT USED!!-- sub bl, ah ;--NOT USED!!-- shl ebx, 8 ;--NOT USED!!-- movzx ecx, BaseColor ;--NOT USED!!-- add ebx, ecx ;--NOT USED!!-- add ebx, offset _gr_fade_table ;--NOT USED!!-- mov ah, [ebx] ;--NOT USED!!-- pop ebx ;--NOT USED!!-- pop ecx ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- mov [esi],ah ;DrawPixel(X, Y, BaseColor + Weighting); ;--NOT USED!!-- mov ah,dh ;msb of ErrorAcc ;--NOT USED!!-- shr ah,cl ;Weighting = ErrorAcc >> IntensityShift; ;--NOT USED!!-- xor ah,ch ;Weighting ^ WeightingComplementMask ;--NOT USED!!-- ;add ah,al ;BaseColor + (Weighting ^ WeightingComplementMask) ;--NOT USED!!-- add esi, _gr_var_bwidth ;--NOT USED!!-- ;--NOT USED!!-- ; Make ah = _gr_fade_table + BaseColor+(15-ah)*256 ;--NOT USED!!-- push ecx ;--NOT USED!!-- push ebx ;--NOT USED!!-- mov ebx, 15 ;--NOT USED!!-- sub bl, ah ;--NOT USED!!-- shl ebx, 8 ;--NOT USED!!-- movzx ecx, BaseColor ;--NOT USED!!-- add ebx, ecx ;--NOT USED!!-- add ebx, offset _gr_fade_table ;--NOT USED!!-- mov ah, [ebx] ;--NOT USED!!-- pop ebx ;--NOT USED!!-- pop ecx ;--NOT USED!!-- ;--NOT USED!!-- ;--NOT USED!!-- mov [esi],ah ;DrawPixel(X, Y+SCREEN_WIDTH_IN_BYTES, ;--NOT USED!!-- ; BaseColor + (Weighting ^ WeightingComplementMask)); ;--NOT USED!!-- sub esi, _gr_var_bwidth ;--NOT USED!!-- dec edi ;--DeltaX ;--NOT USED!!-- jnz XMajorLoop ;--NOT USED!!-- ;--NOT USED!!-- DoneAA: ;we're done with this line ;--NOT USED!!-- pop edi ;restore C's register variables ;--NOT USED!!-- pop esi ;--NOT USED!!-- pop ebp ;restore caller's stack frame ;--NOT USED!!-- ret ;done _TEXT ENDS END
/** * @author Moe_Sakiya sakiya@tun.moe * @date 2019-03-13 15:09:53 * */ #include <iostream> #include <string> #include <algorithm> #include <set> #include <map> #include <vector> #include <stack> #include <queue> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> using namespace std; int maxHeight, maxWidth; struct Ret { int height, width; void Rotate() { swap(height, width); return; } } a, b; bool Check() { if(maxHeight - a.height >= b.height && maxWidth >= b.width && maxWidth >= a.width) return true; if(maxWidth - a.width >= b.width && maxHeight >= a.height && maxHeight >= b.height) return true; return false; } int main(void) { ios::sync_with_stdio(false); cin.tie(NULL); scanf("%d %d", &maxHeight, &maxWidth); scanf("%d %d %d %d", &a.height, &a.width, &b.height, &b.width); if(Check() == true) { printf("YES\n"); return 0; } a.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } b.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } a.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } swap(maxHeight, maxWidth); if(Check() == true) { printf("YES\n"); return 0; } a.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } b.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } a.Rotate(); if(Check() == true) { printf("YES\n"); return 0; } printf("NO\n"); return 0; }