00001 /* 00002 Copyright (C) 2011 Computer Sciences Department, 00003 University of Wisconsin -- Madison 00004 00005 ---------------------------------------------------------------------- 00006 00007 This file is part of Mnemosyne: Lightweight Persistent Memory, 00008 originally developed at the University of Wisconsin -- Madison. 00009 00010 Mnemosyne was originally developed primarily by Haris Volos 00011 with contributions from Andres Jaan Tack. 00012 00013 ---------------------------------------------------------------------- 00014 00015 Mnemosyne is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU General Public License 00017 as published by the Free Software Foundation, version 2 00018 of the License. 00019 00020 Mnemosyne is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 51 Franklin Street, Fifth Floor, 00028 Boston, MA 02110-1301, USA. 00029 00030 ### END HEADER ### 00031 */ 00032 00033 #include <stdio.h> 00034 #include <mnemosyne.h> 00035 #include <pcm.h> 00036 00037 // These two must come before all other includes; they define things like w_entry_t. 00038 #include "pwb_i.h" 00039 #include "mode/pwb-common/barrier-bits.h" 00040 00041 00042 /* 00043 * Called by the CURRENT thread to store a word-sized value. 00044 */ 00045 void 00046 mtm_pwbetl_store(mtm_tx_t *tx, volatile mtm_word_t *addr, mtm_word_t value) 00047 { 00048 pwb_write_internal(tx, addr, value, ~(mtm_word_t)0, 1); 00049 } 00050 00051 00052 /* 00053 * Called by the CURRENT thread to store part of a word-sized value. 00054 */ 00055 void 00056 mtm_pwbetl_store2(mtm_tx_t *tx, volatile mtm_word_t *addr, mtm_word_t value, mtm_word_t mask) 00057 { 00058 pwb_write_internal(tx, addr, value, mask, 1); 00059 } 00060 00061 /* 00062 * Called by the CURRENT thread to load a word-sized value. 00063 */ 00064 mtm_word_t 00065 mtm_pwbetl_load(mtm_tx_t *tx, volatile mtm_word_t *addr) 00066 { 00067 return pwb_load_internal(tx, addr, 1); 00068 } 00069 00070 00071 DEFINE_LOAD_BYTES(pwbetl) 00072 DEFINE_STORE_BYTES(pwbetl) 00073 00074 FOR_ALL_TYPES(DEFINE_READ_BARRIERS, pwbetl) 00075 FOR_ALL_TYPES(DEFINE_WRITE_BARRIERS, pwbetl)