-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinforme.tex
executable file
·165 lines (157 loc) · 7.08 KB
/
informe.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{moreverb}
\setlength{\parindent}{0pt}
\setlength{\parskip}{10pt plus 6pt minus 4pt}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{fancybox}
\usepackage{color}
\usepackage{times}
\usepackage{textcomp}
\usepackage{verbatim}
\usepackage{listings}
\definecolor{gray97}{gray}{.97}
\definecolor{gray75}{gray}{.75}
\definecolor{gray45}{gray}{.45}
\lstset{
frame=Ltb,
framerule=0pt,
aboveskip=0.5cm,
framextopmargin=3pt,
framexbottommargin=3pt,
framexleftmargin=0.4cm,
framesep=0pt,
rulesep=.4pt,
backgroundcolor=\color{gray97},
rulesepcolor=\color{black},
stringstyle=\ttfamily,
showstringspaces = false,
basicstyle=\small\ttfamily,
commentstyle=\color{blue},
keywordstyle=\bfseries,
numbers=left,
numbersep=15pt,
numberstyle=\tiny,
numberfirstline = false,
breaklines=true,
}
%lstnewenvironment{listing}[1][]{
% \lstset{#1}\pagebreak[0]
%}{\pagebreak[0]}
\lstdefinestyle{C}{language=C}
\begin{document}
\begin{center}
\textbf{\LARGE{Arquitecturas de Computadoras}}\\
\large{TP Especial}\par \bigskip
\large{Mini Sistema operativo}
\end{center}
\par \bigskip \bigskip \bigskip \bigskip
\large{\textbf{Integrantes}}\\
\small{MAGNORSKY, Alejandro}\\
\small{MATA SUÃREZ, Andrés}\\
\small{MERCHANTE, Mariano} \bigskip
\par
\large{\textbf{Cátedra}}\\
\small{VALLÉS, Santiago Raúl}\\
\small{PUNCI, Román} \bigskip
\par
\large{\textbf{Fecha de entrega}}\\
\small{Viernes 18 de junio de 2010}
\clearpage
\tableofcontents
\clearpage
\section{Inconvenientes surgidos - FALTA BOCHA**********}
Dada la imposibilidad del uso de las librerÃas de C oficiales, en determinadas situaciones nos vimos obligados a
ajustar el diseño de nuestro sistema de acuerdo con la implementación de nuestra propia libreria de C. Tales percances
y sus resoluciones son expuestos a continuación:\\
\textbf{\large{Alocación en memoria}}\\
Quizás este fue el problema con el que más frecuentemente tuvimos que lidiar. En otras circunstancias, el uso de la
función de reserva de espacio en memoria \texttt{malloc} de C nos hubiera permitido no muy dificilmente solucionar la cuestión.
Sin embargo, al no tener lal bases suficientes como para implementar una función similar a la mencionada en nuestra librerÃa,
en los casos que asà lo dispusieron optamos por reservar cierta cantidad fija en memoria y sacrificar la
manipulación dinámica de ese espacio, mediante la declaración de vectores.\par \bigskip
\textbf{Máxima cantidad de caracteres ingresados por el usuario}\par
La función \texttt{scanf} de \texttt{lib.c}, en un principio, solicita al usuario ingrese una string, invocando a la función
\texttt{getString} de la misma librerÃa. Esta última función recibe un parámetro de tipo \texttt{char *} donde se guardará
cada caracter leÃdo con \texttt{getchar}, dejando un último lugar para el caracter nulo (\texttt{\textquotesingle \textbackslash 0\textquotesingle }).
No devuelve nada; el parámetro
recibido es también de retorno.\par \bigskip
Ahora bien, es tarea de la función invocadora (en este caso, \texttt{scanf}) pasarle a \texttt{getString} un \texttt{char *} con suficiente
espacio reservado para que la función se encargue de rellenarlo. Si el parámetro no tiene suficiente espacio para guardar
todo lo introducido por el usuario, se producirá un error de segmentación en memoria y el sistema se reiniciará.
\par \bigskip
Y es aquà donde se toma la decisión. Con las constantes globales, \texttt{MAX\_ARGUMENTS} y \texttt{MAX\_ARGU MENT\_LENGTH},
se limita la cantidad de argumentos y caracteres por argumento que puede introducir el usuario, respectivamente:\par
\underline{en \texttt{shell.h}:}
\begin{lstlisting}[style=C]
. . .
#define MAX_ARGUMENT_LENGTH 64
#define MAX_ARGUMENTS 10
. . .
\end{lstlisting}
\par Dicho esto, dentro de \texttt{scanf} y antes de la llamada a \texttt{getString}, se declara la variable que posteriormente será utilizada
como el parámetro de retorno que esta última función requiere de la siguiente manera:\par \bigskip \bigskip
\bigskip \bigskip \bigskip \bigskip \bigskip
\underline{en \texttt{libc.c}:}
\begin{lstlisting}[style=C]
. . .
#define MAX_USER_LENGTH MAX_ARGUMENTS*MAX_ARGUMENT_LENGTH
. . .
int scanf(const char * str, ...){
. . .
char strIn[MAX_USER_LENGTH+1];
. . .
}
. . .
\end{lstlisting}
\par AsÃ, se reserva el suficiente espacio para que el usuario pueda meter \texttt{MAX\_USER\_LENGTH} caracteres, más uno para hacer
la string \texttt{null-terminated}.
\textbf{M\'axima cantidad de comandos en el historial} \par
De la misma manera que ocurre con el \'item anterior, se vuelve necesario definir una constante que limite la cantidad m\'axima de argumentos
que se van a tener en cuenta en el historial. La constante \texttt{MAX\_HISTORY} en \texttt{shell.h} se encarga de esta definici\'on. \par
\underline{en \texttt{shell.h}:}
\begin{lstlisting}[style=C]
. . .
#define MAX_HISTORY 20
. . .
\end{lstlisting}
\par \bigskip
\textbf{\large{Scancodes}}
\par
\textbf{Teclas \textquotesingle \texttt{Pausa|Inter}\textquotesingle , \textquotesingle F11\textquotesingle y \textquotesingle F12\textquotesingle }
\par
El scancode de la tecla \texttt{Pausa|Inter}\textquotesingle comprende 4 bytes de \texttt{make code} y 4 de \texttt{break code}. Debido a eso, se hacÃa muy engorroso extender
la condición para levantarla en \texttt{getAscii}, de la librerÃa de teclado \texttt{keyboard.c}, ya que uno de sus \texttt{make codes}
coincide con el de \texttt{bloqNum}, entonces ambas teclas activarán el \texttt{numPad}.
A su vez, las teclas F11 y F12 tienen un scancode que no fue considerado y preferimos hacer algo m\'as productivo.
\clearpage
\section{BibliografÃa consultada}
\begin{itemize}
\item \textbf{OSDev.org}\\
\textcolor{blue}{\underline{http://wiki.osdev.org/Main\_Page}}\\
\item \textbf{Programación del PIC}\\
\textbf{} \textcolor{blue}{\underline{http://www.beyondlogic.org/interrupts/interupt.htm\#6}}\\
\textbf{} \textcolor{blue}{\underline{http://www.osdever.net/tutorials/pdf/pic.pdf}}\\
\item \textbf{ASCIIs y ScanCodes}\\
\textbf{} \textcolor{blue}{\underline{http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html}}\\
\textbf{} \textcolor{blue}{\underline{http://www.cdrummond.qc.ca/cegep/informat/Professeurs/Alain/files/ascii.htm}}\\
\textbf{} \textcolor{blue}{\underline{http://www.ee.bgu.ac.il/~microlab/MicroLab/Labs/ScanCodes.htm}}\\
\item \textbf{Manejo de excepciones}\\
\textbf{} \textcolor{blue}{\underline{http://pdos.csail.mit.edu/6.828/2008/readings/i386/s09\_08.htm}}\\
\item \textbf{Command bytes del teclado}\\
\textbf{Command bytes}\\
\textcolor{blue}{\underline{http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter\_20/CH20-2.html}}\\
\textbf{LEDs} \textcolor{blue}{\underline{http://wiki.osdev.org/PS2\_Keyboard\#Keyboard\_LEDs}}\\
\textbf{Reboot} \textcolor{blue}{\underline{http://wiki.osdev.org/Reboot}}\\
\end{itemize}
\clearpage
\section{Código fuente}
\subsection{Directorio src}
\large{\underline{\textbf{libc.c:}}}\\
\verbatimtabinput[4]{src/libc.c}
\end{document}