Style nits; indentation and tabs
This commit is contained in:
		
							parent
							
								
									16f205b5c9
								
							
						
					
					
						commit
						a7061b4f97
					
				
					 5 changed files with 36 additions and 36 deletions
				
			
		
							
								
								
									
										2
									
								
								defs.h
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								defs.h
									
										
									
									
									
								
							|  | @ -131,7 +131,7 @@ void            release(struct spinlock*); | |||
| void            pushcli(void); | ||||
| void            popcli(void); | ||||
| void            initsleeplock(struct sleeplock*); | ||||
| void            acquire_sleeplock(struct sleeplock*,struct spinlock*); | ||||
| void            acquire_sleeplock(struct sleeplock*, struct spinlock*); | ||||
| void            release_sleeplock(struct sleeplock*); | ||||
| int             acquired_sleeplock(struct sleeplock*); | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										2
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								file.c
									
										
									
									
									
								
							|  | @ -134,7 +134,7 @@ filewrite(struct file *f, char *addr, int n) | |||
|       begin_trans(); | ||||
|       ilock(f->ip); | ||||
|       if ((r = writei(f->ip, addr + i, f->off, n1)) > 0) | ||||
| 	f->off += r; | ||||
|         f->off += r; | ||||
|       iunlock(f->ip); | ||||
|       commit_trans(); | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										8
									
								
								main.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								main.c
									
										
									
									
									
								
							|  | @ -107,10 +107,10 @@ startothers(void) | |||
| // Use PTE_PS in page directory entry to enable 4Mbyte pages.
 | ||||
| __attribute__((__aligned__(PGSIZE))) | ||||
| pde_t enterpgdir[NPDENTRIES] = { | ||||
| 	// Map VA's [0, 4MB) to PA's [0, 4MB)
 | ||||
| 	[0] = (0) + PTE_P + PTE_W + PTE_PS, | ||||
| 	// Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB)
 | ||||
| 	[KERNBASE>>PDXSHIFT] = (0) + PTE_P + PTE_W + PTE_PS, | ||||
|   // Map VA's [0, 4MB) to PA's [0, 4MB)
 | ||||
|   [0] = (0) + PTE_P + PTE_W + PTE_PS, | ||||
|   // Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB)
 | ||||
|   [KERNBASE>>PDXSHIFT] = (0) + PTE_P + PTE_W + PTE_PS, | ||||
| }; | ||||
| 
 | ||||
| //PAGEBREAK!
 | ||||
|  |  | |||
							
								
								
									
										58
									
								
								mmu.h
									
										
									
									
									
								
							
							
						
						
									
										58
									
								
								mmu.h
									
										
									
									
									
								
							|  | @ -25,19 +25,19 @@ | |||
| #define FL_ID           0x00200000      // ID flag
 | ||||
| 
 | ||||
| // Control Register flags
 | ||||
| #define CR0_PE		0x00000001	// Protection Enable
 | ||||
| #define CR0_MP		0x00000002	// Monitor coProcessor
 | ||||
| #define CR0_EM		0x00000004	// Emulation
 | ||||
| #define CR0_TS		0x00000008	// Task Switched
 | ||||
| #define CR0_ET		0x00000010	// Extension Type
 | ||||
| #define CR0_NE		0x00000020	// Numeric Errror
 | ||||
| #define CR0_WP		0x00010000	// Write Protect
 | ||||
| #define CR0_AM		0x00040000	// Alignment Mask
 | ||||
| #define CR0_NW		0x20000000	// Not Writethrough
 | ||||
| #define CR0_CD		0x40000000	// Cache Disable
 | ||||
| #define CR0_PG		0x80000000	// Paging
 | ||||
| #define CR0_PE          0x00000001      // Protection Enable
 | ||||
| #define CR0_MP          0x00000002      // Monitor coProcessor
 | ||||
| #define CR0_EM          0x00000004      // Emulation
 | ||||
| #define CR0_TS          0x00000008      // Task Switched
 | ||||
| #define CR0_ET          0x00000010      // Extension Type
 | ||||
| #define CR0_NE          0x00000020      // Numeric Errror
 | ||||
| #define CR0_WP          0x00010000      // Write Protect
 | ||||
| #define CR0_AM          0x00040000      // Alignment Mask
 | ||||
| #define CR0_NW          0x20000000      // Not Writethrough
 | ||||
| #define CR0_CD          0x40000000      // Cache Disable
 | ||||
| #define CR0_PG          0x80000000      // Paging
 | ||||
| 
 | ||||
| #define CR4_PSE         0x00000010	// Page size extension
 | ||||
| #define CR4_PSE         0x00000010      // Page size extension
 | ||||
| 
 | ||||
| #define SEG_KCODE 1  // kernel code
 | ||||
| #define SEG_KDATA 2  // kernel data+stack
 | ||||
|  | @ -109,39 +109,39 @@ struct segdesc { | |||
| //  \--- PDX(va) --/ \--- PTX(va) --/ 
 | ||||
| 
 | ||||
| // page directory index
 | ||||
| #define PDX(va)		(((uint)(va) >> PDXSHIFT) & 0x3FF) | ||||
| #define PDX(va)         (((uint)(va) >> PDXSHIFT) & 0x3FF) | ||||
| 
 | ||||
| // page table index
 | ||||
| #define PTX(va)		(((uint)(va) >> PTXSHIFT) & 0x3FF) | ||||
| #define PTX(va)         (((uint)(va) >> PTXSHIFT) & 0x3FF) | ||||
| 
 | ||||
| // construct virtual address from indexes and offset
 | ||||
| #define PGADDR(d, t, o)	((uint)((d) << PDXSHIFT | (t) << PTXSHIFT | (o))) | ||||
| #define PGADDR(d, t, o) ((uint)((d) << PDXSHIFT | (t) << PTXSHIFT | (o))) | ||||
| 
 | ||||
| // Page directory and page table constants.
 | ||||
| #define NPDENTRIES	1024		// page directory entries per page directory
 | ||||
| #define NPTENTRIES	1024		// page table entries per page table
 | ||||
| #define NPDENTRIES      1024            // page directory entries per page directory
 | ||||
| #define NPTENTRIES      1024            // page table entries per page table
 | ||||
| #define PGSIZE          4096            // bytes mapped by a page
 | ||||
| 
 | ||||
| #define PGSHIFT         12              // log2(PGSIZE)
 | ||||
| #define PTXSHIFT	12		// offset of PTX in a linear address
 | ||||
| #define PDXSHIFT	22		// offset of PDX in a linear address
 | ||||
| #define PTXSHIFT        12              // offset of PTX in a linear address
 | ||||
| #define PDXSHIFT        22              // offset of PDX in a linear address
 | ||||
| 
 | ||||
| #define PGROUNDUP(sz)  (((sz)+PGSIZE-1) & ~(PGSIZE-1)) | ||||
| #define PGROUNDDOWN(a) (((a)) & ~(PGSIZE-1)) | ||||
| 
 | ||||
| // Page table/directory entry flags.
 | ||||
| #define PTE_P		0x001	// Present
 | ||||
| #define PTE_W		0x002	// Writeable
 | ||||
| #define PTE_U		0x004	// User
 | ||||
| #define PTE_PWT		0x008	// Write-Through
 | ||||
| #define PTE_PCD		0x010	// Cache-Disable
 | ||||
| #define PTE_A		0x020	// Accessed
 | ||||
| #define PTE_D		0x040	// Dirty
 | ||||
| #define PTE_PS		0x080	// Page Size
 | ||||
| #define PTE_MBZ		0x180	// Bits must be zero
 | ||||
| #define PTE_P           0x001   // Present
 | ||||
| #define PTE_W           0x002   // Writeable
 | ||||
| #define PTE_U           0x004   // User
 | ||||
| #define PTE_PWT         0x008   // Write-Through
 | ||||
| #define PTE_PCD         0x010   // Cache-Disable
 | ||||
| #define PTE_A           0x020   // Accessed
 | ||||
| #define PTE_D           0x040   // Dirty
 | ||||
| #define PTE_PS          0x080   // Page Size
 | ||||
| #define PTE_MBZ         0x180   // Bits must be zero
 | ||||
| 
 | ||||
| // Address in page table or page directory entry
 | ||||
| #define PTE_ADDR(pte)	((uint)(pte) & ~0xFFF) | ||||
| #define PTE_ADDR(pte)   ((uint)(pte) & ~0xFFF) | ||||
| 
 | ||||
| #ifndef __ASSEMBLER__ | ||||
| typedef uint pte_t; | ||||
|  |  | |||
							
								
								
									
										2
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								vm.c
									
										
									
									
									
								
							|  | @ -137,7 +137,7 @@ setupkvm(char* (*alloc)(void)) | |||
|     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, alloc) < 0) | ||||
|                 k->perm, alloc) < 0) | ||||
|       return 0; | ||||
| 
 | ||||
|   return pgdir; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Austin Clements
						Austin Clements