T2 SisComp

T2 SisComp


DisciplinaSistemas Computacionais95 materiais314 seguidores
Pré-visualização50 páginas
text files and perform LF normalization
* text=auto
T2-SisComp/attem.c
#include <stdlib.h>
#include <stdio.h>
#define _left_			0xffff0000
#define _right_			0x0000ffff
int main(){
 printf(&quot;%x\n%x\n&quot;, _left_, ~_right_);
}
T2-SisComp/auxiliar.h
#ifndef AUX_H
#define AUX_H
#include &quot;log.h&quot;
#define Kilobytes 8192
#define PAGE_PER_FRAME_SIZE 16 * Kilobytes
typedef unsigned int ent_t;
typedef unsigned int un_int;
typedef unsigned int v_addr;
typedef unsigned int f_addr;
typedef char bool;
#define true 1
#define false 0
#endif
T2-SisComp/binario.c
#include &quot;binario.h&quot;
#include <stdlib.h>
#include <stdio.h>
#define BIN_MASK 0x01
void checkNegative(ent_t value);
ent_t getBitAt_LE(ent_t binario, int pos){
 checkNegative(pos);
 return ((binario >> pos) & BIN_MASK);
}
ent_t getBitAt_BE(ent_t binario, int pos){
 checkNegative(pos);
 return getBitAt_LE(binario, 32-pos);
}
ent_t getBitInRange_LE(ent_t binario, int from, int to){
 ent_t val = binario;
 checkNegative(from);
 checkNegative(to);
 int t,f;
 if(to > from){
 t = to;
 f = from;
 }
 else if(to < from){
 t = from;
 f = to;
 }
 else{
 printf(&quot;Range do Bit igual a 0.\nEncerrando a execucao.\n&quot;);
 exit(1);
 }
 val = (((val << to) >> to) >> from);
 return val;
}
ent_t getBitInRange_BE(ent_t binario, int from, int to){
 getBitInRange_LE(binario, 32 - from, 32 - to);
}
void checkNegative(ent_t value){
 if(value < 0){
 printf(&quot;Binario: Recebendo valor de posicao negativa.\nEncerrando execucao.\n&quot;);
 exit(1);
 }
}
void printBits(size_t const size, void const * const ptr)
{
 unsigned char *b = (unsigned char*) ptr;
 unsigned char byte;
 size_t i;
 int j;
 for (i=size-1;i>=0;i--)
 {
 for (j=7;j>=0;j--)
 {
 byte = (b[i] >> j) & 1;
 printf(&quot;%u&quot;, byte);
 }
 }
 puts(&quot;&quot;);
}
ent_t switch_BitAt(ent_t bin, int pos, bool value){
 ent_t newbin = 1L << pos;
 if(value == 1){
 return bin | newbin;
 }
 else{
 return bin & newbin;
 }
}
ent_t turnon_BitAt(ent_t bin, int pos){
 return switch_BitAt(bin, pos, true);
}
ent_t turnoff_BitAt(ent_t bin, int pos){
 return switch_BitAt(bin, pos, false);
}
T2-SisComp/binario.h
#ifndef BINARIO_H
#define BINARIO_H
#include <stdlib.h>
#include &quot;auxiliar.h&quot;
/**
 * Retorna o valor do bit na posicao indicada.
 * @param binário: o valor em binário inicial.
 * @param pos: posicao do bit no vetor de bit.
 */
ent_t getBitAt_LE(ent_t binario, int pos);
ent_t getBitAt_BE(ent_t binario, int pos);
/**
 * Coleta os bits em um range de {to} até {from}
 * @param binário: o valor em binário inicial.
 * @param to: ultimo bit da faixa de bits desejada.
 * @param from: primeiro bit da faixa de bits desejada. 
 */
ent_t getBitInRange_LE(ent_t binario, int from, int to);
ent_t getBitInRange_BE(ent_t binario, int from, int to);
ent_t turnon_BitAt(ent_t bin, int pos);
ent_t turnoff_BitAt(ent_t bin, int pos);
/**
 * Imprime na tela um valor em binário. Assumindo Little Endian.
 * @param size: sizeof(variavel que armazena o valor em binário)
 * @param ptr: endereço para a variavel que armazena o valor em binário.
 */
void printBits(size_t const size, void const * const ptr);
#endif
T2-SisComp/commit.sh
git add *
git commit -m &quot;mensagem&quot;
T2-SisComp/compilador.log
0041f7a0 R
13f5e2c0 R
05e78900 R
004758a0 R
31348900 W
004a30e0 R
0700ff05 R
0049e120 R
004c25f8 R
004c2600 R
3305a5e0 W
05e06600 W
0044e4f8 R
0044e500 R
0044e520 R
0700ff10 R
2f6965a0 W
0044e5c0 R
0044e5e0 R
0044e621 R
31dae640 W
00414f20 R
05f7cf20 W
004bcfc0 R
2774cfc0 W
004696a0 R
00446460 R
31f92120 W
00496ec0 R
004a0c00 R
0049d640 R
004f3df0 R
0700ff10 R
3d729820 W
00496fb0 R
00496fc0 R
21dd6fc0 W
004a9860 R
004aa4d8 R
004aa4e0 R
004bd000 R
044b71e0 R
0700ff10 R
04497780 R
004977a0 R
12151660 R
004b3a80 R
05e9ba80 W
31602880 W
004b39c0 R
33b1b9c0 W
004b0ba0 R
004953b0 R
004bd080 R
0785d080 W
05ae74a2 W
004b3900 R
32f53900 W
00497738 R
31a2f720 W
00497740 R
3a34f740 W
07967018 R
07967d00 R
303f18c3 W
08848548 R
08848560 R
0702ff10 R
088487e0 R
088c1a20 R
088c1a60 R
06379a60 W
088c1aa0 R
088c1ac0 R
0f8cfef0 R
303f1ae0 W
079911b0 R
30b111a0 W
079911c0 R
00470888 R
31b10880 W
00497920 R
00497940 R
31a2f940 W
00497960 R
00497980 R
31187980 W
004979a0 R
26c1f9a0 W
3272c040 W
33b1b960 W
004b3980 R
004979c0 R
004979e0 R
00497a00 R
00497a40 R
0700ff40 W
198857a5 W
0048d7a0 R
0048d7c0 R
0703ff1d R
32594380 W
00497a80 R
0700ff10 R
0749ffd0 R
00497ae0 R
32dcfae0 W
004af5f0 R
004af600 R
0cac7600 W
004af620 R
32dcf620 W
004af640 R
004af660 R
004af680 R
074afeb0 R
00495558 R
00495560 R
19885560 W
00495580 R
004955a0 R
004181d8 R
00418200 R
0741ce20 R
00418240 R
314b02a0 W
004182e0 R
00418260 R
31a50260 W
05e7e2d0 R
00472a08 R
2ff72a00 W
00466fa8 R
00467000 R
00467020 R
05ae76c8 R
00467180 R
004671a0 R
05afc668 R
2574c660 W
05ae76e1 R
05ae7700 R
00418280 R
00452150 R
00452160 R
06342140 W
3305a160 W
00452180 R
004521a0 R
004521c0 R
316021e0 W
0701ff10 R
00452220 R
31f92220 W
00452260 R
00452280 R
0703ff18 R
2574cc80 W
004955e0 R
004af6c0 R
0049ca20 R
0745fe20 W
0049ca40 R
0703ff10 R
303f1620 W
31a2f1e0 W
11d5f200 R
121dd6c0 R
121ddfa0 R
0608dfa0 W
121ddfe0 R
30afdfe0 W
11f5e000 R
11f5e020 R
13f5e040 R
121ddf00 R
121ddf20 R
121ddf40 R
121ddf60 R
121ddf80 R
171ddf08 R
00420ce8 R
062f0ce0 W
314b0d20 W
00420d40 R
27a5fd40 W
0041e9c8 R
0041e9e0 R
27fb69e0 W
0041ea00 R
27fb6a00 W
00420d60 R
00420d80 R
31348d60 W
0700ff10 R
258c62e0 W
0042e300 R
05b99b60 R
05b99b50 R
0042e320 R
00402500 R
0042e340 R
2f696340 W
00420bc0 R
00420be0 R
00420c00 R
121dd630 R
11f5e060 R
11f5e160 R
31f7e140 W
17f5e580 R
11f5e1a0 R
11d5f0d8 R
11f5e080 R
11f5e0a0 R
2f6962e1 W
11f5e300 R
00400740 R
00400760 R
00400780 R
13f5e0c0 R
11f5e120 R
2f6960e0 W
17f5ed10 R
003fe120 W
31c68780 W
26c1fae0 W
26c1fb00 W
3259efa0 W
0047efa0 W
066b8000 W
31ca0000 W
32098020 W
320980a0 W
0041ff80 W
314b00c0 W
320980e0 W
31c68160 W
31a50280 W
314b02c0 W
314b02e0 W
314b0340 W
314b0360 W
2e3c8380 W
314b0380 W
231383a0 W
314bffc0 W
06bb83e0 W
2414ffc0 W
23138420 W
31a50420 W
32098480 W
31a504c0 W
2001ff00 W
314b0520 W
314b0540 W
31c68560 W
31c68580 W
32098580 W
2313cd60 W
314b05c0 W
314b0600 W
05b00620 W
31c68640 W
31a50660 W
314b0680 W
31b10660 W
05b006a0 W
314b06a0 W
31b10700 W
314b0740 W
314b0760 W
31b10740 W
31308760 W
31b107a0 W
31b107c0 W
31b10800 W
31b10820 W
31a508a0 W
31c688c0 W
05e788e0 W
31b10900 W
23138900 W
05e78940 W
314b0960 W
31b10980 W
314b09a0 W
31a509c0 W
31b109c0 W
314bce00 W
31b109e0 W
31b10a00 W
231389e0 W
31a50a20 W
31a50a40 W
00470a20 W
06338ac0 W
31a5fee0 W
314b0ac0 W
23138b00 W
31a50b60 W
0460ef80 W
31a5ffc0 W
05b08ca0 W
23138d00 W
314b0d60 W
0417ff60 W
314b0d80 W
31a54da0 W
31a50dc2 W
314b0de0 W
314b0e20 W
31c6ce40 W
06aa0e20 W
31308e20 W
31a50e40 W
314b0e60 W
06378e60 W
314b0ea0 W
31a50ec0 W
2001ffe0 W
31a50f00 W
31a50f20 W
31348f60 W
31a50f60 W
31a50f80 W
0a1dcfa0 W
314b0fa0 W
31348fe0 W
3d729000 W
30b11020 W
3d729040 W
30b11060 W
303f10a0 W
3081dd00 W
21489120 W
0426ff40 W
30b11120 W
05ae9160 W
303f1140 W
33319160 W
33319180 W
3d7291a0 W
333191c0 W
30b111e0 W
3007fe00 W
05e99220 W
33319240 W
3d729240 W
303fde60 W
33319280 W
333192a0 W
05ba9280 W
30b11260 W
3d7292a0 W
3011ffc0 W
30b112e0 W
23dfdf00 W
05ba9300 W
33319360 W
3d729380 W
3d729360 W
2d3b1380 W
3007ffc0 W
05b113e0 W
2d3b13a0 W
3d7293a0 W
05b113c0 W
333193e0 W
05b11400 W
1215fc20 W
217493c0