Skip to content

Commit 65cfc71

Browse files
author
Deepak Ravi
committed
lab1 fix build error
1 parent bc08e14 commit 65cfc71

File tree

5 files changed

+74
-4
lines changed

5 files changed

+74
-4
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
obj
2+
*.o
3+
tags
4+

GNUmakefile

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ all:
137137
# Include Makefrags for subdirectories
138138
include boot/Makefrag
139139
include kern/Makefrag
140+
include lib/Makefrag
140141

141142

142143
IMAGES = $(OBJDIR)/kern/kernel.img

inc/syscall.h

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* PIOS system call definitions.
3+
*
4+
* Copyright (C) 2010 Yale University.
5+
* See section "MIT License" in the file LICENSES for licensing terms.
6+
*
7+
* Primary author: Bryan Ford
8+
*/
9+
10+
#ifndef PIOS_INC_SYSCALL_H
11+
#define PIOS_INC_SYSCALL_H
12+
13+
#include <inc/trap.h>
14+
15+
16+
// System call command codes (passed in EAX)
17+
#define SYS_TYPE 0x00000003 // Basic operation type
18+
#define SYS_CPUTS 0x00000000 // Write debugging string to console
19+
#define SYS_PUT 0x00000001 // Push data to child and start it
20+
#define SYS_PUT 0x00000001 // Push data to child and start it
21+
#define SYS_GET 0x00000002 // Pull results from child
22+
#define SYS_RET 0x00000003 // Return to parent
23+
24+
#define SYS_START 0x00000010 // Put: start child running
25+
26+
#define SYS_REGS 0x00001000 // Get/put register state
27+
#define SYS_FPU 0x00002000 // Get/put FPU state
28+
29+
30+
// Register conventions for CPUTS system call:
31+
// EAX: System call command
32+
// EBX: User pointer to string to output to console
33+
#define SYS_CPUTS_MAX 256 // Max buffer length cputs will accept
34+
35+
36+
// Register conventions on GET/PUT system call entry:
37+
// EAX: System call command/flags (SYS_*)
38+
// EDX: bits 7-0: Child process number to get/put
39+
// EBX: Get/put CPU state pointer for SYS_REGS and/or SYS_FPU)
40+
// ECX: Get/put memory region size
41+
// ESI: Get/put local memory region start
42+
// EDI: Get/put child memory region start
43+
// EBP: reserved
44+
45+
46+
#ifndef __ASSEMBLER__
47+
48+
// CPU state save area format for GET/PUT with SYS_REGS flags
49+
typedef struct cpustate {
50+
trapframe tf; // general registers
51+
fxsave fx; // x87/MMX/XMM registers
52+
} cpustate;
53+
54+
55+
// Prototypes for user-level syscalls stubs defined in lib/syscall.c
56+
void sys_cputs(const char *s);
57+
void sys_put(uint32_t flags, uint16_t child, cpustate *cpu,
58+
void *localsrc, void *childdest, size_t size);
59+
void sys_get(uint32_t flags, uint16_t child, cpustate *cpu,
60+
void *childsrc, void *localdest, size_t size);
61+
void sys_ret(void);
62+
63+
#endif /* !__ASSEMBLER__ */
64+
65+
#endif /* !PIOS_INC_SYSCALL_H */

kern/console.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <kern/cpu.h>
2323
#include <kern/console.h>
24-
#include <kern/spinlock.h>
24+
//LAB1 #include <kern/spinlock.h>
2525
#include <kern/mem.h>
2626

2727
#include <dev/video.h>
@@ -113,7 +113,7 @@ void
113113
cputs(const char *str)
114114
{
115115
if (read_cs() & 3)
116-
return sys_cputs(str); // use syscall from user mode
116+
return ;//LAB1 sys_cputs(str); // use syscall from user mode
117117

118118
char ch;
119119
while (*str)

kern/mem.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void
136136
mem_incref(pageinfo *pi)
137137
{
138138
assert(pi > &mem_pageinfo[1] && pi < &mem_pageinfo[mem_npage]);
139-
assert(pi != mem_ptr2pi(pmap_zero)); // Don't alloc/free zero page!
139+
//LAB1 assert(pi != mem_ptr2pi(pmap_zero)); // Don't alloc/free zero page!
140140
assert(pi < mem_ptr2pi(start) || pi > mem_ptr2pi(end-1));
141141

142142
lockadd(&pi->refcount, 1);
@@ -148,7 +148,7 @@ void
148148
mem_decref(pageinfo* pi)
149149
{
150150
assert(pi > &mem_pageinfo[1] && pi < &mem_pageinfo[mem_npage]);
151-
assert(pi != mem_ptr2pi(pmap_zero)); // Don't alloc/free zero page!
151+
//LAB1 assert(pi != mem_ptr2pi(pmap_zero)); // Don't alloc/free zero page!
152152
assert(pi < mem_ptr2pi(start) || pi > mem_ptr2pi(end-1));
153153

154154
if (lockaddz(&pi->refcount, -1))

0 commit comments

Comments
 (0)